diff --git a/include/asm/segment.h b/include/asm/segment.h index faf0d1b45cb79125fb097edf7b9736e6a73d1eb6..fe41e78b0b60404cff7164768d11f0f654bd9079 100644 --- a/include/asm/segment.h +++ b/include/asm/segment.h @@ -5,6 +5,8 @@ inline unsigned char get_fs_byte(const char * addr); inline void put_fs_byte(char val,char *addr); +inline void put_fs_word(short val, short * addr) ; + inline unsigned long get_fs_long(const unsigned long *addr) ; inline void put_fs_long(unsigned long val,unsigned long * addr) ; diff --git a/include/linux/sys.h b/include/linux/sys.h index b5b5dcce477e0737697dc57d957cc5ae33a80470..b341c0e97e88c7799edd721051bcdc2b0340cc30 100644 --- a/include/linux/sys.h +++ b/include/linux/sys.h @@ -78,7 +78,7 @@ extern int sys_sigaction(); //extern int sys_getrusage(); extern int sys_gettimeofday(); //extern int sys_settimeofday(); -//extern int sys_getgroups(); +extern int sys_getgroups(); //extern int sys_setgroups(); //extern int sys_select(); //extern int sys_symlink(); @@ -177,7 +177,7 @@ fn_ptr sys_call_table[] = { 0, // sys_getrusage, sys_gettimeofday, 0, // sys_settimeofday, - 0, // sys_getgroups, + sys_getgroups, 0, // sys_setgroups, 0, // sys_select, 0, // sys_symlink, diff --git a/include/unistd.h b/include/unistd.h index de156418f1ff74661643d840e57311b671ff55f6..ced7413dc606c4c5844938fd76bea71e7a31ed18 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -161,6 +161,7 @@ int execve(const char * filename, char ** argv, char ** envp); int fcntl(int fildes, int cmd, ...); int fork(); int fstat(); +int getgroups(int gidsetlen, gid_t *gidset); int gettimeofday(struct timeval *tv, struct timezone *tz); int setup(void *BIOS); int sync(); diff --git a/kernel/printk.c b/kernel/printk.c index 17ddc4dcb128cdb9e8df4f3bcc2e411a946b711b..c6f851063fe76cc0e7cb6aa1396a612301600bbe 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -31,7 +31,7 @@ int printk(const char* fmt, ...) { void print_sys(int index) { int i; - int filter[] = {3, 4, 5, 6, 18, 29, 45, 48, 54}; + int filter[] = {3, 4, 5, 6, 18, 29, 45, 48, 54, 80}; for (i = 0; i < sizeof(filter) / sizeof(int); i++) { if (index == filter[i]) diff --git a/kernel/segment.c b/kernel/segment.c index 35b941491563007ed90e755ab7f1a0ade58b7f68..54dd69e184c728925cf42bd9b7ee6880933a25ef 100644 --- a/kernel/segment.c +++ b/kernel/segment.c @@ -10,6 +10,10 @@ inline void put_fs_byte(char val,char *addr) { __asm__ ("movb %0,%%fs:%1"::"r" (val),"m" (*addr)); } +inline void put_fs_word(short val, short *addr) { + __asm__ ("movw %0,%%fs:%1"::"r" (val),"m" (*addr)); +} + inline unsigned long get_fs_long(const unsigned long *addr) { unsigned long _v; __asm__ ("movl %%fs:%1,%0":"=r" (_v):"m" (*addr)); diff --git a/kernel/sys.c b/kernel/sys.c index 09e448013df29622a4b3a017bd2b02ae621e6ed1..b0b89b8d5976c74191c4959adf8c401f8eca209b 100644 --- a/kernel/sys.c +++ b/kernel/sys.c @@ -130,6 +130,21 @@ int sys_ulimit() { return -ENOSYS; } +int sys_getgroups(int gidsetsize, gid_t *grouplist) { + int i; + if (gidsetsize) + verify_area(grouplist, sizeof(gid_t) * gidsetsize); + for (i = 0; (i < NGROUPS) && (current->groups[i] != NOGROUP); + i++, grouplist++) { + if (gidsetsize) { + if (i >= gidsetsize) + return -EINVAL; + put_fs_word(current->groups[i], (short *) grouplist); + } + } + return i; +} + int sys_brk(unsigned long end_data_seg) { if (end_data_seg >= current->end_code && end_data_seg < current->start_stack - 16384)