aboutsummaryrefslogtreecommitdiff
path: root/system/include/libc
diff options
context:
space:
mode:
authorBruce Mitchener <bruce.mitchener@gmail.com>2013-09-06 17:48:28 +0700
committerAlon Zakai <alonzakai@gmail.com>2013-09-13 10:07:03 -0700
commit733e6877d7b1146ecb5c796f4d249843101a7b5f (patch)
treedeef7abf4f88e6e0ba4ac326d351063a73399a8d /system/include/libc
parent4c3c7df30af6dc9ba6309e527a5173d9078c56b9 (diff)
Update to musl-0.9.13 headers.
Diffstat (limited to 'system/include/libc')
-rw-r--r--system/include/libc/netinet/tcp.h35
-rw-r--r--system/include/libc/pthread.h3
-rw-r--r--system/include/libc/resolv.h2
-rw-r--r--system/include/libc/sched.h61
-rw-r--r--system/include/libc/stdlib.h8
-rw-r--r--system/include/libc/sys/msg.h1
-rw-r--r--system/include/libc/sys/personality.h40
-rw-r--r--system/include/libc/sys/un.h19
-rw-r--r--system/include/libc/sys/wait.h4
9 files changed, 168 insertions, 5 deletions
diff --git a/system/include/libc/netinet/tcp.h b/system/include/libc/netinet/tcp.h
index b7828a50..8266f21d 100644
--- a/system/include/libc/netinet/tcp.h
+++ b/system/include/libc/netinet/tcp.h
@@ -33,4 +33,39 @@
#include <sys/socket.h>
#endif
+#ifdef _GNU_SOURCE
+#include <endian.h>
+struct tcphdr
+{
+ u_int16_t source;
+ u_int16_t dest;
+ u_int32_t seq;
+ u_int32_t ack_seq;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ u_int16_t res1:4;
+ u_int16_t doff:4;
+ u_int16_t fin:1;
+ u_int16_t syn:1;
+ u_int16_t rst:1;
+ u_int16_t psh:1;
+ u_int16_t ack:1;
+ u_int16_t urg:1;
+ u_int16_t res2:2;
+#else
+ u_int16_t doff:4;
+ u_int16_t res1:4;
+ u_int16_t res2:2;
+ u_int16_t urg:1;
+ u_int16_t ack:1;
+ u_int16_t psh:1;
+ u_int16_t rst:1;
+ u_int16_t syn:1;
+ u_int16_t fin:1;
+#endif
+ u_int16_t window;
+ u_int16_t check;
+ u_int16_t urg_ptr;
+};
+#endif
+
#endif
diff --git a/system/include/libc/pthread.h b/system/include/libc/pthread.h
index 731bce38..f7c9568c 100644
--- a/system/include/libc/pthread.h
+++ b/system/include/libc/pthread.h
@@ -210,6 +210,9 @@ void _pthread_cleanup_pop(struct __ptcb *, int);
#define pthread_cleanup_pop(r) _pthread_cleanup_pop(&__cb, (r)); } while(0)
#ifdef _GNU_SOURCE
+struct cpu_set_t;
+int pthread_getaffinity_np(pthread_t, size_t, struct cpu_set_t *);
+int pthread_setaffinity_np(pthread_t, size_t, const struct cpu_set_t *);
int pthread_getattr_np(pthread_t, pthread_attr_t *);
#endif
diff --git a/system/include/libc/resolv.h b/system/include/libc/resolv.h
index cdedd274..259e4bc1 100644
--- a/system/include/libc/resolv.h
+++ b/system/include/libc/resolv.h
@@ -134,7 +134,7 @@ int res_search(const char *, int, int, unsigned char *, int);
int res_mkquery(int, const char *, int, int, char *, int, struct rrec *, char *, int);
int res_send(const char *, int, char *, int);
int dn_comp(unsigned char *, unsigned char *, int, unsigned char **, unsigned char *, unsigned char **);
-int dn_expand(unsigned char *, unsigned char *, unsigned char *, unsigned char *, int);
+int dn_expand(const unsigned char *, const unsigned char *, const unsigned char *, char *, int);
int dn_skipname(const unsigned char *, const unsigned char *);
#ifdef __cplusplus
diff --git a/system/include/libc/sched.h b/system/include/libc/sched.h
index 994260d0..6a6b2fcb 100644
--- a/system/include/libc/sched.h
+++ b/system/include/libc/sched.h
@@ -10,6 +10,10 @@ extern "C" {
#define __NEED_pid_t
#define __NEED_time_t
+#ifdef _GNU_SOURCE
+#define __NEED_size_t
+#endif
+
#include <bits/alltypes.h>
struct sched_param {
@@ -63,6 +67,63 @@ int sched_yield(void);
int clone (int (*)(void *), void *, int, void *, ...);
int unshare(int);
int setns(int, int);
+
+void *memcpy(void *__restrict, const void *__restrict, size_t);
+int memcmp(const void *, const void *, size_t);
+void *calloc(size_t, size_t);
+void free(void *);
+
+typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t;
+int __sched_cpucount(size_t, const cpu_set_t *);
+int sched_getaffinity(pid_t, size_t, cpu_set_t *);
+int sched_setaffinity(pid_t, size_t, const cpu_set_t *);
+
+#define __CPU_op_S(i, size, set, op) ( (i)/8 >= (size) ? 0 : \
+ ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) )
+
+#define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=)
+#define CPU_CLR_S(i, size, set) __CPU_op_S(i, size, set, &=~)
+#define CPU_ISSET_S(i, size, set) __CPU_op_S(i, size, set, &)
+
+#define __CPU_op_func_S(func, op) \
+static __inline void __CPU_##func##_S(size_t __size, cpu_set_t *__dest, \
+ const cpu_set_t *__src1, const cpu_set_t *__src2) \
+{ \
+ size_t __i; \
+ for (__i=0; __i<__size/sizeof(long); __i++) \
+ __dest->__bits[__i] = __src1->__bits[__i] \
+ op __src2->__bits[__i] ; \
+}
+
+__CPU_op_func_S(AND, &)
+__CPU_op_func_S(OR, |)
+__CPU_op_func_S(XOR, ^)
+
+#define CPU_AND_S(a,b,c,d) __CPU_AND_S(a,b,c,d)
+#define CPU_OR_S(a,b,c,d) __CPU_OR_S(a,b,c,d)
+#define CPU_XOR_S(a,b,c,d) __CPU_XOR_S(a,b,c,d)
+
+#define CPU_COUNT_S(size,set) __sched_cpucount(size,set)
+#define CPU_ZERO_S(size,set) memset(set,0,size)
+#define CPU_EQUAL_S(size,set1,set2) (!memcmp(set1,set2,size))
+
+#define CPU_ALLOC_SIZE(n) (sizeof(long) * ( (n)/(8*sizeof(long)) \
+ + ((n)%(8*sizeof(long)) + 8*sizeof(long)-1)/(8*sizeof(long)) ) )
+#define CPU_ALLOC(n) ((cpu_set_t *)calloc(1,CPU_ALLOC_SIZE(n)))
+#define CPU_FREE(set) free(set)
+
+#define CPU_SETSIZE 128
+
+#define CPU_SET(i, set) CPU_SET_S(i,sizeof(cpu_set_t),set)
+#define CPU_CLR(i, set) CPU_CLR_S(i,sizeof(cpu_set_t),set)
+#define CPU_ISSET(i, set) CPU_ISSET_S(i,sizeof(cpu_set_t),set)
+#define CPU_AND(d,s1,s2) CPU_AND_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_OR(d,s1,s2) CPU_OR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_XOR(d,s1,s2) CPU_XOR_S(sizeof(cpu_set_t),d,s1,s2)
+#define CPU_COUNT(set) CPU_COUNT_S(sizeof(cpu_set_t),set)
+#define CPU_ZERO(set) CPU_ZERO_S(sizeof(cpu_set_t),set)
+#define CPU_EQUAL(set) CPU_EQUAL_S(sizeof(cpu_set_t),set)
+
#endif
#ifdef __cplusplus
diff --git a/system/include/libc/stdlib.h b/system/include/libc/stdlib.h
index 0bcc9f4f..bca1fb41 100644
--- a/system/include/libc/stdlib.h
+++ b/system/include/libc/stdlib.h
@@ -88,8 +88,8 @@ size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
#define WTERMSIG(s) ((s) & 0x7f)
#define WSTOPSIG(s) WEXITSTATUS(s)
#define WIFEXITED(s) (!WTERMSIG(s))
-#define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
-#define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
int posix_memalign (void **, size_t, size_t);
int setenv (const char *, const char *, int);
@@ -149,6 +149,10 @@ int ptsname_r(int, char *, size_t);
char *ecvt(double, int, int *, int *);
char *fcvt(double, int, int *, int *);
char *gcvt(double, int, char *);
+struct __locale_struct;
+float strtof_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+double strtod_l(const char *__restrict, char **__restrict, struct __locale_struct *);
+long double strtold_l(const char *__restrict, char **__restrict, struct __locale_struct *);
#endif
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
diff --git a/system/include/libc/sys/msg.h b/system/include/libc/sys/msg.h
index ceedd1c6..139f22b7 100644
--- a/system/include/libc/sys/msg.h
+++ b/system/include/libc/sys/msg.h
@@ -23,6 +23,7 @@ typedef unsigned long msglen_t;
#define __msg_cbytes msg_cbytes
#define MSG_NOERROR 010000
+#define MSG_EXCEPT 020000
#define MSG_STAT 11
#define MSG_INFO 12
diff --git a/system/include/libc/sys/personality.h b/system/include/libc/sys/personality.h
index 852c0248..31d43dfe 100644
--- a/system/include/libc/sys/personality.h
+++ b/system/include/libc/sys/personality.h
@@ -1,6 +1,46 @@
#ifndef _PERSONALITY_H
#define _PERSONALITY_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define ADDR_NO_RANDOMIZE 0x0040000
+#define MMAP_PAGE_ZERO 0x0100000
+#define ADDR_COMPAT_LAYOUT 0x0200000
+#define READ_IMPLIES_EXEC 0x0400000
+#define ADDR_LIMIT_32BIT 0x0800000
+#define SHORT_INODE 0x1000000
+#define WHOLE_SECONDS 0x2000000
+#define STICKY_TIMEOUTS 0x4000000
+#define ADDR_LIMIT_3GB 0x8000000
+
+#define PER_LINUX 0
+#define PER_LINUX_32BIT ADDR_LIMIT_32BIT
+#define PER_SVR4 (1 | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_SVR3 (2 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_SCOSVR3 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS | SHORT_INODE)
+#define PER_OSR5 (3 | STICKY_TIMEOUTS | WHOLE_SECONDS)
+#define PER_WYSEV386 (4 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_ISCR4 (5 | STICKY_TIMEOUTS)
+#define PER_BSD 6
+#define PER_SUNOS (6 | STICKY_TIMEOUTS)
+#define PER_XENIX (7 | STICKY_TIMEOUTS | SHORT_INODE)
+#define PER_LINUX32 8
+#define PER_LINUX32_3GB (8 | ADDR_LIMIT_3GB)
+#define PER_IRIX32 (9 | STICKY_TIMEOUTS)
+#define PER_IRIXN32 (0xa | STICKY_TIMEOUTS)
+#define PER_IRIX64 (0x0b | STICKY_TIMEOUTS)
+#define PER_RISCOS 0xc
+#define PER_SOLARIS (0xd | STICKY_TIMEOUTS)
+#define PER_UW7 (0xe | STICKY_TIMEOUTS | MMAP_PAGE_ZERO)
+#define PER_OSF4 0xf
+#define PER_HPUX 0x10
+#define PER_MASK 0xff
+
int personality(unsigned long);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/system/include/libc/sys/un.h b/system/include/libc/sys/un.h
index 769dac6b..7494f1a3 100644
--- a/system/include/libc/sys/un.h
+++ b/system/include/libc/sys/un.h
@@ -1,7 +1,17 @@
#ifndef _SYS_UN_H
#define _SYS_UN_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <features.h>
+
#define __NEED_sa_family_t
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+#define __NEED_size_t
+#endif
+
#include <bits/alltypes.h>
struct sockaddr_un
@@ -10,4 +20,13 @@ struct sockaddr_un
char sun_path[108];
};
+#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
+size_t strlen(const char *);
+#define SUN_LEN(s) (2+strlen((s)->sun_path))
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/system/include/libc/sys/wait.h b/system/include/libc/sys/wait.h
index b6dfe01d..a7ad7cd1 100644
--- a/system/include/libc/sys/wait.h
+++ b/system/include/libc/sys/wait.h
@@ -45,8 +45,8 @@ pid_t wait4 (pid_t, int *, int, struct rusage *);
#define WSTOPSIG(s) WEXITSTATUS(s)
#define WCOREDUMP(s) ((s) & 0x80)
#define WIFEXITED(s) (!WTERMSIG(s))
-#define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
-#define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
+#define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00)
+#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu)
#define WIFCONTINUED(s) ((s) == 0xffff)
#ifdef __cplusplus