Merge "Add the libcutils localtime_tz and mktime_t extensions to bionic."
diff --git a/libc/Android.mk b/libc/Android.mk
index c3759db..6a77deb 100644
--- a/libc/Android.mk
+++ b/libc/Android.mk
@@ -61,7 +61,6 @@
unistd/sigwait.c \
unistd/sleep.c \
unistd/statfs.c \
- unistd/strsignal.c \
unistd/syslog.c \
unistd/system.c \
unistd/tcgetpgrp.c \
@@ -191,8 +190,6 @@
string/strcoll.c \
string/strcspn.c \
string/strdup.c \
- string/strerror.c \
- string/strerror_r.c \
string/strlcat.c \
string/strlcpy.c \
string/strncat.c \
@@ -291,6 +288,9 @@
bionic/sched_cpucount.c \
bionic/semaphore.c \
bionic/sha1.c \
+ bionic/strerror.cpp \
+ bionic/strerror_r.cpp \
+ bionic/strsignal.cpp \
bionic/stubs.cpp \
bionic/system_properties.c \
bionic/tdestroy.c \
@@ -331,7 +331,10 @@
libc_upstream_netbsd_src_files := \
upstream-netbsd/libc/compat-43/creat.c \
+ upstream-netbsd/libc/gen/ftw.c \
+ upstream-netbsd/libc/gen/nftw.c \
upstream-netbsd/libc/gen/nice.c \
+ upstream-netbsd/libc/gen/psignal.c \
upstream-netbsd/libc/regex/regcomp.c \
upstream-netbsd/libc/regex/regerror.c \
upstream-netbsd/libc/regex/regexec.c \
@@ -916,7 +919,7 @@
LOCAL_MODULE:= libc_malloc_debug_leak
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_SHARED_LIBRARIES := libc
+LOCAL_SHARED_LIBRARIES := libc libdl
LOCAL_WHOLE_STATIC_LIBRARIES := libc_common
LOCAL_SYSTEM_SHARED_LIBRARIES :=
LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
diff --git a/libc/NOTICE b/libc/NOTICE
index 8bf4978..299f672 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -3421,6 +3421,26 @@
-------------------------------------------------------------------
+Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies.
+
+THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Sponsored in part by the Defense Advanced Research Projects
+Agency (DARPA) and Air Force Research Laboratory, Air Force
+Materiel Command, USAF, under agreement number F39502-99-1-0512.
+
+-------------------------------------------------------------------
+
Copyright (c) 2004 The NetBSD Foundation, Inc.
All rights reserved.
@@ -3931,6 +3951,34 @@
-------------------------------------------------------------------
+Copyright (c) 2012 The Android Open Source Project
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+-------------------------------------------------------------------
+
Copyright (c)1999 Citrus Project,
All rights reserved.
diff --git a/libc/arch-mips/bionic/pipe.S b/libc/arch-mips/bionic/pipe.S
index 8556569..0baf246 100644
--- a/libc/arch-mips/bionic/pipe.S
+++ b/libc/arch-mips/bionic/pipe.S
@@ -26,6 +26,12 @@
* SUCH DAMAGE.
*/
+/*
+ * The MIPS pipe syscall returns results in two registers, which
+ * we have to copy into the supplied array. This prevents us from
+ * using an auto-generated stub.
+ */
+
#include <asm/unistd.h>
.text
@@ -38,12 +44,17 @@
.ent pipe
pipe:
.set noreorder
-
+ .cpload $t9
li $v0,__NR_pipe
syscall /* syscall returns results in v0,v1 */
-
- sw $v0,0($a0)
- sw $v1,4($a0)
+ bnez $a3, 1f /* check errno */
+ nop
+ sw $v0, 0($a0)
+ sw $v1, 4($a0)
j $ra
- move $v0,$zero
+ move $v0, $zero
+1:
+ la $t9, __set_errno
+ j $t9
+ move $a0, $v0 /* delay slot, prepare args for __set_errno */
.end pipe
diff --git a/libc/bionic/ThreadLocalBuffer.h b/libc/bionic/ThreadLocalBuffer.h
new file mode 100644
index 0000000..99acdba
--- /dev/null
+++ b/libc/bionic/ThreadLocalBuffer.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _BIONIC_THREAD_LOCAL_BUFFER_H_included
+#define _BIONIC_THREAD_LOCAL_BUFFER_H_included
+
+#include <malloc.h>
+#include <pthread.h>
+
+// libstdc++ currently contains __cxa_guard_acquire and __cxa_guard_release,
+// so we make do with macros instead of a C++ class.
+// TODO: move __cxa_guard_acquire and __cxa_guard_release into libc.
+
+#define GLOBAL_INIT_THREAD_LOCAL_BUFFER(name) \
+ static pthread_once_t name ## _once; \
+ static pthread_key_t name ## _key; \
+ static void name ## _key_destroy(void* buffer) { \
+ free(buffer); \
+ } \
+ static void name ## _key_init() { \
+ pthread_key_create(&name ## _key, name ## _key_destroy); \
+ }
+
+// Leaves "name_buffer" and "name_byte_count" defined and initialized.
+#define LOCAL_INIT_THREAD_LOCAL_BUFFER(type, name, byte_count) \
+ pthread_once(&name ## _once, name ## _key_init); \
+ type name ## _buffer = reinterpret_cast<type>(pthread_getspecific(name ## _key)); \
+ if (name ## _buffer == NULL) { \
+ name ## _buffer = reinterpret_cast<type>(malloc(byte_count)); \
+ pthread_setspecific(name ## _key, name ## _buffer); \
+ } \
+ const size_t name ## _buffer_size = byte_count
+
+#endif // _BIONIC_THREAD_LOCAL_BUFFER_H_included
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 14d2fec..da3a551 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -205,6 +205,8 @@
pthread_exit((void*) result);
}
+#include <private/logd.h>
+
__LIBC_ABI_PRIVATE__
int _init_thread(pthread_internal_t* thread, pid_t kernel_id, pthread_attr_t* attr,
void* stack_base, bool add_to_thread_list)
@@ -229,7 +231,9 @@
struct sched_param param;
param.sched_priority = thread->attr.sched_priority;
if (sched_setscheduler(kernel_id, thread->attr.sched_policy, ¶m) == -1) {
- error = errno;
+ // For back compat reasons, we just warn about possible invalid sched_policy
+ const char* msg = "pthread_create sched_setscheduler call failed: %s\n";
+ __libc_android_log_print(ANDROID_LOG_WARN, "libc", msg, strerror(errno));
}
}
diff --git a/libc/unistd/strsignal.c b/libc/bionic/strerror.cpp
similarity index 70%
rename from libc/unistd/strsignal.c
rename to libc/bionic/strerror.cpp
index 171de3d..455dc52 100644
--- a/libc/unistd/strsignal.c
+++ b/libc/bionic/strerror.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,14 +25,22 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <signal.h>
-#include <string.h>
-char*
-strsignal(int sig)
-{
- if ((unsigned)sig < NSIG)
- return (char*) sys_siglist[sig];
- else
- return "Invalid signal number";
+#include <string.h>
+#include "ThreadLocalBuffer.h"
+
+extern "C" const char* __strerror_lookup(int);
+
+GLOBAL_INIT_THREAD_LOCAL_BUFFER(strerror);
+
+char* strerror(int error_number) {
+ // Just return the original constant in the easy cases.
+ char* result = const_cast<char*>(__strerror_lookup(error_number));
+ if (result != NULL) {
+ return result;
+ }
+
+ LOCAL_INIT_THREAD_LOCAL_BUFFER(char*, strerror, NL_TEXTMAX);
+ strerror_r(error_number, strerror_buffer, strerror_buffer_size);
+ return strerror_buffer;
}
diff --git a/libc/bionic/strerror_r.cpp b/libc/bionic/strerror_r.cpp
new file mode 100644
index 0000000..e6a3975
--- /dev/null
+++ b/libc/bionic/strerror_r.cpp
@@ -0,0 +1,79 @@
+/* $OpenBSD: strerror_r.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */
+/* Public Domain <marc@snafu.org> */
+
+#include <errno.h>
+#include <limits.h>
+#include <signal.h>
+#include <stdio.h>
+#include <string.h>
+
+struct Pair {
+ int code;
+ const char* msg;
+};
+
+static const char* __code_string_lookup(const Pair* strings, int code) {
+ for (size_t i = 0; strings[i].msg != NULL; ++i) {
+ if (strings[i].code == code) {
+ return strings[i].msg;
+ }
+ }
+ return NULL;
+}
+
+static const Pair _sys_error_strings[] = {
+#define __BIONIC_ERRDEF(x,y,z) { x, z },
+#include <sys/_errdefs.h>
+ { 0, NULL }
+};
+
+extern "C" __LIBC_HIDDEN__ const char* __strerror_lookup(int error_number) {
+ return __code_string_lookup(_sys_error_strings, error_number);
+}
+
+static const Pair _sys_signal_strings[] = {
+#define __BIONIC_SIGDEF(x,y,z) { y, z },
+#include <sys/_sigdefs.h>
+ { 0, NULL }
+};
+
+extern "C" __LIBC_HIDDEN__ const char* __strsignal_lookup(int signal_number) {
+ return __code_string_lookup(_sys_signal_strings, signal_number);
+}
+
+int strerror_r(int error_number, char* buf, size_t buf_len) {
+ int saved_errno = errno;
+ size_t length;
+
+ const char* error_name = __strerror_lookup(error_number);
+ if (error_name != NULL) {
+ length = snprintf(buf, buf_len, "%s", error_name);
+ } else {
+ length = snprintf(buf, buf_len, "Unknown error %u", error_number);
+ }
+ if (length >= buf_len) {
+ errno = ERANGE;
+ return -1;
+ }
+
+ errno = saved_errno;
+ return 0;
+}
+
+extern "C" __LIBC_HIDDEN__ const char* __strsignal(int signal_number, char* buf, size_t buf_len) {
+ const char* signal_name = __strsignal_lookup(signal_number);
+ if (signal_name != NULL) {
+ return signal_name;
+ }
+
+ const char* prefix = "Unknown";
+ if (signal_number >= SIGRTMIN && signal_number <= SIGRTMAX) {
+ prefix = "Real-time";
+ signal_number -= SIGRTMIN;
+ }
+ size_t length = snprintf(buf, buf_len, "%s signal %d", prefix, signal_number);
+ if (length >= buf_len) {
+ return NULL;
+ }
+ return buf;
+}
diff --git a/libc/unistd/strsignal.c b/libc/bionic/strsignal.cpp
similarity index 68%
copy from libc/unistd/strsignal.c
copy to libc/bionic/strsignal.cpp
index 171de3d..9b046d4 100644
--- a/libc/unistd/strsignal.c
+++ b/libc/bionic/strsignal.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2008 The Android Open Source Project
+ * Copyright (C) 2012 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,14 +25,22 @@
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
-#include <signal.h>
-#include <string.h>
-char*
-strsignal(int sig)
-{
- if ((unsigned)sig < NSIG)
- return (char*) sys_siglist[sig];
- else
- return "Invalid signal number";
+#include <string.h>
+#include "ThreadLocalBuffer.h"
+
+extern "C" const char* __strsignal_lookup(int);
+extern "C" const char* __strsignal(int, char*, size_t);
+
+GLOBAL_INIT_THREAD_LOCAL_BUFFER(strsignal);
+
+char* strsignal(int signal_number) {
+ // Just return the original constant in the easy cases.
+ char* result = const_cast<char*>(__strsignal_lookup(signal_number));
+ if (result != NULL) {
+ return result;
+ }
+
+ LOCAL_INIT_THREAD_LOCAL_BUFFER(char*, strsignal, NL_TEXTMAX);
+ return const_cast<char*>(__strsignal(signal_number, strsignal_buffer, strsignal_buffer_size));
}
diff --git a/libc/bionic/stubs.cpp b/libc/bionic/stubs.cpp
index a539b34..1cab7d3 100644
--- a/libc/bionic/stubs.cpp
+++ b/libc/bionic/stubs.cpp
@@ -264,25 +264,30 @@
return (unsigned)(appid + userid*AID_USER);
}
-static void print_app_uid_name(uid_t uid, char* buffer, int bufferlen) {
- uid_t appid = uid % AID_USER;
- uid_t userid = uid / AID_USER;
-
- if (appid < AID_ISOLATED_START) {
- if (appid < AID_APP) {
- for (size_t n = 0; n < android_id_count; n++) {
- if (android_ids[n].aid == appid) {
- snprintf(buffer, bufferlen, "u%u_%s", userid, android_ids[n].name);
- return;
- }
+static void print_app_name_from_appid_userid(const uid_t appid,
+ const uid_t userid, char* buffer, const int bufferlen) {
+ if (appid >= AID_ISOLATED_START) {
+ snprintf(buffer, bufferlen, "u%u_i%u", userid, appid - AID_ISOLATED_START);
+ } else if (userid == 0 && appid >= AID_SHARED_GID_START) {
+ snprintf(buffer, bufferlen, "all_a%u", appid - AID_SHARED_GID_START);
+ } else if (appid < AID_APP) {
+ for (size_t n = 0; n < android_id_count; n++) {
+ if (android_ids[n].aid == appid) {
+ snprintf(buffer, bufferlen, "u%u_%s", userid, android_ids[n].name);
+ return;
}
}
- snprintf(buffer, bufferlen, "u%u_a%u", userid, appid - AID_APP);
} else {
- snprintf(buffer, bufferlen, "u%u_i%u", userid, appid - AID_ISOLATED_START);
+ snprintf(buffer, bufferlen, "u%u_a%u", userid, appid - AID_APP);
}
}
+static void print_app_name_from_uid(const uid_t uid, char* buffer, const int bufferlen) {
+ const uid_t appid = uid % AID_USER;
+ const uid_t userid = uid / AID_USER;
+ return print_app_name_from_appid_userid(appid, userid, buffer, bufferlen);
+}
+
// Translate a uid into the corresponding name.
// 0 to AID_APP-1 -> "system", "radio", etc.
// AID_APP to AID_ISOLATED_START-1 -> u0_a1234
@@ -297,10 +302,18 @@
return NULL;
}
- print_app_uid_name(uid, state->app_name_buffer_,
- sizeof(state->app_name_buffer_));
+ const uid_t appid = uid % AID_USER;
+ const uid_t userid = uid / AID_USER;
- snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/data");
+ print_app_name_from_appid_userid(appid, userid, state->app_name_buffer_,
+ sizeof(state->app_name_buffer_));
+
+ if (appid < AID_APP) {
+ snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/");
+ } else {
+ snprintf(state->dir_buffer_, sizeof(state->dir_buffer_), "/data");
+ }
+
snprintf(state->sh_buffer_, sizeof(state->sh_buffer_), "/system/bin/sh");
pw->pw_name = state->app_name_buffer_;
@@ -320,8 +333,8 @@
return NULL;
}
- print_app_uid_name(gid, state->group_name_buffer_,
- sizeof(state->group_name_buffer_));
+ print_app_name_from_uid(gid, state->group_name_buffer_,
+ sizeof(state->group_name_buffer_));
group* gr = &state->group_;
gr->gr_name = state->group_name_buffer_;
diff --git a/libc/include/ftw.h b/libc/include/ftw.h
new file mode 100644
index 0000000..3bebea3
--- /dev/null
+++ b/libc/include/ftw.h
@@ -0,0 +1,62 @@
+/* $NetBSD: ftw.h,v 1.1 2005/12/30 23:07:33 agc Exp $ */
+
+/* From OpenBSD: ftw.h,v 1.1 2003/07/21 21:13:18 millert Exp */
+
+/*
+ * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
+#ifndef _FTW_H
+#define _FTW_H
+
+#include <sys/types.h>
+#include <sys/stat.h>
+
+/*
+ * Valid flags for the 3rd argument to the function that is passed as the
+ * second argument to ftw(3) and nftw(3). Say it three times fast!
+ */
+#define FTW_F 0 /* File. */
+#define FTW_D 1 /* Directory. */
+#define FTW_DNR 2 /* Directory without read permission. */
+#define FTW_DP 3 /* Directory with subdirectories visited. */
+#define FTW_NS 4 /* Unknown type; stat() failed. */
+#define FTW_SL 5 /* Symbolic link. */
+#define FTW_SLN 6 /* Sym link that names a nonexistent file. */
+
+/*
+ * Flags for use as the 4th argument to nftw(3). These may be ORed together.
+ */
+#define FTW_PHYS 0x01 /* Physical walk, don't follow sym links. */
+#define FTW_MOUNT 0x02 /* The walk does not cross a mount point. */
+#define FTW_DEPTH 0x04 /* Subdirs visited before the dir itself. */
+#define FTW_CHDIR 0x08 /* Change to a directory before reading it. */
+
+struct FTW {
+ int base;
+ int level;
+};
+
+__BEGIN_DECLS
+int ftw(const char *, int (*)(const char *, const struct stat *, int), int);
+int nftw(const char *, int (*)(const char *, const struct stat *, int,
+ struct FTW *), int, int);
+__END_DECLS
+
+#endif /* !_FTW_H */
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/signal.h b/libc/include/signal.h
index 91c3b00..6432c18 100644
--- a/libc/include/signal.h
+++ b/libc/include/signal.h
@@ -125,6 +125,8 @@
extern int killpg(int pgrp, int sig);
extern int sigaltstack(const stack_t *ss, stack_t *oss);
+extern void psiginfo(const siginfo_t* si, const char* message);
+extern void psignal(int signal_number, const char* message);
__END_DECLS
diff --git a/libc/include/sys/klog.h b/libc/include/sys/klog.h
index 21bb7d9..02851d2 100644
--- a/libc/include/sys/klog.h
+++ b/libc/include/sys/klog.h
@@ -32,17 +32,25 @@
__BEGIN_DECLS
-#define KLOG_CLOSE 0
-#define KLOG_OPEN 1
-#define KLOG_READ 2
-#define KLOG_READ_ALL 3
-#define KLOG_READ_CLEAR 4
-#define KLOG_CLEAR 5
-#define KLOG_DISABLE 6
-#define KLOG_ENABLE 7
-#define KLOG_SETLEVEL 8
+/* These correspond to the kernel's SYSLOG_ACTION_whatever constants. */
+#define KLOG_CLOSE 0
+#define KLOG_OPEN 1
+#define KLOG_READ 2
+#define KLOG_READ_ALL 3
+#define KLOG_READ_CLEAR 4
+#define KLOG_CLEAR 5
+#define KLOG_CONSOLE_OFF 6
+#define KLOG_CONSOLE_ON 7
+#define KLOG_CONSOLE_LEVEL 8
+#define KLOG_SIZE_UNREAD 9
+#define KLOG_SIZE_BUFFER 10
+
+/* These are deprecated names that were used in earlier bionic releases. Do not use. */
+#define KLOG_DISABLE 6
+#define KLOG_ENABLE 7
+#define KLOG_SETLEVEL 8
#define KLOG_UNREADSIZE 9
-#define KLOG_WRITE 10
+#define KLOG_WRITE 10
extern int klogctl(int, char *, int);
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/include/sys/ttydefaults.h b/libc/include/sys/ttydefaults.h
new file mode 100644
index 0000000..405e759
--- /dev/null
+++ b/libc/include/sys/ttydefaults.h
@@ -0,0 +1,115 @@
+/* $NetBSD: ttydefaults.h,v 1.16 2008/05/24 14:06:39 yamt Exp $ */
+
+/*-
+ * Copyright (c) 1982, 1986, 1993
+ * The Regents of the University of California. All rights reserved.
+ * (c) UNIX System Laboratories, Inc.
+ * All or some portions of this file are derived from material licensed
+ * to the University of California by American Telephone and Telegraph
+ * Co. or Unix System Laboratories, Inc. and are reproduced herein with
+ * the permission of UNIX System Laboratories, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ttydefaults.h 8.4 (Berkeley) 1/21/94
+ */
+
+/*
+ * System wide defaults for terminal state.
+ */
+#ifndef _SYS_TTYDEFAULTS_H_
+#define _SYS_TTYDEFAULTS_H_
+
+/*
+ * Defaults on "first" open.
+ */
+#define TTYDEF_IFLAG (BRKINT | ICRNL | IMAXBEL | IXON | IXANY)
+#define TTYDEF_OFLAG (OPOST | ONLCR | OXTABS)
+#define TTYDEF_LFLAG (ECHO | ICANON | ISIG | IEXTEN | ECHOE|ECHOKE|ECHOCTL)
+#define TTYDEF_CFLAG (CREAD | CS8 | HUPCL)
+#define TTYDEF_SPEED (B9600)
+
+/*
+ * Control Character Defaults
+ */
+#define CTRL(x) (x&037)
+#define CEOF CTRL('d')
+#define CEOL ((unsigned char)'\377') /* XXX avoid _POSIX_VDISABLE */
+#define CERASE 0177
+#define CINTR CTRL('c')
+#define CSTATUS CTRL('t')
+#define CKILL CTRL('u')
+#define CMIN 1
+#define CQUIT 034 /* FS, ^\ */
+#define CSUSP CTRL('z')
+#define CTIME 0
+#define CDSUSP CTRL('y')
+#define CSTART CTRL('q')
+#define CSTOP CTRL('s')
+#define CLNEXT CTRL('v')
+#define CDISCARD CTRL('o')
+#define CWERASE CTRL('w')
+#define CREPRINT CTRL('r')
+#define CEOT CEOF
+/* compat */
+#define CBRK CEOL
+#define CRPRNT CREPRINT
+#define CFLUSH CDISCARD
+
+/* PROTECTED INCLUSION ENDS HERE */
+#endif /* !_SYS_TTYDEFAULTS_H_ */
+
+/*
+ * #define TTYDEFCHARS to include an array of default control characters.
+ */
+#ifdef _KERNEL
+#ifdef TTYDEFCHARS
+const cc_t ttydefchars[NCCS] = {
+ [VEOF] = CEOF,
+ [VEOL] = CEOL,
+ [VEOL2] = CEOL,
+ [VERASE] = CERASE,
+ [VWERASE] = CWERASE,
+ [VKILL] = CKILL,
+ [VREPRINT] = CREPRINT,
+ [7] = _POSIX_VDISABLE, /* spare */
+ [VINTR] = CINTR,
+ [VQUIT] = CQUIT,
+ [VSUSP] = CSUSP,
+ [VDSUSP] = CDSUSP,
+ [VSTART] = CSTART,
+ [VSTOP] = CSTOP,
+ [VLNEXT] = CLNEXT,
+ [VDISCARD] = CDISCARD,
+ [VMIN] = CMIN,
+ [VTIME] = CTIME,
+ [VSTATUS] = CSTATUS,
+ [19] = _POSIX_VDISABLE, /* spare */
+};
+#undef TTYDEFCHARS
+#else
+extern const cc_t ttydefchars[NCCS];
+#endif
+#endif /* _KERNEL */
diff --git a/libc/include/sys/un.h b/libc/include/sys/un.h
index 973861f..f89ead3 100644
--- a/libc/include/sys/un.h
+++ b/libc/include/sys/un.h
@@ -28,6 +28,9 @@
#ifndef _SYS_UN_H_
#define _SYS_UN_H_
+#include <sys/_types.h>
+typedef __sa_family_t sa_family_t;
+
#include <linux/un.h>
#endif /* _SYS_UN_H_ */
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/asmmacro.h b/libc/kernel/arch-mips/asm/asmmacro.h
index e1e9804..c42d45e 100644
--- a/libc/kernel/arch-mips/asm/asmmacro.h
+++ b/libc/kernel/arch-mips/asm/asmmacro.h
@@ -19,5 +19,6 @@
#ifndef _ASM_ASMMACRO_H
#define _ASM_ASMMACRO_H
#include <asm/hazards.h>
-#endif
+#include <asm/asmmacro-32.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/cpu-features.h b/libc/kernel/arch-mips/asm/cpu-features.h
index b3642c2..50ce572 100644
--- a/libc/kernel/arch-mips/asm/cpu-features.h
+++ b/libc/kernel/arch-mips/asm/cpu-features.h
@@ -161,26 +161,45 @@
#define cpu_has_userlocal (cpu_data[0].options & MIPS_CPU_ULRI)
#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_nofpuex
+#define cpu_has_nofpuex (cpu_data[0].options & MIPS_CPU_NOFPUEX)
+#endif
+#ifndef cpu_has_64bits
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define cpu_has_64bits (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
+#endif
+#ifndef cpu_has_64bit_zero_reg
+#define cpu_has_64bit_zero_reg (cpu_data[0].isa_level & MIPS_CPU_ISA_64BIT)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
+#ifndef cpu_has_64bit_gp_regs
+#define cpu_has_64bit_gp_regs 0
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef cpu_has_64bit_addresses
+#define cpu_has_64bit_addresses 0
+#endif
#ifndef cpu_has_vint
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_has_vint 0
#endif
#ifndef cpu_has_veic
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_has_veic 0
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#ifndef cpu_has_inclusive_pcaches
#define cpu_has_inclusive_pcaches (cpu_data[0].options & MIPS_CPU_INCLUSIVE_CACHES)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef cpu_dcache_line_size
#define cpu_dcache_line_size() cpu_data[0].dcache.linesz
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef cpu_icache_line_size
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_icache_line_size() cpu_data[0].icache.linesz
#endif
#ifndef cpu_scache_line_size
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define cpu_scache_line_size() cpu_data[0].scache.linesz
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#endif
diff --git a/libc/kernel/arch-mips/asm/elf.h b/libc/kernel/arch-mips/asm/elf.h
index 6ccb622..6f79694 100644
--- a/libc/kernel/arch-mips/asm/elf.h
+++ b/libc/kernel/arch-mips/asm/elf.h
@@ -186,29 +186,33 @@
typedef double elf_fpreg_t;
typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define elf_check_arch(hdr) ({ int __res = 1; struct elfhdr *__h = (hdr); if (__h->e_machine != EM_MIPS) __res = 0; if (__h->e_ident[EI_CLASS] != ELFCLASS32) __res = 0; if ((__h->e_flags & EF_MIPS_ABI2) != 0) __res = 0; if (((__h->e_flags & EF_MIPS_ABI) != 0) && ((__h->e_flags & EF_MIPS_ABI) != EF_MIPS_ABI_O32)) __res = 0; __res; })
+#define ELF_CLASS ELFCLASS32
#ifdef __MIPSEB__
#define ELF_DATA ELFDATA2MSB
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#elif __MIPSEL__
#define ELF_DATA ELFDATA2LSB
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
#define ELF_ARCH EM_MIPS
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
struct mips_abi;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SET_PERSONALITY(ex, ibcs2) do { if (ibcs2) set_personality(PER_SVR4); set_personality(PER_LINUX); current->thread.abi = &mips_abi; } while (0)
struct task_struct;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_CORE_COPY_REGS(elf_regs, regs) elf_dump_regs((elf_greg_t *)&(elf_regs), regs);
#define ELF_CORE_COPY_TASK_REGS(tsk, elf_regs) dump_task_regs(tsk, elf_regs)
#define ELF_CORE_COPY_FPREGS(tsk, elf_fpregs) dump_task_fpu(tsk, elf_fpregs)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define USE_ELF_CORE_DUMP
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_EXEC_PAGESIZE PAGE_SIZE
#define ELF_HWCAP (0)
#define ELF_PLATFORM (NULL)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ELF_PLAT_INIT(_r, load_addr) do { _r->regs[1] = _r->regs[2] = _r->regs[3] = _r->regs[4] = 0; _r->regs[5] = _r->regs[6] = _r->regs[7] = _r->regs[8] = 0; _r->regs[9] = _r->regs[10] = _r->regs[11] = _r->regs[12] = 0; _r->regs[13] = _r->regs[14] = _r->regs[15] = _r->regs[16] = 0; _r->regs[17] = _r->regs[18] = _r->regs[19] = _r->regs[20] = 0; _r->regs[21] = _r->regs[22] = _r->regs[23] = _r->regs[24] = 0; _r->regs[25] = _r->regs[26] = _r->regs[27] = _r->regs[28] = 0; _r->regs[30] = _r->regs[31] = 0; } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#ifndef ELF_ET_DYN_BASE
#define ELF_ET_DYN_BASE (TASK_SIZE / 3 * 2)
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/fcntl.h b/libc/kernel/arch-mips/asm/fcntl.h
index 2686340..73de4ad 100644
--- a/libc/kernel/arch-mips/asm/fcntl.h
+++ b/libc/kernel/arch-mips/asm/fcntl.h
@@ -43,6 +43,18 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define F_SETLKW64 35
#endif
+struct flock {
+ short l_type;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ long l_sysid;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __kernel_pid_t l_pid;
+ long pad[4];
+};
+#define HAVE_ARCH_STRUCT_FLOCK
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <asm-generic/fcntl.h>
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/mach-generic/spaces.h b/libc/kernel/arch-mips/asm/mach-generic/spaces.h
index cbda237..0ec1f57 100644
--- a/libc/kernel/arch-mips/asm/mach-generic/spaces.h
+++ b/libc/kernel/arch-mips/asm/mach-generic/spaces.h
@@ -23,8 +23,19 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define PHYS_OFFSET _AC(0, UL)
#endif
-#ifndef PAGE_OFFSET
-#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
+#define CAC_BASE _AC(0x80000000, UL)
+#define IO_BASE _AC(0xa0000000, UL)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define UNCAC_BASE _AC(0xa0000000, UL)
+#ifndef MAP_BASE
+#define MAP_BASE _AC(0xc0000000, UL)
+#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#ifndef HIGHMEM_START
+#define HIGHMEM_START _AC(0x20000000, UL)
+#endif
+#ifndef PAGE_OFFSET
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_OFFSET (CAC_BASE + PHYS_OFFSET)
#endif
#endif
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/module.h b/libc/kernel/arch-mips/asm/module.h
index 45808e9..dd24290 100644
--- a/libc/kernel/arch-mips/asm/module.h
+++ b/libc/kernel/arch-mips/asm/module.h
@@ -49,8 +49,20 @@
Elf64_Byte r_type;
Elf64_Sxword r_addend;
} Elf64_Mips_Rela;
+#define Elf_Shdr Elf32_Shdr
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Elf_Sym Elf32_Sym
+#define Elf_Ehdr Elf32_Ehdr
+#define Elf_Addr Elf32_Addr
+#define Elf_Mips_Rel Elf32_Rel
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define Elf_Mips_Rela Elf32_Rela
+#define ELF_MIPS_R_SYM(rel) ELF32_R_SYM(rel.r_info)
+#define ELF_MIPS_R_TYPE(rel) ELF32_R_TYPE(rel.r_info)
#error MODULE_PROC_FAMILY undefined for your processor configuration
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define MODULE_KERNEL_TYPE "32BIT "
#define MODULE_KERNEL_SMTC ""
#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_KERNEL_TYPE MODULE_KERNEL_SMTC
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/msgbuf.h b/libc/kernel/arch-mips/asm/msgbuf.h
index 31a1887..d81da73 100644
--- a/libc/kernel/arch-mips/asm/msgbuf.h
+++ b/libc/kernel/arch-mips/asm/msgbuf.h
@@ -21,18 +21,21 @@
struct msqid64_ds {
struct ipc64_perm msg_perm;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused1;
__kernel_time_t msg_stime;
+ unsigned long __unused2;
__kernel_time_t msg_rtime;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long __unused3;
__kernel_time_t msg_ctime;
unsigned long msg_cbytes;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_qnum;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long msg_qbytes;
__kernel_pid_t msg_lspid;
__kernel_pid_t msg_lrpid;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused4;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long __unused5;
};
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/pgalloc.h b/libc/kernel/arch-mips/asm/pgalloc.h
index e3ef3b8..0f16346 100644
--- a/libc/kernel/arch-mips/asm/pgalloc.h
+++ b/libc/kernel/arch-mips/asm/pgalloc.h
@@ -24,6 +24,8 @@
#include <linux/sched.h>
#define pmd_pgtable(pmd) pmd_page(pmd)
#define __pte_free_tlb(tlb,pte) do { pgtable_page_dtor(pte); tlb_remove_page((tlb), pte); } while (0)
-#define check_pgt_cache() do { } while (0)
+#define pmd_free(mm, x) do { } while (0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __pmd_free_tlb(tlb, x) do { } while (0)
+#define check_pgt_cache() do { } while (0)
#endif
diff --git a/libc/kernel/arch-mips/asm/pgtable.h b/libc/kernel/arch-mips/asm/pgtable.h
index ceb4343..46a5ba1 100644
--- a/libc/kernel/arch-mips/asm/pgtable.h
+++ b/libc/kernel/arch-mips/asm/pgtable.h
@@ -18,61 +18,62 @@
****************************************************************************/
#ifndef _ASM_PGTABLE_H
#define _ASM_PGTABLE_H
+#include <asm/pgtable-32.h>
#include <asm/io.h>
-#include <asm/pgtable-bits.h>
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm/pgtable-bits.h>
struct mm_struct;
struct vm_area_struct;
#define PAGE_NONE __pgprot(_PAGE_PRESENT | _CACHE_CACHABLE_NONCOHERENT)
-#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_SHARED __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
#define PAGE_COPY __pgprot(_PAGE_PRESENT | _PAGE_READ | _page_cachable_default)
#define PAGE_READONLY __pgprot(_PAGE_PRESENT | _PAGE_READ | _page_cachable_default)
#define PAGE_KERNEL __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL | _page_cachable_default)
-#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PAGE_USERIO __pgprot(_PAGE_PRESENT | _PAGE_READ | _PAGE_WRITE | _page_cachable_default)
#define PAGE_KERNEL_UNCACHED __pgprot(_PAGE_PRESENT | __READABLE | __WRITEABLE | _PAGE_GLOBAL | _CACHE_UNCACHED)
#define __P000 __pgprot(0)
#define __P001 __pgprot(0)
-#define __P010 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P010 __pgprot(0)
#define __P011 __pgprot(0)
#define __P100 __pgprot(0)
#define __P101 __pgprot(0)
-#define __P110 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __P110 __pgprot(0)
#define __P111 __pgprot(0)
#define __S000 __pgprot(0)
#define __S001 __pgprot(0)
-#define __S010 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S010 __pgprot(0)
#define __S011 __pgprot(0)
#define __S100 __pgprot(0)
#define __S101 __pgprot(0)
-#define __S110 __pgprot(0)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __S110 __pgprot(0)
#define __S111 __pgprot(0)
#define ZERO_PAGE(vaddr) (virt_to_page((void *)(empty_zero_page + (((unsigned long)(vaddr)) & zero_page_mask))))
#define pmd_phys(pmd) virt_to_phys((void *)pmd_val(pmd))
-#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define pmd_page(pmd) (pfn_to_page(pmd_phys(pmd) >> PAGE_SHIFT))
#define pmd_page_vaddr(pmd) pmd_val(pmd)
#define pte_none(pte) (!(pte_val(pte) & ~_PAGE_GLOBAL))
#define pte_present(pte) (pte_val(pte) & _PAGE_PRESENT)
-#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define set_pte_at(mm, addr, ptep, pteval) set_pte(ptep, pteval)
#define set_pmd(pmdptr, pmdval) do { *(pmdptr) = (pmdval); } while(0)
#define PGD_T_LOG2 (__builtin_ffs(sizeof(pgd_t)) - 1)
#define PMD_T_LOG2 (__builtin_ffs(sizeof(pmd_t)) - 1)
-#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTE_T_LOG2 (__builtin_ffs(sizeof(pte_t)) - 1)
#define pgprot_noncached pgprot_noncached
#define mk_pte(page, pgprot) pfn_pte(page_to_pfn(page), (pgprot))
#define kern_addr_valid(addr) (1)
-#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) remap_pfn_range(vma, vaddr, pfn, size, prot)
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define io_remap_pfn_range(vma, vaddr, pfn, size, prot) remap_pfn_range(vma, vaddr, pfn, size, prot)
#include <asm-generic/pgtable.h>
#define HAVE_ARCH_UNMAPPED_AREA
#define pgtable_cache_init() do { } while (0)
-#endif
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif
diff --git a/libc/kernel/arch-mips/asm/processor.h b/libc/kernel/arch-mips/asm/processor.h
index 3563121..fe9ee76 100644
--- a/libc/kernel/arch-mips/asm/processor.h
+++ b/libc/kernel/arch-mips/asm/processor.h
@@ -29,61 +29,65 @@
#include <asm/prefetch.h>
#include <asm/system.h>
#define current_text_addr() ({ __label__ _l; _l: &&_l;})
-#define NUM_FPU_REGS 32
+#define TASK_SIZE 0x7fff8000UL
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define STACK_TOP TASK_SIZE
+#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
+#define NUM_FPU_REGS 32
typedef __u64 fpureg_t;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mips_fpu_struct {
fpureg_t fpr[NUM_FPU_REGS];
unsigned int fcr31;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
};
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define NUM_DSP_REGS 6
typedef __u32 dspreg_t;
struct mips_dsp_state {
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
dspreg_t dspr[NUM_DSP_REGS];
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned int dspcontrol;
};
#define INIT_CPUMASK { {0,} }
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
typedef struct {
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long seg;
} mm_segment_t;
#define ARCH_MIN_TASKALIGN 8
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct mips_abi;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct thread_struct {
unsigned long reg16;
unsigned long reg17, reg18, reg19, reg20, reg21, reg22, reg23;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long reg29, reg30, reg31;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_status;
struct mips_fpu_struct fpu;
struct mips_dsp_state dsp;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_badvaddr;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long cp0_baduaddr;
unsigned long error_code;
unsigned long trap_no;
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long irix_trampoline;
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
unsigned long irix_oldctx;
struct mips_abi *abi;
};
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define FPAFF_INIT
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define INIT_THREAD { .reg16 = 0, .reg17 = 0, .reg18 = 0, .reg19 = 0, .reg20 = 0, .reg21 = 0, .reg22 = 0, .reg23 = 0, .reg29 = 0, .reg30 = 0, .reg31 = 0, .cp0_status = 0, .fpu = { .fpr = {0,}, .fcr31 = 0, }, FPAFF_INIT .dsp = { .dspr = {0, }, .dspcontrol = 0, }, .cp0_badvaddr = 0, .cp0_baduaddr = 0, .error_code = 0, .trap_no = 0, .irix_trampoline = 0, .irix_oldctx = 0, }
struct task_struct;
#define release_thread(thread) do { } while(0)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define prepare_to_copy(tsk) do { } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __KSTK_TOS(tsk) ((unsigned long)task_stack_page(tsk) + THREAD_SIZE - 32)
#define task_pt_regs(tsk) ((struct pt_regs *)__KSTK_TOS(tsk) - 1)
#define KSTK_EIP(tsk) (task_pt_regs(tsk)->cp0_epc)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KSTK_ESP(tsk) (task_pt_regs(tsk)->regs[29])
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KSTK_STATUS(tsk) (task_pt_regs(tsk)->cp0_status)
#define cpu_relax() barrier()
#define return_address() ({__asm__ __volatile__("":::"$31");__builtin_return_address(0);})
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/ptrace.h b/libc/kernel/arch-mips/asm/ptrace.h
index 2b71e70..43cfcf1 100644
--- a/libc/kernel/arch-mips/asm/ptrace.h
+++ b/libc/kernel/arch-mips/asm/ptrace.h
@@ -33,29 +33,31 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define ACX 78
struct pt_regs {
+ unsigned long pad0[6];
unsigned long regs[32];
- unsigned long cp0_status;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_status;
unsigned long hi;
unsigned long lo;
unsigned long cp0_badvaddr;
- unsigned long cp0_cause;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ unsigned long cp0_cause;
unsigned long cp0_epc;
} __attribute__ ((aligned (8)));
#define PTRACE_GETREGS 12
-#define PTRACE_SETREGS 13
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_SETREGS 13
#define PTRACE_GETFPREGS 14
#define PTRACE_SETFPREGS 15
#define PTRACE_OLDSETOPTIONS 21
-#define PTRACE_GET_THREAD_AREA 25
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_GET_THREAD_AREA 25
#define PTRACE_SET_THREAD_AREA 26
#define PTRACE_PEEKTEXT_3264 0xc0
#define PTRACE_PEEKDATA_3264 0xc1
-#define PTRACE_POKETEXT_3264 0xc2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define PTRACE_POKETEXT_3264 0xc2
#define PTRACE_POKEDATA_3264 0xc3
#define PTRACE_GET_THREAD_AREA_3264 0xc4
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/reg.h b/libc/kernel/arch-mips/asm/reg.h
index 9174e27..1b8e8ee 100644
--- a/libc/kernel/arch-mips/asm/reg.h
+++ b/libc/kernel/arch-mips/asm/reg.h
@@ -18,57 +18,54 @@
****************************************************************************/
#ifndef __ASM_MIPS_REG_H
#define __ASM_MIPS_REG_H
-#ifdef WANT_COMPAT_REG_H
#define EF_R0 6
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R1 7
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R2 8
#define EF_R3 9
#define EF_R4 10
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R5 11
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R6 12
#define EF_R7 13
#define EF_R8 14
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R9 15
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R10 16
#define EF_R11 17
#define EF_R12 18
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R13 19
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R14 20
#define EF_R15 21
#define EF_R16 22
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R17 23
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R18 24
#define EF_R19 25
#define EF_R20 26
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R21 27
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R22 28
#define EF_R23 29
#define EF_R24 30
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R25 31
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R26 32
#define EF_R27 33
#define EF_R28 34
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R29 35
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_R30 36
#define EF_R31 37
#define EF_LO 38
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_HI 39
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_CP0_EPC 40
#define EF_CP0_BADVADDR 41
#define EF_CP0_STATUS 42
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_CP0_CAUSE 43
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define EF_UNUSED0 44
#define EF_SIZE 180
#endif
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#endif
diff --git a/libc/kernel/arch-mips/asm/resource.h b/libc/kernel/arch-mips/asm/resource.h
index e841072..1374d7d 100644
--- a/libc/kernel/arch-mips/asm/resource.h
+++ b/libc/kernel/arch-mips/asm/resource.h
@@ -24,6 +24,7 @@
#define RLIMIT_RSS 7
#define RLIMIT_NPROC 8
#define RLIMIT_MEMLOCK 9
-#include <asm-generic/resource.h>
+#define RLIM_INFINITY 0x7fffffffUL
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/resource.h>
#endif
diff --git a/libc/kernel/arch-mips/asm/siginfo.h b/libc/kernel/arch-mips/asm/siginfo.h
index f3e508a..8fdbf77 100644
--- a/libc/kernel/arch-mips/asm/siginfo.h
+++ b/libc/kernel/arch-mips/asm/siginfo.h
@@ -24,73 +24,75 @@
#define HAVE_ARCH_SIGINFO_T
#define HAVE_ARCH_COPY_SIGINFO
struct siginfo;
-#include <asm-generic/siginfo.h>
+#define __ARCH_SI_PREAMBLE_SIZE (3 * sizeof(int))
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#include <asm-generic/siginfo.h>
typedef struct siginfo {
int si_signo;
int si_code;
- int si_errno;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int si_errno;
int __pad0[SI_MAX_SIZE / sizeof(int) - SI_PAD_SIZE - 3];
union {
int _pad[SI_PAD_SIZE];
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
} _kill;
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
timer_t _tid;
int _overrun;
char _pad[sizeof( __ARCH_SI_UID_T) - sizeof(int)];
- sigval_t _sigval;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ sigval_t _sigval;
int _sys_private;
} _timer;
struct {
- pid_t _pid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
__ARCH_SI_UID_T _uid;
sigval_t _sigval;
} _rt;
- struct {
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ struct {
pid_t _pid;
__ARCH_SI_UID_T _uid;
int _status;
- clock_t _utime;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ clock_t _utime;
clock_t _stime;
} _sigchld;
struct {
- pid_t _pid;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ pid_t _pid;
clock_t _utime;
int _status;
clock_t _stime;
- } _irix_sigchld;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ } _irix_sigchld;
struct {
void __user *_addr;
#ifdef __ARCH_SI_TRAPNO
- int _trapno;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ int _trapno;
#endif
} _sigfault;
struct {
- __ARCH_SI_BAND_T _band;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+ __ARCH_SI_BAND_T _band;
int _fd;
} _sigpoll;
} _sifields;
-} siginfo_t;
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+} siginfo_t;
#undef SI_ASYNCIO
#undef SI_TIMER
#undef SI_MESGQ
-#define SI_ASYNCIO -2
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define SI_ASYNCIO -2
#define SI_TIMER __SI_CODE(__SI_TIMER, -3)
#define SI_MESGQ __SI_CODE(__SI_MESGQ, -4)
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
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/string.h b/libc/kernel/arch-mips/asm/string.h
index 856f61b..6f375a3 100644
--- a/libc/kernel/arch-mips/asm/string.h
+++ b/libc/kernel/arch-mips/asm/string.h
@@ -18,8 +18,16 @@
****************************************************************************/
#ifndef _ASM_STRING_H
#define _ASM_STRING_H
+#ifndef IN_STRING_C
+#define __HAVE_ARCH_STRCPY
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __HAVE_ARCH_STRNCPY
+#define __HAVE_ARCH_STRCMP
+#endif
+#define __HAVE_ARCH_STRNCMP
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMCPY
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __HAVE_ARCH_MEMMOVE
#endif
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
diff --git a/libc/kernel/arch-mips/asm/uaccess.h b/libc/kernel/arch-mips/asm/uaccess.h
index 3703af3..96025d3 100644
--- a/libc/kernel/arch-mips/asm/uaccess.h
+++ b/libc/kernel/arch-mips/asm/uaccess.h
@@ -23,35 +23,45 @@
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#include <linux/thread_info.h>
#include <asm-generic/uaccess.h>
+#define __UA_LIMIT 0x80000000UL
+#define __UA_ADDR ".word"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __UA_LA "la"
+#define __UA_ADDU "addu"
+#define __UA_t0 "$8"
+#define __UA_t1 "$9"
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define KERNEL_DS ((mm_segment_t) { 0UL })
#define USER_DS ((mm_segment_t) { __UA_LIMIT })
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define VERIFY_READ 0
#define VERIFY_WRITE 1
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define get_ds() (KERNEL_DS)
#define get_fs() (current_thread_info()->addr_limit)
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define set_fs(x) (current_thread_info()->addr_limit = (x))
#define segment_eq(a, b) ((a).seg == (b).seg)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __ua_size(size) ((__builtin_constant_p(size) && (signed long) (size) > 0) ? 0 : (size))
#define __access_mask get_fs().seg
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __access_ok(addr, size, mask) (((signed long)((mask) & ((addr) | ((addr) + (size)) | __ua_size(size)))) == 0)
#define access_ok(type, addr, size) likely(__access_ok((unsigned long)(addr), (size), __access_mask))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define put_user(x,ptr) __put_user_check((x), (ptr), sizeof(*(ptr)))
#define get_user(x,ptr) __get_user_check((x), (ptr), sizeof(*(ptr)))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __put_user(x,ptr) __put_user_nocheck((x), (ptr), sizeof(*(ptr)))
#define __get_user(x,ptr) __get_user_nocheck((x), (ptr), sizeof(*(ptr)))
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
struct __large_struct { unsigned long buf[100]; };
#define __m(x) (*(struct __large_struct __user *)(x))
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __GET_USER_DW(val, ptr) __get_user_asm_ll32(val, ptr)
#define __get_user_common(val, size, ptr) do { switch (size) { case 1: __get_user_asm(val, "lb", ptr); break; case 2: __get_user_asm(val, "lh", ptr); break; case 4: __get_user_asm(val, "lw", ptr); break; case 8: __GET_USER_DW(val, ptr); break; default: __get_user_unknown(); break; } } while (0)
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __get_user_nocheck(x, ptr, size) ({ long __gu_err; __get_user_common((x), size, ptr); __gu_err; })
#define __get_user_check(x, ptr, size) ({ long __gu_err = -EFAULT; const __typeof__(*(ptr)) __user * __gu_ptr = (ptr); if (likely(access_ok(VERIFY_READ, __gu_ptr, size))) __get_user_common((x), size, __gu_ptr); __gu_err; })
#define __get_user_asm(val, insn, addr) { long __gu_tmp; __asm__ __volatile__( "1: " insn " %1, %3 \n" "2: \n" " .section .fixup,\"ax\" \n" "3: li %0, %4 \n" " j 2b \n" " .previous \n" " .section __ex_table,\"a\" \n" " "__UA_ADDR "\t1b, 3b \n" " .previous \n" : "=r" (__gu_err), "=r" (__gu_tmp) : "0" (0), "o" (__m(addr)), "i" (-EFAULT)); (val) = (__typeof__(*(addr))) __gu_tmp; }
-/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
#define __get_user_asm_ll32(val, addr) { union { unsigned long long l; __typeof__(*(addr)) t; } __gu_tmp; __asm__ __volatile__( "1: lw %1, (%3) \n" "2: lw %D1, 4(%3) \n" "3: .section .fixup,\"ax\" \n" "4: li %0, %4 \n" " move %1, $0 \n" " move %D1, $0 \n" " j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" " " __UA_ADDR " 1b, 4b \n" " " __UA_ADDR " 2b, 4b \n" " .previous \n" : "=r" (__gu_err), "=&r" (__gu_tmp.l) : "0" (0), "r" (addr), "i" (-EFAULT)); (val) = __gu_tmp.t; }
+/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#define __PUT_USER_DW(ptr) __put_user_asm_ll32(ptr)
#define __put_user_nocheck(x, ptr, size) ({ __typeof__(*(ptr)) __pu_val; long __pu_err = 0; __pu_val = (x); switch (size) { case 1: __put_user_asm("sb", ptr); break; case 2: __put_user_asm("sh", ptr); break; case 4: __put_user_asm("sw", ptr); break; case 8: __PUT_USER_DW(ptr); break; default: __put_user_unknown(); break; } __pu_err; })
#define __put_user_check(x, ptr, size) ({ __typeof__(*(ptr)) __user *__pu_addr = (ptr); __typeof__(*(ptr)) __pu_val = (x); long __pu_err = -EFAULT; if (likely(access_ok(VERIFY_WRITE, __pu_addr, size))) { switch (size) { case 1: __put_user_asm("sb", __pu_addr); break; case 2: __put_user_asm("sh", __pu_addr); break; case 4: __put_user_asm("sw", __pu_addr); break; case 8: __PUT_USER_DW(__pu_addr); break; default: __put_user_unknown(); break; } } __pu_err; })
#define __put_user_asm(insn, ptr) { __asm__ __volatile__( "1: " insn " %z2, %3 # __put_user_asm\n" "2: \n" " .section .fixup,\"ax\" \n" "3: li %0, %4 \n" " j 2b \n" " .previous \n" " .section __ex_table,\"a\" \n" " " __UA_ADDR " 1b, 3b \n" " .previous \n" : "=r" (__pu_err) : "0" (0), "Jr" (__pu_val), "o" (__m(ptr)), "i" (-EFAULT)); }
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 */
-
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 86a14fd..7eeffb4 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -45,6 +45,7 @@
kernel_default_arch_macros = {
"arm": {},
"x86": {"__i386__": "1", "CONFIG_X86_32": "1"},
+ "mips": {"CONFIG_32BIT":"1"},
}
# Replace tokens in the output according to this mapping
diff --git a/libc/string/strerror.c b/libc/string/strerror.c
deleted file mode 100644
index b2ae001..0000000
--- a/libc/string/strerror.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* $OpenBSD: strerror.c,v 1.7 2005/08/08 08:05:37 espie Exp $ */
-/*
- * Copyright (c) 1988 Regents of the University of California.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <string.h>
-#include <limits.h>
-
-char *
-strerror(int num)
-{
- static char buf[256];
-
- (void)strerror_r(num, buf, sizeof(buf));
- return (buf);
-}
diff --git a/libc/string/strerror_r.c b/libc/string/strerror_r.c
deleted file mode 100644
index 30841f3..0000000
--- a/libc/string/strerror_r.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $OpenBSD: strerror_r.c,v 1.6 2005/08/08 08:05:37 espie Exp $ */
-/* Public Domain <marc@snafu.org> */
-
-#define sys_siglist _sys_siglist
-
-#include <errno.h>
-#include <limits.h>
-#include <signal.h>
-#include <string.h>
-
-typedef struct {
- int code;
- const char* msg;
-} CodeString;
-
-static const char*
-__code_string_lookup( const CodeString* strings,
- int code )
-{
- int nn = 0;
-
- for (;;)
- {
- if (strings[nn].msg == NULL)
- break;
-
- if (strings[nn].code == code)
- return strings[nn].msg;
-
- nn++;
- }
- return NULL;
-}
-
-
-static const CodeString _sys_error_strings[] =
-{
-#define __BIONIC_ERRDEF(x,y,z) { x, z },
-#include <sys/_errdefs.h>
- { 0, NULL }
-};
-
-static size_t
-__digits10(unsigned int num)
-{
- size_t i = 0;
-
- do {
- num /= 10;
- i++;
- } while (num != 0);
-
- return i;
-}
-
-static int
-__itoa(int num, int sign, char *buffer, size_t start, size_t end)
-{
- size_t pos;
- unsigned int a;
- int neg;
-
- if (sign && num < 0) {
- a = -num;
- neg = 1;
- }
- else {
- a = num;
- neg = 0;
- }
-
- pos = start + __digits10(a);
- if (neg)
- pos++;
-
- if (pos < end)
- buffer[pos] = '\0';
- else
- return ERANGE;
- pos--;
- do {
- buffer[pos] = (a % 10) + '0';
- pos--;
- a /= 10;
- } while (a != 0);
- if (neg)
- buffer[pos] = '-';
- return 0;
-}
-
-
-int
-strerror_r(int errnum, char *strerrbuf, size_t buflen)
-{
- int save_errno;
- int len, ret = 0;
- const char* msg;
-
- save_errno = errno;
- msg = __code_string_lookup( _sys_error_strings, errnum );
- if (msg != NULL) {
- len = strlcpy(strerrbuf, msg, buflen);
- if ((size_t)len >= buflen)
- ret = ERANGE;
- } else {
- len = strlcpy(strerrbuf, "Unknown error: ", buflen);
- if ((size_t)len >= buflen)
- ret = ERANGE;
- else {
- int ret = __itoa(errnum, 1, strerrbuf, len, buflen);
-
- if (ret == 0)
- ret = EINVAL;
- }
- }
- return ret;
-}
-
-#if 0
-static const CodeString _sys_signal_strings[] =
-{
-#define SIGDEF(x,y,z) { y, z },
-#include <sys/_sigdefs.h>
-};
-
-
-static int
-__num2string(int num, int sign, int setid, char *buf, size_t buflen,
- char * list[], size_t max, const char *def)
-{
- int ret = 0;
- size_t len;
-
- if (0 <= num && num < max) {
- len = strlcpy(buf, def, buflen);
- if (len >= buflen)
- ret = ERANGE;
- } else {
- len = strlcpy(buf, def, buflen);
- if (len >= buflen)
- ret = ERANGE;
- else {
- ret = __itoa(num, sign, buf, len, buflen);
- if (ret == 0)
- ret = EINVAL;
- }
- }
-
- return ret;
-}
-
-
-
-#define USIGPREFIX "Unknown signal: "
-
-char *
-__strsignal(int num, char *buf)
-{
- __num2string(num, 0, 2, buf, NL_TEXTMAX, (char **)sys_siglist, NSIG,
- USIGPREFIX);
- return buf;
-}
-#endif
diff --git a/libc/tools/generate-NOTICE.py b/libc/tools/generate-NOTICE.py
index 46152b9..b7d23f7 100755
--- a/libc/tools/generate-NOTICE.py
+++ b/libc/tools/generate-NOTICE.py
@@ -1,5 +1,7 @@
#!/usr/bin/python
# Run with directory arguments from any directory, with no special setup required.
+# Or:
+# for i in libc libdl libm linker libstdc++ libthread_db ; do ./libc/tools/generate-NOTICE.py $i > $i/NOTICE ; done
import ftplib
import hashlib
diff --git a/libc/upstream-netbsd/extern.h b/libc/upstream-netbsd/extern.h
new file mode 100644
index 0000000..942e237
--- /dev/null
+++ b/libc/upstream-netbsd/extern.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _BIONIC_NETBSD_EXTERN_H_included
+#define _BIONIC_NETBSD_EXTERN_H_included
+
+// Placeholder.
+
+#endif
diff --git a/libc/upstream-netbsd/libc/gen/ftw.c b/libc/upstream-netbsd/libc/gen/ftw.c
new file mode 100644
index 0000000..a7f6bbd
--- /dev/null
+++ b/libc/upstream-netbsd/libc/gen/ftw.c
@@ -0,0 +1,98 @@
+/* $NetBSD: ftw.c,v 1.1 2005/12/30 23:07:32 agc Exp $ */
+
+/* From OpenBSD: ftw.c,v 1.2 2003/07/21 21:15:32 millert Exp */
+
+/*
+ * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+#include <sys/cdefs.h>
+
+#ifndef lint
+__RCSID("$NetBSD: ftw.c,v 1.1 2005/12/30 23:07:32 agc Exp $");
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fts.h>
+#include <ftw.h>
+#include <limits.h>
+
+int
+ftw(const char *path, int (*fn)(const char *, const struct stat *, int),
+ int nfds)
+{
+ /* LINTED */
+ char * const paths[2] = { __UNCONST(path), NULL };
+ FTSENT *cur;
+ FTS *ftsp;
+ int fnflag, error, sverrno;
+
+ /* XXX - nfds is currently unused */
+ if (nfds < 1 || nfds > OPEN_MAX) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ ftsp = fts_open(paths, FTS_COMFOLLOW | FTS_NOCHDIR, NULL);
+ if (ftsp == NULL)
+ return (-1);
+ error = 0;
+ while ((cur = fts_read(ftsp)) != NULL) {
+ switch (cur->fts_info) {
+ case FTS_D:
+ fnflag = FTW_D;
+ break;
+ case FTS_DNR:
+ fnflag = FTW_DNR;
+ break;
+ case FTS_DP:
+ /* we only visit in preorder */
+ continue;
+ case FTS_F:
+ case FTS_DEFAULT:
+ fnflag = FTW_F;
+ break;
+ case FTS_NS:
+ case FTS_NSOK:
+ case FTS_SLNONE:
+ fnflag = FTW_NS;
+ break;
+ case FTS_SL:
+ fnflag = FTW_SL;
+ break;
+ case FTS_DC:
+ errno = ELOOP;
+ /* FALLTHROUGH */
+ default:
+ error = -1;
+ goto done;
+ }
+ error = fn(cur->fts_path, cur->fts_statp, fnflag);
+ if (error != 0)
+ break;
+ }
+done:
+ sverrno = errno;
+ if (fts_close(ftsp) != 0 && error == 0)
+ error = -1;
+ else
+ errno = sverrno;
+ return (error);
+}
diff --git a/libc/upstream-netbsd/libc/gen/nftw.c b/libc/upstream-netbsd/libc/gen/nftw.c
new file mode 100644
index 0000000..0e51342
--- /dev/null
+++ b/libc/upstream-netbsd/libc/gen/nftw.c
@@ -0,0 +1,114 @@
+/* $NetBSD */
+
+/* From OpenBSD: nftw.c,v 1.2 2003/07/21 21:15:32 millert Exp */
+
+/*
+ * Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Sponsored in part by the Defense Advanced Research Projects
+ * Agency (DARPA) and Air Force Research Laboratory, Air Force
+ * Materiel Command, USAF, under agreement number F39502-99-1-0512.
+ */
+
+#include <sys/cdefs.h>
+
+#ifndef lint
+__RCSID("$NetBSD: nftw.c,v 1.1 2005/12/30 23:07:32 agc Exp $");
+#endif
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <fts.h>
+#include <ftw.h>
+#include <limits.h>
+
+int
+nftw(const char *path, int (*fn)(const char *, const struct stat *, int,
+ struct FTW *), int nfds, int ftwflags)
+{
+ /* LINTED */
+ char * const paths[2] = { __UNCONST(path), NULL };
+ struct FTW f;
+ FTSENT *cur;
+ FTS *ftsp;
+ int ftsflags, fnflag, error, postorder, sverrno;
+
+ /* XXX - nfds is currently unused */
+ if (nfds < 1 || nfds > OPEN_MAX) {
+ errno = EINVAL;
+ return (-1);
+ }
+
+ ftsflags = FTS_COMFOLLOW;
+ if (!(ftwflags & FTW_CHDIR))
+ ftsflags |= FTS_NOCHDIR;
+ if (ftwflags & FTW_MOUNT)
+ ftsflags |= FTS_XDEV;
+ if (ftwflags & FTW_PHYS)
+ ftsflags |= FTS_PHYSICAL;
+ postorder = (ftwflags & FTW_DEPTH) != 0;
+ ftsp = fts_open(paths, ftsflags, NULL);
+ if (ftsp == NULL)
+ return (-1);
+ error = 0;
+ while ((cur = fts_read(ftsp)) != NULL) {
+ switch (cur->fts_info) {
+ case FTS_D:
+ if (postorder)
+ continue;
+ fnflag = FTW_D;
+ break;
+ case FTS_DNR:
+ fnflag = FTW_DNR;
+ break;
+ case FTS_DP:
+ if (!postorder)
+ continue;
+ fnflag = FTW_DP;
+ break;
+ case FTS_F:
+ case FTS_DEFAULT:
+ fnflag = FTW_F;
+ break;
+ case FTS_NS:
+ case FTS_NSOK:
+ fnflag = FTW_NS;
+ break;
+ case FTS_SL:
+ fnflag = FTW_SL;
+ break;
+ case FTS_SLNONE:
+ fnflag = FTW_SLN;
+ break;
+ case FTS_DC:
+ errno = ELOOP;
+ /* FALLTHROUGH */
+ default:
+ error = -1;
+ goto done;
+ }
+ f.base = cur->fts_pathlen - cur->fts_namelen;
+ f.level = cur->fts_level;
+ error = fn(cur->fts_path, cur->fts_statp, fnflag, &f);
+ if (error != 0)
+ break;
+ }
+done:
+ sverrno = errno;
+ (void) fts_close(ftsp);
+ errno = sverrno;
+ return (error);
+}
diff --git a/libc/upstream-netbsd/libc/gen/psignal.c b/libc/upstream-netbsd/libc/gen/psignal.c
new file mode 100644
index 0000000..4472be6
--- /dev/null
+++ b/libc/upstream-netbsd/libc/gen/psignal.c
@@ -0,0 +1,85 @@
+/* $NetBSD: psignal.c,v 1.23 2012/03/13 21:13:36 christos Exp $ */
+
+/*
+ * Copyright (c) 1983, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)psignal.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: psignal.c,v 1.23 2012/03/13 21:13:36 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+
+#include <sys/types.h>
+#include <sys/uio.h>
+
+#include <limits.h>
+#include <signal.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "extern.h"
+
+#ifdef __weak_alias
+__weak_alias(psignal,_psignal)
+#endif
+
+void
+psignal(int sig, const char *s)
+{
+ struct iovec *v;
+ struct iovec iov[4];
+ char buf[NL_TEXTMAX];
+
+ v = iov;
+ if (s && *s) {
+ v->iov_base = __UNCONST(s);
+ v->iov_len = strlen(s);
+ v++;
+ v->iov_base = __UNCONST(": ");
+ v->iov_len = 2;
+ v++;
+ }
+ v->iov_base = __UNCONST(__strsignal((int)sig, buf, sizeof(buf)));
+ v->iov_len = strlen(v->iov_base);
+ v++;
+ v->iov_base = __UNCONST("\n");
+ v->iov_len = 1;
+ (void)writev(STDERR_FILENO, iov, (int)((v - iov) + 1));
+}
+
+void
+psiginfo(const siginfo_t *si, const char *s)
+{
+ psignal(si->si_signo, s);
+}
diff --git a/libc/zoneinfo/zoneinfo.dat b/libc/zoneinfo/zoneinfo.dat
index 3d0b53c..4631c2c 100644
--- a/libc/zoneinfo/zoneinfo.dat
+++ b/libc/zoneinfo/zoneinfo.dat
Binary files differ
diff --git a/libc/zoneinfo/zoneinfo.idx b/libc/zoneinfo/zoneinfo.idx
index ac6bbc9..0e3b394 100644
--- a/libc/zoneinfo/zoneinfo.idx
+++ b/libc/zoneinfo/zoneinfo.idx
Binary files differ
diff --git a/libc/zoneinfo/zoneinfo.version b/libc/zoneinfo/zoneinfo.version
index f9e9d44..18a0c39 100644
--- a/libc/zoneinfo/zoneinfo.version
+++ b/libc/zoneinfo/zoneinfo.version
@@ -1 +1 @@
-2012e
+2012f
diff --git a/tests/Android.mk b/tests/Android.mk
index ae57d9b..be47585 100644
--- a/tests/Android.mk
+++ b/tests/Android.mk
@@ -22,34 +22,45 @@
getcwd_test.cpp \
pthread_test.cpp \
regex_test.cpp \
+ string_test.cpp \
+ stubs_test.cpp \
+
+test_dynamic_ldflags = -Wl,--export-dynamic -Wl,-u,DlSymTestFunction
+test_dynamic_src_files = \
+ dlopen_test.cpp \
# Build for the device (with bionic's .so). Run with:
# adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
include $(CLEAR_VARS)
LOCAL_MODULE := bionic-unit-tests
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_SRC_FILES := $(test_src_files)
+LOCAL_LDFLAGS += $(test_dynamic_ldflags)
+LOCAL_SHARED_LIBRARIES += libdl
+LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
include $(BUILD_NATIVE_TEST)
# Build for the device (with bionic's .a). Run with:
# adb shell /data/nativetest/bionic-unit-tests-static/bionic-unit-tests-static
include $(CLEAR_VARS)
-LOCAL_FORCE_STATIC_EXECUTABLE := true
-LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
LOCAL_MODULE := bionic-unit-tests-static
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
+LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_SRC_FILES := $(test_src_files)
+LOCAL_STATIC_LIBRARIES += libstlport_static libstdc++ libm libc
include $(BUILD_NATIVE_TEST)
# Build for the host (with glibc).
# Note that this will build against glibc, so it's not useful for testing
# bionic's implementation, but it does let you use glibc as a reference
# implementation for testing the tests themselves.
+ifeq ($(HOST_OS)-$(HOST_ARCH),linux-x86)
include $(CLEAR_VARS)
LOCAL_MODULE := bionic-unit-tests-glibc
LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
-LOCAL_LDFLAGS += -lpthread
-LOCAL_SRC_FILES := $(test_src_files)
+LOCAL_LDFLAGS += -lpthread -ldl
+LOCAL_LDFLAGS += $(test_dynamic_ldflags)
+LOCAL_SRC_FILES := $(test_src_files) $(test_dynamic_src_files)
include $(BUILD_HOST_NATIVE_TEST)
+endif
endif # !BUILD_TINY_ANDROID
diff --git a/tests/dlopen_test.cpp b/tests/dlopen_test.cpp
new file mode 100644
index 0000000..c290b4d
--- /dev/null
+++ b/tests/dlopen_test.cpp
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <dlfcn.h>
+
+static bool gCalled = false;
+extern "C" void DlSymTestFunction() {
+ gCalled = true;
+}
+
+TEST(dlopen, dlsym_in_self) {
+ void* self = dlopen(NULL, RTLD_NOW);
+ ASSERT_TRUE(self != NULL);
+
+ void* sym = dlsym(self, "DlSymTestFunction");
+ ASSERT_TRUE(sym != NULL);
+
+ void (*function)() = reinterpret_cast<void(*)()>(sym);
+
+ gCalled = false;
+ function();
+ ASSERT_TRUE(gCalled);
+}
diff --git a/tests/string_test.cpp b/tests/string_test.cpp
new file mode 100644
index 0000000..ea1491c
--- /dev/null
+++ b/tests/string_test.cpp
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <errno.h>
+#include <string.h>
+
+TEST(string, strerror) {
+ // Valid.
+ ASSERT_STREQ("Success", strerror(0));
+ ASSERT_STREQ("Operation not permitted", strerror(1));
+
+ // Invalid.
+ ASSERT_STREQ("Unknown error 4294967295", strerror(-1));
+ ASSERT_STREQ("Unknown error 1234", strerror(1234));
+}
+
+void* ConcurrentStrErrorFn(void* arg) {
+ bool equal = (strcmp("Unknown error 2002", strerror(2002)) == 0);
+ return reinterpret_cast<void*>(equal);
+}
+
+#if __BIONIC__ // glibc's strerror isn't thread safe, only its strsignal.
+TEST(string, strerror_concurrent) {
+ const char* strerror1001 = strerror(1001);
+ ASSERT_STREQ("Unknown error 1001", strerror1001);
+
+ pthread_t t;
+ ASSERT_EQ(0, pthread_create(&t, NULL, ConcurrentStrErrorFn, NULL));
+ void* result;
+ ASSERT_EQ(0, pthread_join(t, &result));
+ ASSERT_TRUE(static_cast<bool>(result));
+
+ ASSERT_STREQ("Unknown error 1001", strerror1001);
+}
+#endif
+
+#if __BIONIC__ // glibc's strerror_r doesn't even have the same signature as the POSIX one.
+TEST(string, strerror_r) {
+ char buf[256];
+
+ // Valid.
+ ASSERT_EQ(0, strerror_r(0, buf, sizeof(buf)));
+ ASSERT_STREQ("Success", buf);
+ ASSERT_EQ(0, strerror_r(1, buf, sizeof(buf)));
+ ASSERT_STREQ("Operation not permitted", buf);
+
+ // Invalid.
+ ASSERT_EQ(0, strerror_r(-1, buf, sizeof(buf)));
+ ASSERT_STREQ("Unknown error 4294967295", buf);
+ ASSERT_EQ(0, strerror_r(1234, buf, sizeof(buf)));
+ ASSERT_STREQ("Unknown error 1234", buf);
+
+ // Buffer too small.
+ ASSERT_EQ(-1, strerror_r(0, buf, 2));
+ ASSERT_EQ(ERANGE, errno);
+}
+#endif
+
+TEST(string, strsignal) {
+ // A regular signal.
+ ASSERT_STREQ("Hangup", strsignal(1));
+
+ // A real-time signal.
+#ifdef __GLIBC__ // glibc reserves real-time signals for internal use, and doesn't count those.
+ ASSERT_STREQ("Real-time signal 14", strsignal(48));
+#else
+ ASSERT_STREQ("Real-time signal 16", strsignal(48));
+#endif
+
+ // Errors.
+ ASSERT_STREQ("Unknown signal -1", strsignal(-1)); // Too small.
+ ASSERT_STREQ("Unknown signal 0", strsignal(0)); // Still too small.
+ ASSERT_STREQ("Unknown signal 1234", strsignal(1234)); // Too large.
+}
+
+void* ConcurrentStrSignalFn(void* arg) {
+ bool equal = (strcmp("Unknown signal 2002", strsignal(2002)) == 0);
+ return reinterpret_cast<void*>(equal);
+}
+
+TEST(string, strsignal_concurrent) {
+ const char* strsignal1001 = strsignal(1001);
+ ASSERT_STREQ("Unknown signal 1001", strsignal1001);
+
+ pthread_t t;
+ ASSERT_EQ(0, pthread_create(&t, NULL, ConcurrentStrSignalFn, NULL));
+ void* result;
+ ASSERT_EQ(0, pthread_join(t, &result));
+ ASSERT_TRUE(static_cast<bool>(result));
+
+ ASSERT_STREQ("Unknown signal 1001", strsignal1001);
+}
diff --git a/tests/stubs_test.cpp b/tests/stubs_test.cpp
new file mode 100644
index 0000000..d2d0ad8
--- /dev/null
+++ b/tests/stubs_test.cpp
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <gtest/gtest.h>
+
+#include <sys/types.h>
+#include <sys/cdefs.h>
+#include <pwd.h>
+#include <errno.h>
+#include <limits.h>
+#include <unistd.h>
+
+#if __BIONIC__
+
+#define CHECK_GETPWNAM_FOR(username, uid, uid_type) \
+ SCOPED_TRACE(username); \
+ ASSERT_NO_FATAL_FAILURE(check_getpwnam(username, uid, uid_type));
+
+typedef enum {
+ TYPE_SYSTEM,
+ TYPE_APP
+} uid_type_t;
+
+static void check_getpwnam(const char* username, int uid, uid_type_t uid_type) {
+ errno = 0;
+ passwd* pwd = getpwuid(uid);
+ ASSERT_TRUE(pwd != NULL);
+ ASSERT_EQ(errno, 0);
+ EXPECT_STREQ(username, pwd->pw_name);
+ EXPECT_EQ(uid, pwd->pw_uid);
+ EXPECT_EQ(uid, pwd->pw_gid);
+
+ if (uid_type == TYPE_SYSTEM) {
+ EXPECT_STREQ("/", pwd->pw_dir);
+ } else if (uid_type == TYPE_APP) {
+ EXPECT_STREQ("/data", pwd->pw_dir);
+ }
+
+ EXPECT_STREQ("/system/bin/sh", pwd->pw_shell);
+}
+
+TEST(getpwnam, system_id_root) {
+ CHECK_GETPWNAM_FOR("root", 0, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, system_id_system) {
+ CHECK_GETPWNAM_FOR("system", 1000, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, app_id_radio) {
+ CHECK_GETPWNAM_FOR("radio", 1001, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, app_id_nobody) {
+ CHECK_GETPWNAM_FOR("nobody", 9999, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, app_id_all_a0) {
+ CHECK_GETPWNAM_FOR("all_a0", 50000, TYPE_APP);
+}
+
+TEST(getpwnam, app_id_u1_a40000) {
+ CHECK_GETPWNAM_FOR("u1_a40000", 150000, TYPE_APP);
+}
+
+TEST(getpwnam, app_id_u0_a0) {
+ CHECK_GETPWNAM_FOR("u0_a0", 10000, TYPE_APP);
+}
+
+TEST(getpwnam, app_id_u0_a1234) {
+ CHECK_GETPWNAM_FOR("u0_a1234", 11234, TYPE_APP);
+}
+
+TEST(getpwnam, app_id_u0_a9999) {
+ CHECK_GETPWNAM_FOR("u0_a9999", 19999, TYPE_APP);
+}
+
+// nonsensical, but expected
+TEST(getpwnam, app_id_u1_root) {
+ CHECK_GETPWNAM_FOR("u1_root", 100000, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, app_id_u1_radio) {
+ CHECK_GETPWNAM_FOR("u1_radio", 101001, TYPE_SYSTEM);
+}
+
+TEST(getpwnam, app_id_u1_a0) {
+ CHECK_GETPWNAM_FOR("u1_a0", 110000, TYPE_APP);
+}
+
+TEST(getpwnam, app_id_u1_i0) {
+ CHECK_GETPWNAM_FOR("u1_i0", 199000, TYPE_APP);
+}
+
+#endif /* __BIONIC__ */