share/mk/: build-html: Don't build mbind.2 and set_mempolicy.2
[man-pages.git] / man3 / byteorder.3
blob76b699143a6989b3c21132a99b17303b53ef4e96
1 '\" t
2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\"
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\"
6 .\" References consulted:
7 .\"     Linux libc source code
8 .\"     Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\"     386BSD man pages
10 .\" Modified Sat Jul 24 21:29:05 1993 by Rik Faith (faith@cs.unc.edu)
11 .\" Modified Thu Jul 26 14:06:20 2001 by Andries Brouwer (aeb@cwi.nl)
12 .\"
13 .TH BYTEORDER 3 (date) "Linux man-pages (unreleased)"
14 .SH NAME
15 htonl, htons, ntohl, ntohs \- convert values between host and network
16 byte order
17 .SH LIBRARY
18 Standard C library
19 .RI ( libc ", " \-lc )
20 .SH SYNOPSIS
21 .nf
22 .B #include <arpa/inet.h>
24 .BI "uint32_t htonl(uint32_t " hostlong );
25 .BI "uint16_t htons(uint16_t " hostshort );
27 .BI "uint32_t ntohl(uint32_t " netlong );
28 .BI "uint16_t ntohs(uint16_t " netshort );
29 .fi
30 .SH DESCRIPTION
31 The
32 .BR htonl ()
33 function converts the unsigned integer
34 .I hostlong
35 from host byte order to network byte order.
37 The
38 .BR htons ()
39 function converts the unsigned short integer
40 .I hostshort
41 from host byte order to network byte order.
43 The
44 .BR ntohl ()
45 function converts the unsigned integer
46 .I netlong
47 from network byte order to host byte order.
49 The
50 .BR ntohs ()
51 function converts the unsigned short integer
52 .I netshort
53 from network byte order to host byte order.
55 On the i386 the host byte order is Least Significant Byte first,
56 whereas the network byte order, as used on the Internet, is Most
57 Significant Byte first.
58 .SH ATTRIBUTES
59 For an explanation of the terms used in this section, see
60 .BR attributes (7).
61 .TS
62 allbox;
63 lbx lb lb
64 l l l.
65 Interface       Attribute       Value
67 .na
68 .nh
69 .BR htonl (),
70 .BR htons (),
71 .BR ntohl (),
72 .BR ntohs ()
73 T}      Thread safety   MT-Safe
74 .TE
75 .SH STANDARDS
76 POSIX.1-2008.
77 .SH HISTORY
78 POSIX.1-2001.
79 .SH SEE ALSO
80 .BR bswap (3),
81 .BR endian (3),
82 .BR gethostbyname (3),
83 .BR getservent (3)