machine.h" which defines:
0 if the local UNIX
flavor doesn't have the SCM_RIGHTS cmsg_type.
strerror(3).
#include <sys/types.h> #include <sys/param.h> #include <sys/socket.h> #include <sys/uio.h> #include <errno.h> #include "machine.h" #include "fdrights.h"
xclate,
wrapw and other tools to pass access rights
(open file descriptors) between processes.
extern int RightsSendFd(int fd, int *list, unsigned count, char *tag);
The peer process should be calling RightsRecvFd on the other
end of fd, the list pointer points to a
vector of count file descriptors. The tag
strings is sent in the message.
A tag of (char *)0 sends the message "ok".
extern int RightsRecvFd(int fd, int *list, unsigned count, char *tag, size_t *length);
extern char acRightsRecvBuf[RIGHTS_TAG_LINE];
count access rights
on file descriptor fd.
The new file descriptor indexes are recorded in list, which
might be large enough to hold the list sent by the peer.
The synchronization string is copied into tag which
must be at least length bytes long, the number of
bytes returned is the return value of this function call.
When tag is provided as (char *)0 the
global buffer acRightsRecvBuf is used.
extern int RightsWrap(int fd, char *pcSuffix, void *pvData, char *pcType);
wrapw work in advanced
wrappers (like ksb's xclate) that work across machines (through sshw).
This hook is what divConnect from mkcmd's library needs
to "wrap-back" to a wrapw diversion on another host. It must be
linked with RightsRecvFd, since it calls that function.
extern int RopenSplit(void (*)());
extern int ropen(char *, int , int );
explode fdrights.h
explode fdrights.c
more fdrightstest.c
$Id: fdrights.html,v 3.9 2012/03/21 16:15:04 ksb Exp $