Retrieves the file descriptor associated with the message sent by an I_SENDFD operation over a stream pipe.
The I_RECVFD operation retrieves the file descriptor associated with the message sent by an I_SENDFD operation over a stream pipe. The arg parameter is a pointer to a data buffer large enough to hold an strrecvfd data structure containing the following elements:
int fd;
unsigned short uid;
unsigned short gid;
char fill[8];
The fields of the strrecvfd structure are defined as follows:
Field | Description |
---|---|
fd | Specifies an integer file descriptor. |
uid | Specifies the user ID of the sending stream. |
gid | Specifies the group ID of the sending stream. |
If the O_NDELAY flag is not set, the I_RECVFD operation blocks until a message is present at the stream head. If the O_NDELAY flag is set, the I_RECVFD operation fails with the errno global variable set to EAGAIN if no message is present at the stream head.
If the message at the stream head is a message sent by an I_SENDFD operation, a new user file descriptor is allocated for the file pointer contained in the message. The new file descriptor is place in the fd field of the strrecvfd structure. The structure is copied into the user data buffer pointed to by the arg parameter.
This operation is part of STREAMS Kernel Extensions.
If unsuccessful, the errno global variable is set to one of the following values:
Value | Description |
---|---|
EAGAIN | A message was not present at the stream head read queue, and the O_NDELAY flag is set. |
EBADMSG | The message at the stream head read queue was not a message containing a passed file descriptor. |
EFAULT | The arg parameter points outside the allocated address space. |
EMFILE | The NOFILES file descriptor is currently open. |
ENXIO | Hangup received on the fildes parameter. |