Structure of a resource manager's connect message
Synopsis:
struct _io_connect {
uint16_t type;
uint16_t subtype;
uint32_t file_type;
uint16_t reply_max;
uint16_t entry_max;
uint32_t key;
uint32_t handle;
uint32_t ioflag;
uint32_t mode;
uint16_t sflag;
uint16_t access;
uint16_t zero;
uint16_t path_len;
uint8_t eflag;
uint8_t extra_type;
uint16_t extra_len;
char path[1];
};
Description:
The _io_connect structure is used to describe a connect message
that a resource manager receives and sends.
The members include:
-
type
-
_IO_CONNECT
-
subtype
- The type of connection that the message concerns; one of:
-
_IO_CONNECT_COMBINE — combine with an I/O message.
-
_IO_CONNECT_COMBINE_CLOSE — combine with I/O
message and always close.
-
_IO_CONNECT_OPEN
-
_IO_CONNECT_UNLINK
-
_IO_CONNECT_RENAME
-
_IO_CONNECT_MKNOD
-
_IO_CONNECT_READLINK
-
_IO_CONNECT_LINK
-
_IO_CONNECT_RSVD_UNBLOCK — place holder in the
jump table.
-
_IO_CONNECT_MOUNT
-
file_type
- The file type; one of the following (defined in
<sys/ftype.h>):
-
_FTYPE_ANY — the path name can be anything.
-
_FTYPE_LINK — reserved for the Process Manager.
-
_FTYPE_MOUNT — receive mount requests on the path
(path must be NULL).
-
_FTYPE_MQUEUE — reserved for a message-queue manager.
-
_FTYPE_PIPE — reserved for a pipe manager.
-
_FTYPE_SEM — reserved for a semaphore manager.
-
_FTYPE_SHMEM — reserved for a shared memory object.
-
_FTYPE_SOCKET — reserved for a socket manager.
-
_FTYPE_SYMLINK — reserved for the Process Manager.
-
reply_max
- The maximum length of the reply message.
-
entry_max
- The maximum number of _io_connect_entry structures that
the resource manager is willing to accept.
If a path could reference more than one resource manager, it returns
a list of _io_connect_entry structures referring to the
overlapping resource managers.
-
key
- Reserved.
-
handle
- The handle returned by
resmgr_attach()
.
-
ioflag
- The bottom two bits are modified from traditional Unix values to more
useful bit flags:
-
O_RDONLY (0) is converted to
_IO_FLAG_RD (0x01)
-
O_WRONLY (1) is converted to
_IO_FLAG_WR (0x02)
-
O_RDWR (2) is converted to _IO_FLAG_RD
| _IO_FLAG_WR (0x03)
Note that this translation can be performed without overlapping
other O_* flags.
To check for permissions, use the following:
-
ioflag & _IO_FLAG_RD for read permission
-
ioflag & _IO_FLAG_WR for write permission
- If the file is open for reading and writing, both bits are set.
The remaining values of ioflag are outside this
range and are not modified. These values are:
-
O_APPEND — if set, the file offset is set to
the end of the file prior to each write.
-
O_CREAT — create the file.
-
O_DSYNC — if set, this flag affects subsequent
I/O calls; each call to
write()
waits until all data is successfully transferred
to the storage device such that it's readable on any subsequent open of
the file (even one that follows a system failure) in the absence of a
failure of the physical storage medium. If the physical storage medium
implements a non-write-through cache, then a system failure may be
interpreted as a failure of the physical storage medium, and data may
not be readable even if this flag is set and the write()
indicates that it succeeded.
-
O_EXCL — if you set both O_EXCL
and O_CREAT,
open() fails if the file exists. The check for the
existence of the file and the creation of the file if it doesn't
exist are atomic; no other process that's attempting the same
operation with the same filename at the same time will succeed.
Specifying O_EXCL
without O_CREAT has no effect.
-
O_LARGEFILE — allow the file offset to be
64 bits long.
-
O_NOCTTY — if set, and path identifies
a terminal device, the
open() function doesn't cause the terminal device to become
the controlling terminal for the process.
-
O_NONBLOCK — don't block.
-
O_REALIDS — use the real
uid/gid for permissions checking.
-
O_RSYNC — read I/O operations on the file
descriptor complete at the same level of integrity as
specified by the O_DSYNC and O_SYNC flags.
-
O_SYNC — if set, this flag affects subsequent
I/O calls; each call to
read()
or
write()
is complete only when both the data has been successfully transferred
(either read or written) and all file system information relevant to
that I/O operation (including that required to retrieve said data) is
successfully transferred, including file update and/or access times,
and so on. See the discussion of a successful data transfer in
O_DSYNC, above.
-
O_TRUNC — if the file exists and is a regular
file, and the file is successfully
opened O_WRONLY or O_RDWR,
the file length is truncated to zero and the mode and owner are left
unchanged. O_TRUNC has no effect on FIFO or block or
character special files or directories. Using O_TRUNC
with O_RDONLY has no effect.
-
mode
- Contains the type and access permissions of the file.
The type is one of:
-
S_IFBLK — block special.
-
S_IFCHR — character special.
-
S_IFDIR — directory.
-
S_IFIFO — FIFO special.
-
S_IFLNK — symbolic link.
-
S_IFMT — type of file.
-
S_IFNAM — special named file.
-
S_IFREG — regular.
-
S_IFSOCK — socket.
The permissions are a combination of:
| Owner
|
Group
|
Others
|
Permission |
|
S_IRUSR
|
S_IRGRP
|
S_IROTH
|
Read |
|
S_IRWXU
|
S_IRWXG
|
S_IRWXO
|
Read, write, execute/search. A bitwise
inclusive OR of the other three
constants (S_IRWXU is OR of IRUSR, S_IWSUR and S_IXUSR.) |
|
S_IWUSR
|
S_IWGRP
|
S_IWOTH
|
Write |
|
S_IXUSR
|
S_IXGRP
|
S_IXOTH
|
Execute/search |
The following bits define miscellaneous permissions used by other
implementations:
| Bit
|
Equivalent
|
|
S_IEXEC
|
S_IXUSR
|
|
S_IREAD
|
S_IRUSR
|
|
S_IWRITE
|
S_IWUSR
|
-
sflag
- How the client wants the file to be shared; a combination of the
following bits:
-
SH_COMPAT — set compatibility mode.
-
SH_DENYRW — prevent read or write access to the
file.
-
SH_DENYWR — prevent write access to the file.
-
SH_DENYRD — prevent read access to the file.
-
SH_DENYNO — permit both read and write access
to the file.
-
access
- Contains a combination of _IO_FLAG_RD and
_IO_FLAG_WR bits, which are
used internally as the access permissions to allow from ioflag.
-
path_len
- The length of the path member.
-
eflag
- Extended flags:
-
_IO_CONNECT_EFLAG_DIR — the path referenced a
directory.
-
_IO_CONNECT_EFLAG_DOT — the last component of a
path was . or .. (i.e. the current or parent
directory).
-
extra_type
- One of:
-
_IO_CONNECT_EXTRA_NONE
-
_IO_CONNECT_EXTRA_LINK
-
_IO_CONNECT_EXTRA_SYMLINK
-
_IO_CONNECT_EXTRA_MQUEUE
-
_IO_CONNECT_EXTRA_SOCKET
-
_IO_CONNECT_EXTRA_SEM
-
_IO_CONNECT_EXTRA_RESMGR_LINK
-
_IO_CONNECT_EXTRA_PROC_SYMLINK
-
_IO_CONNECT_EXTRA_RENAME
-
_IO_CONNECT_EXTRA_MOUNT
-
_IO_CONNECT_EXTRA_MOUNT_OCB
-
extra_len
- The length of any extra data included in the message.
-
path
- The path that the client is trying to connect to, relative to the
resource manager's mountpoint.