Re: OT: getting the protocol family of a file descriptor



"Heiko Wundram (Beenic)" <wundram@xxxxxxxxxx> writes:
I'm currently in the need to get the protocol family that was used to
create a socket (and passed via a unix domain socket to another
program), and I've not really come up with a proper scheme other than
to use getsockname and retrieve sa_family from the resulting socket
(which currently matches the socket domain and historically has, but
why take the chances ;-)).

This is the correct way to do it, I don't understand why you think it
might not work in the future.

Is there any other "better" way to get at the domain (protocol family)
of a socket?

Why should there be a better way?

DES
--
Dag-Erling Smørgrav - des@xxxxxx
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Updated fine-grain locking patch for UNIX domain sockets
    ... Attached, and at the below URL, find an updated copy of the UNIX domain socket fine-grained locking patch. ... Since the last revision, I've updated the patch to close several race conditions historically present in UNIX domain sockets, as well as move to an rwlock for the global lock. ... int); ...
    (freebsd-performance)
  • Re: UNIX domain sockets MFCs
    ... new reports of UNIX domain socket problems in the last couple of days, it sounds like the MFC of the last batch of fixes and cleanups has not lead to problems. ... I think we have a leak in the way some edge case is handled with regard to UNIX domain socket shutdown. ... processes in a soclose state, ...
    (freebsd-stable)
  • Scattered-write with sendto() un a SOCK_DGRAM Unix Domain Socket
    ... Hi to everyone, I'd like to do a scattered write, like with writev() ... on a Unix Domain Socket. ... datagram Unix Socket? ...
    (comp.unix.programmer)
  • Re: unix socket connection tracking
    ... I've got GNOME running, gconfd-2 is a "registry" ... management process that accepts connections through a unix domain socket (named ... I would like to know which socket leads where. ...
    (Linux-Kernel)
  • Re: shared memory
    ... then "put" this socket into a shared memory. ... opening a program "B" which will read the shared memory to ... a socket is just a file descriptor. ... over a Unix domain socket. ...
    (comp.unix.programmer)