diff options
-rw-r--r-- | libc/SYSCALLS.TXT | 1 | ||||
-rw-r--r-- | libc/arch-arm/syscalls.mk | 1 | ||||
-rw-r--r-- | libc/arch-arm/syscalls/getsid.S | 14 | ||||
-rw-r--r-- | libc/arch-mips/syscalls.mk | 1 | ||||
-rw-r--r-- | libc/arch-mips/syscalls/getsid.S | 22 | ||||
-rw-r--r-- | libc/arch-x86/syscalls.mk | 1 | ||||
-rw-r--r-- | libc/arch-x86/syscalls/getsid.S | 23 | ||||
-rw-r--r-- | libc/include/sys/linux-syscalls.h | 1 | ||||
-rw-r--r-- | libc/include/termios.h | 5 | ||||
-rw-r--r-- | libc/include/unistd.h | 2 | ||||
-rw-r--r-- | libc/upstream-dlmalloc/malloc.c | 12 | ||||
-rw-r--r-- | tests/Android.mk | 6 |
12 files changed, 85 insertions, 4 deletions
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index 6f12be87f..26673e61a 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -62,6 +62,7 @@ int getgroups:getgroups32(int, gid_t *) 205,205,-1 int getgroups:getgroups(int, gid_t *) -1,-1,80 pid_t getpgid(pid_t) 132 pid_t getppid() 64 +pid_t getsid(pid_t) 147 pid_t setsid() 66 int setgid:setgid32(gid_t) 214,214,-1 int setgid:setgid(gid_t) -1,-1,46 diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk index b1c669df8..565c2bdfb 100644 --- a/libc/arch-arm/syscalls.mk +++ b/libc/arch-arm/syscalls.mk @@ -18,6 +18,7 @@ syscall_src += arch-arm/syscalls/readahead.S syscall_src += arch-arm/syscalls/getgroups.S syscall_src += arch-arm/syscalls/getpgid.S syscall_src += arch-arm/syscalls/getppid.S +syscall_src += arch-arm/syscalls/getsid.S syscall_src += arch-arm/syscalls/setsid.S syscall_src += arch-arm/syscalls/setgid.S syscall_src += arch-arm/syscalls/__setreuid.S diff --git a/libc/arch-arm/syscalls/getsid.S b/libc/arch-arm/syscalls/getsid.S new file mode 100644 index 000000000..856d41a5c --- /dev/null +++ b/libc/arch-arm/syscalls/getsid.S @@ -0,0 +1,14 @@ +/* autogenerated by gensyscalls.py */ +#include <machine/asm.h> +#include <sys/linux-syscalls.h> + +ENTRY(getsid) + .save {r4, r7} + stmfd sp!, {r4, r7} + ldr r7, =__NR_getsid + swi #0 + ldmfd sp!, {r4, r7} + movs r0, r0 + bxpl lr + b __set_syscall_errno +END(getsid) diff --git a/libc/arch-mips/syscalls.mk b/libc/arch-mips/syscalls.mk index 6de0c8fb0..51fd32df5 100644 --- a/libc/arch-mips/syscalls.mk +++ b/libc/arch-mips/syscalls.mk @@ -19,6 +19,7 @@ syscall_src += arch-mips/syscalls/readahead.S syscall_src += arch-mips/syscalls/getgroups.S syscall_src += arch-mips/syscalls/getpgid.S syscall_src += arch-mips/syscalls/getppid.S +syscall_src += arch-mips/syscalls/getsid.S syscall_src += arch-mips/syscalls/setsid.S syscall_src += arch-mips/syscalls/setgid.S syscall_src += arch-mips/syscalls/__setreuid.S diff --git a/libc/arch-mips/syscalls/getsid.S b/libc/arch-mips/syscalls/getsid.S new file mode 100644 index 000000000..2c089acc4 --- /dev/null +++ b/libc/arch-mips/syscalls/getsid.S @@ -0,0 +1,22 @@ +/* autogenerated by gensyscalls.py */ +#include <sys/linux-syscalls.h> + .text + .globl getsid + .align 4 + .ent getsid + +getsid: + .set noreorder + .cpload $t9 + li $v0, __NR_getsid + syscall + bnez $a3, 1f + move $a0, $v0 + j $ra + nop +1: + la $t9,__set_errno + j $t9 + nop + .set reorder + .end getsid diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk index 235222160..623c19365 100644 --- a/libc/arch-x86/syscalls.mk +++ b/libc/arch-x86/syscalls.mk @@ -19,6 +19,7 @@ syscall_src += arch-x86/syscalls/readahead.S syscall_src += arch-x86/syscalls/getgroups.S syscall_src += arch-x86/syscalls/getpgid.S syscall_src += arch-x86/syscalls/getppid.S +syscall_src += arch-x86/syscalls/getsid.S syscall_src += arch-x86/syscalls/setsid.S syscall_src += arch-x86/syscalls/setgid.S syscall_src += arch-x86/syscalls/__setreuid.S diff --git a/libc/arch-x86/syscalls/getsid.S b/libc/arch-x86/syscalls/getsid.S new file mode 100644 index 000000000..7046b9a01 --- /dev/null +++ b/libc/arch-x86/syscalls/getsid.S @@ -0,0 +1,23 @@ +/* autogenerated by gensyscalls.py */ +#include <sys/linux-syscalls.h> + + .text + .type getsid, @function + .globl getsid + .align 4 + +getsid: + pushl %ebx + mov 8(%esp), %ebx + movl $__NR_getsid, %eax + int $0x80 + cmpl $-129, %eax + jb 1f + negl %eax + pushl %eax + call __set_errno + addl $4, %esp + orl $-1, %eax +1: + popl %ebx + ret diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h index 48564cd39..056829303 100644 --- a/libc/include/sys/linux-syscalls.h +++ b/libc/include/sys/linux-syscalls.h @@ -83,6 +83,7 @@ #define __NR_msync (__NR_SYSCALL_BASE + 144) #define __NR_readv (__NR_SYSCALL_BASE + 145) #define __NR_writev (__NR_SYSCALL_BASE + 146) +#define __NR_getsid (__NR_SYSCALL_BASE + 147) #define __NR_perf_event_open (__NR_SYSCALL_BASE + 364) #ifdef __arm__ diff --git a/libc/include/termios.h b/libc/include/termios.h index ad1908995..0d4435559 100644 --- a/libc/include/termios.h +++ b/libc/include/termios.h @@ -66,6 +66,11 @@ static __inline__ int tcflush(int fd, int __queue) return ioctl(fd, TCFLSH, (void *)(intptr_t)__queue); } +static __inline__ int tcdrain(int fd) +{ + return ioctl(fd, TCSBRK, (void *)(intptr_t)1); +} + static __inline__ pid_t tcgetsid(int fd) { pid_t _pid; diff --git a/libc/include/unistd.h b/libc/include/unistd.h index d8263fef6..a6a6dbf6f 100644 --- a/libc/include/unistd.h +++ b/libc/include/unistd.h @@ -60,6 +60,7 @@ extern int setpgid(pid_t, pid_t); extern pid_t getppid(void); extern pid_t getpgrp(void); extern int setpgrp(void); +extern pid_t getsid(pid_t); extern pid_t setsid(void); extern int execv(const char *, char * const *); @@ -192,7 +193,6 @@ extern pid_t tcgetpgrp(int fd); extern int tcsetpgrp(int fd, pid_t _pid); #if 0 /* MISSING FROM BIONIC */ -extern pid_t getsid(pid_t); extern int execvpe(const char *, char * const *, char * const *); extern int execlpe(const char *, const char *, ...); extern int getfsuid(uid_t); diff --git a/libc/upstream-dlmalloc/malloc.c b/libc/upstream-dlmalloc/malloc.c index c6a32c8c4..d951841ee 100644 --- a/libc/upstream-dlmalloc/malloc.c +++ b/libc/upstream-dlmalloc/malloc.c @@ -4064,12 +4064,20 @@ static void* sys_alloc(mstate m, size_t nb) { } asize = granularity_align(nb + SYS_ALLOC_PADDING); - if (asize <= nb) + if (asize <= nb) { + /* BEGIN android-added: set errno */ + MALLOC_FAILURE_ACTION; + /* END android-added */ return 0; /* wraparound */ + } if (m->footprint_limit != 0) { size_t fp = m->footprint + asize; - if (fp <= m->footprint || fp > m->footprint_limit) + if (fp <= m->footprint || fp > m->footprint_limit) { + /* BEGIN android-added: set errno */ + MALLOC_FAILURE_ACTION; + /* END android-added */ return 0; + } } /* diff --git a/tests/Android.mk b/tests/Android.mk index d50d4d7d9..ba1112e2d 100644 --- a/tests/Android.mk +++ b/tests/Android.mk @@ -12,7 +12,9 @@ # 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. -# Copyright The Android Open Source Project +# + +ifneq ($(BUILD_TINY_ANDROID), true) LOCAL_PATH := $(call my-dir) @@ -35,3 +37,5 @@ include $(CLEAR_VARS) LOCAL_MODULE := bionic-unit-tests-glibc LOCAL_SRC_FILES := $(test_src_files) include $(BUILD_HOST_NATIVE_TEST) + +endif # !BUILD_TINY_ANDROID |