mirror of https://github.com/mkerrisk/man-pages
cmsg.3: Reorganize the text somewhat (no content changes)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
parent
79e1824a12
commit
9910d338e7
46
man3/cmsg.3
46
man3/cmsg.3
|
@ -26,16 +26,6 @@ CMSG_ALIGN, CMSG_SPACE, CMSG_NXTHDR, CMSG_FIRSTHDR \- access ancillary data
|
||||||
.br
|
.br
|
||||||
.BI "unsigned char *CMSG_DATA(struct cmsghdr *" cmsg );
|
.BI "unsigned char *CMSG_DATA(struct cmsghdr *" cmsg );
|
||||||
.PP
|
.PP
|
||||||
.nf
|
|
||||||
struct cmsghdr {
|
|
||||||
size_t cmsg_len; /* Data byte count, including header
|
|
||||||
(type is socklen_t in POSIX) */
|
|
||||||
int cmsg_level; /* Originating protocol */
|
|
||||||
int cmsg_type; /* Protocol-specific type */
|
|
||||||
/* followed by
|
|
||||||
unsigned char cmsg_data[]; */
|
|
||||||
};
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
These macros are used to create and access control messages (also called
|
These macros are used to create and access control messages (also called
|
||||||
ancillary data) that are not a part of the socket payload.
|
ancillary data) that are not a part of the socket payload.
|
||||||
|
@ -52,44 +42,64 @@ and received by calling
|
||||||
See their manual pages for more information.
|
See their manual pages for more information.
|
||||||
.PP
|
.PP
|
||||||
Ancillary data is a sequence of
|
Ancillary data is a sequence of
|
||||||
.I struct cmsghdr
|
.I cmsghdr
|
||||||
structures with appended data.
|
structures with appended data.
|
||||||
This sequence should be accessed
|
|
||||||
using only the macros described in this manual page and never directly.
|
|
||||||
See the specific protocol man pages for the available control message types.
|
See the specific protocol man pages for the available control message types.
|
||||||
The maximum ancillary buffer size allowed per socket can be set using
|
The maximum ancillary buffer size allowed per socket can be set using
|
||||||
.IR /proc/sys/net/core/optmem_max ;
|
.IR /proc/sys/net/core/optmem_max ;
|
||||||
see
|
see
|
||||||
.BR socket (7).
|
.BR socket (7).
|
||||||
.PP
|
.PP
|
||||||
|
The
|
||||||
|
.I cmsghdr
|
||||||
|
structure is defined as follows:
|
||||||
|
.PP
|
||||||
|
.in +4n
|
||||||
|
.EX
|
||||||
|
struct cmsghdr {
|
||||||
|
size_t cmsg_len; /* Data byte count, including header
|
||||||
|
(type is socklen_t in POSIX) */
|
||||||
|
int cmsg_level; /* Originating protocol */
|
||||||
|
int cmsg_type; /* Protocol-specific type */
|
||||||
|
/* followed by
|
||||||
|
unsigned char cmsg_data[]; */
|
||||||
|
};
|
||||||
|
.EE
|
||||||
|
.in
|
||||||
|
.PP
|
||||||
|
The sequence of
|
||||||
|
.I cmsghdr
|
||||||
|
structures should never be accessed directly.
|
||||||
|
Instead, use only the following macros:
|
||||||
|
.IP * 3
|
||||||
.BR CMSG_FIRSTHDR ()
|
.BR CMSG_FIRSTHDR ()
|
||||||
returns a pointer to the first
|
returns a pointer to the first
|
||||||
.I cmsghdr
|
.I cmsghdr
|
||||||
in the ancillary
|
in the ancillary
|
||||||
data buffer associated with the passed
|
data buffer associated with the passed
|
||||||
.IR msghdr .
|
.IR msghdr .
|
||||||
.PP
|
.IP *
|
||||||
.BR CMSG_NXTHDR ()
|
.BR CMSG_NXTHDR ()
|
||||||
returns the next valid
|
returns the next valid
|
||||||
.I cmsghdr
|
.I cmsghdr
|
||||||
after the passed
|
after the passed
|
||||||
.IR cmsghdr .
|
.IR cmsghdr .
|
||||||
It returns NULL when there isn't enough space left in the buffer.
|
It returns NULL when there isn't enough space left in the buffer.
|
||||||
.PP
|
.IP *
|
||||||
.BR CMSG_ALIGN (),
|
.BR CMSG_ALIGN (),
|
||||||
given a length, returns it including the required alignment.
|
given a length, returns it including the required alignment.
|
||||||
This is a
|
This is a
|
||||||
constant expression.
|
constant expression.
|
||||||
.PP
|
.IP *
|
||||||
.BR CMSG_SPACE ()
|
.BR CMSG_SPACE ()
|
||||||
returns the number of bytes an ancillary element with payload of the
|
returns the number of bytes an ancillary element with payload of the
|
||||||
passed data length occupies.
|
passed data length occupies.
|
||||||
This is a constant expression.
|
This is a constant expression.
|
||||||
.PP
|
.IP *
|
||||||
.BR CMSG_DATA ()
|
.BR CMSG_DATA ()
|
||||||
returns a pointer to the data portion of a
|
returns a pointer to the data portion of a
|
||||||
.IR cmsghdr .
|
.IR cmsghdr .
|
||||||
.PP
|
.IP *
|
||||||
.BR CMSG_LEN ()
|
.BR CMSG_LEN ()
|
||||||
returns the value to store in the
|
returns the value to store in the
|
||||||
.I cmsg_len
|
.I cmsg_len
|
||||||
|
|
Loading…
Reference in New Issue