extra elements in _io_connect

Hi:

  1. The connect struct ‘_io_connect’ has 2 elements ‘extra_type’ and
    ‘extra_len’. What are they used for?

  2. I am trying to find ways to pass some additional flags (just need 8
    bits, at the most) from a regular open() call in libc to my handler in
    my resource manager. Are those above elements somethign that I can use?

  3. If not, is there any way to pass these custom flags?

Thanks and Regards,
Rommel

Rommel Dongre <rdongre@pillardata.com> wrote:

  1. The connect struct ‘_io_connect’ has 2 elements ‘extra_type’ and
    ‘extra_len’. What are they used for?

Used to pass additional data with a connect message. From <sys/iomsg.h>
you can see the IO_CONNECT_EXTRA* manifests, which show it to be used
by things like rename(), mount(), symlink(), etc.

  1. I am trying to find ways to pass some additional flags (just need 8
    bits, at the most) from a regular open() call in libc to my handler in
    my resource manager. Are those above elements somethign that I can use?

Yes, you could create your own _io_connect_extra_type enumerations, keep
it well outside the range of the system ones (say 0x80 or above). But
to get this information in, since open() doesn’t do it, you’d need to
access the lower-level messaging routines, such as _connect(), directly;
I don’t think we document this, but you may try to discern from <fcntl.h>.

  1. If not, is there any way to pass these custom flags?

You might consider placing the extra data in the pathname, which means
you could continue using open() and still use standard command-line
utilities to access your IO manager too. Just parse them off in the
open routine (does require _RESMGR_FLAG_DIR-style processing rather
than simple name attaching). Like “/dev/mymanager/mydevice#data”.