home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.wizards,comp.unix.programmers
- Path: sparky!uunet!ftpbox!mothost!panther!panther3.panther.mot.com!ronf
- From: ronf@panther3.panther.mot.com (Ron Feigen)
- Subject: Re: Passing FIDs
- Message-ID: <1992Sep4.183731.26832@panther.mot.com>
- Sender: usenet@panther.mot.com
- Nntp-Posting-Host: panther3.panther.mot.com
- Organization: Motorola Panther Project, Chandler, AZ
- Date: Fri, 4 Sep 1992 18:37:31 GMT
- Lines: 36
-
-
- Hello,
-
- Does anyone know of bugs/problems with SunOS 4.1.2 passing of file
- descriptors. I faithfully RTFM (as well as R. Stevens UNIX Net. Prog)
- to learn about how to do this. Here's the desciption:
- I have 1 process open a socket, start a non-blocking connect(). Then
- at an arbitrary time later pass the access rights to another process.
- The other process would request a socket (through a little ack/nack deal)
- and then receive the access rights.
-
- Using sendmsg() -> recvmsg() with msghdr like the following:
-
- struct iovec iov;
- iov.iov_base = (char *)0; iov.iov_len = 0;
- msg.msg_name = (caddr_t)0; msg.msg_namelen = 0; msg.msg_iov = iov;
- msg.msg_iovlen = 0;
- msg.msg_accrights = (caddr_t)&fd; /* where this is the created socket fd */
- msg.msg_accrightslen = sizeof(int);
-
- The problems start when I send the desciptor. For some reason the access
- rights fields in the msghdr struct get zeroed out, and garbage ends up
- getting sent to the receiver...hence a garbled access rights...but NO error
- reported by either sendmsg() or recvmsg() (no return of -1 and errno set)
-
- Anybody had problems like this?
-
- P.S. The code does seem to work occasionally, or when using dbx.
-
- Any help would be greatly appreciated
-
- --
-
- >
- Ron Feigen
- ronf@panther.mot.com
-