From 0939fd479f91e0140d1b973068defaf396f94641 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 24 Sep 2018 14:58:49 -0600 Subject: [PATCH] include/sys/socket.h: Renumber the socket types. They must begin at 1, not zero. Socket type zero has a special meaning for some interfaces. For example, getaddrinfo() uses a socket type of zero to many any type of socket. The is no standard name for the any-type-socket, but macOS uses SOCK_UNSPEC. NuttX will do the same. Issue noted by Anthony Merlino. --- include/sys/socket.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/include/sys/socket.h b/include/sys/socket.h index b15040f1cc6..ee918d699fb 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -83,24 +83,25 @@ * the communication semantics. */ -#define SOCK_STREAM 0 /* Provides sequenced, reliable, two-way, +#define SOCK_UNSPEC 0 /* Unspecified socket type */ +#define SOCK_STREAM 1 /* Provides sequenced, reliable, two-way, * connection-based byte streams. An out-of-band data * transmission mechanism may be supported. */ -#define SOCK_DGRAM 1 /* Supports datagrams (connectionless, unreliable +#define SOCK_DGRAM 2 /* Supports datagrams (connectionless, unreliable * messages of a fixed maximum length). */ -#define SOCK_SEQPACKET 2 /* Provides a sequenced, reliable, two-way +#define SOCK_SEQPACKET 3 /* Provides a sequenced, reliable, two-way * connection-based data transmission path for * datagrams of fixed maximum length; a consumer is * required to read an entire packet with each read * system call. */ -#define SOCK_RAW 3 /* Provides raw network protocol access. */ -#define SOCK_RDM 4 /* Provides a reliable datagram layer that does not +#define SOCK_RAW 4 /* Provides raw network protocol access. */ +#define SOCK_RDM 5 /* Provides a reliable datagram layer that does not * guarantee ordering. */ -#define SOCK_PACKET 5 /* Obsolete and should not be used in new programs */ +#define SOCK_PACKET 6 /* Obsolete and should not be used in new programs */ /* Bits in the FLAGS argument to `send', `recv', et al. These are the bits * recognized by Linus, not all are supported by NuttX.