home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / unix / wizards / 3806 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.7 KB  |  48 lines

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