Add getsid system call to bionic

Add getsid() system call to bionic for
all architectures. This is needed for various tools
(e.g. perf).

Adding the getsid system call was done in 3 steps:
() add getsid system call (function name and syscall
number) to libc/SYSCALLS.TXT
() generate all necessary headers by calling
libc/tools/gensyscalls.py. This patch is adding
the generated files since the build system
does not call gensyscalls.py.
() add the system call signature to libc/include/unistd.h

Change-Id: Id69a257e13ec02e1a44085a6b217a3f19ab025b1
Signed-off-by: Irina Tirdea <irina.tirdea@intel.com>
This commit is contained in:
Irina Tirdea 2012-08-29 11:48:35 +03:00
parent 8b4e8a937b
commit 1ad10a566e
9 changed files with 65 additions and 1 deletions

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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__

View File

@ -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);