| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: socket.2,v 1.50 2023/07/20 23:28:44 gutteridge Exp $ | | 1 | .\" $NetBSD: socket.2,v 1.51 2023/07/28 23:41:02 wiz Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1983, 1991, 1993 | | 3 | .\" Copyright (c) 1983, 1991, 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -43,65 +43,62 @@ | | | @@ -43,65 +43,62 @@ |
43 | .Fn socket "int domain" "int type" "int protocol" | | 43 | .Fn socket "int domain" "int type" "int protocol" |
44 | .Sh DESCRIPTION | | 44 | .Sh DESCRIPTION |
45 | .Fn socket | | 45 | .Fn socket |
46 | creates an endpoint for communication and returns a descriptor. | | 46 | creates an endpoint for communication and returns a descriptor. |
47 | .Pp | | 47 | .Pp |
48 | The | | 48 | The |
49 | .Fa domain | | 49 | .Fa domain |
50 | parameter specifies a communications domain within which | | 50 | parameter specifies a communications domain within which |
51 | communication will take place; this selects the protocol family | | 51 | communication will take place; this selects the protocol family |
52 | which should be used. | | 52 | which should be used. |
53 | These families are defined in the include file | | 53 | These families are defined in the include file |
54 | .Ao Pa sys/socket.h Ac . | | 54 | .Ao Pa sys/socket.h Ac . |
55 | The currently understood formats are: | | 55 | The currently understood formats are: |
56 | .Pp | | | |
57 | .Bl -column -offset indent ".Dv PF_APPLETALK" | | 56 | .Bl -column -offset indent ".Dv PF_APPLETALK" |
58 | .It Dv PF_LOCAL Ta local domain Po previously Tn UNIX domain Pc protocols | | 57 | .It Dv PF_LOCAL Ta local domain Po previously Tn UNIX domain Pc protocols |
59 | .It Dv PF_INET Ta Tn ARPA Internet protocols | | 58 | .It Dv PF_INET Ta Tn ARPA Internet protocols |
60 | .It Dv PF_INET6 Ta Tn IPv6 (Internet Protocol version 6) protocols | | 59 | .It Dv PF_INET6 Ta Tn IPv6 (Internet Protocol version 6) protocols |
61 | .It Dv PF_NS Ta Xerox Network Systems protocols | | 60 | .It Dv PF_NS Ta Xerox Network Systems protocols |
62 | .It Dv PF_APPLETALK Ta AppleTalk protocols | | 61 | .It Dv PF_APPLETALK Ta AppleTalk protocols |
63 | .It Dv PF_BLUETOOTH Ta Bluetooth protocols | | 62 | .It Dv PF_BLUETOOTH Ta Bluetooth protocols |
64 | .It Dv PF_CAN Ta Tn CAN bus protocols | | 63 | .It Dv PF_CAN Ta Tn CAN bus protocols |
65 | .El | | 64 | .El |
66 | .Pp | | 65 | .Pp |
67 | The socket has the indicated | | 66 | The socket has the indicated |
68 | .Fa type , | | 67 | .Fa type , |
69 | which specifies the semantics of communication. | | 68 | which specifies the semantics of communication. |
70 | Currently defined types are: | | 69 | Currently defined types are: |
71 | .Pp | | | |
72 | .Bl -tag -offset indent -width Dv | | 70 | .Bl -tag -offset indent -width Dv |
73 | .It Dv SOCK_STREAM | | 71 | .It Dv SOCK_STREAM |
74 | Provides sequenced, reliable, two-way connection based byte streams. | | 72 | Provides sequenced, reliable, two-way connection based byte streams. |
75 | An out-of-band data transmission mechanism may be supported. | | 73 | An out-of-band data transmission mechanism may be supported. |
76 | .It Dv SOCK_DGRAM | | 74 | .It Dv SOCK_DGRAM |
77 | Supports datagrams: connectionless, unreliable messages of a | | 75 | Supports datagrams: connectionless, unreliable messages of a |
78 | fixed\(emtypically small\(emmaximum length. | | 76 | fixed\(emtypically small\(emmaximum length. |
79 | .It Dv SOCK_RAW | | 77 | .It Dv SOCK_RAW |
80 | Provides access to internal network protocols and interfaces. | | 78 | Provides access to internal network protocols and interfaces. |
81 | Available only to the super-user. | | 79 | Available only to the super-user. |
82 | Not described here. | | 80 | Not described here. |
83 | .It Dv SOCK_SEQPACKET | | 81 | .It Dv SOCK_SEQPACKET |
84 | Provides a sequenced, reliable, two-way connection-based data | | 82 | Provides a sequenced, reliable, two-way connection-based data |
85 | transmission path for datagrams of fixed maximum length. | | 83 | transmission path for datagrams of fixed maximum length. |
86 | A consumer may be required to read an entire packet with each read | | 84 | A consumer may be required to read an entire packet with each read |
87 | system call. | | 85 | system call. |
88 | .It Dv SOCK_RDM | | 86 | .It Dv SOCK_RDM |
89 | Not implemented. | | 87 | Not implemented. |
90 | .El | | 88 | .El |
91 | .Pp | | 89 | .Pp |
92 | The following flags can be or'ed to the socket type to add conditions to | | 90 | The following flags can be or'ed to the socket type to add conditions to |
93 | the returned file descriptor: | | 91 | the returned file descriptor: |
94 | .Pp | | | |
95 | .Bl -tag -offset indent -width Dv | | 92 | .Bl -tag -offset indent -width Dv |
96 | .It Dv SOCK_CLOEXEC | | 93 | .It Dv SOCK_CLOEXEC |
97 | Set the close on exec property. | | 94 | Set the close on exec property. |
98 | .It Dv SOCK_NONBLOCK | | 95 | .It Dv SOCK_NONBLOCK |
99 | Set non-blocking I/O. | | 96 | Set non-blocking I/O. |
100 | .It Dv SOCK_NOSIGPIPE | | 97 | .It Dv SOCK_NOSIGPIPE |
101 | Return | | 98 | Return |
102 | .Er EPIPE | | 99 | .Er EPIPE |
103 | instead of raising | | 100 | instead of raising |
104 | .Dv SIGPIPE . | | 101 | .Dv SIGPIPE . |
105 | .El | | 102 | .El |
106 | .Pp | | 103 | .Pp |
107 | The | | 104 | The |