Update the kernel headers to match external/kernel-headers.

Note that the Linux kernel handed over responsibility for most of the
socket constants to glibc some time ago. Someone had updated our
external/kernel-headers file but not regenerated the bionic headers,
so this change copies the missing stuff from the old bionic <linux/socket.h>
into <sys/socket.h>. This is what glibc does.

I've hacked a few of the other files to #include <sys/socket.h> for
backward compatibility, but even so this requires numerous other
changes to switch people over from direct inclusion of <linux/...> headers.

Change-Id: I0e4af64e631d3cef911a31d90f2f806e058278a0
diff --git a/libc/include/net/if.h b/libc/include/net/if.h
index 9044fc5..f36f37e 100644
--- a/libc/include/net/if.h
+++ b/libc/include/net/if.h
@@ -25,6 +25,8 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
+#include <sys/socket.h>
 #include <linux/if.h>
 #include <sys/cdefs.h>
 #ifndef IF_NAMESIZE
diff --git a/libc/include/net/if_arp.h b/libc/include/net/if_arp.h
index a25f1b4..5eae82c 100644
--- a/libc/include/net/if_arp.h
+++ b/libc/include/net/if_arp.h
@@ -1 +1,2 @@
+#include <sys/socket.h>
 #include <linux/if_arp.h>
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index 5ad7b4a..ead5954 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -206,7 +206,7 @@
 void endprotoent(void);
 void endservent(void);
 void freehostent(struct hostent *);
-struct hostent	*gethostbyaddr(const void *, int, int);
+struct hostent	*gethostbyaddr(const void *, socklen_t, int);
 int gethostbyaddr_r(const void *, int, int, struct hostent *, char *, size_t, struct hostent **, int *);
 struct hostent	*gethostbyname(const char *);
 int gethostbyname_r(const char *, struct hostent *, char *, size_t, struct hostent **, int *);
diff --git a/libc/include/netinet/if_ether.h b/libc/include/netinet/if_ether.h
index 700b9db..e4317fa 100644
--- a/libc/include/netinet/if_ether.h
+++ b/libc/include/netinet/if_ether.h
@@ -25,6 +25,8 @@
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
+
+#include <sys/socket.h>
 #include <linux/if_ether.h>
 #include <linux/if_arp.h>
 #ifndef ETHER_ADDR_LEN
diff --git a/libc/include/netinet/in.h b/libc/include/netinet/in.h
index 01bf58e..c5b964e 100644
--- a/libc/include/netinet/in.h
+++ b/libc/include/netinet/in.h
@@ -29,7 +29,7 @@
 #define _NETINET_IN_H_
 
 #include <endian.h>
-#include <linux/socket.h>
+#include <sys/socket.h>
 #include <linux/in.h>
 #include <linux/in6.h>
 #include <linux/ipv6.h>
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index f6acee8..e5e0c2e 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -32,8 +32,18 @@
 #include <sys/types.h>
 #include <linux/socket.h>
 
+#include <asm/socket.h>
+#include <linux/sockios.h>
+#include <linux/uio.h>
+#include <linux/types.h>
+#include <linux/compiler.h>
+
 __BEGIN_DECLS
 
+#define sockaddr_storage __kernel_sockaddr_storage
+typedef __sa_family_t sa_family_t;
+typedef int socklen_t;
+
 #ifdef __mips__
 #define SOCK_DGRAM      1
 #define SOCK_STREAM     2
@@ -51,12 +61,6 @@
 #define SOCK_PACKET      10
 #endif
 
-#ifdef __i386__
-# define __socketcall extern __attribute__((__cdecl__))
-#else
-# define __socketcall extern
-#endif
-
 /* BIONIC: second argument to shutdown() */
 enum {
     SHUT_RD = 0,        /* no more receptions */
@@ -67,8 +71,191 @@
 #define SHUT_RDWR       SHUT_RDWR
 };
 
+struct sockaddr {
+ sa_family_t sa_family;
+ char sa_data[14];
+};
 
-typedef int socklen_t;
+struct linger {
+ int l_onoff;
+ int l_linger;
+};
+
+struct msghdr {
+ void * msg_name;
+ int msg_namelen;
+ struct iovec * msg_iov;
+ __kernel_size_t msg_iovlen;
+ void * msg_control;
+ __kernel_size_t msg_controllen;
+ unsigned msg_flags;
+};
+
+struct cmsghdr {
+ __kernel_size_t cmsg_len;
+ int cmsg_level;
+ int cmsg_type;
+};
+
+#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
+#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
+#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
+#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
+#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
+#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
+#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ?   (struct cmsghdr *)(ctl) :   (struct cmsghdr *)NULL)
+#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
+#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
+
+#ifdef __GNUC__
+#define __KINLINE static __inline__
+#elif defined(__cplusplus)
+#define __KINLINE static inline
+#else
+#define __KINLINE static
+#endif
+
+__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size, struct cmsghdr *__cmsg) {
+ struct cmsghdr * __ptr;
+ __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
+ if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
+ return (struct cmsghdr *)0;
+ return __ptr;
+}
+
+__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg) {
+ return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
+}
+
+#define SCM_RIGHTS 0x01
+#define SCM_CREDENTIALS 0x02
+#define SCM_SECURITY 0x03
+
+struct ucred {
+ __u32 pid;
+ __u32 uid;
+ __u32 gid;
+};
+
+#define AF_UNSPEC 0
+#define AF_UNIX 1
+#define AF_LOCAL 1
+#define AF_INET 2
+#define AF_AX25 3
+#define AF_IPX 4
+#define AF_APPLETALK 5
+#define AF_NETROM 6
+#define AF_BRIDGE 7
+#define AF_ATMPVC 8
+#define AF_X25 9
+#define AF_INET6 10
+#define AF_ROSE 11
+#define AF_DECnet 12
+#define AF_NETBEUI 13
+#define AF_SECURITY 14
+#define AF_KEY 15
+#define AF_NETLINK 16
+#define AF_ROUTE AF_NETLINK
+#define AF_PACKET 17
+#define AF_ASH 18
+#define AF_ECONET 19
+#define AF_ATMSVC 20
+#define AF_SNA 22
+#define AF_IRDA 23
+#define AF_PPPOX 24
+#define AF_WANPIPE 25
+#define AF_LLC 26
+#define AF_TIPC 30
+#define AF_BLUETOOTH 31
+#define AF_CAIF 38
+#define AF_MAX 39
+
+#define PF_UNSPEC AF_UNSPEC
+#define PF_UNIX AF_UNIX
+#define PF_LOCAL AF_LOCAL
+#define PF_INET AF_INET
+#define PF_AX25 AF_AX25
+#define PF_IPX AF_IPX
+#define PF_APPLETALK AF_APPLETALK
+#define PF_NETROM AF_NETROM
+#define PF_BRIDGE AF_BRIDGE
+#define PF_ATMPVC AF_ATMPVC
+#define PF_X25 AF_X25
+#define PF_INET6 AF_INET6
+#define PF_ROSE AF_ROSE
+#define PF_DECnet AF_DECnet
+#define PF_NETBEUI AF_NETBEUI
+#define PF_SECURITY AF_SECURITY
+#define PF_KEY AF_KEY
+#define PF_NETLINK AF_NETLINK
+#define PF_ROUTE AF_ROUTE
+#define PF_PACKET AF_PACKET
+#define PF_ASH AF_ASH
+#define PF_ECONET AF_ECONET
+#define PF_ATMSVC AF_ATMSVC
+#define PF_SNA AF_SNA
+#define PF_IRDA AF_IRDA
+#define PF_PPPOX AF_PPPOX
+#define PF_WANPIPE AF_WANPIPE
+#define PF_LLC AF_LLC
+#define PF_TIPC AF_TIPC
+#define PF_BLUETOOTH AF_BLUETOOTH
+#define PF_CAIF AF_CAIF
+#define PF_MAX AF_MAX
+
+#define SOMAXCONN 128
+
+#define MSG_OOB 1
+#define MSG_PEEK 2
+#define MSG_DONTROUTE 4
+#define MSG_TRYHARD 4
+#define MSG_CTRUNC 8
+#define MSG_PROBE 0x10
+#define MSG_TRUNC 0x20
+#define MSG_DONTWAIT 0x40
+#define MSG_EOR 0x80
+#define MSG_WAITALL 0x100
+#define MSG_FIN 0x200
+#define MSG_SYN 0x400
+#define MSG_CONFIRM 0x800
+#define MSG_RST 0x1000
+#define MSG_ERRQUEUE 0x2000
+#define MSG_NOSIGNAL 0x4000
+#define MSG_MORE 0x8000
+#define MSG_EOF MSG_FIN
+#define MSG_CMSG_COMPAT 0
+
+#define SOL_IP 0
+#define SOL_TCP 6
+#define SOL_UDP 17
+#define SOL_IPV6 41
+#define SOL_ICMPV6 58
+#define SOL_SCTP 132
+#define SOL_RAW 255
+#define SOL_IPX 256
+#define SOL_AX25 257
+#define SOL_ATALK 258
+#define SOL_NETROM 259
+#define SOL_ROSE 260
+#define SOL_DECNET 261
+#define SOL_X25 262
+#define SOL_PACKET 263
+#define SOL_ATM 264
+#define SOL_AAL 265
+#define SOL_IRDA 266
+#define SOL_NETBEUI 267
+#define SOL_LLC 268
+#define SOL_DCCP 269
+#define SOL_NETLINK 270
+#define SOL_TIPC 271
+
+#define IPX_TYPE 1
+
+#ifdef __i386__
+# define __socketcall extern __attribute__((__cdecl__))
+#else
+# define __socketcall extern
+#endif
 
 __socketcall int socket(int, int, int);
 __socketcall int bind(int, const struct sockaddr *, int);
diff --git a/libc/kernel/arch-arm/asm/socket.h b/libc/kernel/arch-arm/asm/socket.h
index a8c5000..0741bad 100644
--- a/libc/kernel/arch-arm/asm/socket.h
+++ b/libc/kernel/arch-arm/asm/socket.h
@@ -63,4 +63,17 @@
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_PEERSEC 31
 #define SO_PASSSEC 34
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_MARK 36
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_PROTOCOL 38
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DOMAIN 39
+#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/arch-arm/asm/ucontext.h b/libc/kernel/arch-arm/asm/ucontext.h
index b9a879d..769f694 100644
--- a/libc/kernel/arch-arm/asm/ucontext.h
+++ b/libc/kernel/arch-arm/asm/ucontext.h
@@ -27,7 +27,7 @@
  struct sigcontext uc_mcontext;
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
  sigset_t uc_sigmask;
- int _unused[32 - (sizeof (sigset_t) / sizeof (int))];
+ int __unused[32 - (sizeof (sigset_t) / sizeof (int))];
  unsigned long uc_regspace[128] __attribute__((__aligned__(8)));
 };
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mman.h b/libc/kernel/arch-mips/asm/mman.h
index c5b93a4..cb42c6a 100644
--- a/libc/kernel/arch-mips/asm/mman.h
+++ b/libc/kernel/arch-mips/asm/mman.h
@@ -77,4 +77,3 @@
 #define MAP_FILE 0
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
-
diff --git a/libc/kernel/arch-mips/asm/socket.h b/libc/kernel/arch-mips/asm/socket.h
index ff8a3ba..4dbbe85 100644
--- a/libc/kernel/arch-mips/asm/socket.h
+++ b/libc/kernel/arch-mips/asm/socket.h
@@ -42,30 +42,39 @@
 #define SO_RCVTIMEO 0x1006  
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_ACCEPTCONN 0x1009
+#define SO_PROTOCOL 0x1028  
+#define SO_DOMAIN 0x1029  
 #define SO_NO_CHECK 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_PRIORITY 12
 #define SO_BSDCOMPAT 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_PASSCRED 17
 #define SO_PEERCRED 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_SECURITY_AUTHENTICATION 22
 #define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_SECURITY_ENCRYPTION_NETWORK 24
 #define SO_BINDTODEVICE 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_ATTACH_FILTER 26
 #define SO_DETACH_FILTER 27
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_PEERNAME 28
 #define SO_TIMESTAMP 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SCM_TIMESTAMP SO_TIMESTAMP
 #define SO_PEERSEC 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_SNDBUFFORCE 31
 #define SO_RCVBUFFORCE 33
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SO_PASSSEC 34
 #define SO_TIMESTAMPNS 35
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define SCM_TIMESTAMPNS SO_TIMESTAMPNS
 #define SO_MARK 36
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_TIMESTAMPING 37
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_RXQ_OVFL 40
+#define SO_WIFI_STATUS 41
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
 #endif
diff --git a/libc/kernel/arch-mips/asm/unistd.h b/libc/kernel/arch-mips/asm/unistd.h
index 6b89ac9..4a8744f 100644
--- a/libc/kernel/arch-mips/asm/unistd.h
+++ b/libc/kernel/arch-mips/asm/unistd.h
@@ -1244,4 +1244,3 @@
 #define __NR_N32_Linux 6000
 #define __NR_N32_Linux_syscalls 310
 #endif
-
diff --git a/libc/kernel/arch-x86/asm/socket.h b/libc/kernel/arch-x86/asm/socket.h
index b520169..50a9874 100644
--- a/libc/kernel/arch-x86/asm/socket.h
+++ b/libc/kernel/arch-x86/asm/socket.h
@@ -16,54 +16,4 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _ASM_SOCKET_H
-#define _ASM_SOCKET_H
-#include <asm/sockios.h>
-#define SOL_SOCKET 1
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_DEBUG 1
-#define SO_REUSEADDR 2
-#define SO_TYPE 3
-#define SO_ERROR 4
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_DONTROUTE 5
-#define SO_BROADCAST 6
-#define SO_SNDBUF 7
-#define SO_RCVBUF 8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_SNDBUFFORCE 32
-#define SO_RCVBUFFORCE 33
-#define SO_KEEPALIVE 9
-#define SO_OOBINLINE 10
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_NO_CHECK 11
-#define SO_PRIORITY 12
-#define SO_LINGER 13
-#define SO_BSDCOMPAT 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PASSCRED 16
-#define SO_PEERCRED 17
-#define SO_RCVLOWAT 18
-#define SO_SNDLOWAT 19
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_RCVTIMEO 20
-#define SO_SNDTIMEO 21
-#define SO_SECURITY_AUTHENTICATION 22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_SECURITY_ENCRYPTION_NETWORK 24
-#define SO_BINDTODEVICE 25
-#define SO_ATTACH_FILTER 26
-#define SO_DETACH_FILTER 27
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PEERNAME 28
-#define SO_TIMESTAMP 29
-#define SCM_TIMESTAMP SO_TIMESTAMP
-#define SO_ACCEPTCONN 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SO_PEERSEC 31
-#define SO_PASSSEC 34
-#define SO_TIMESTAMPNS 35
-#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
+#include <asm-generic/socket.h>
diff --git a/libc/kernel/arch-x86/asm/unistd_32.h b/libc/kernel/arch-x86/asm/unistd_32.h
index 4536585..b2193a2 100644
--- a/libc/kernel/arch-x86/asm/unistd_32.h
+++ b/libc/kernel/arch-x86/asm/unistd_32.h
@@ -16,8 +16,8 @@
  ***
  ****************************************************************************
  ****************************************************************************/
-#ifndef _ASM_I386_UNISTD_H_
-#define _ASM_I386_UNISTD_H_
+#ifndef _ASM_X86_UNISTD_32_H
+#define _ASM_X86_UNISTD_32_H
 #define __NR_restart_syscall 0
 #define __NR_exit 1
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
@@ -417,9 +417,35 @@
 #define __NR_utimensat 320
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #define __NR_signalfd 321
-#define __NR_timerfd 322
+#define __NR_timerfd_create 322
 #define __NR_eventfd 323
 #define __NR_fallocate 324
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __NR_perf_event_open 364
+#define __NR_timerfd_settime 325
+#define __NR_timerfd_gettime 326
+#define __NR_signalfd4 327
+#define __NR_eventfd2 328
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_epoll_create1 329
+#define __NR_dup3 330
+#define __NR_pipe2 331
+#define __NR_inotify_init1 332
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_preadv 333
+#define __NR_pwritev 334
+#define __NR_rt_tgsigqueueinfo 335
+#define __NR_perf_event_open 336
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_recvmmsg 337
+#define __NR_fanotify_init 338
+#define __NR_fanotify_mark 339
+#define __NR_prlimit64 340
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_name_to_handle_at 341
+#define __NR_open_by_handle_at 342
+#define __NR_clock_adjtime 343
+#define __NR_syncfs 344
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __NR_sendmmsg 345
+#define __NR_setns 346
 #endif
diff --git a/libc/kernel/common/asm-generic/socket.h b/libc/kernel/common/asm-generic/socket.h
new file mode 100644
index 0000000..fb3876e
--- /dev/null
+++ b/libc/kernel/common/asm-generic/socket.h
@@ -0,0 +1,81 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef __ASM_GENERIC_SOCKET_H
+#define __ASM_GENERIC_SOCKET_H
+#include <asm/sockios.h>
+#define SOL_SOCKET 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DEBUG 1
+#define SO_REUSEADDR 2
+#define SO_TYPE 3
+#define SO_ERROR 4
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_DONTROUTE 5
+#define SO_BROADCAST 6
+#define SO_SNDBUF 7
+#define SO_RCVBUF 8
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDBUFFORCE 32
+#define SO_RCVBUFFORCE 33
+#define SO_KEEPALIVE 9
+#define SO_OOBINLINE 10
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_NO_CHECK 11
+#define SO_PRIORITY 12
+#define SO_LINGER 13
+#define SO_BSDCOMPAT 14
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef SO_PASSCRED
+#define SO_PASSCRED 16
+#define SO_PEERCRED 17
+#define SO_RCVLOWAT 18
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SNDLOWAT 19
+#define SO_RCVTIMEO 20
+#define SO_SNDTIMEO 21
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_SECURITY_AUTHENTICATION 22
+#define SO_SECURITY_ENCRYPTION_TRANSPORT 23
+#define SO_SECURITY_ENCRYPTION_NETWORK 24
+#define SO_BINDTODEVICE 25
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_ATTACH_FILTER 26
+#define SO_DETACH_FILTER 27
+#define SO_PEERNAME 28
+#define SO_TIMESTAMP 29
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_TIMESTAMP SO_TIMESTAMP
+#define SO_ACCEPTCONN 30
+#define SO_PEERSEC 31
+#define SO_PASSSEC 34
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_TIMESTAMPNS 35
+#define SCM_TIMESTAMPNS SO_TIMESTAMPNS
+#define SO_MARK 36
+#define SO_TIMESTAMPING 37
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SCM_TIMESTAMPING SO_TIMESTAMPING
+#define SO_PROTOCOL 38
+#define SO_DOMAIN 39
+#define SO_RXQ_OVFL 40
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SO_WIFI_STATUS 41
+#define SCM_WIFI_STATUS SO_WIFI_STATUS
+#endif
diff --git a/libc/kernel/common/linux/can.h b/libc/kernel/common/linux/can.h
new file mode 100644
index 0000000..36d3f42
--- /dev/null
+++ b/libc/kernel/common/linux/can.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_H
+#define CAN_H
+#include <linux/types.h>
+#include <linux/socket.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_EFF_FLAG 0x80000000U  
+#define CAN_RTR_FLAG 0x40000000U  
+#define CAN_ERR_FLAG 0x20000000U  
+#define CAN_SFF_MASK 0x000007FFU  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_EFF_MASK 0x1FFFFFFFU  
+#define CAN_ERR_MASK 0x1FFFFFFFU  
+typedef __u32 canid_t;
+typedef __u32 can_err_mask_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct can_frame {
+ canid_t can_id;
+ __u8 can_dlc;
+ __u8 data[8] __attribute__((aligned(8)));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define CAN_RAW 1  
+#define CAN_BCM 2  
+#define CAN_TP16 3  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_TP20 4  
+#define CAN_MCNET 5  
+#define CAN_ISOTP 6  
+#define CAN_NPROTO 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SOL_CAN_BASE 100
+struct sockaddr_can {
+ __kernel_sa_family_t can_family;
+ int can_ifindex;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ union {
+ struct { canid_t rx_id, tx_id; } tp;
+ } can_addr;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct can_filter {
+ canid_t can_id;
+ canid_t can_mask;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_INV_FILTER 0x20000000U  
+#endif
diff --git a/libc/kernel/common/linux/can/bcm.h b/libc/kernel/common/linux/can/bcm.h
new file mode 100644
index 0000000..fca1232
--- /dev/null
+++ b/libc/kernel/common/linux/can/bcm.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_BCM_H
+#define CAN_BCM_H
+#include <linux/types.h>
+#include <linux/can.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct bcm_msg_head {
+ __u32 opcode;
+ __u32 flags;
+ __u32 count;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct timeval ival1, ival2;
+ canid_t can_id;
+ __u32 nframes;
+ struct can_frame frames[0];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum {
+ TX_SETUP = 1,
+ TX_DELETE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ TX_READ,
+ TX_SEND,
+ RX_SETUP,
+ RX_DELETE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ RX_READ,
+ TX_STATUS,
+ TX_EXPIRED,
+ RX_STATUS,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ RX_TIMEOUT,
+ RX_CHANGED
+};
+#define SETTIMER 0x0001
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STARTTIMER 0x0002
+#define TX_COUNTEVT 0x0004
+#define TX_ANNOUNCE 0x0008
+#define TX_CP_CAN_ID 0x0010
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define RX_FILTER_ID 0x0020
+#define RX_CHECK_DLC 0x0040
+#define RX_NO_AUTOTIMER 0x0080
+#define RX_ANNOUNCE_RESUME 0x0100
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define TX_RESET_MULTI_IDX 0x0200
+#define RX_RTR_FRAME 0x0400
+#endif
diff --git a/libc/kernel/common/linux/can/error.h b/libc/kernel/common/linux/can/error.h
new file mode 100644
index 0000000..6caaf8b
--- /dev/null
+++ b/libc/kernel/common/linux/can/error.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_ERROR_H
+#define CAN_ERROR_H
+#define CAN_ERR_DLC 8  
+#define CAN_ERR_TX_TIMEOUT 0x00000001U  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_LOSTARB 0x00000002U  
+#define CAN_ERR_CRTL 0x00000004U  
+#define CAN_ERR_PROT 0x00000008U  
+#define CAN_ERR_TRX 0x00000010U  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_ACK 0x00000020U  
+#define CAN_ERR_BUSOFF 0x00000040U  
+#define CAN_ERR_BUSERROR 0x00000080U  
+#define CAN_ERR_RESTARTED 0x00000100U  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_LOSTARB_UNSPEC 0x00  
+#define CAN_ERR_CRTL_UNSPEC 0x00  
+#define CAN_ERR_CRTL_RX_OVERFLOW 0x01  
+#define CAN_ERR_CRTL_TX_OVERFLOW 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_CRTL_RX_WARNING 0x04  
+#define CAN_ERR_CRTL_TX_WARNING 0x08  
+#define CAN_ERR_CRTL_RX_PASSIVE 0x10  
+#define CAN_ERR_CRTL_TX_PASSIVE 0x20  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_UNSPEC 0x00  
+#define CAN_ERR_PROT_BIT 0x01  
+#define CAN_ERR_PROT_FORM 0x02  
+#define CAN_ERR_PROT_STUFF 0x04  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_BIT0 0x08  
+#define CAN_ERR_PROT_BIT1 0x10  
+#define CAN_ERR_PROT_OVERLOAD 0x20  
+#define CAN_ERR_PROT_ACTIVE 0x40  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_TX 0x80  
+#define CAN_ERR_PROT_LOC_UNSPEC 0x00  
+#define CAN_ERR_PROT_LOC_SOF 0x03  
+#define CAN_ERR_PROT_LOC_ID28_21 0x02  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_LOC_ID20_18 0x06  
+#define CAN_ERR_PROT_LOC_SRTR 0x04  
+#define CAN_ERR_PROT_LOC_IDE 0x05  
+#define CAN_ERR_PROT_LOC_ID17_13 0x07  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_LOC_ID12_05 0x0F  
+#define CAN_ERR_PROT_LOC_ID04_00 0x0E  
+#define CAN_ERR_PROT_LOC_RTR 0x0C  
+#define CAN_ERR_PROT_LOC_RES1 0x0D  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_LOC_RES0 0x09  
+#define CAN_ERR_PROT_LOC_DLC 0x0B  
+#define CAN_ERR_PROT_LOC_DATA 0x0A  
+#define CAN_ERR_PROT_LOC_CRC_SEQ 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_LOC_CRC_DEL 0x18  
+#define CAN_ERR_PROT_LOC_ACK 0x19  
+#define CAN_ERR_PROT_LOC_ACK_DEL 0x1B  
+#define CAN_ERR_PROT_LOC_EOF 0x1A  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_PROT_LOC_INTERM 0x12  
+#define CAN_ERR_TRX_UNSPEC 0x00  
+#define CAN_ERR_TRX_CANH_NO_WIRE 0x04  
+#define CAN_ERR_TRX_CANH_SHORT_TO_BAT 0x05  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_TRX_CANH_SHORT_TO_VCC 0x06  
+#define CAN_ERR_TRX_CANH_SHORT_TO_GND 0x07  
+#define CAN_ERR_TRX_CANL_NO_WIRE 0x40  
+#define CAN_ERR_TRX_CANL_SHORT_TO_BAT 0x50  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_ERR_TRX_CANL_SHORT_TO_VCC 0x60  
+#define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70  
+#define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80  
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/common/linux/can/gw.h b/libc/kernel/common/linux/can/gw.h
new file mode 100644
index 0000000..2aacd2d
--- /dev/null
+++ b/libc/kernel/common/linux/can/gw.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_GW_H
+#define CAN_GW_H
+#include <linux/types.h>
+#include <linux/can.h>
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct rtcanmsg {
+ __u8 can_family;
+ __u8 gwtype;
+ __u16 flags;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum {
+ CGW_TYPE_UNSPEC,
+ CGW_TYPE_CAN_CAN,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __CGW_TYPE_MAX
+};
+#define CGW_TYPE_MAX (__CGW_TYPE_MAX - 1)
+enum {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CGW_UNSPEC,
+ CGW_MOD_AND,
+ CGW_MOD_OR,
+ CGW_MOD_XOR,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CGW_MOD_SET,
+ CGW_CS_XOR,
+ CGW_CS_CRC8,
+ CGW_HANDLED,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CGW_DROPPED,
+ CGW_SRC_IF,
+ CGW_DST_IF,
+ CGW_FILTER,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __CGW_MAX
+};
+#define CGW_MAX (__CGW_MAX - 1)
+#define CGW_FLAGS_CAN_ECHO 0x01
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CGW_FLAGS_CAN_SRC_TSTAMP 0x02
+#define CGW_MOD_FUNCS 4  
+#define CGW_MOD_ID 0x01
+#define CGW_MOD_DLC 0x02
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CGW_MOD_DATA 0x04
+#define CGW_FRAME_MODS 3  
+#define MAX_MODFUNCTIONS (CGW_MOD_FUNCS * CGW_FRAME_MODS)
+struct cgw_frame_mod {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct can_frame cf;
+ __u8 modtype;
+} __attribute__((packed));
+#define CGW_MODATTR_LEN sizeof(struct cgw_frame_mod)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct cgw_csum_xor {
+ __s8 from_idx;
+ __s8 to_idx;
+ __s8 result_idx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 init_xor_val;
+} __attribute__((packed));
+struct cgw_csum_crc8 {
+ __s8 from_idx;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __s8 to_idx;
+ __s8 result_idx;
+ __u8 init_crc_val;
+ __u8 final_xor_val;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u8 crctab[256];
+ __u8 profile;
+ __u8 profile_data[20];
+} __attribute__((packed));
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CGW_CS_XOR_LEN sizeof(struct cgw_csum_xor)
+#define CGW_CS_CRC8_LEN sizeof(struct cgw_csum_crc8)
+enum {
+ CGW_CRC8PRF_UNSPEC,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CGW_CRC8PRF_1U8,
+ CGW_CRC8PRF_16U8,
+ CGW_CRC8PRF_SFFID_XOR,
+ __CGW_CRC8PRF_MAX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define CGW_CRC8PRF_MAX (__CGW_CRC8PRF_MAX - 1)
+#endif
diff --git a/libc/kernel/common/linux/can/netlink.h b/libc/kernel/common/linux/can/netlink.h
new file mode 100644
index 0000000..a6006d3
--- /dev/null
+++ b/libc/kernel/common/linux/can/netlink.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_NETLINK_H
+#define CAN_NETLINK_H
+#include <linux/types.h>
+struct can_bittiming {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 bitrate;
+ __u32 sample_point;
+ __u32 tq;
+ __u32 prop_seg;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 phase_seg1;
+ __u32 phase_seg2;
+ __u32 sjw;
+ __u32 brp;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+struct can_bittiming_const {
+ char name[16];
+ __u32 tseg1_min;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 tseg1_max;
+ __u32 tseg2_min;
+ __u32 tseg2_max;
+ __u32 sjw_max;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 brp_min;
+ __u32 brp_max;
+ __u32 brp_inc;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct can_clock {
+ __u32 freq;
+};
+enum can_state {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CAN_STATE_ERROR_ACTIVE = 0,
+ CAN_STATE_ERROR_WARNING,
+ CAN_STATE_ERROR_PASSIVE,
+ CAN_STATE_BUS_OFF,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CAN_STATE_STOPPED,
+ CAN_STATE_SLEEPING,
+ CAN_STATE_MAX
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct can_berr_counter {
+ __u16 txerr;
+ __u16 rxerr;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+struct can_ctrlmode {
+ __u32 mask;
+ __u32 flags;
+};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_CTRLMODE_LOOPBACK 0x01  
+#define CAN_CTRLMODE_LISTENONLY 0x02  
+#define CAN_CTRLMODE_3_SAMPLES 0x04  
+#define CAN_CTRLMODE_ONE_SHOT 0x08  
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define CAN_CTRLMODE_BERR_REPORTING 0x10  
+struct can_device_stats {
+ __u32 bus_error;
+ __u32 error_warning;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __u32 error_passive;
+ __u32 bus_off;
+ __u32 arbitration_lost;
+ __u32 restarts;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+enum {
+ IFLA_CAN_UNSPEC,
+ IFLA_CAN_BITTIMING,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ IFLA_CAN_BITTIMING_CONST,
+ IFLA_CAN_CLOCK,
+ IFLA_CAN_STATE,
+ IFLA_CAN_CTRLMODE,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ IFLA_CAN_RESTART_MS,
+ IFLA_CAN_RESTART,
+ IFLA_CAN_BERR_COUNTER,
+ __IFLA_CAN_MAX
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+};
+#define IFLA_CAN_MAX (__IFLA_CAN_MAX - 1)
+#endif
diff --git a/libc/kernel/common/linux/can/raw.h b/libc/kernel/common/linux/can/raw.h
new file mode 100644
index 0000000..af17bb6
--- /dev/null
+++ b/libc/kernel/common/linux/can/raw.h
@@ -0,0 +1,31 @@
+/****************************************************************************
+ ****************************************************************************
+ ***
+ ***   This header was automatically generated from a Linux kernel header
+ ***   of the same name, to make information necessary for userspace to
+ ***   call into the kernel available to libc.  It contains only constants,
+ ***   structures, and macros generated from the original header, and thus,
+ ***   contains no copyrightable information.
+ ***
+ ***   To edit the content of this header, modify the corresponding
+ ***   source file (e.g. under external/kernel-headers/original/) then
+ ***   run bionic/libc/kernel/tools/update_all.py
+ ***
+ ***   Any manual change here will be lost the next time this script will
+ ***   be run. You've been warned!
+ ***
+ ****************************************************************************
+ ****************************************************************************/
+#ifndef CAN_RAW_H
+#define CAN_RAW_H
+#include <linux/can.h>
+#define SOL_CAN_RAW (SOL_CAN_BASE + CAN_RAW)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+enum {
+ CAN_RAW_FILTER = 1,
+ CAN_RAW_ERR_FILTER,
+ CAN_RAW_LOOPBACK,
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ CAN_RAW_RECV_OWN_MSGS
+};
+#endif
diff --git a/libc/kernel/common/linux/socket.h b/libc/kernel/common/linux/socket.h
index 99146f3..1037f50 100644
--- a/libc/kernel/common/linux/socket.h
+++ b/libc/kernel/common/linux/socket.h
@@ -21,229 +21,10 @@
 #define _K_SS_MAXSIZE 128  
 #define _K_SS_ALIGNSIZE (__alignof__ (struct sockaddr *))
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+typedef unsigned short __kernel_sa_family_t;
 struct __kernel_sockaddr_storage {
- unsigned short ss_family;
+ __kernel_sa_family_t ss_family;
  char __data[_K_SS_MAXSIZE - sizeof(unsigned short)];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 } __attribute__ ((aligned(_K_SS_ALIGNSIZE)));
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#if !defined(__GLIBC__) || __GLIBC__ < 2
-#include <asm/socket.h>  
-#include <linux/sockios.h>  
-#include <linux/uio.h>  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#include <linux/types.h>  
-#include <linux/compiler.h>  
-typedef unsigned short sa_family_t;
-struct sockaddr {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- sa_family_t sa_family;
- char sa_data[14];
-};
-struct linger {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int l_onoff;
- int l_linger;
-};
-#define sockaddr_storage __kernel_sockaddr_storage
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-struct msghdr {
- void * msg_name;
- int msg_namelen;
- struct iovec * msg_iov;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __kernel_size_t msg_iovlen;
- void * msg_control;
- __kernel_size_t msg_controllen;
- unsigned msg_flags;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-};
-struct cmsghdr {
- __kernel_size_t cmsg_len;
- int cmsg_level;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- int cmsg_type;
-};
-#define __CMSG_NXTHDR(ctl, len, cmsg) __cmsg_nxthdr((ctl),(len),(cmsg))
-#define CMSG_NXTHDR(mhdr, cmsg) cmsg_nxthdr((mhdr), (cmsg))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define CMSG_ALIGN(len) ( ((len)+sizeof(long)-1) & ~(sizeof(long)-1) )
-#define CMSG_DATA(cmsg) ((void *)((char *)(cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr))))
-#define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + CMSG_ALIGN(len))
-#define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr)) + (len))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __CMSG_FIRSTHDR(ctl,len) ((len) >= sizeof(struct cmsghdr) ?   (struct cmsghdr *)(ctl) :   (struct cmsghdr *)NULL)
-#define CMSG_FIRSTHDR(msg) __CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
-#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) &&   (cmsg)->cmsg_len <= (unsigned long)   ((mhdr)->msg_controllen -   ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
-#ifdef __GNUC__
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __KINLINE static __inline__
-#elif defined(__cplusplus)
-#define __KINLINE static inline
-#else
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define __KINLINE static
-#endif
-__KINLINE struct cmsghdr * __cmsg_nxthdr(void *__ctl, __kernel_size_t __size,
- struct cmsghdr *__cmsg)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-{
- struct cmsghdr * __ptr;
- __ptr = (struct cmsghdr*)(((unsigned char *) __cmsg) + CMSG_ALIGN(__cmsg->cmsg_len));
- if ((unsigned long)((char*)(__ptr+1) - (char *) __ctl) > __size)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- return (struct cmsghdr *)0;
- return __ptr;
-}
-__KINLINE struct cmsghdr * cmsg_nxthdr (struct msghdr *__msg, struct cmsghdr *__cmsg)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-{
- return __cmsg_nxthdr(__msg->msg_control, __msg->msg_controllen, __cmsg);
-}
-#define SCM_RIGHTS 0x01  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SCM_CREDENTIALS 0x02  
-#define SCM_SECURITY 0x03  
-struct ucred {
- __u32 pid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
- __u32 uid;
- __u32 gid;
-};
-#define AF_UNSPEC 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_UNIX 1  
-#define AF_LOCAL 1  
-#define AF_INET 2  
-#define AF_AX25 3  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_IPX 4  
-#define AF_APPLETALK 5  
-#define AF_NETROM 6  
-#define AF_BRIDGE 7  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_ATMPVC 8  
-#define AF_X25 9  
-#define AF_INET6 10  
-#define AF_ROSE 11  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_DECnet 12  
-#define AF_NETBEUI 13  
-#define AF_SECURITY 14  
-#define AF_KEY 15  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_NETLINK 16
-#define AF_ROUTE AF_NETLINK  
-#define AF_PACKET 17  
-#define AF_ASH 18  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_ECONET 19  
-#define AF_ATMSVC 20  
-#define AF_SNA 22  
-#define AF_IRDA 23  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_PPPOX 24  
-#define AF_WANPIPE 25  
-#define AF_LLC 26  
-#define AF_TIPC 30  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define AF_BLUETOOTH 31  
-#define AF_CAIF 38  
-#define AF_MAX 39  
-#define PF_UNSPEC AF_UNSPEC
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_UNIX AF_UNIX
-#define PF_LOCAL AF_LOCAL
-#define PF_INET AF_INET
-#define PF_AX25 AF_AX25
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_IPX AF_IPX
-#define PF_APPLETALK AF_APPLETALK
-#define PF_NETROM AF_NETROM
-#define PF_BRIDGE AF_BRIDGE
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_ATMPVC AF_ATMPVC
-#define PF_X25 AF_X25
-#define PF_INET6 AF_INET6
-#define PF_ROSE AF_ROSE
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_DECnet AF_DECnet
-#define PF_NETBEUI AF_NETBEUI
-#define PF_SECURITY AF_SECURITY
-#define PF_KEY AF_KEY
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_NETLINK AF_NETLINK
-#define PF_ROUTE AF_ROUTE
-#define PF_PACKET AF_PACKET
-#define PF_ASH AF_ASH
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_ECONET AF_ECONET
-#define PF_ATMSVC AF_ATMSVC
-#define PF_SNA AF_SNA
-#define PF_IRDA AF_IRDA
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_PPPOX AF_PPPOX
-#define PF_WANPIPE AF_WANPIPE
-#define PF_LLC AF_LLC
-#define PF_TIPC AF_TIPC
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define PF_BLUETOOTH AF_BLUETOOTH
-#define PF_CAIF AF_CAIF
-#define PF_MAX AF_MAX
-#define SOMAXCONN 128
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSG_OOB 1
-#define MSG_PEEK 2
-#define MSG_DONTROUTE 4
-#define MSG_TRYHARD 4  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSG_CTRUNC 8
-#define MSG_PROBE 0x10  
-#define MSG_TRUNC 0x20
-#define MSG_DONTWAIT 0x40  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSG_EOR 0x80  
-#define MSG_WAITALL 0x100  
-#define MSG_FIN 0x200
-#define MSG_SYN 0x400
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSG_CONFIRM 0x800  
-#define MSG_RST 0x1000
-#define MSG_ERRQUEUE 0x2000  
-#define MSG_NOSIGNAL 0x4000  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define MSG_MORE 0x8000  
-#define MSG_EOF MSG_FIN
-#define MSG_CMSG_COMPAT 0  
-#define SOL_IP 0
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_TCP 6
-#define SOL_UDP 17
-#define SOL_IPV6 41
-#define SOL_ICMPV6 58
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_SCTP 132
-#define SOL_RAW 255
-#define SOL_IPX 256
-#define SOL_AX25 257
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_ATALK 258
-#define SOL_NETROM 259
-#define SOL_ROSE 260
-#define SOL_DECNET 261
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_X25 262
-#define SOL_PACKET 263
-#define SOL_ATM 264  
-#define SOL_AAL 265  
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_IRDA 266
-#define SOL_NETBEUI 267
-#define SOL_LLC 268
-#define SOL_DCCP 269
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define SOL_NETLINK 270
-#define SOL_TIPC 271
-#define IPX_TYPE 1
-#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
 #endif
diff --git a/libc/kernel/common/linux/sw_sync.h b/libc/kernel/common/linux/sw_sync.h
index 12d062a..e1c0547 100644
--- a/libc/kernel/common/linux/sw_sync.h
+++ b/libc/kernel/common/linux/sw_sync.h
@@ -31,4 +31,3 @@
 #define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32)
 #endif
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-
diff --git a/libc/kernel/common/linux/sync.h b/libc/kernel/common/linux/sync.h
index 63c1cc8..b2c5d96 100644
--- a/libc/kernel/common/linux/sync.h
+++ b/libc/kernel/common/linux/sync.h
@@ -49,4 +49,3 @@
 #define SYNC_IOC_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_merge_data)
 #define SYNC_IOC_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2,  struct sync_fence_info_data)
 #endif
-
diff --git a/libc/kernel/common/linux/videodev2.h b/libc/kernel/common/linux/videodev2.h
index 05c2cf3..c475563 100644
--- a/libc/kernel/common/linux/videodev2.h
+++ b/libc/kernel/common/linux/videodev2.h
@@ -1951,4 +1951,3 @@
 #define BASE_VIDIOC_PRIVATE 192  
 #endif
 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-