[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/libc/glibc/glibc-2.22/socket/Makefile b/ap/libc/glibc/glibc-2.22/socket/Makefile
new file mode 100644
index 0000000..2fd9ff6
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/Makefile
@@ -0,0 +1,35 @@
+# Copyright (C) 1991-2015 Free Software Foundation, Inc.
+# This file is part of the GNU C Library.
+
+# The GNU C Library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+
+# The GNU C Library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with the GNU C Library; if not, see
+# <http://www.gnu.org/licenses/>.
+
+#
+# Sub-makefile for socket portion of the library.
+#
+subdir := socket
+
+include ../Makeconfig
+
+headers := sys/socket.h sys/un.h bits/sockaddr.h bits/socket.h \
+ bits/socket2.h sys/socketvar.h net/if.h
+
+routines := accept bind connect getpeername getsockname getsockopt \
+ listen recv recvfrom recvmsg send sendmsg sendto \
+ setsockopt shutdown socket socketpair isfdtype opensock \
+ sockatmark accept4 recvmmsg sendmmsg
+
+aux := have_sock_cloexec sa_len
+
+include ../Rules
diff --git a/ap/libc/glibc/glibc-2.22/socket/Versions b/ap/libc/glibc/glibc-2.22/socket/Versions
new file mode 100644
index 0000000..7ce6f43
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/Versions
@@ -0,0 +1,44 @@
+libc {
+ GLIBC_2.0 {
+ # functions used in other libraries
+ __connect; __send;
+
+ # a*
+ accept;
+
+ # b*
+ bind;
+
+ # c*
+ connect;
+
+ # g*
+ getpeername; getsockname; getsockopt;
+
+ # i*
+ isfdtype;
+
+ # l*
+ listen;
+
+ # r*
+ recv; recvfrom; recvmsg;
+
+ # s*
+ send; sendmsg; sendto; setsockopt; shutdown; socket; socketpair;
+ }
+ GLIBC_2.2.4 {
+ # Addition from P1003.1-200x
+ sockatmark;
+ }
+ GLIBC_2.10 {
+ accept4;
+ }
+ GLIBC_2.17 {
+ recvmmsg; sendmmsg;
+ }
+ GLIBC_PRIVATE {
+ __sendmmsg;
+ __recv; __socket;
+ }
+}
diff --git a/ap/libc/glibc/glibc-2.22/socket/accept.c b/ap/libc/glibc/glibc-2.22/socket/accept.c
new file mode 100644
index 0000000..619bee5
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/accept.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. */
+int
+accept (fd, addr, addr_len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (accept)
+
+
+stub_warning (accept)
diff --git a/ap/libc/glibc/glibc-2.22/socket/accept4.c b/ap/libc/glibc/glibc-2.22/socket/accept4.c
new file mode 100644
index 0000000..e1a6d05
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/accept4.c
@@ -0,0 +1,40 @@
+/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors. The operation can be influenced
+ by the FLAGS parameter. */
+int
+__libc_accept4 (fd, addr, addr_len, flags)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__libc_accept4, accept4)
+
+
+stub_warning (accept4)
diff --git a/ap/libc/glibc/glibc-2.22/socket/bind.c b/ap/libc/glibc/glibc-2.22/socket/bind.c
new file mode 100644
index 0000000..4dea286
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/bind.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Give the socket FD the local address ADDR (which is LEN bytes long). */
+int
+__bind (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__bind, bind)
+
+stub_warning (bind)
diff --git a/ap/libc/glibc/glibc-2.22/socket/bits/socket2.h b/ap/libc/glibc/glibc-2.22/socket/bits/socket2.h
new file mode 100644
index 0000000..18e4fbd
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/bits/socket2.h
@@ -0,0 +1,77 @@
+/* Checking macros for socket functions.
+ Copyright (C) 2005-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SOCKET_H
+# error "Never include <bits/socket2.h> directly; use <sys/socket.h> instead."
+#endif
+
+extern ssize_t __recv_chk (int __fd, void *__buf, size_t __n, size_t __buflen,
+ int __flags);
+extern ssize_t __REDIRECT (__recv_alias, (int __fd, void *__buf, size_t __n,
+ int __flags), recv);
+extern ssize_t __REDIRECT (__recv_chk_warn,
+ (int __fd, void *__buf, size_t __n, size_t __buflen,
+ int __flags), __recv_chk)
+ __warnattr ("recv called with bigger length than size of destination "
+ "buffer");
+
+__fortify_function ssize_t
+recv (int __fd, void *__buf, size_t __n, int __flags)
+{
+ if (__bos0 (__buf) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n))
+ return __recv_chk (__fd, __buf, __n, __bos0 (__buf), __flags);
+
+ if (__n > __bos0 (__buf))
+ return __recv_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags);
+ }
+ return __recv_alias (__fd, __buf, __n, __flags);
+}
+
+extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n,
+ size_t __buflen, int __flags,
+ __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+extern ssize_t __REDIRECT (__recvfrom_alias,
+ (int __fd, void *__restrict __buf, size_t __n,
+ int __flags, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len), recvfrom);
+extern ssize_t __REDIRECT (__recvfrom_chk_warn,
+ (int __fd, void *__restrict __buf, size_t __n,
+ size_t __buflen, int __flags,
+ __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len), __recvfrom_chk)
+ __warnattr ("recvfrom called with bigger length than size of "
+ "destination buffer");
+
+__fortify_function ssize_t
+recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags,
+ __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len)
+{
+ if (__bos0 (__buf) != (size_t) -1)
+ {
+ if (!__builtin_constant_p (__n))
+ return __recvfrom_chk (__fd, __buf, __n, __bos0 (__buf), __flags,
+ __addr, __addr_len);
+ if (__n > __bos0 (__buf))
+ return __recvfrom_chk_warn (__fd, __buf, __n, __bos0 (__buf), __flags,
+ __addr, __addr_len);
+ }
+ return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len);
+}
diff --git a/ap/libc/glibc/glibc-2.22/socket/connect.c b/ap/libc/glibc/glibc-2.22/socket/connect.c
new file mode 100644
index 0000000..45cee74
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/connect.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
+ For connectionless socket types, just set the default address to send to
+ and the only address from which to accept transmissions.
+ Return 0 on success, -1 for errors. */
+int
+__connect (fd, addr, len)
+ int fd;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+weak_alias (__connect, connect)
+libc_hidden_def (__connect)
+
+stub_warning (connect)
diff --git a/ap/libc/glibc/glibc-2.22/socket/getpeername.c b/ap/libc/glibc/glibc-2.22/socket/getpeername.c
new file mode 100644
index 0000000..d3425bb
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/getpeername.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the address of the peer connected to socket FD into *ADDR
+ (which is *LEN bytes long), and its actual length into *LEN. */
+int
+getpeername (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (getpeername)
diff --git a/ap/libc/glibc/glibc-2.22/socket/getsockname.c b/ap/libc/glibc/glibc-2.22/socket/getsockname.c
new file mode 100644
index 0000000..47e1838
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/getsockname.c
@@ -0,0 +1,34 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the local address of FD into *ADDR and its length in *LEN. */
+int
+__getsockname (fd, addr, len)
+ int fd;
+ __SOCKADDR_ARG addr;
+ socklen_t *len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__getsockname, getsockname)
+
+stub_warning (getsockname)
diff --git a/ap/libc/glibc/glibc-2.22/socket/getsockopt.c b/ap/libc/glibc/glibc-2.22/socket/getsockopt.c
new file mode 100644
index 0000000..73fb15e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/getsockopt.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
+ into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
+ actual length. Returns 0 on success, -1 for errors. */
+int
+getsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ void *optval;
+ socklen_t *optlen;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+stub_warning (getsockopt)
diff --git a/ap/libc/glibc/glibc-2.22/socket/have_sock_cloexec.c b/ap/libc/glibc/glibc-2.22/socket/have_sock_cloexec.c
new file mode 100644
index 0000000..c849f92
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/have_sock_cloexec.c
@@ -0,0 +1,32 @@
+/* Copyright (C) 2008-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <kernel-features.h>
+
+#if defined SOCK_CLOEXEC && !defined __ASSUME_SOCK_CLOEXEC
+int __have_sock_cloexec;
+#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_PIPE2
+int __have_pipe2;
+#endif
+
+#if defined O_CLOEXEC && !defined __ASSUME_DUP3
+int __have_dup3;
+#endif
diff --git a/ap/libc/glibc/glibc-2.22/socket/isfdtype.c b/ap/libc/glibc/glibc-2.22/socket/isfdtype.c
new file mode 100644
index 0000000..2e60b3c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/isfdtype.c
@@ -0,0 +1,29 @@
+/* isfdtype - Determine whether descriptor has given property. Stub version.
+ Copyright (C) 1996-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/stat.h>
+
+
+int
+isfdtype (int fildes, int fdtype)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (isfdtype)
diff --git a/ap/libc/glibc/glibc-2.22/socket/listen.c b/ap/libc/glibc/glibc-2.22/socket/listen.c
new file mode 100644
index 0000000..2bbdfdc
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/listen.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Prepare to accept connections on socket FD.
+ N connection requests will be queued before further requests are refused.
+ Returns 0 on success, -1 for errors. */
+int
+__listen (fd, n)
+ int fd;
+ int n;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__listen, listen)
+
+stub_warning (listen)
diff --git a/ap/libc/glibc/glibc-2.22/socket/opensock.c b/ap/libc/glibc/glibc-2.22/socket/opensock.c
new file mode 100644
index 0000000..31f247e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/opensock.c
@@ -0,0 +1,70 @@
+/* Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <stdio.h>
+#include <sys/socket.h>
+#include <bits/libc-lock.h>
+
+/* Return a socket of any type. The socket can be used in subsequent
+ ioctl calls to talk to the kernel. */
+int internal_function
+__opensock (void)
+{
+ /* Cache the last AF that worked, to avoid many redundant calls to
+ socket(). */
+ static int sock_af = -1;
+ int fd = -1;
+ __libc_lock_define_initialized (static, lock);
+
+ if (sock_af != -1)
+ {
+ fd = __socket (sock_af, SOCK_DGRAM, 0);
+ if (fd != -1)
+ return fd;
+ }
+
+ __libc_lock_lock (lock);
+
+ if (sock_af != -1)
+ fd = __socket (sock_af, SOCK_DGRAM, 0);
+
+ if (fd == -1)
+ {
+#ifdef AF_INET
+ fd = __socket (sock_af = AF_INET, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_INET6
+ if (fd < 0)
+ fd = __socket (sock_af = AF_INET6, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_IPX
+ if (fd < 0)
+ fd = __socket (sock_af = AF_IPX, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_AX25
+ if (fd < 0)
+ fd = __socket (sock_af = AF_AX25, SOCK_DGRAM, 0);
+#endif
+#ifdef AF_APPLETALK
+ if (fd < 0)
+ fd = __socket (sock_af = AF_APPLETALK, SOCK_DGRAM, 0);
+#endif
+ }
+
+ __libc_lock_unlock (lock);
+ return fd;
+}
diff --git a/ap/libc/glibc/glibc-2.22/socket/recv.c b/ap/libc/glibc/glibc-2.22/socket/recv.c
new file mode 100644
index 0000000..63a9fcb
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/recv.c
@@ -0,0 +1,36 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Read N bytes into BUF from socket FD.
+ Returns the number read or -1 for errors. */
+ssize_t
+__recv (fd, buf, n, flags)
+ int fd;
+ void *buf;
+ size_t n;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__recv)
+weak_alias (__recv, recv)
+
+stub_warning (recv)
diff --git a/ap/libc/glibc/glibc-2.22/socket/recvfrom.c b/ap/libc/glibc/glibc-2.22/socket/recvfrom.c
new file mode 100644
index 0000000..479350f
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/recvfrom.c
@@ -0,0 +1,39 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Read N bytes into BUF through socket FD from peer
+ at address ADDR (which is ADDR_LEN bytes long).
+ Returns the number read or -1 for errors. */
+ssize_t
+__recvfrom (fd, buf, n, flags, addr, addr_len)
+ int fd;
+ void *buf;
+ size_t n;
+ int flags;
+ __SOCKADDR_ARG addr;
+ socklen_t *addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__recvfrom, recvfrom)
+
+stub_warning (recvfrom)
diff --git a/ap/libc/glibc/glibc-2.22/socket/recvmmsg.c b/ap/libc/glibc/glibc-2.22/socket/recvmmsg.c
new file mode 100644
index 0000000..ea945b4
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/recvmmsg.c
@@ -0,0 +1,31 @@
+/* Receive multiple messages on a socket. Stub version.
+ Copyright (C) 2010-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
+ Returns the number of bytes read or -1 for errors. */
+int
+recvmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags,
+ struct timespec *tmo)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+stub_warning (recvmmsg)
diff --git a/ap/libc/glibc/glibc-2.22/socket/recvmsg.c b/ap/libc/glibc/glibc-2.22/socket/recvmsg.c
new file mode 100644
index 0000000..d34a435
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/recvmsg.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Receive a message as described by MESSAGE from socket FD.
+ Returns the number of bytes read or -1 for errors. */
+ssize_t
+__recvmsg (fd, message, flags)
+ int fd;
+ struct msghdr *message;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__recvmsg, recvmsg)
+
+stub_warning (recvmsg)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sa_len.c b/ap/libc/glibc/glibc-2.22/socket/sa_len.c
new file mode 100644
index 0000000..a71f017
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sa_len.c
@@ -0,0 +1,108 @@
+/* Helper for SA_LEN macro.
+ Copyright (C) 2013-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <sys/socket.h>
+
+/* If _HAVE_SA_LEN is defined, then SA_LEN just uses sockaddr.sa_len
+ and there is no need for a helper function. */
+
+#ifndef _HAVE_SA_LEN
+
+/* All configurations have at least these two headers
+ and their associated address families. */
+
+# include <netinet/in.h>
+# include <sys/un.h>
+
+/* More-specific sa_len.c files #define these various HAVE_*_H
+ macros and then #include this file. */
+
+# ifdef HAVE_NETASH_ASH_H
+# include <netash/ash.h>
+# endif
+# ifdef HAVE_NETATALK_AT_H
+# include <netatalk/at.h>
+# endif
+# ifdef HAVE_NETAX25_AX25_H
+# include <netax25/ax25.h>
+# endif
+# ifdef HAVE_NETECONET_EC_H
+# include <neteconet/ec.h>
+# endif
+# ifdef HAVE_NETIPX_IPX_H
+# include <netipx/ipx.h>
+# endif
+# ifdef HAVE_NETPACKET_PACKET_H
+# include <netpacket/packet.h>
+# endif
+# ifdef HAVE_NETROSE_ROSE_H
+# include <netrose/rose.h>
+# endif
+# ifdef HAVE_NETIUCV_IUCV_H
+# include <netiucv/iucv.h>
+# endif
+
+int
+__libc_sa_len (sa_family_t af)
+{
+ switch (af)
+ {
+# ifdef HAVE_NETATALK_AT_H
+ case AF_APPLETALK:
+ return sizeof (struct sockaddr_at);
+# endif
+# ifdef HAVE_NETASH_ASH_H
+ case AF_ASH:
+ return sizeof (struct sockaddr_ash);
+# endif
+# ifdef HAVE_NETAX25_AX25_H
+ case AF_AX25:
+ return sizeof (struct sockaddr_ax25);
+# endif
+# ifdef HAVE_NETECONET_EC_H
+ case AF_ECONET:
+ return sizeof (struct sockaddr_ec);
+# endif
+ case AF_INET:
+ return sizeof (struct sockaddr_in);
+ case AF_INET6:
+ return sizeof (struct sockaddr_in6);
+# ifdef HAVE_NETIPX_IPX_H
+ case AF_IPX:
+ return sizeof (struct sockaddr_ipx);
+# endif
+# ifdef HAVE_NETIUCV_IUCV_H
+ case AF_IUCV:
+ return sizeof (struct sockaddr_iucv);
+# endif
+ case AF_LOCAL:
+ return sizeof (struct sockaddr_un);
+# ifdef HAVE_NETPACKET_PACKET_H
+ case AF_PACKET:
+ return sizeof (struct sockaddr_ll);
+# endif
+# ifdef HAVE_NETROSE_ROSE_H
+ case AF_ROSE:
+ return sizeof (struct sockaddr_rose);
+# endif
+ }
+ return 0;
+}
+libc_hidden_def (__libc_sa_len)
+
+#endif /* Not _HAVE_SA_LEN. */
diff --git a/ap/libc/glibc/glibc-2.22/socket/send.c b/ap/libc/glibc/glibc-2.22/socket/send.c
new file mode 100644
index 0000000..4ecb332
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/send.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
+ssize_t
+__send (fd, buf, n, flags)
+ int fd;
+ const __ptr_t buf;
+ size_t n;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__send)
+weak_alias (__send, send)
+
+stub_warning (send)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sendmmsg.c b/ap/libc/glibc/glibc-2.22/socket/sendmmsg.c
new file mode 100644
index 0000000..6435e3c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sendmmsg.c
@@ -0,0 +1,32 @@
+/* Send multiple messages on a socket. Stub version.
+ Copyright (C) 2011-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send a VLEN messages as described by VMESSAGES to socket FD.
+ Returns the number of datagrams successfully written or -1 for errors. */
+int
+__sendmmsg (int fd, struct mmsghdr *vmessages, unsigned int vlen, int flags)
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+libc_hidden_def (__sendmmsg)
+weak_alias (__sendmmsg, sendmmsg)
+stub_warning (sendmmsg)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sendmsg.c b/ap/libc/glibc/glibc-2.22/socket/sendmsg.c
new file mode 100644
index 0000000..586f598
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sendmsg.c
@@ -0,0 +1,35 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send a message described MESSAGE on socket FD.
+ Returns the number of bytes sent, or -1 for errors. */
+ssize_t
+__sendmsg (fd, message, flags)
+ int fd;
+ const struct msghdr *message;
+ int flags;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sendmsg, sendmsg)
+
+stub_warning (sendmsg)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sendto.c b/ap/libc/glibc/glibc-2.22/socket/sendto.c
new file mode 100644
index 0000000..de2e523
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sendto.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
+ ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
+ssize_t
+__sendto (fd, buf, n, flags, addr, addr_len)
+ int fd;
+ const __ptr_t buf;
+ size_t n;
+ int flags;
+ __CONST_SOCKADDR_ARG addr;
+ socklen_t addr_len;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__sendto, sendto)
+
+stub_warning (sendto)
diff --git a/ap/libc/glibc/glibc-2.22/socket/setsockopt.c b/ap/libc/glibc/glibc-2.22/socket/setsockopt.c
new file mode 100644
index 0000000..cf36f1c
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/setsockopt.c
@@ -0,0 +1,38 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+ to *OPTVAL (which is OPTLEN bytes long).
+ Returns 0 on success, -1 for errors. */
+int
+__setsockopt (fd, level, optname, optval, optlen)
+ int fd;
+ int level;
+ int optname;
+ const __ptr_t optval;
+ socklen_t optlen;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+weak_alias (__setsockopt, setsockopt)
+
+stub_warning (setsockopt)
diff --git a/ap/libc/glibc/glibc-2.22/socket/shutdown.c b/ap/libc/glibc/glibc-2.22/socket/shutdown.c
new file mode 100644
index 0000000..ea5f7b3
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/shutdown.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Shut down all or part of the connection open on socket FD.
+ HOW determines what to shut down:
+ 0 = No more receptions;
+ 1 = No more transmissions;
+ 2 = No more receptions or transmissions.
+ Returns 0 on success, -1 for errors. */
+int
+shutdown (fd, how)
+ int fd;
+ int how;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (shutdown)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sockatmark.c b/ap/libc/glibc/glibc-2.22/socket/sockatmark.c
new file mode 100644
index 0000000..6ff6d01
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sockatmark.c
@@ -0,0 +1,31 @@
+/* Copyright (C) 2001-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Determine wheter socket is at a out-of-band mark. */
+int
+sockatmark (fd)
+ int fd;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (sockatmark)
diff --git a/ap/libc/glibc/glibc-2.22/socket/socket.c b/ap/libc/glibc/glibc-2.22/socket/socket.c
new file mode 100644
index 0000000..9fe8fd9
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/socket.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Create a new socket of type TYPE in domain DOMAIN, using
+ protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
+ Returns a file descriptor for the new socket, or -1 for errors. */
+int
+__socket (domain, type, protocol)
+ int domain;
+ int type;
+ int protocol;
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+libc_hidden_def (__socket)
+weak_alias (__socket, socket)
+stub_warning (socket)
diff --git a/ap/libc/glibc/glibc-2.22/socket/socketpair.c b/ap/libc/glibc/glibc-2.22/socket/socketpair.c
new file mode 100644
index 0000000..e0948f0
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/socketpair.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#include <errno.h>
+#include <sys/socket.h>
+
+/* Create two new sockets, of type TYPE in domain DOMAIN and using
+ protocol PROTOCOL, which are connected to each other, and put file
+ descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
+ one will be chosen automatically. Returns 0 on success, -1 for errors. */
+int
+socketpair (domain, type, protocol, fds)
+ int domain;
+ int type;
+ int protocol;
+ int fds[2];
+{
+ __set_errno (ENOSYS);
+ return -1;
+}
+
+
+stub_warning (socketpair)
diff --git a/ap/libc/glibc/glibc-2.22/socket/sys/socket.h b/ap/libc/glibc/glibc-2.22/socket/sys/socket.h
new file mode 100644
index 0000000..affc29e
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sys/socket.h
@@ -0,0 +1,285 @@
+/* Declarations of socket constants, types, and functions.
+ Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_SOCKET_H
+#define _SYS_SOCKET_H 1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+#include <sys/uio.h>
+#define __need_size_t
+#include <stddef.h>
+#ifdef __USE_GNU
+/* Get the __sigset_t definition. */
+# include <bits/sigset.h>
+#endif
+
+
+/* This operating system-specific header file defines the SOCK_*, PF_*,
+ AF_*, MSG_*, SOL_*, and SO_* constants, and the `struct sockaddr',
+ `struct msghdr', and `struct linger' types. */
+#include <bits/socket.h>
+
+#ifdef __USE_MISC
+/* This is the 4.3 BSD `struct sockaddr' format, which is used as wire
+ format in the grotty old 4.3 `talk' protocol. */
+struct osockaddr
+ {
+ unsigned short int sa_family;
+ unsigned char sa_data[14];
+ };
+#endif
+
+/* The following constants should be used for the second parameter of
+ `shutdown'. */
+enum
+{
+ SHUT_RD = 0, /* No more receptions. */
+#define SHUT_RD SHUT_RD
+ SHUT_WR, /* No more transmissions. */
+#define SHUT_WR SHUT_WR
+ SHUT_RDWR /* No more receptions or transmissions. */
+#define SHUT_RDWR SHUT_RDWR
+};
+
+/* This is the type we use for generic socket address arguments.
+
+ With GCC 2.7 and later, the funky union causes redeclarations or
+ uses with any of the listed types to be allowed without complaint.
+ G++ 2.7 does not support transparent unions so there we want the
+ old-style declaration, too. */
+#if defined __cplusplus || !__GNUC_PREREQ (2, 7) || !defined __USE_GNU
+# define __SOCKADDR_ARG struct sockaddr *__restrict
+# define __CONST_SOCKADDR_ARG const struct sockaddr *
+#else
+/* Add more `struct sockaddr_AF' types here as necessary.
+ These are all the ones I found on NetBSD and Linux. */
+# define __SOCKADDR_ALLTYPES \
+ __SOCKADDR_ONETYPE (sockaddr) \
+ __SOCKADDR_ONETYPE (sockaddr_at) \
+ __SOCKADDR_ONETYPE (sockaddr_ax25) \
+ __SOCKADDR_ONETYPE (sockaddr_dl) \
+ __SOCKADDR_ONETYPE (sockaddr_eon) \
+ __SOCKADDR_ONETYPE (sockaddr_in) \
+ __SOCKADDR_ONETYPE (sockaddr_in6) \
+ __SOCKADDR_ONETYPE (sockaddr_inarp) \
+ __SOCKADDR_ONETYPE (sockaddr_ipx) \
+ __SOCKADDR_ONETYPE (sockaddr_iso) \
+ __SOCKADDR_ONETYPE (sockaddr_ns) \
+ __SOCKADDR_ONETYPE (sockaddr_un) \
+ __SOCKADDR_ONETYPE (sockaddr_x25)
+
+# define __SOCKADDR_ONETYPE(type) struct type *__restrict __##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+ } __SOCKADDR_ARG __attribute__ ((__transparent_union__));
+# undef __SOCKADDR_ONETYPE
+# define __SOCKADDR_ONETYPE(type) const struct type *__restrict __##type##__;
+typedef union { __SOCKADDR_ALLTYPES
+ } __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
+# undef __SOCKADDR_ONETYPE
+#endif
+
+#ifdef __USE_GNU
+/* For `recvmmsg' and `sendmmsg'. */
+struct mmsghdr
+ {
+ struct msghdr msg_hdr; /* Actual message header. */
+ unsigned int msg_len; /* Number of received or sent bytes for the
+ entry. */
+ };
+#endif
+
+
+/* Create a new socket of type TYPE in domain DOMAIN, using
+ protocol PROTOCOL. If PROTOCOL is zero, one is chosen automatically.
+ Returns a file descriptor for the new socket, or -1 for errors. */
+extern int socket (int __domain, int __type, int __protocol) __THROW;
+
+/* Create two new sockets, of type TYPE in domain DOMAIN and using
+ protocol PROTOCOL, which are connected to each other, and put file
+ descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
+ one will be chosen automatically. Returns 0 on success, -1 for errors. */
+extern int socketpair (int __domain, int __type, int __protocol,
+ int __fds[2]) __THROW;
+
+/* Give the socket FD the local address ADDR (which is LEN bytes long). */
+extern int bind (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len)
+ __THROW;
+
+/* Put the local address of FD into *ADDR and its length in *LEN. */
+extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __len) __THROW;
+
+/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
+ For connectionless socket types, just set the default address to send to
+ and the only address from which to accept transmissions.
+ Return 0 on success, -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int connect (int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len);
+
+/* Put the address of the peer connected to socket FD into *ADDR
+ (which is *LEN bytes long), and its actual length into *LEN. */
+extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __len) __THROW;
+
+
+/* Send N bytes of BUF to socket FD. Returns the number sent or -1.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t send (int __fd, const void *__buf, size_t __n, int __flags);
+
+/* Read N bytes into BUF from socket FD.
+ Returns the number read or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t recv (int __fd, void *__buf, size_t __n, int __flags);
+
+/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
+ ADDR_LEN bytes long). Returns the number sent, or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t sendto (int __fd, const void *__buf, size_t __n,
+ int __flags, __CONST_SOCKADDR_ARG __addr,
+ socklen_t __addr_len);
+
+/* Read N bytes into BUF through socket FD.
+ If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
+ the sender, and store the actual size of the address in *ADDR_LEN.
+ Returns the number of bytes read or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
+ int __flags, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+
+
+/* Send a message described MESSAGE on socket FD.
+ Returns the number of bytes sent, or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t sendmsg (int __fd, const struct msghdr *__message,
+ int __flags);
+
+#ifdef __USE_GNU
+/* Send a VLEN messages as described by VMESSAGES to socket FD.
+ Returns the number of datagrams successfully written or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int sendmmsg (int __fd, struct mmsghdr *__vmessages,
+ unsigned int __vlen, int __flags);
+#endif
+
+/* Receive a message as described by MESSAGE from socket FD.
+ Returns the number of bytes read or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags);
+
+#ifdef __USE_GNU
+/* Receive up to VLEN messages as described by VMESSAGES from socket FD.
+ Returns the number of messages received or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int recvmmsg (int __fd, struct mmsghdr *__vmessages,
+ unsigned int __vlen, int __flags,
+ struct timespec *__tmo);
+#endif
+
+
+/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
+ into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
+ actual length. Returns 0 on success, -1 for errors. */
+extern int getsockopt (int __fd, int __level, int __optname,
+ void *__restrict __optval,
+ socklen_t *__restrict __optlen) __THROW;
+
+/* Set socket FD's option OPTNAME at protocol level LEVEL
+ to *OPTVAL (which is OPTLEN bytes long).
+ Returns 0 on success, -1 for errors. */
+extern int setsockopt (int __fd, int __level, int __optname,
+ const void *__optval, socklen_t __optlen) __THROW;
+
+
+/* Prepare to accept connections on socket FD.
+ N connection requests will be queued before further requests are refused.
+ Returns 0 on success, -1 for errors. */
+extern int listen (int __fd, int __n) __THROW;
+
+/* Await a connection on socket FD.
+ When a connection arrives, open a new socket to communicate with it,
+ set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
+ peer and *ADDR_LEN to the address's actual length, and return the
+ new socket's descriptor, or -1 for errors.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int accept (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len);
+
+#ifdef __USE_GNU
+/* Similar to 'accept' but takes an additional parameter to specify flags.
+
+ This function is a cancellation point and therefore not marked with
+ __THROW. */
+extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
+ socklen_t *__restrict __addr_len, int __flags);
+#endif
+
+/* Shut down all or part of the connection open on socket FD.
+ HOW determines what to shut down:
+ SHUT_RD = No more receptions;
+ SHUT_WR = No more transmissions;
+ SHUT_RDWR = No more receptions or transmissions.
+ Returns 0 on success, -1 for errors. */
+extern int shutdown (int __fd, int __how) __THROW;
+
+
+#ifdef __USE_XOPEN2K
+/* Determine wheter socket is at a out-of-band mark. */
+extern int sockatmark (int __fd) __THROW;
+#endif
+
+
+#ifdef __USE_MISC
+/* FDTYPE is S_IFSOCK or another S_IF* macro defined in <sys/stat.h>;
+ returns 1 if FD is open on an object of the indicated type, 0 if not,
+ or -1 for errors (setting errno). */
+extern int isfdtype (int __fd, int __fdtype) __THROW;
+#endif
+
+
+/* Define some macros helping to catch buffer overflows. */
+#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
+# include <bits/socket2.h>
+#endif
+
+__END_DECLS
+
+#endif /* sys/socket.h */
diff --git a/ap/libc/glibc/glibc-2.22/socket/sys/un.h b/ap/libc/glibc/glibc-2.22/socket/sys/un.h
new file mode 100644
index 0000000..0059570
--- /dev/null
+++ b/ap/libc/glibc/glibc-2.22/socket/sys/un.h
@@ -0,0 +1,46 @@
+/* Copyright (C) 1991-2015 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _SYS_UN_H
+#define _SYS_UN_H 1
+
+#include <sys/cdefs.h>
+
+/* Get the definition of the macro to define the common sockaddr members. */
+#include <bits/sockaddr.h>
+
+__BEGIN_DECLS
+
+/* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */
+struct sockaddr_un
+ {
+ __SOCKADDR_COMMON (sun_);
+ char sun_path[108]; /* Path name. */
+ };
+
+
+#ifdef __USE_MISC
+# include <string.h> /* For prototype of `strlen'. */
+
+/* Evaluate to actual length of the `sockaddr_un' structure. */
+# define SUN_LEN(ptr) ((size_t) (((struct sockaddr_un *) 0)->sun_path) \
+ + strlen ((ptr)->sun_path))
+#endif
+
+__END_DECLS
+
+#endif /* sys/un.h */