Deleted Added
full compact
unix.4 (144978) unix.4 (147398)
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)unix.4 8.1 (Berkeley) 6/9/93
1.\" Copyright (c) 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 16 unchanged lines hidden (view full) ---

25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.\" @(#)unix.4 8.1 (Berkeley) 6/9/93
33.\" $FreeBSD: head/share/man/man4/unix.4 144978 2005-04-13 00:01:46Z mdodd $
33.\" $FreeBSD: head/share/man/man4/unix.4 147398 2005-06-15 13:31:23Z ru $
34.\"
35.Dd July 15, 2001
36.Dt UNIX 4
37.Os
38.Sh NAME
39.Nm unix
40.Nd UNIX-domain protocol family
41.Sh SYNOPSIS

--- 47 unchanged lines hidden (view full) ---

89.Xr bind 2
90and
91.Xr connect 2 ,
92can be calculated by the macro
93.Fn SUN_LEN
94defined in
95.In sys/un.h .
96The
34.\"
35.Dd July 15, 2001
36.Dt UNIX 4
37.Os
38.Sh NAME
39.Nm unix
40.Nd UNIX-domain protocol family
41.Sh SYNOPSIS

--- 47 unchanged lines hidden (view full) ---

89.Xr bind 2
90and
91.Xr connect 2 ,
92can be calculated by the macro
93.Fn SUN_LEN
94defined in
95.In sys/un.h .
96The
97.Ar sun_path
98field must be terminated by a NUL character to be used with
97.Va sun_path
98field must be terminated by a
99.Dv NUL
100character to be used with
99.Fn SUN_LEN ,
101.Fn SUN_LEN ,
100but the terminating NUL is
102but the terminating
103.Dv NUL
104is
101.Em not
102part of the address.
103.Pp
104The
105.Ux Ns -domain
106protocol family does not support broadcast addressing or any form
107of
108.Dq wildcard

--- 81 unchanged lines hidden (view full) ---

190This mechanism is reliable; there is no way for either party to influence
191the credentials presented to its peer except by calling the appropriate
192system call (e.g.,
193.Xr connect 2
194or
195.Xr listen 2 )
196under different effective credentials.
197.Pp
105.Em not
106part of the address.
107.Pp
108The
109.Ux Ns -domain
110protocol family does not support broadcast addressing or any form
111of
112.Dq wildcard

--- 81 unchanged lines hidden (view full) ---

194This mechanism is reliable; there is no way for either party to influence
195the credentials presented to its peer except by calling the appropriate
196system call (e.g.,
197.Xr connect 2
198or
199.Xr listen 2 )
200under different effective credentials.
201.Pp
198
199.Tn UNIX
200domain sockets support a number of socket options which can be set with
201.Xr setsockopt 2
202and tested with
203.Xr getsockopt 2 :
204.Bl -tag -width ".Dv LOCAL_CONNWAIT"
205.It Dv LOCAL_CREDS
206This option may be enabled on a
207.Dv SOCK_DGRAM
208or a
209.Dv SOCK_STREAM
202.Tn UNIX
203domain sockets support a number of socket options which can be set with
204.Xr setsockopt 2
205and tested with
206.Xr getsockopt 2 :
207.Bl -tag -width ".Dv LOCAL_CONNWAIT"
208.It Dv LOCAL_CREDS
209This option may be enabled on a
210.Dv SOCK_DGRAM
211or a
212.Dv SOCK_STREAM
210socket. This option provides a mechanism for the receiver to
213socket.
214This option provides a mechanism for the receiver to
211receive the credentials of the process as a
212.Xr recvmsg 2
215receive the credentials of the process as a
216.Xr recvmsg 2
213control message. The msg_control field in the msghdr structure points
214to a buffer that contains a cmsghdr structure followed by a variable
215length sockcred structure, defined in
216.Pa \*[Lt]sys/socket.h\*[Gt]
217control message.
218The
219.Va msg_control
220field in the
221.Vt msghdr
222structure points to a buffer that contains a
223.Vt cmsghdr
224structure followed by a variable length
225.Vt sockcred
226structure, defined in
227.In sys/socket.h
217as follows:
218.Bd -literal
219struct sockcred {
220 id_t sc_uid; /* real user id */
221 uid_t sc_euid; /* effective user id */
222 gid_t sc_gid; /* real group id */
223 gid_t sc_egid; /* effective group id */
224 int sc_ngroups; /* number of supplemental groups */
225 gid_t sc_groups[1]; /* variable length */
226};
227.Ed
228.Pp
229The
230.Fn SOCKCREDSIZE
228as follows:
229.Bd -literal
230struct sockcred {
231 id_t sc_uid; /* real user id */
232 uid_t sc_euid; /* effective user id */
233 gid_t sc_gid; /* real group id */
234 gid_t sc_egid; /* effective group id */
235 int sc_ngroups; /* number of supplemental groups */
236 gid_t sc_groups[1]; /* variable length */
237};
238.Ed
239.Pp
240The
241.Fn SOCKCREDSIZE
231macro computes the size of the sockcred structure for a specified number
242macro computes the size of the
243.Vt sockcred
244structure for a specified number
232of groups.
245of groups.
233The cmsghdr fields have the following values:
246The
247.Vt cmsghdr
248fields have the following values:
234.Bd -literal
235cmsg_len = sizeof(struct cmsghdr) + SOCKCREDSIZE(ngroups)
236cmsg_level = SOL_SOCKET
237cmsg_type = SCM_CREDS
238.Ed
239.It Dv LOCAL_CONNWAIT
249.Bd -literal
250cmsg_len = sizeof(struct cmsghdr) + SOCKCREDSIZE(ngroups)
251cmsg_level = SOL_SOCKET
252cmsg_type = SCM_CREDS
253.Ed
254.It Dv LOCAL_CONNWAIT
240Used with
255Used with
241.Dv SOCK_STREAM
242sockets, this option causes the
243.Xr connect 2
244function to block until
245.Xr accept 2
246has been called on the listening socket.
256.Dv SOCK_STREAM
257sockets, this option causes the
258.Xr connect 2
259function to block until
260.Xr accept 2
261has been called on the listening socket.
262.El
247.Sh SEE ALSO
248.Xr socket 2 ,
249.Xr intro 4
250.Rs
251.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
252.%B PS1
253.%N 7
254.Re
255.Rs
256.%T "An Advanced 4.3 BSD Interprocess Communication Tutorial"
257.%B PS1
258.%N 8
259.Re
263.Sh SEE ALSO
264.Xr socket 2 ,
265.Xr intro 4
266.Rs
267.%T "An Introductory 4.3 BSD Interprocess Communication Tutorial"
268.%B PS1
269.%N 7
270.Re
271.Rs
272.%T "An Advanced 4.3 BSD Interprocess Communication Tutorial"
273.%B PS1
274.%N 8
275.Re