Code drop from //branches/cupcake/...@124589
diff --git a/libc/include/sys/_system_properties.h b/libc/include/sys/_system_properties.h
index a145927..42a7f6c 100644
--- a/libc/include/sys/_system_properties.h
+++ b/libc/include/sys/_system_properties.h
@@ -61,16 +61,16 @@
 #define SERIAL_DIRTY(serial) ((serial) & 1)
 
 struct prop_info {
-    unsigned char name[PROP_NAME_MAX];
+    char name[PROP_NAME_MAX];
     unsigned volatile serial;
-    unsigned char value[PROP_VALUE_MAX];
+    char value[PROP_VALUE_MAX];
 };
 
 struct prop_msg 
 {
     unsigned cmd;
-    unsigned char name[PROP_NAME_MAX];
-    unsigned char value[PROP_VALUE_MAX];
+    char name[PROP_NAME_MAX];
+    char value[PROP_VALUE_MAX];
 };
 
 #define PROP_MSG_SETPROP 1
diff --git a/libc/include/sys/atomics.h b/libc/include/sys/atomics.h
index fbf9b6e..d3fa145 100644
--- a/libc/include/sys/atomics.h
+++ b/libc/include/sys/atomics.h
@@ -29,6 +29,7 @@
 #define _SYS_ATOMICS_H
 
 #include <sys/cdefs.h>
+#include <sys/time.h>
 
 __BEGIN_DECLS
 
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index b6912ad..bed00ce 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -37,7 +37,6 @@
 #define __NR_getrusage                    (__NR_SYSCALL_BASE + 77)
 #define __NR_setgroups32                  (__NR_SYSCALL_BASE + 206)
 #define __NR_setpgid                      (__NR_SYSCALL_BASE + 57)
-#define __NR_vfork                        (__NR_SYSCALL_BASE + 190)
 #define __NR_setregid32                   (__NR_SYSCALL_BASE + 204)
 #define __NR_chroot                       (__NR_SYSCALL_BASE + 61)
 #define __NR_prctl                        (__NR_SYSCALL_BASE + 172)
@@ -46,6 +45,8 @@
 #define __NR_acct                         (__NR_SYSCALL_BASE + 51)
 #define __NR_read                         (__NR_SYSCALL_BASE + 3)
 #define __NR_write                        (__NR_SYSCALL_BASE + 4)
+#define __NR_pread64                      (__NR_SYSCALL_BASE + 180)
+#define __NR_pwrite64                     (__NR_SYSCALL_BASE + 181)
 #define __NR_open                         (__NR_SYSCALL_BASE + 5)
 #define __NR_close                        (__NR_SYSCALL_BASE + 6)
 #define __NR_lseek                        (__NR_SYSCALL_BASE + 19)
@@ -100,6 +101,7 @@
 #define __NR_settimeofday                 (__NR_SYSCALL_BASE + 79)
 #define __NR_times                        (__NR_SYSCALL_BASE + 43)
 #define __NR_nanosleep                    (__NR_SYSCALL_BASE + 162)
+#define __NR_getitimer                    (__NR_SYSCALL_BASE + 105)
 #define __NR_setitimer                    (__NR_SYSCALL_BASE + 104)
 #define __NR_sigaction                    (__NR_SYSCALL_BASE + 67)
 #define __NR_sigprocmask                  (__NR_SYSCALL_BASE + 126)
@@ -130,6 +132,7 @@
 #ifdef __arm__
 #define __NR_exit_group                   (__NR_SYSCALL_BASE + 248)
 #define __NR_waitid                       (__NR_SYSCALL_BASE + 280)
+#define __NR_vfork                        (__NR_SYSCALL_BASE + 190)
 #define __NR_openat                       (__NR_SYSCALL_BASE + 322)
 #define __NR_madvise                      (__NR_SYSCALL_BASE + 220)
 #define __NR_mincore                      (__NR_SYSCALL_BASE + 219)
@@ -217,6 +220,7 @@
 #define __NR_timer_getoverrun             (__NR_SYSCALL_BASE + 262)
 #define __NR_timer_delete                 (__NR_SYSCALL_BASE + 263)
 #define __NR_utimes                       (__NR_SYSCALL_BASE + 271)
+#define __NR_socketcall                   (__NR_SYSCALL_BASE + 102)
 #define __NR_epoll_create                 (__NR_SYSCALL_BASE + 254)
 #define __NR_epoll_ctl                    (__NR_SYSCALL_BASE + 255)
 #define __NR_epoll_wait                   (__NR_SYSCALL_BASE + 256)
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index a3ffa3e..8539c7b 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -7,7 +7,7 @@
 
 void             _exit (int);
 void             _exit_thread (int);
-int              fork (void);
+pid_t            __fork (void);
 pid_t            _waitpid (pid_t, int*, int, struct rusage*);
 int              waitid (int, pid_t, struct siginfo_t*, int,void*);
 pid_t            __clone (int (*fn)(void*), void *child_stack, int flags, void *arg);
@@ -51,6 +51,8 @@
 int              acct (const char*  filepath);
 ssize_t          read (int, void*, size_t);
 ssize_t          write (int, const void*, size_t);
+ssize_t          __pread64 (int, void *, size_t, off_t, off_t);
+ssize_t          __pwrite64 (int, void *, size_t, off_t, off_t);
 int              __open (const char*, int, mode_t);
 int              __openat (int, const char*, int, mode_t);
 int              close (int);
@@ -124,12 +126,13 @@
 int              clock_settime (clockid_t clk_id, const struct timespec *tp);
 int              clock_getres (clockid_t clk_id, struct timespec *res);
 int              clock_nanosleep (const struct timespec *req, struct timespec *rem);
+int              getitimer (int, const struct itimerval *);
 int              setitimer (int, const struct itimerval *, struct itimerval *);
-int              timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid);
-int              timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*);
-int              timer_gettime (timer_t, struct itimerspec*);
-int              timer_getoverrun (timer_t);
-int              timer_delete (timer_t);
+int              __timer_create (clockid_t clockid, struct sigevent *evp, timer_t *timerid);
+int              __timer_settime (timer_t, int, const struct itimerspec*, struct itimerspec*);
+int              __timer_gettime (timer_t, struct itimerspec*);
+int              __timer_getoverrun (timer_t);
+int              __timer_delete (timer_t);
 int              utimes (const char*, const struct timeval tvp[2]);
 int              sigaction (int, const struct sigaction *, struct sigaction *);
 int              sigprocmask (int, const sigset_t *, sigset_t *);
@@ -153,6 +156,21 @@
 int              getsockopt (int, int, int, void *, socklen_t *);
 int              sendmsg (int, const struct msghdr *, unsigned int);
 int              recvmsg (int, struct msghdr *, unsigned int);
+int              socket (int, int, int);
+int              bind (int, struct sockaddr *, int);
+int              connect (int, struct sockaddr *, socklen_t);
+int              listen (int, int);
+int              accept (int, struct sockaddr *, socklen_t *);
+int              getsockname (int, struct sockaddr *, socklen_t *);
+int              getpeername (int, struct sockaddr *, socklen_t *);
+int              socketpair (int, int, int, int*);
+int              sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t);
+int              recvfrom (int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *);
+int              shutdown (int, int);
+int              setsockopt (int, int, int, const void *, socklen_t);
+int              getsockopt (int, int, int, void *, socklen_t *);
+int              sendmsg (int, const struct msghdr *, unsigned int);
+int              recvmsg (int, struct msghdr *, unsigned int);
 int              sched_setscheduler (pid_t pid, int policy, const struct sched_param *param);
 int              sched_getscheduler (pid_t pid);
 int              sched_yield (void);
diff --git a/libc/include/sys/socket.h b/libc/include/sys/socket.h
index 85516fe..208663e 100644
--- a/libc/include/sys/socket.h
+++ b/libc/include/sys/socket.h
@@ -42,7 +42,7 @@
 #define SOCK_PACKET      10
 
 #ifdef __i386__
-# define __socketcall extern __cdecl
+# define __socketcall extern __attribute__((__cdecl__))
 #else
 # define __socketcall extern
 #endif
diff --git a/libc/include/sys/timeb.h b/libc/include/sys/timeb.h
new file mode 100644
index 0000000..f2cc39c
--- /dev/null
+++ b/libc/include/sys/timeb.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2008 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 _SYS_TIMEB_H
+#define _SYS_TIMEB_H
+
+#include <sys/time.h>
+
+__BEGIN_DECLS
+
+struct timeb {
+    time_t          time;
+    unsigned short  millitm;
+    short           timezone;
+    short           dstflag;
+};
+
+extern int  ftime(struct timeb*  timebuf);
+
+__END_DECLS
+
+#endif /* _SYS_TIMEB_H */