1bea7fb259c2f80fd6b7f44810009138f7ac07d9
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / uclibc / 0.9.33.2 / 0035-socket.h-pull-socket_type.h-from-eglibc.patch
1 From 8eccce991d08960d135b97066621c8d3248a79b7 Mon Sep 17 00:00:00 2001
2 From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
3 Date: Thu, 17 Jan 2013 19:29:22 +0100
4 Subject: [PATCH] socket.h: pull socket_type.h from eglibc
5
6 Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
7 ---
8  Makefile.in                                      |    2 +-
9  libc/inet/opensock.c                             |    9 +-
10  libc/sysdeps/linux/alpha/bits/socket_type.h      |   54 ++++
11  libc/sysdeps/linux/common/bits/kernel-features.h |   10 +-
12  libc/sysdeps/linux/common/bits/socket.h          |  104 +++---
13  libc/sysdeps/linux/common/bits/socket_type.h     |   54 ++++
14  libc/sysdeps/linux/common/cmsg_nxthdr.c          |    1 +
15  libc/sysdeps/linux/hppa/bits/socket_type.h       |   54 ++++
16  libc/sysdeps/linux/mips/bits/socket.h            |  369 ---------------------
17  libc/sysdeps/linux/mips/bits/socket_type.h       |   55 ++++
18  libc/sysdeps/linux/sparc/bits/socket.h           |  376 ----------------------
19  libc/sysdeps/linux/sparc/bits/socket_type.h      |   54 ++++
20  12 files changed, 325 insertions(+), 817 deletions(-)
21  create mode 100644 libc/sysdeps/linux/alpha/bits/socket_type.h
22  create mode 100644 libc/sysdeps/linux/common/bits/socket_type.h
23  create mode 100644 libc/sysdeps/linux/hppa/bits/socket_type.h
24  delete mode 100644 libc/sysdeps/linux/mips/bits/socket.h
25  create mode 100644 libc/sysdeps/linux/mips/bits/socket_type.h
26  delete mode 100644 libc/sysdeps/linux/sparc/bits/socket.h
27  create mode 100644 libc/sysdeps/linux/sparc/bits/socket_type.h
28
29 diff --git a/Makefile.in b/Makefile.in
30 index 87b8e4b..69abfaf 100644
31 --- a/Makefile.in
32 +++ b/Makefile.in
33 @@ -255,7 +255,7 @@ HEADERS_RM-$(UCLIBC_HAS_REALTIME)            += mqueue.h bits/mqueue.h sched.h \
34  HEADERS_RM-$(UCLIBC_HAS_REGEX)               += regex.h regexp.h
35  HEADERS_RM-$(UCLIBC_HAS_RPC)                 += rpc
36  HEADERS_RM-$(UCLIBC_HAS_SHADOW)              += shadow.h
37 -HEADERS_RM-$(UCLIBC_HAS_SOCKET)              += sys/socket.h bits/socket.h sys/socketvar.h
38 +HEADERS_RM-$(UCLIBC_HAS_SOCKET)              += sys/socket.h bits/socket.h sys/socketvar.h bits/socket_type.h
39  HEADERS_RM-$(UCLIBC_HAS_SYSLOG)              += syslog.h sys/syslog.h bits/syslog*.h
40  HEADERS_RM-$(UCLIBC_HAS_THREADS)             += *thread*.h semaphore.h \
41         bits/*thread*.h \
42 diff --git a/libc/inet/opensock.c b/libc/inet/opensock.c
43 index 86f8c59..da5858f 100644
44 --- a/libc/inet/opensock.c
45 +++ b/libc/inet/opensock.c
46 @@ -16,14 +16,11 @@
47     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
48     02111-1307 USA.  */
49  
50 -#include <assert.h>
51 -#include <errno.h>
52 -#include <stdio.h>
53 -#include <string.h>
54 -#include <unistd.h>
55 -#include <sys/socket.h>
56 +
57  #include <features.h>
58  #include <libc-internal.h>
59 +#include <sys/socket.h>
60 +#include <bits/kernel-features.h>
61  
62  /* Return a socket of any type.  The socket can be used in subsequent
63     ioctl calls to talk to the kernel.  */
64 diff --git a/libc/sysdeps/linux/alpha/bits/socket_type.h b/libc/sysdeps/linux/alpha/bits/socket_type.h
65 new file mode 100644
66 index 0000000..ee55d66
67 --- /dev/null
68 +++ b/libc/sysdeps/linux/alpha/bits/socket_type.h
69 @@ -0,0 +1,54 @@
70 +/* Define enum __socket_type for Linux/Alpha.
71 +   Copyright (C) 1991-2012 Free Software Foundation, Inc.
72 +   This file is part of the GNU C Library.
73 +
74 +   The GNU C Library is free software; you can redistribute it and/or
75 +   modify it under the terms of the GNU Lesser General Public
76 +   License as published by the Free Software Foundation; either
77 +   version 2.1 of the License, or (at your option) any later version.
78 +
79 +   The GNU C Library is distributed in the hope that it will be useful,
80 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
81 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
82 +   Lesser General Public License for more details.
83 +
84 +   You should have received a copy of the GNU Lesser General Public
85 +   License along with the GNU C Library.  If not, see
86 +   <http://www.gnu.org/licenses/>.  */
87 +
88 +#ifndef _SYS_SOCKET_H
89 +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
90 +#endif
91 +
92 +/* Types of sockets.  */
93 +enum __socket_type
94 +{
95 +  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
96 +                                  byte streams.  */
97 +#define SOCK_STREAM SOCK_STREAM
98 +  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
99 +                                  of fixed maximum length.  */
100 +#define SOCK_DGRAM SOCK_DGRAM
101 +  SOCK_RAW = 3,                        /* Raw protocol interface.  */
102 +#define SOCK_RAW SOCK_RAW
103 +  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
104 +#define SOCK_RDM SOCK_RDM
105 +  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
106 +                                  datagrams of fixed maximum length.  */
107 +#define SOCK_SEQPACKET SOCK_SEQPACKET
108 +  SOCK_DCCP = 6,               /* Datagram Congestion Control Protocol.  */
109 +#define SOCK_DCCP SOCK_DCCP
110 +  SOCK_PACKET = 10,            /* Linux specific way of getting packets
111 +                                  at the dev level.  For writing rarp and
112 +                                  other similar things on the user level. */
113 +#define SOCK_PACKET SOCK_PACKET
114 +
115 +  /* Flags to be ORed into the type parameter of socket and socketpair.  */
116 +
117 +  SOCK_CLOEXEC = 010000000,    /* Atomically set close-on-exec flag for the
118 +                                  new descriptor(s).  */
119 +#define SOCK_CLOEXEC SOCK_CLOEXEC
120 +  SOCK_NONBLOCK = 0x40000000   /* Atomically mark descriptor(s) as
121 +                                  non-blocking.  */
122 +#define SOCK_NONBLOCK SOCK_NONBLOCK
123 +};
124 diff --git a/libc/sysdeps/linux/common/bits/kernel-features.h b/libc/sysdeps/linux/common/bits/kernel-features.h
125 index 5ea85d2..5665e24 100644
126 --- a/libc/sysdeps/linux/common/bits/kernel-features.h
127 +++ b/libc/sysdeps/linux/common/bits/kernel-features.h
128 @@ -311,17 +311,19 @@
129  
130  /* Support for various CLOEXEC and NONBLOCK flags was added for x86,
131   *    x86-64, PPC, IA-64, and SPARC in 2.6.27.  */
132 -#if __LINUX_KERNEL_VERSION >= 0x02061b \
133 -    && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
134 -        || defined __ia64__ || defined __sparc__ || defined __s390__)
135 +#if (__LINUX_KERNEL_VERSION >= 0x02061b \
136 +     && (defined __i386__ || defined __x86_64__ || defined __powerpc__ \
137 +         || defined __ia64__ || defined __sparc__ || defined __s390__) \
138 +       ) || (__LINUX_KERNEL_VERSION >= 0x020621 && defined __alpha__) \
139 +       || defined __aarch64__ || defined __tile__
140  /* # define __ASSUME_SOCK_CLOEXEC  1 */
141  /* # define __ASSUME_IN_NONBLOCK   1 */
142  # define __ASSUME_PIPE2         1
143  /* # define __ASSUME_EVENTFD2      1 */
144  /* # define __ASSUME_SIGNALFD4     1 */
145 +/* # define __ASSUME_DUP3              1 */
146  #endif
147  
148 -
149  /* These features were surely available with 2.4.12.  */
150  #if __LINUX_KERNEL_VERSION >= 132108 && defined __mc68000__
151  # define __ASSUME_MMAP2_SYSCALL                1
152 diff --git a/libc/sysdeps/linux/common/bits/socket.h b/libc/sysdeps/linux/common/bits/socket.h
153 index 7e12733..6a89340 100644
154 --- a/libc/sysdeps/linux/common/bits/socket.h
155 +++ b/libc/sysdeps/linux/common/bits/socket.h
156 @@ -1,5 +1,6 @@
157  /* System-specific socket constants and types.  Linux version.
158 -   Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc.
159 +   Copyright (C) 1991,1992,1994-2001,2004,2006-2012
160 +   Free Software Foundation, Inc.
161     This file is part of the GNU C Library.
162  
163     The GNU C Library is free software; you can redistribute it and/or
164 @@ -20,12 +21,11 @@
165  #ifndef __BITS_SOCKET_H
166  #define __BITS_SOCKET_H
167  
168 -#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
169 +#ifndef _SYS_SOCKET_H
170  # error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
171  #endif
172  
173  #define        __need_size_t
174 -#define __need_NULL
175  #include <stddef.h>
176  
177  #include <limits.h>
178 @@ -37,37 +37,8 @@ typedef __socklen_t socklen_t;
179  # define __socklen_t_defined
180  #endif
181  
182 -/* Types of sockets.  */
183 -enum __socket_type
184 -{
185 -  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
186 -                                  byte streams.  */
187 -#define SOCK_STREAM SOCK_STREAM
188 -  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
189 -                                  of fixed maximum length.  */
190 -#define SOCK_DGRAM SOCK_DGRAM
191 -  SOCK_RAW = 3,                        /* Raw protocol interface.  */
192 -#define SOCK_RAW SOCK_RAW
193 -  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
194 -#define SOCK_RDM SOCK_RDM
195 -  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
196 -                                  datagrams of fixed maximum length.  */
197 -#define SOCK_SEQPACKET SOCK_SEQPACKET
198 -  SOCK_PACKET = 10,            /* Linux specific way of getting packets
199 -                                  at the dev level.  For writing rarp and
200 -                                  other similar things on the user level. */
201 -#define SOCK_PACKET SOCK_PACKET
202 -
203 -  /* Flags to be ORed into the type parameter of socket and socketpair and
204 -     used for the flags parameter of paccept.  */
205 -
206 -  SOCK_CLOEXEC = 02000000,     /* Atomically set close-on-exec flag for the
207 -                                  new descriptor(s).  */
208 -#define SOCK_CLOEXEC SOCK_CLOEXEC
209 -  SOCK_NONBLOCK = 04000                /* Atomically mark descriptor(s) as
210 -                                  non-blocking.  */
211 -#define SOCK_NONBLOCK SOCK_NONBLOCK
212 -};
213 +/* Get the architecture-dependent definition of enum __socket_type.  */
214 +#include <bits/socket_type.h>
215  
216  /* Protocol families.  */
217  #define        PF_UNSPEC       0       /* Unspecified.  */
218 @@ -94,22 +65,24 @@ enum __socket_type
219  #define        PF_ASH          18      /* Ash.  */
220  #define        PF_ECONET       19      /* Acorn Econet.  */
221  #define        PF_ATMSVC       20      /* ATM SVCs.  */
222 +#define PF_RDS         21      /* RDS sockets.  */
223  #define        PF_SNA          22      /* Linux SNA Project */
224  #define        PF_IRDA         23      /* IRDA sockets.  */
225  #define        PF_PPPOX        24      /* PPPoX sockets.  */
226  #define        PF_WANPIPE      25      /* Wanpipe API sockets.  */
227 -#define        PF_LLC          26      /* Linux LLC.  */
228 -#define        PF_CAN          29      /* Controller Area Network.  */
229 -#define        PF_TIPC         30      /* TIPC sockets.  */
230 +#define PF_LLC         26      /* Linux LLC.  */
231 +#define PF_CAN         29      /* Controller Area Network.  */
232 +#define PF_TIPC                30      /* TIPC sockets.  */
233  #define        PF_BLUETOOTH    31      /* Bluetooth sockets.  */
234  #define        PF_IUCV         32      /* IUCV sockets.  */
235 -#define        PF_RXRPC        33      /* RxRPC sockets.  */
236 -#define        PF_ISDN         34      /* mISDN sockets.  */
237 -#define        PF_PHONET       35      /* Phonet sockets.  */
238 -#define        PF_IEEE802154   36      /* IEEE 802.15.4 sockets.  */
239 -#define        PF_CAIF         37      /* CAIF sockets.  */
240 -#define        PF_ALG          38      /* Algorithm sockets.  */
241 -#define        PF_MAX          39      /* For now..  */
242 +#define PF_RXRPC       33      /* RxRPC sockets.  */
243 +#define PF_ISDN                34      /* mISDN sockets.  */
244 +#define PF_PHONET      35      /* Phonet sockets.  */
245 +#define PF_IEEE802154  36      /* IEEE 802.15.4 sockets.  */
246 +#define PF_CAIF                37      /* CAIF sockets.  */
247 +#define PF_ALG         38      /* Algorithm sockets.  */
248 +#define PF_NFC         39      /* NFC sockets.  */
249 +#define        PF_MAX          40      /* For now..  */
250  
251  /* Address families.  */
252  #define        AF_UNSPEC       PF_UNSPEC
253 @@ -136,21 +109,23 @@ enum __socket_type
254  #define        AF_ASH          PF_ASH
255  #define        AF_ECONET       PF_ECONET
256  #define        AF_ATMSVC       PF_ATMSVC
257 +#define AF_RDS         PF_RDS
258  #define        AF_SNA          PF_SNA
259  #define        AF_IRDA         PF_IRDA
260  #define        AF_PPPOX        PF_PPPOX
261  #define        AF_WANPIPE      PF_WANPIPE
262 -#define        AF_LLC          PF_LLC
263 -#define        AF_CAN          PF_CAN
264 -#define        AF_TIPC         PF_TIPC
265 +#define AF_LLC         PF_LLC
266 +#define AF_CAN         PF_CAN
267 +#define AF_TIPC                PF_TIPC
268  #define        AF_BLUETOOTH    PF_BLUETOOTH
269 -#define        AF_IUCV         PF_IUCV
270 -#define        AF_RXRPC        PF_RXRPC
271 -#define        AF_ISDN         PF_ISDN
272 -#define        AF_PHONET       PF_PHONET
273 -#define        AF_IEEE802154   PF_IEEE802154
274 -#define        AF_CAIF         PF_CAIF
275 -#define        AF_ALG          PF_ALG
276 +#define AF_IUCV                PF_IUCV
277 +#define AF_RXRPC       PF_RXRPC
278 +#define AF_ISDN                PF_ISDN
279 +#define AF_PHONET      PF_PHONET
280 +#define AF_IEEE802154  PF_IEEE802154
281 +#define AF_CAIF                PF_CAIF
282 +#define AF_ALG         PF_ALG
283 +#define AF_NFC         PF_NFC
284  #define        AF_MAX          PF_MAX
285  
286  /* Socket level values.  Others are defined in the appropriate headers.
287 @@ -235,8 +210,14 @@ enum
288  #define        MSG_ERRQUEUE    MSG_ERRQUEUE
289      MSG_NOSIGNAL       = 0x4000, /* Do not generate SIGPIPE.  */
290  #define        MSG_NOSIGNAL    MSG_NOSIGNAL
291 -    MSG_MORE           = 0x8000  /* Sender will send more.  */
292 +    MSG_MORE           = 0x8000,  /* Sender will send more.  */
293  #define        MSG_MORE        MSG_MORE
294 +    MSG_WAITFORONE     = 0x10000, /* Wait for at least one packet to return.*/
295 +#define MSG_WAITFORONE MSG_WAITFORONE
296 +    MSG_CMSG_CLOEXEC   = 0x40000000    /* Set close_on_exit for file
297 +                                          descriptor received through
298 +                                          SCM_RIGHTS.  */
299 +#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
300    };
301  
302  
303 @@ -290,7 +271,7 @@ struct cmsghdr
304  #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
305  #define CMSG_FIRSTHDR(mhdr) \
306    ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)                \
307 -   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
308 +   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) 0)
309  #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
310                          & (size_t) ~(sizeof (size_t) - 1))
311  #define CMSG_SPACE(len) (CMSG_ALIGN (len) \
312 @@ -302,14 +283,14 @@ extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
313  libc_hidden_proto(__cmsg_nxthdr)
314  #ifdef __USE_EXTERN_INLINES
315  # ifndef _EXTERN_INLINE
316 -#  define _EXTERN_INLINE extern __inline
317 +#  define _EXTERN_INLINE __extern_inline
318  # endif
319  _EXTERN_INLINE struct cmsghdr *
320  __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
321  {
322    if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
323      /* The kernel header does this so there may be a reason.  */
324 -    return 0;
325 +    return (struct cmsghdr *) 0;
326  
327    __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
328                                + CMSG_ALIGN (__cmsg->cmsg_len));
329 @@ -318,7 +299,7 @@ __NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
330        || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
331           > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
332      /* No more entries.  */
333 -    return 0;
334 +    return (struct cmsghdr *) 0;
335    return __cmsg;
336  }
337  #endif /* Use `extern inline'.  */
338 @@ -329,20 +310,21 @@ enum
339    {
340      SCM_RIGHTS = 0x01          /* Transfer file descriptors.  */
341  #define SCM_RIGHTS SCM_RIGHTS
342 -#ifdef __USE_BSD
343 +#ifdef __USE_GNU
344      , SCM_CREDENTIALS = 0x02   /* Credentials passing.  */
345  # define SCM_CREDENTIALS SCM_CREDENTIALS
346  #endif
347    };
348  
349 +#ifdef __USE_GNU
350  /* User visible structure for SCM_CREDENTIALS message */
351 -
352  struct ucred
353  {
354    pid_t pid;                   /* PID of sending process.  */
355    uid_t uid;                   /* UID of sending process.  */
356    gid_t gid;                   /* GID of sending process.  */
357  };
358 +#endif
359  
360  /* Get socket manipulation related informations from kernel headers.  */
361  #ifndef __GLIBC__
362 diff --git a/libc/sysdeps/linux/common/bits/socket_type.h b/libc/sysdeps/linux/common/bits/socket_type.h
363 new file mode 100644
364 index 0000000..65436b0
365 --- /dev/null
366 +++ b/libc/sysdeps/linux/common/bits/socket_type.h
367 @@ -0,0 +1,54 @@
368 +/* Define enum __socket_type for generic Linux.
369 +   Copyright (C) 1991-2012 Free Software Foundation, Inc.
370 +   This file is part of the GNU C Library.
371 +
372 +   The GNU C Library is free software; you can redistribute it and/or
373 +   modify it under the terms of the GNU Lesser General Public
374 +   License as published by the Free Software Foundation; either
375 +   version 2.1 of the License, or (at your option) any later version.
376 +
377 +   The GNU C Library is distributed in the hope that it will be useful,
378 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
379 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
380 +   Lesser General Public License for more details.
381 +
382 +   You should have received a copy of the GNU Lesser General Public
383 +   License along with the GNU C Library; if not, see
384 +   <http://www.gnu.org/licenses/>.  */
385 +
386 +#ifndef _SYS_SOCKET_H
387 +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
388 +#endif
389 +
390 +/* Types of sockets.  */
391 +enum __socket_type
392 +{
393 +  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
394 +                                  byte streams.  */
395 +#define SOCK_STREAM SOCK_STREAM
396 +  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
397 +                                  of fixed maximum length.  */
398 +#define SOCK_DGRAM SOCK_DGRAM
399 +  SOCK_RAW = 3,                        /* Raw protocol interface.  */
400 +#define SOCK_RAW SOCK_RAW
401 +  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
402 +#define SOCK_RDM SOCK_RDM
403 +  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
404 +                                  datagrams of fixed maximum length.  */
405 +#define SOCK_SEQPACKET SOCK_SEQPACKET
406 +  SOCK_DCCP = 6,               /* Datagram Congestion Control Protocol.  */
407 +#define SOCK_DCCP SOCK_DCCP
408 +  SOCK_PACKET = 10,            /* Linux specific way of getting packets
409 +                                  at the dev level.  For writing rarp and
410 +                                  other similar things on the user level. */
411 +#define SOCK_PACKET SOCK_PACKET
412 +
413 +  /* Flags to be ORed into the type parameter of socket and socketpair.  */
414 +
415 +  SOCK_CLOEXEC = 02000000,     /* Atomically set close-on-exec flag for the
416 +                                  new descriptor(s).  */
417 +#define SOCK_CLOEXEC SOCK_CLOEXEC
418 +  SOCK_NONBLOCK = 00004000     /* Atomically mark descriptor(s) as
419 +                                  non-blocking.  */
420 +#define SOCK_NONBLOCK SOCK_NONBLOCK
421 +};
422 diff --git a/libc/sysdeps/linux/common/cmsg_nxthdr.c b/libc/sysdeps/linux/common/cmsg_nxthdr.c
423 index 0360b47..9c21190 100644
424 --- a/libc/sysdeps/linux/common/cmsg_nxthdr.c
425 +++ b/libc/sysdeps/linux/common/cmsg_nxthdr.c
426 @@ -19,6 +19,7 @@
427  
428  #define __FORCE_GLIBC
429  #include <features.h>
430 +#include <stddef.h>
431  /* Prevent math.h from defining a colliding inline */
432  #undef __USE_EXTERN_INLINES
433  #include <sys/socket.h>
434 diff --git a/libc/sysdeps/linux/hppa/bits/socket_type.h b/libc/sysdeps/linux/hppa/bits/socket_type.h
435 new file mode 100644
436 index 0000000..c6df6c3
437 --- /dev/null
438 +++ b/libc/sysdeps/linux/hppa/bits/socket_type.h
439 @@ -0,0 +1,54 @@
440 +/* Define enum __socket_type for Linux/HP-PARISC.
441 +   Copyright (C) 2012 Free Software Foundation, Inc.
442 +   This file is part of the GNU C Library.
443 +
444 +   The GNU C Library is free software; you can redistribute it and/or
445 +   modify it under the terms of the GNU Lesser General Public
446 +   License as published by the Free Software Foundation; either
447 +   version 2.1 of the License, or (at your option) any later version.
448 +
449 +   The GNU C Library is distributed in the hope that it will be useful,
450 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
451 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
452 +   Lesser General Public License for more details.
453 +
454 +   You should have received a copy of the GNU Lesser General Public
455 +   License along with the GNU C Library; if not, see
456 +   <http://www.gnu.org/licenses/>.  */
457 +
458 +#ifndef _SYS_SOCKET_H
459 +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
460 +#endif
461 +
462 +/* Types of sockets.  */
463 +enum __socket_type
464 +{
465 +  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
466 +                                  byte streams.  */
467 +#define SOCK_STREAM SOCK_STREAM
468 +  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
469 +                                  of fixed maximum length.  */
470 +#define SOCK_DGRAM SOCK_DGRAM
471 +  SOCK_RAW = 3,                        /* Raw protocol interface.  */
472 +#define SOCK_RAW SOCK_RAW
473 +  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
474 +#define SOCK_RDM SOCK_RDM
475 +  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
476 +                                  datagrams of fixed maximum length.  */
477 +#define SOCK_SEQPACKET SOCK_SEQPACKET
478 +  SOCK_DCCP = 6,               /* Datagram Congestion Control Protocol.  */
479 +#define SOCK_DCCP SOCK_DCCP
480 +  SOCK_PACKET = 10,            /* Linux specific way of getting packets
481 +                                  at the dev level.  For writing rarp and
482 +                                  other similar things on the user level. */
483 +#define SOCK_PACKET SOCK_PACKET
484 +
485 +  /* Flags to be ORed into the type parameter of socket and socketpair.  */
486 +
487 +  SOCK_CLOEXEC = 010000000,    /* Atomically set close-on-exec flag for the
488 +                                  new descriptor(s).  */
489 +#define SOCK_CLOEXEC SOCK_CLOEXEC
490 +  SOCK_NONBLOCK = 0x40000000   /* Atomically mark descriptor(s) as
491 +                                  non-blocking.  */
492 +#define SOCK_NONBLOCK SOCK_NONBLOCK
493 +};
494 diff --git a/libc/sysdeps/linux/mips/bits/socket.h b/libc/sysdeps/linux/mips/bits/socket.h
495 deleted file mode 100644
496 index 27ceafa..0000000
497 --- a/libc/sysdeps/linux/mips/bits/socket.h
498 +++ /dev/null
499 @@ -1,369 +0,0 @@
500 -/* System-specific socket constants and types.  Linux/MIPS version.
501 -   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006
502 -   Free Software Foundation, Inc.
503 -   This file is part of the GNU C Library.
504 -
505 -   The GNU C Library is free software; you can redistribute it and/or
506 -   modify it under the terms of the GNU Lesser General Public
507 -   License as published by the Free Software Foundation; either
508 -   version 2.1 of the License, or (at your option) any later version.
509 -
510 -   The GNU C Library is distributed in the hope that it will be useful,
511 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
512 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
513 -   Lesser General Public License for more details.
514 -
515 -   You should have received a copy of the GNU Lesser General Public
516 -   License along with the GNU C Library; if not, write to the Free
517 -   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
518 -   02111-1307 USA.  */
519 -
520 -#ifndef __BITS_SOCKET_H
521 -#define __BITS_SOCKET_H
522 -
523 -#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
524 -# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
525 -#endif
526 -
527 -#define        __need_size_t
528 -#define __need_NULL
529 -#include <stddef.h>
530 -
531 -#include <limits.h>
532 -#include <sys/types.h>
533 -
534 -/* Type for length arguments in socket calls.  */
535 -#ifndef __socklen_t_defined
536 -typedef __socklen_t socklen_t;
537 -# define __socklen_t_defined
538 -#endif
539 -
540 -/* Types of sockets.  */
541 -enum __socket_type
542 -{
543 -  SOCK_DGRAM = 1,              /* Connectionless, unreliable datagrams
544 -                                  of fixed maximum length.  */
545 -#define SOCK_DGRAM SOCK_DGRAM
546 -  SOCK_STREAM = 2,             /* Sequenced, reliable, connection-based
547 -                                  byte streams.  */
548 -#define SOCK_STREAM SOCK_STREAM
549 -  SOCK_RAW = 3,                        /* Raw protocol interface.  */
550 -#define SOCK_RAW SOCK_RAW
551 -  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
552 -#define SOCK_RDM SOCK_RDM
553 -  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
554 -                                  datagrams of fixed maximum length.  */
555 -#define SOCK_SEQPACKET SOCK_SEQPACKET
556 -  SOCK_DCCP = 6,
557 -#define SOCK_DCCP SOCK_DCCP    /* Datagram Congestion Control Protocol.  */
558 -  SOCK_PACKET = 10,            /* Linux specific way of getting packets
559 -                                  at the dev level.  For writing rarp and
560 -                                  other similar things on the user level. */
561 -#define SOCK_PACKET SOCK_PACKET
562 -  /* Flags to be ORed into the type parameter of socket and socketpair and
563 -     used for the flags parameter of paccept.  */
564 -
565 -  SOCK_CLOEXEC = 02000000,     /* Atomically set close-on-exec flag for the
566 -                                   new descriptor(s).  */
567 -#define SOCK_CLOEXEC SOCK_CLOEXEC
568 -  SOCK_NONBLOCK = 0200         /* Atomically mark descriptor(s) as
569 -                                  non-blocking.  */
570 -#define SOCK_NONBLOCK SOCK_NONBLOCK
571 -};
572 -
573 -/* Protocol families.  */
574 -#define        PF_UNSPEC       0       /* Unspecified.  */
575 -#define        PF_LOCAL        1       /* Local to host (pipes and file-domain).  */
576 -#define        PF_UNIX         PF_LOCAL /* Old BSD name for PF_LOCAL.  */
577 -#define        PF_FILE         PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
578 -#define        PF_INET         2       /* IP protocol family.  */
579 -#define        PF_AX25         3       /* Amateur Radio AX.25.  */
580 -#define        PF_IPX          4       /* Novell Internet Protocol.  */
581 -#define        PF_APPLETALK    5       /* Appletalk DDP.  */
582 -#define        PF_NETROM       6       /* Amateur radio NetROM.  */
583 -#define        PF_BRIDGE       7       /* Multiprotocol bridge.  */
584 -#define        PF_ATMPVC       8       /* ATM PVCs.  */
585 -#define        PF_X25          9       /* Reserved for X.25 project.  */
586 -#define        PF_INET6        10      /* IP version 6.  */
587 -#define        PF_ROSE         11      /* Amateur Radio X.25 PLP.  */
588 -#define        PF_DECnet       12      /* Reserved for DECnet project.  */
589 -#define        PF_NETBEUI      13      /* Reserved for 802.2LLC project.  */
590 -#define        PF_SECURITY     14      /* Security callback pseudo AF.  */
591 -#define        PF_KEY          15      /* PF_KEY key management API.  */
592 -#define        PF_NETLINK      16
593 -#define        PF_ROUTE        PF_NETLINK /* Alias to emulate 4.4BSD.  */
594 -#define        PF_PACKET       17      /* Packet family.  */
595 -#define        PF_ASH          18      /* Ash.  */
596 -#define        PF_ECONET       19      /* Acorn Econet.  */
597 -#define        PF_ATMSVC       20      /* ATM SVCs.  */
598 -#define        PF_SNA          22      /* Linux SNA Project */
599 -#define        PF_IRDA         23      /* IRDA sockets.  */
600 -#define        PF_PPPOX        24      /* PPPoX sockets.  */
601 -#define        PF_WANPIPE      25      /* Wanpipe API sockets.  */
602 -#define        PF_LLC          26      /* Linux LLC.  */
603 -#define        PF_CAN          29      /* Controller Area Network.  */
604 -#define        PF_TIPC         30      /* TIPC sockets.  */
605 -#define        PF_BLUETOOTH    31      /* Bluetooth sockets.  */
606 -#define        PF_IUCV         32      /* IUCV sockets.  */
607 -#define        PF_RXRPC        33      /* RxRPC sockets.  */
608 -#define        PF_ISDN         34      /* mISDN sockets.  */
609 -#define        PF_PHONET       35      /* Phonet sockets.  */
610 -#define        PF_IEEE802154   36      /* IEEE 802.15.4 sockets.  */
611 -#define        PF_CAIF         37      /* CAIF sockets.  */
612 -#define        PF_ALG          38      /* Algorithm sockets.  */
613 -#define        PF_MAX          39      /* For now..  */
614 -
615 -/* Address families.  */
616 -#define        AF_UNSPEC       PF_UNSPEC
617 -#define        AF_LOCAL        PF_LOCAL
618 -#define        AF_UNIX         PF_UNIX
619 -#define        AF_FILE         PF_FILE
620 -#define        AF_INET         PF_INET
621 -#define        AF_AX25         PF_AX25
622 -#define        AF_IPX          PF_IPX
623 -#define        AF_APPLETALK    PF_APPLETALK
624 -#define        AF_NETROM       PF_NETROM
625 -#define        AF_BRIDGE       PF_BRIDGE
626 -#define        AF_ATMPVC       PF_ATMPVC
627 -#define        AF_X25          PF_X25
628 -#define        AF_INET6        PF_INET6
629 -#define        AF_ROSE         PF_ROSE
630 -#define        AF_DECnet       PF_DECnet
631 -#define        AF_NETBEUI      PF_NETBEUI
632 -#define        AF_SECURITY     PF_SECURITY
633 -#define        AF_KEY          PF_KEY
634 -#define        AF_NETLINK      PF_NETLINK
635 -#define        AF_ROUTE        PF_ROUTE
636 -#define        AF_PACKET       PF_PACKET
637 -#define        AF_ASH          PF_ASH
638 -#define        AF_ECONET       PF_ECONET
639 -#define        AF_ATMSVC       PF_ATMSVC
640 -#define        AF_SNA          PF_SNA
641 -#define        AF_IRDA         PF_IRDA
642 -#define        AF_PPPOX        PF_PPPOX
643 -#define        AF_WANPIPE      PF_WANPIPE
644 -#define        AF_LLC          PF_LLC
645 -#define        AF_CAN          PF_CAN
646 -#define        AF_TIPC         PF_TIPC
647 -#define        AF_BLUETOOTH    PF_BLUETOOTH
648 -#define        AF_IUCV         PF_IUCV
649 -#define        AF_RXRPC        PF_RXRPC
650 -#define        AF_ISDN         PF_ISDN
651 -#define        AF_PHONET       PF_PHONET
652 -#define        AF_IEEE802154   PF_IEEE802154
653 -#define        AF_CAIF         PF_CAIF
654 -#define        AF_ALG          PF_ALG
655 -#define        AF_MAX          PF_MAX
656 -
657 -/* Socket level values.  Others are defined in the appropriate headers.
658 -
659 -   XXX These definitions also should go into the appropriate headers as
660 -   far as they are available.  */
661 -#define SOL_RAW                255
662 -#define SOL_DECNET      261
663 -#define SOL_X25         262
664 -#define SOL_PACKET     263
665 -#define SOL_ATM                264     /* ATM layer (cell level).  */
666 -#define SOL_AAL                265     /* ATM Adaption Layer (packet level).  */
667 -#define SOL_IRDA       266
668 -
669 -/* Maximum queue length specifiable by listen.  */
670 -#define SOMAXCONN      128
671 -
672 -/* Get the definition of the macro to define the common sockaddr members.  */
673 -#include <bits/sockaddr.h>
674 -
675 -/* Structure describing a generic socket address.  */
676 -struct sockaddr
677 -  {
678 -    __SOCKADDR_COMMON (sa_);   /* Common data: address family and length.  */
679 -    char sa_data[14];          /* Address data.  */
680 -  };
681 -
682 -
683 -/* Structure large enough to hold any socket address (with the historical
684 -   exception of AF_UNIX).  We reserve 128 bytes.  */
685 -#define __ss_aligntype unsigned long int
686 -#define _SS_SIZE       128
687 -#define _SS_PADSIZE    (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
688 -
689 -struct sockaddr_storage
690 -  {
691 -    __SOCKADDR_COMMON (ss_);   /* Address family, etc.  */
692 -    __ss_aligntype __ss_align; /* Force desired alignment.  */
693 -    char __ss_padding[_SS_PADSIZE];
694 -  };
695 -
696 -
697 -/* Bits in the FLAGS argument to `send', `recv', et al.  */
698 -enum
699 -  {
700 -    MSG_OOB            = 0x01, /* Process out-of-band data.  */
701 -#define MSG_OOB                MSG_OOB
702 -    MSG_PEEK           = 0x02, /* Peek at incoming messages.  */
703 -#define MSG_PEEK       MSG_PEEK
704 -    MSG_DONTROUTE      = 0x04, /* Don't use local routing.  */
705 -#define MSG_DONTROUTE  MSG_DONTROUTE
706 -#ifdef __USE_GNU
707 -    /* DECnet uses a different name.  */
708 -    MSG_TRYHARD                = MSG_DONTROUTE,
709 -# define MSG_TRYHARD   MSG_DONTROUTE
710 -#endif
711 -    MSG_CTRUNC         = 0x08, /* Control data lost before delivery.  */
712 -#define MSG_CTRUNC     MSG_CTRUNC
713 -    MSG_PROXY          = 0x10, /* Supply or ask second address.  */
714 -#define MSG_PROXY      MSG_PROXY
715 -    MSG_TRUNC          = 0x20,
716 -#define        MSG_TRUNC       MSG_TRUNC
717 -    MSG_DONTWAIT       = 0x40, /* Nonblocking IO.  */
718 -#define        MSG_DONTWAIT    MSG_DONTWAIT
719 -    MSG_EOR            = 0x80, /* End of record.  */
720 -#define        MSG_EOR         MSG_EOR
721 -    MSG_WAITALL                = 0x100, /* Wait for a full request.  */
722 -#define        MSG_WAITALL     MSG_WAITALL
723 -    MSG_FIN            = 0x200,
724 -#define        MSG_FIN         MSG_FIN
725 -    MSG_SYN            = 0x400,
726 -#define        MSG_SYN         MSG_SYN
727 -    MSG_CONFIRM                = 0x800, /* Confirm path validity.  */
728 -#define        MSG_CONFIRM     MSG_CONFIRM
729 -    MSG_RST            = 0x1000,
730 -#define        MSG_RST         MSG_RST
731 -    MSG_ERRQUEUE       = 0x2000, /* Fetch message from error queue.  */
732 -#define        MSG_ERRQUEUE    MSG_ERRQUEUE
733 -    MSG_NOSIGNAL       = 0x4000, /* Do not generate SIGPIPE.  */
734 -#define        MSG_NOSIGNAL    MSG_NOSIGNAL
735 -    MSG_MORE           = 0x8000, /* Sender will send more.  */
736 -#define        MSG_MORE        MSG_MORE
737 -    MSG_WAITFORONE      = 0x10000, /* Wait for at least one packet to return.*/
738 -#define MSG_WAITFORONE  MSG_WAITFORONE
739 -
740 -    MSG_CMSG_CLOEXEC    = 0x40000000    /* Set close_on_exit for file
741 -                                          descriptor received through
742 -                                          SCM_RIGHTS.  */
743 -#define MSG_CMSG_CLOEXEC MSG_CMSG_CLOEXEC
744 -  };
745 -
746 -
747 -/* Structure describing messages sent by
748 -   `sendmsg' and received by `recvmsg'.  */
749 -/* Note: do not change these members to match glibc; these match the
750 -   SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
751 -   http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
752 -/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
753 -   platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
754 -struct msghdr
755 -  {
756 -    void *msg_name;            /* Address to send to/receive from.  */
757 -    socklen_t msg_namelen;     /* Length of address data.  */
758 -
759 -    struct iovec *msg_iov;     /* Vector of data to send/receive into.  */
760 -#if __WORDSIZE == 32
761 -    int msg_iovlen;            /* Number of elements in the vector.  */
762 -#else
763 -    size_t msg_iovlen;         /* Number of elements in the vector.  */
764 -#endif
765 -
766 -    void *msg_control;         /* Ancillary data (eg BSD filedesc passing). */
767 -#if __WORDSIZE == 32
768 -    socklen_t msg_controllen;  /* Ancillary data buffer length.  */
769 -#else
770 -    size_t msg_controllen;     /* Ancillary data buffer length.  */
771 -#endif
772 -
773 -    int msg_flags;             /* Flags on received message.  */
774 -  };
775 -
776 -/* Structure used for storage of ancillary data object information.  */
777 -struct cmsghdr
778 -  {
779 -    size_t cmsg_len;           /* Length of data in cmsg_data plus length
780 -                                  of cmsghdr structure.  */
781 -    int cmsg_level;            /* Originating protocol.  */
782 -    int cmsg_type;             /* Protocol specific type.  */
783 -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
784 -    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
785 -#endif
786 -  };
787 -
788 -/* Ancillary data object manipulation macros.  */
789 -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
790 -# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
791 -#else
792 -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
793 -#endif
794 -#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
795 -#define CMSG_FIRSTHDR(mhdr) \
796 -  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)                \
797 -   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
798 -#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
799 -                        & (size_t) ~(sizeof (size_t) - 1))
800 -#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
801 -                        + CMSG_ALIGN (sizeof (struct cmsghdr)))
802 -#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
803 -
804 -extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
805 -                                     struct cmsghdr *__cmsg) __THROW;
806 -libc_hidden_proto(__cmsg_nxthdr)
807 -#ifdef __USE_EXTERN_INLINES
808 -# ifndef _EXTERN_INLINE
809 -#  define _EXTERN_INLINE extern __inline
810 -# endif
811 -_EXTERN_INLINE struct cmsghdr *
812 -__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
813 -{
814 -  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
815 -    /* The kernel header does this so there may be a reason.  */
816 -    return 0;
817 -
818 -  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
819 -                              + CMSG_ALIGN (__cmsg->cmsg_len));
820 -  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
821 -                                       + __mhdr->msg_controllen)
822 -      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
823 -         > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
824 -    /* No more entries.  */
825 -    return 0;
826 -  return __cmsg;
827 -}
828 -#endif /* Use `extern inline'.  */
829 -
830 -/* Socket level message types.  This must match the definitions in
831 -   <linux/socket.h>.  */
832 -enum
833 -  {
834 -    SCM_RIGHTS = 0x01          /* Transfer file descriptors.  */
835 -#define SCM_RIGHTS SCM_RIGHTS
836 -#ifdef __USE_BSD
837 -    , SCM_CREDENTIALS = 0x02   /* Credentials passing.  */
838 -# define SCM_CREDENTIALS SCM_CREDENTIALS
839 -#endif
840 -  };
841 -
842 -/* User visible structure for SCM_CREDENTIALS message */
843 -
844 -struct ucred
845 -{
846 -  pid_t pid;                   /* PID of sending process.  */
847 -  uid_t uid;                   /* UID of sending process.  */
848 -  gid_t gid;                   /* GID of sending process.  */
849 -};
850 -
851 -/* Get socket manipulation related informations from kernel headers.  */
852 -#ifndef __GLIBC__
853 -#define __GLIBC__ 2
854 -#include <asm/socket.h>
855 -#undef __GLIBC__
856 -#else
857 -#include <asm/socket.h>
858 -#endif
859 -
860 -
861 -/* Structure used to manipulate the SO_LINGER option.  */
862 -struct linger
863 -  {
864 -    int l_onoff;               /* Nonzero to linger on close.  */
865 -    int l_linger;              /* Time to linger.  */
866 -  };
867 -
868 -#endif /* bits/socket.h */
869 diff --git a/libc/sysdeps/linux/mips/bits/socket_type.h b/libc/sysdeps/linux/mips/bits/socket_type.h
870 new file mode 100644
871 index 0000000..20d2732
872 --- /dev/null
873 +++ b/libc/sysdeps/linux/mips/bits/socket_type.h
874 @@ -0,0 +1,55 @@
875 +/* System-specific socket constants and types.  Linux/MIPS version.
876 +   Copyright (C) 1991, 92, 1994-1999, 2000, 2001, 2004, 2005, 2006
877 +   Free Software Foundation, Inc.
878 +   This file is part of the GNU C Library.
879 +
880 +   The GNU C Library is free software; you can redistribute it and/or
881 +   modify it under the terms of the GNU Lesser General Public
882 +   License as published by the Free Software Foundation; either
883 +   version 2.1 of the License, or (at your option) any later version.
884 +
885 +   The GNU C Library is distributed in the hope that it will be useful,
886 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
887 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
888 +   Lesser General Public License for more details.
889 +
890 +   You should have received a copy of the GNU Lesser General Public
891 +   License along with the GNU C Library; if not, see
892 +   <http://www.gnu.org/licenses/>.  */
893 +
894 +#ifndef _SYS_SOCKET_H
895 +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
896 +#endif
897 +
898 +/* Types of sockets.  */
899 +enum __socket_type
900 +{
901 +  SOCK_DGRAM = 1,              /* Connectionless, unreliable datagrams
902 +                                  of fixed maximum length.  */
903 +#define SOCK_DGRAM SOCK_DGRAM
904 +  SOCK_STREAM = 2,             /* Sequenced, reliable, connection-based
905 +                                  byte streams.  */
906 +#define SOCK_STREAM SOCK_STREAM
907 +  SOCK_RAW = 3,                        /* Raw protocol interface.  */
908 +#define SOCK_RAW SOCK_RAW
909 +  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
910 +#define SOCK_RDM SOCK_RDM
911 +  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
912 +                                  datagrams of fixed maximum length.  */
913 +#define SOCK_SEQPACKET SOCK_SEQPACKET
914 +  SOCK_DCCP = 6,
915 +#define SOCK_DCCP SOCK_DCCP    /* Datagram Congestion Control Protocol.  */
916 +  SOCK_PACKET = 10,            /* Linux specific way of getting packets
917 +                                  at the dev level.  For writing rarp and
918 +                                  other similar things on the user level. */
919 +#define SOCK_PACKET SOCK_PACKET
920 +
921 +  /* Flags to be ORed into the type parameter of socket and socketpair.  */
922 +
923 +  SOCK_CLOEXEC = 02000000,     /* Atomically set close-on-exec flag for the
924 +                                  new descriptor(s).  */
925 +#define SOCK_CLOEXEC SOCK_CLOEXEC
926 +  SOCK_NONBLOCK = 00000200     /* Atomically mark descriptor(s) as
927 +                                  non-blocking.  */
928 +#define SOCK_NONBLOCK SOCK_NONBLOCK
929 +};
930 diff --git a/libc/sysdeps/linux/sparc/bits/socket.h b/libc/sysdeps/linux/sparc/bits/socket.h
931 deleted file mode 100644
932 index 64973e2..0000000
933 --- a/libc/sysdeps/linux/sparc/bits/socket.h
934 +++ /dev/null
935 @@ -1,376 +0,0 @@
936 -/* System-specific socket constants and types.  Linux version.
937 -   Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc.
938 -   This file is part of the GNU C Library.
939 -
940 -   The GNU C Library is free software; you can redistribute it and/or
941 -   modify it under the terms of the GNU Lesser General Public
942 -   License as published by the Free Software Foundation; either
943 -   version 2.1 of the License, or (at your option) any later version.
944 -
945 -   The GNU C Library is distributed in the hope that it will be useful,
946 -   but WITHOUT ANY WARRANTY; without even the implied warranty of
947 -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
948 -   Lesser General Public License for more details.
949 -
950 -   You should have received a copy of the GNU Lesser General Public
951 -   License along with the GNU C Library; if not, write to the Free
952 -   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
953 -   02111-1307 USA.  */
954 -
955 -#ifndef __BITS_SOCKET_H
956 -#define __BITS_SOCKET_H
957 -
958 -#if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H
959 -# error "Never include <bits/socket.h> directly; use <sys/socket.h> instead."
960 -#endif
961 -
962 -#define        __need_size_t
963 -#define __need_NULL
964 -#include <stddef.h>
965 -
966 -#include <limits.h>
967 -#include <sys/types.h>
968 -
969 -/* Type for length arguments in socket calls.  */
970 -#ifndef __socklen_t_defined
971 -typedef __socklen_t socklen_t;
972 -# define __socklen_t_defined
973 -#endif
974 -
975 -/* Types of sockets.  */
976 -enum __socket_type
977 -{
978 -  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
979 -                                  byte streams.  */
980 -#define SOCK_STREAM SOCK_STREAM
981 -  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
982 -                                  of fixed maximum length.  */
983 -#define SOCK_DGRAM SOCK_DGRAM
984 -  SOCK_RAW = 3,                        /* Raw protocol interface.  */
985 -#define SOCK_RAW SOCK_RAW
986 -  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
987 -#define SOCK_RDM SOCK_RDM
988 -  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
989 -                                  datagrams of fixed maximum length.  */
990 -#define SOCK_SEQPACKET SOCK_SEQPACKET
991 -  SOCK_PACKET = 10             /* Linux specific way of getting packets
992 -                                  at the dev level.  For writing rarp and
993 -                                  other similar things on the user level. */
994 -#define SOCK_PACKET SOCK_PACKET
995 -};
996 -
997 -/* Protocol families.  */
998 -#define        PF_UNSPEC       0       /* Unspecified.  */
999 -#define        PF_LOCAL        1       /* Local to host (pipes and file-domain).  */
1000 -#define        PF_UNIX         PF_LOCAL /* Old BSD name for PF_LOCAL.  */
1001 -#define        PF_FILE         PF_LOCAL /* Another non-standard name for PF_LOCAL.  */
1002 -#define        PF_INET         2       /* IP protocol family.  */
1003 -#define        PF_AX25         3       /* Amateur Radio AX.25.  */
1004 -#define        PF_IPX          4       /* Novell Internet Protocol.  */
1005 -#define        PF_APPLETALK    5       /* Appletalk DDP.  */
1006 -#define        PF_NETROM       6       /* Amateur radio NetROM.  */
1007 -#define        PF_BRIDGE       7       /* Multiprotocol bridge.  */
1008 -#define        PF_ATMPVC       8       /* ATM PVCs.  */
1009 -#define        PF_X25          9       /* Reserved for X.25 project.  */
1010 -#define        PF_INET6        10      /* IP version 6.  */
1011 -#define        PF_ROSE         11      /* Amateur Radio X.25 PLP.  */
1012 -#define        PF_DECnet       12      /* Reserved for DECnet project.  */
1013 -#define        PF_NETBEUI      13      /* Reserved for 802.2LLC project.  */
1014 -#define        PF_SECURITY     14      /* Security callback pseudo AF.  */
1015 -#define        PF_KEY          15      /* PF_KEY key management API.  */
1016 -#define        PF_NETLINK      16
1017 -#define        PF_ROUTE        PF_NETLINK /* Alias to emulate 4.4BSD.  */
1018 -#define        PF_PACKET       17      /* Packet family.  */
1019 -#define        PF_ASH          18      /* Ash.  */
1020 -#define        PF_ECONET       19      /* Acorn Econet.  */
1021 -#define        PF_ATMSVC       20      /* ATM SVCs.  */
1022 -#define        PF_SNA          22      /* Linux SNA Project */
1023 -#define        PF_IRDA         23      /* IRDA sockets.  */
1024 -#define        PF_PPPOX        24      /* PPPoX sockets.  */
1025 -#define        PF_WANPIPE      25      /* Wanpipe API sockets.  */
1026 -#define        PF_LLC          26      /* Linux LLC.  */
1027 -#define        PF_CAN          29      /* Controller Area Network.  */
1028 -#define        PF_TIPC         30      /* TIPC sockets.  */
1029 -#define        PF_BLUETOOTH    31      /* Bluetooth sockets.  */
1030 -#define        PF_IUCV         32      /* IUCV sockets.  */
1031 -#define        PF_RXRPC        33      /* RxRPC sockets.  */
1032 -#define        PF_ISDN         34      /* mISDN sockets.  */
1033 -#define        PF_PHONET       35      /* Phonet sockets.  */
1034 -#define        PF_IEEE802154   36      /* IEEE 802.15.4 sockets.  */
1035 -#define        PF_CAIF         37      /* CAIF sockets.  */
1036 -#define        PF_ALG          38      /* Algorithm sockets.  */
1037 -#define        PF_MAX          39      /* For now..  */
1038 -
1039 -/* Address families.  */
1040 -#define        AF_UNSPEC       PF_UNSPEC
1041 -#define        AF_LOCAL        PF_LOCAL
1042 -#define        AF_UNIX         PF_UNIX
1043 -#define        AF_FILE         PF_FILE
1044 -#define        AF_INET         PF_INET
1045 -#define        AF_AX25         PF_AX25
1046 -#define        AF_IPX          PF_IPX
1047 -#define        AF_APPLETALK    PF_APPLETALK
1048 -#define        AF_NETROM       PF_NETROM
1049 -#define        AF_BRIDGE       PF_BRIDGE
1050 -#define        AF_ATMPVC       PF_ATMPVC
1051 -#define        AF_X25          PF_X25
1052 -#define        AF_INET6        PF_INET6
1053 -#define        AF_ROSE         PF_ROSE
1054 -#define        AF_DECnet       PF_DECnet
1055 -#define        AF_NETBEUI      PF_NETBEUI
1056 -#define        AF_SECURITY     PF_SECURITY
1057 -#define        AF_KEY          PF_KEY
1058 -#define        AF_NETLINK      PF_NETLINK
1059 -#define        AF_ROUTE        PF_ROUTE
1060 -#define        AF_PACKET       PF_PACKET
1061 -#define        AF_ASH          PF_ASH
1062 -#define        AF_ECONET       PF_ECONET
1063 -#define        AF_ATMSVC       PF_ATMSVC
1064 -#define        AF_SNA          PF_SNA
1065 -#define        AF_IRDA         PF_IRDA
1066 -#define        AF_PPPOX        PF_PPPOX
1067 -#define        AF_WANPIPE      PF_WANPIPE
1068 -#define        AF_LLC          PF_LLC
1069 -#define        AF_CAN          PF_CAN
1070 -#define        AF_TIPC         PF_TIPC
1071 -#define        AF_BLUETOOTH    PF_BLUETOOTH
1072 -#define        AF_IUCV         PF_IUCV
1073 -#define        AF_RXRPC        PF_RXRPC
1074 -#define        AF_ISDN         PF_ISDN
1075 -#define        AF_PHONET       PF_PHONET
1076 -#define        AF_IEEE802154   PF_IEEE802154
1077 -#define        AF_CAIF         PF_CAIF
1078 -#define        AF_ALG          PF_ALG
1079 -#define        AF_MAX          PF_MAX
1080 -
1081 -/* Socket level values.  Others are defined in the appropriate headers.
1082 -
1083 -   XXX These definitions also should go into the appropriate headers as
1084 -   far as they are available.  */
1085 -#define SOL_RAW                255
1086 -#define SOL_DECNET      261
1087 -#define SOL_X25         262
1088 -#define SOL_PACKET     263
1089 -#define SOL_ATM                264     /* ATM layer (cell level).  */
1090 -#define SOL_AAL                265     /* ATM Adaption Layer (packet level).  */
1091 -#define SOL_IRDA       266
1092 -
1093 -/* Maximum queue length specifiable by listen.  */
1094 -#define SOMAXCONN      128
1095 -
1096 -/* Get the definition of the macro to define the common sockaddr members.  */
1097 -#include <bits/sockaddr.h>
1098 -
1099 -/* Structure describing a generic socket address.  */
1100 -struct sockaddr
1101 -  {
1102 -    __SOCKADDR_COMMON (sa_);   /* Common data: address family and length.  */
1103 -    char sa_data[14];          /* Address data.  */
1104 -  };
1105 -
1106 -
1107 -/* Structure large enough to hold any socket address (with the historical
1108 -   exception of AF_UNIX).  We reserve 128 bytes.  */
1109 -#if ULONG_MAX > 0xffffffff
1110 -# define __ss_aligntype        __uint64_t
1111 -#else
1112 -# define __ss_aligntype        __uint32_t
1113 -#endif
1114 -#define _SS_SIZE       128
1115 -#define _SS_PADSIZE    (_SS_SIZE - (2 * sizeof (__ss_aligntype)))
1116 -
1117 -struct sockaddr_storage
1118 -  {
1119 -    __SOCKADDR_COMMON (ss_);   /* Address family, etc.  */
1120 -    __ss_aligntype __ss_align; /* Force desired alignment.  */
1121 -    char __ss_padding[_SS_PADSIZE];
1122 -  };
1123 -
1124 -
1125 -/* Bits in the FLAGS argument to `send', `recv', et al.  */
1126 -enum
1127 -  {
1128 -    MSG_OOB            = 0x01, /* Process out-of-band data.  */
1129 -#define MSG_OOB                MSG_OOB
1130 -    MSG_PEEK           = 0x02, /* Peek at incoming messages.  */
1131 -#define MSG_PEEK       MSG_PEEK
1132 -    MSG_DONTROUTE      = 0x04, /* Don't use local routing.  */
1133 -#define MSG_DONTROUTE  MSG_DONTROUTE
1134 -#ifdef __USE_GNU
1135 -    /* DECnet uses a different name.  */
1136 -    MSG_TRYHARD                = MSG_DONTROUTE,
1137 -# define MSG_TRYHARD   MSG_DONTROUTE
1138 -#endif
1139 -    MSG_CTRUNC         = 0x08, /* Control data lost before delivery.  */
1140 -#define MSG_CTRUNC     MSG_CTRUNC
1141 -    MSG_PROXY          = 0x10, /* Supply or ask second address.  */
1142 -#define MSG_PROXY      MSG_PROXY
1143 -    MSG_TRUNC          = 0x20,
1144 -#define        MSG_TRUNC       MSG_TRUNC
1145 -    MSG_DONTWAIT       = 0x40, /* Nonblocking IO.  */
1146 -#define        MSG_DONTWAIT    MSG_DONTWAIT
1147 -    MSG_EOR            = 0x80, /* End of record.  */
1148 -#define        MSG_EOR         MSG_EOR
1149 -    MSG_WAITALL                = 0x100, /* Wait for a full request.  */
1150 -#define        MSG_WAITALL     MSG_WAITALL
1151 -    MSG_FIN            = 0x200,
1152 -#define        MSG_FIN         MSG_FIN
1153 -    MSG_SYN            = 0x400,
1154 -#define        MSG_SYN         MSG_SYN
1155 -    MSG_CONFIRM                = 0x800, /* Confirm path validity.  */
1156 -#define        MSG_CONFIRM     MSG_CONFIRM
1157 -    MSG_RST            = 0x1000,
1158 -#define        MSG_RST         MSG_RST
1159 -    MSG_ERRQUEUE       = 0x2000, /* Fetch message from error queue.  */
1160 -#define        MSG_ERRQUEUE    MSG_ERRQUEUE
1161 -    MSG_NOSIGNAL       = 0x4000, /* Do not generate SIGPIPE.  */
1162 -#define        MSG_NOSIGNAL    MSG_NOSIGNAL
1163 -    MSG_MORE           = 0x8000  /* Sender will send more.  */
1164 -#define        MSG_MORE        MSG_MORE
1165 -  };
1166 -
1167 -
1168 -/* Structure describing messages sent by
1169 -   `sendmsg' and received by `recvmsg'.  */
1170 -/* Note: do not change these members to match glibc; these match the
1171 -   SuSv3 spec already (e.g. msg_iovlen/msg_controllen).
1172 -   http://www.opengroup.org/onlinepubs/009695399/basedefs/sys/socket.h.html */
1173 -/* Note: linux kernel uses __kernel_size_t (which is 8bytes on 64bit
1174 -   platforms, and 4bytes on 32bit platforms) for msg_iovlen/msg_controllen */
1175 -struct msghdr
1176 -  {
1177 -    void *msg_name;            /* Address to send to/receive from.  */
1178 -    socklen_t msg_namelen;     /* Length of address data.  */
1179 -
1180 -    struct iovec *msg_iov;     /* Vector of data to send/receive into.  */
1181 -#if __WORDSIZE == 32
1182 -    int msg_iovlen;            /* Number of elements in the vector.  */
1183 -#else
1184 -    size_t msg_iovlen;         /* Number of elements in the vector.  */
1185 -#endif
1186 -
1187 -    void *msg_control;         /* Ancillary data (eg BSD filedesc passing). */
1188 -#if __WORDSIZE == 32
1189 -    socklen_t msg_controllen;  /* Ancillary data buffer length.  */
1190 -#else
1191 -    size_t msg_controllen;     /* Ancillary data buffer length.  */
1192 -#endif
1193 -
1194 -    int msg_flags;             /* Flags on received message.  */
1195 -  };
1196 -
1197 -/* Structure used for storage of ancillary data object information.  */
1198 -struct cmsghdr
1199 -  {
1200 -    size_t cmsg_len;           /* Length of data in cmsg_data plus length
1201 -                                  of cmsghdr structure.  */
1202 -    int cmsg_level;            /* Originating protocol.  */
1203 -    int cmsg_type;             /* Protocol specific type.  */
1204 -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
1205 -    __extension__ unsigned char __cmsg_data __flexarr; /* Ancillary data.  */
1206 -#endif
1207 -  };
1208 -
1209 -/* Ancillary data object manipulation macros.  */
1210 -#if (!defined __STRICT_ANSI__ && __GNUC__ >= 2) || __STDC_VERSION__ >= 199901L
1211 -# define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data)
1212 -#else
1213 -# define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1))
1214 -#endif
1215 -#define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg)
1216 -#define CMSG_FIRSTHDR(mhdr) \
1217 -  ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr)                \
1218 -   ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL)
1219 -#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \
1220 -                        & (size_t) ~(sizeof (size_t) - 1))
1221 -#define CMSG_SPACE(len) (CMSG_ALIGN (len) \
1222 -                        + CMSG_ALIGN (sizeof (struct cmsghdr)))
1223 -#define CMSG_LEN(len)   (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
1224 -
1225 -extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr,
1226 -                                     struct cmsghdr *__cmsg) __THROW;
1227 -libc_hidden_proto(__cmsg_nxthdr)
1228 -#ifdef __USE_EXTERN_INLINES
1229 -# ifndef _EXTERN_INLINE
1230 -#  define _EXTERN_INLINE extern __inline
1231 -# endif
1232 -_EXTERN_INLINE struct cmsghdr *
1233 -__NTH (__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg))
1234 -{
1235 -  if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr))
1236 -    /* The kernel header does this so there may be a reason.  */
1237 -    return 0;
1238 -
1239 -  __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg
1240 -                              + CMSG_ALIGN (__cmsg->cmsg_len));
1241 -  if ((unsigned char *) (__cmsg + 1) > ((unsigned char *) __mhdr->msg_control
1242 -                                       + __mhdr->msg_controllen)
1243 -      || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)
1244 -         > ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen)))
1245 -    /* No more entries.  */
1246 -    return 0;
1247 -  return __cmsg;
1248 -}
1249 -#endif /* Use `extern inline'.  */
1250 -
1251 -/* Socket level message types.  This must match the definitions in
1252 -   <linux/socket.h>.  */
1253 -enum
1254 -  {
1255 -    SCM_RIGHTS = 0x01          /* Transfer file descriptors.  */
1256 -#define SCM_RIGHTS SCM_RIGHTS
1257 -#ifdef __USE_BSD
1258 -    , SCM_CREDENTIALS = 0x02   /* Credentials passing.  */
1259 -# define SCM_CREDENTIALS SCM_CREDENTIALS
1260 -#endif
1261 -  };
1262 -
1263 -/* User visible structure for SCM_CREDENTIALS message */
1264 -
1265 -struct ucred
1266 -{
1267 -  pid_t pid;                   /* PID of sending process.  */
1268 -  uid_t uid;                   /* UID of sending process.  */
1269 -  gid_t gid;                   /* GID of sending process.  */
1270 -};
1271 -
1272 -/* Get socket manipulation related informations from kernel headers.  */
1273 -#ifndef __GLIBC__
1274 -#define __GLIBC__ 2
1275 -#include <asm/socket.h>
1276 -#undef __GLIBC__
1277 -#else
1278 -#include <asm/socket.h>
1279 -#endif
1280 -
1281 -
1282 -/* Structure used to manipulate the SO_LINGER option.  */
1283 -struct linger
1284 -  {
1285 -    int l_onoff;               /* Nonzero to linger on close.  */
1286 -    int l_linger;              /* Time to linger.  */
1287 -  };
1288 -
1289 -/* Prefer socketcall over all these for sparc32, 
1290 -   since it only has socketcall */
1291 -#ifndef __arch64__
1292 - #undef __NR_accept
1293 - #undef __NR_bind
1294 - #undef __NR_connect
1295 - #undef __NR_getpeername
1296 - #undef __NR_getsockname
1297 - #undef __NR_getsockopt
1298 - #undef __NR_listen
1299 - #undef __NR_recv
1300 - #undef __NR_recvfrom
1301 - #undef __NR_recvmsg
1302 - #undef __NR_send
1303 - #undef __NR_sendmsg
1304 - #undef __NR_sendto
1305 - #undef __NR_setsockopt
1306 - #undef __NR_shutdown
1307 - #undef __NR_socket
1308 - #undef __NR_socketpair
1309 -#endif
1310 -
1311 -#endif /* bits/socket.h */
1312 diff --git a/libc/sysdeps/linux/sparc/bits/socket_type.h b/libc/sysdeps/linux/sparc/bits/socket_type.h
1313 new file mode 100644
1314 index 0000000..494655f
1315 --- /dev/null
1316 +++ b/libc/sysdeps/linux/sparc/bits/socket_type.h
1317 @@ -0,0 +1,54 @@
1318 +/* System-specific socket constants and types.  Linux version.
1319 +   Copyright (C) 1991,1992,1994-2001,2004,2006 Free Software Foundation, Inc.
1320 +   This file is part of the GNU C Library.
1321 +
1322 +   The GNU C Library is free software; you can redistribute it and/or
1323 +   modify it under the terms of the GNU Lesser General Public
1324 +   License as published by the Free Software Foundation; either
1325 +   version 2.1 of the License, or (at your option) any later version.
1326 +
1327 +   The GNU C Library is distributed in the hope that it will be useful,
1328 +   but WITHOUT ANY WARRANTY; without even the implied warranty of
1329 +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1330 +   Lesser General Public License for more details.
1331 +
1332 +   You should have received a copy of the GNU Lesser General Public
1333 +   License along with the GNU C Library; if not, see
1334 +   <http://www.gnu.org/licenses/>.  */
1335 +
1336 +#ifndef _SYS_SOCKET_H
1337 +# error "Never include <bits/socket_type.h> directly; use <sys/socket.h> instead."
1338 +#endif
1339 +
1340 +/* Types of sockets.  */
1341 +enum __socket_type
1342 +{
1343 +  SOCK_STREAM = 1,             /* Sequenced, reliable, connection-based
1344 +                                  byte streams.  */
1345 +#define SOCK_STREAM SOCK_STREAM
1346 +  SOCK_DGRAM = 2,              /* Connectionless, unreliable datagrams
1347 +                                  of fixed maximum length.  */
1348 +#define SOCK_DGRAM SOCK_DGRAM
1349 +  SOCK_RAW = 3,                        /* Raw protocol interface.  */
1350 +#define SOCK_RAW SOCK_RAW
1351 +  SOCK_RDM = 4,                        /* Reliably-delivered messages.  */
1352 +#define SOCK_RDM SOCK_RDM
1353 +  SOCK_SEQPACKET = 5,          /* Sequenced, reliable, connection-based,
1354 +                                  datagrams of fixed maximum length.  */
1355 +#define SOCK_SEQPACKET SOCK_SEQPACKET
1356 +  SOCK_DCCP = 6,               /* Datagram Congestion Control Protocol.  */
1357 +#define SOCK_DCCP SOCK_DCCP
1358 +  SOCK_PACKET = 10,            /* Linux specific way of getting packets
1359 +                                  at the dev level.  For writing rarp and
1360 +                                  other similar things on the user level. */
1361 +#define SOCK_PACKET SOCK_PACKET
1362 +
1363 +  /* Flags to be ORed into the type parameter of socket and socketpair.  */
1364 +
1365 +  SOCK_CLOEXEC = 0x400000,     /* Atomically set close-on-exec flag for the
1366 +                                  new descriptor(s).  */
1367 +#define SOCK_CLOEXEC SOCK_CLOEXEC
1368 +  SOCK_NONBLOCK = 0x004000     /* Atomically mark descriptor(s) as
1369 +                                  non-blocking.  */
1370 +#define SOCK_NONBLOCK SOCK_NONBLOCK
1371 +};
1372 -- 
1373 1.7.10.4
1374