syscall table patch

linas at austin.ibm.com linas at austin.ibm.com
Tue Nov 11 04:54:19 EST 2003


On Mon, Nov 10, 2003 at 09:49:15PM +1100, Paul Mackerras wrote:
>
> linas at austin.ibm.com writes:
>
> > Can someone apply the patch below, harmonizing the syscall table
> > in misc.S with the #define syscalls in unistd.h ?  Its a 'trivial'
> > patch; what it really does is to make it easier for other
> > non-mainstream kernel extensions to add new system calls
> > 'cleanly' to include/asm/unistd.h and arch/ppc64/kernel/misc.S
> > without making an ugly hash of things.
>
> Hmmm, I don't like how the patch ends up with a string of lines inside
> #if 0 and then another set of lines (for the same series of syscall
> numbers) saying sys_ni_syscall.  I would prefer that the #if 0 goes
> away and the lines inside that section be changed to look like:
>
> 	.llong	.sys_ni_syscall		/* 208, reserved for tkill */
>
> so that we don't end up with the numbers in the comments going from
> 220 to 208.

The attached patch does this.

> We also need to resync the list in 2.4 with 2.5.

The attached patch does this too, except for one change:

-#define __NR_pread             179
-#define __NR_pwrite            180
+#define __NR_pread64           179
+#define __NR_pwrite64          180

which I was nervous doing ... as these are already defined and used ...

> > Since several people commented about having a syscall table written
> > in C, I also append a 'sample' implementation in C.  There are two
> > or three things to note about this:
> >
> > -- table initialization is now done at runtime, rather than at
> >    compile time.
>
> Hmmm this will bloat the size of the kernel image, won't it?  And it
> doesn't save us any space at runtime.

Table initialization can be done at compile time; sacrificing the
two-tables-at-once intiailization (or doing the ugly preprocessor trick
mentioned in this thread.

> > -- C compiler wants function prototypes to be really happy,
> >    and this patch doesn't provide them.  Does anybody want them?
>
> That's the trouble with doing it in C.

Well, let me know if you'd want the table-in-C patch, & I'll finish it.
I'm wishy-washy, I won't argue strongly for or against it.

--linas

p.s. is there an ETA for when the marcello kernel will sync up with
the current ppc64 code?


-------------- next part --------------
Index: arch/ppc64/kernel/misc.S
===================================================================
RCS file: /home/linas/cvsroot/linux24/arch/ppc64/kernel/misc.S,v
retrieving revision 1.1.1.2
diff -u -p -u -p -r1.1.1.2 misc.S
--- arch/ppc64/kernel/misc.S	23 Oct 2003 20:07:43 -0000	1.1.1.2
+++ arch/ppc64/kernel/misc.S	10 Nov 2003 17:32:24 -0000
@@ -593,9 +593,10 @@ _GLOBAL(arch_kernel_thread)

 #ifdef CONFIG_BINFMT_ELF32
 /* Why isn't this a) automatic, b) written in 'C'? */
+/* because a) its not regular enough, b) C function protoypes needed */
 	.balign 8
 _GLOBAL(sys_call_table32)
-	.llong .sys_ni_syscall	/* 0  -  old "setup()" system call */
+	.llong .sys_ni_syscall	/* 0  -  reserved - restart_syscall */
 	.llong .sys32_exit
 	.llong .sys32_fork
 	.llong .sys_read
@@ -803,30 +804,55 @@ _GLOBAL(sys_call_table32)
 	.llong .sys_madvise		/* 205 */
 	.llong .sys_mincore		/* 206 */
 	.llong .sys_gettid		/* 207 */
-#if 0 /* Reserved syscalls */
-	.llong .sys_tkill		/* 208 */
-	.llong .sys_setxattr
-	.llong .sys_lsetxattr	/* 210 */
-	.llong .sys_fsetxattr
-	.llong .sys_getxattr
-	.llong .sys_lgetxattr
-	.llong .sys_fgetxattr
-	.llong .sys_listxattr	/* 215 */
-	.llong .sys_llistxattr
-	.llong .sys_flistxattr
-	.llong .sys_removexattr
-	.llong .sys_lremovexattr
-	.llong .sys_fremovexattr	/* 220 */
-	.llong .sys_futex
-#endif
+	.llong .sys_ni_syscall		/* 208 - reserved - .sys_tkill */
+	.llong .sys_ni_syscall		/* 209 - reserved - .sys_setxattr */
+	.llong .sys_ni_syscall		/* 210 - reserved - .sys_lsetxattr */
+	.llong .sys_ni_syscall		/* 211 - reserved - .sys_lsetxattr */
+	.llong .sys_ni_syscall		/* 212 - reserved - .sys_getxattr */
+	.llong .sys_ni_syscall		/* 213 - reserved - .sys_lgetxattr */
+	.llong .sys_ni_syscall		/* 214 - reserved - .sys_fgetxattr */
+	.llong .sys_ni_syscall		/* 215 - reserved - .sys_listxattr */
+	.llong .sys_ni_syscall		/* 216 - reserved - .sys_llistxattr */
+	.llong .sys_ni_syscall		/* 217 - reserved - .sys_flistxattr */
+	.llong .sys_ni_syscall		/* 218 - reserved - .sys_removexattr */
+	.llong .sys_ni_syscall		/* 219 - reserved - .sys_lremovexattr */
+	.llong .sys_ni_syscall		/* 220 - resreved - .sys_fremovexattr */
+	.llong .sys_ni_syscall		/* 221 - reserved - .sys_futex */
+	.llong .sys_ni_syscall		/* 222 - reserved - sched_setaffinity */
+	.llong .sys_ni_syscall		/* 223 - reserved - sched_getaffinity */
+	.llong .sys_ni_syscall		/* 224 - currently unused */
+	.llong .sys_ni_syscall		/* 225 - reserved - tuxcall */
+	.llong .sys_ni_syscall		/* 226 - reserved - sendfile64 */
+	.llong .sys_ni_syscall		/* 227 - reserved - io_setup */
+	.llong .sys_ni_syscall		/* 228 - reserved - io_destroy */
+	.llong .sys_ni_syscall		/* 229 - reserved - io_getevents */
+	.llong .sys_ni_syscall		/* 230 - reserved - io_submit */
+	.llong .sys_ni_syscall		/* 231 - reserved - io_cancel */
+	.llong .sys_ni_syscall		/* 232 - reserved - set_tid_address */
+	.llong .sys_ni_syscall		/* 233 - reserved - fadvise64 */
+	.llong .sys_ni_syscall		/* 234 - reserved - exit_group */
+	.llong .sys_ni_syscall		/* 235 - reserved - lookup_dcookie */
+	.llong .sys_ni_syscall		/* 236 - reserved - sys_epoll_create */
+	.llong .sys_ni_syscall		/* 237 - reserved - sys_epoll_ctl */
+	.llong .sys_ni_syscall		/* 238 - reserved - sys_epoll_wait */
+	.llong .sys_ni_syscall		/* 239 - reserved - remap_file_pages */
+	.llong .sys_ni_syscall		/* 240 - reserved - timer_create */
+	.llong .sys_ni_syscall		/* 241 - reserved - timer_settime */
+	.llong .sys_ni_syscall		/* 242 - reserved - timer_gettime */
+	.llong .sys_ni_syscall		/* 243 - reserved - timer_getoverrun */
+	.llong .sys_ni_syscall		/* 244 - reserved - timer_delete */
+	.llong .sys_ni_syscall		/* 245 - reserved - clock_settime */
+	.llong .sys_ni_syscall		/* 246 - reserved - clock_gettime */
+	.llong .sys_ni_syscall		/* 247 - reserved - clock_getres */
+	.llong .sys_ni_syscall		/* 248 - reserved - clock_nanosleep */
 	.llong .sys_perfmonctl   /* Put this here for now ... */
-	.rept NR_syscalls-222
+	.rept NR_syscalls-250
 		.llong .sys_ni_syscall
 	.endr
 #endif
 	.balign 8
 _GLOBAL(sys_call_table)
-	.llong .sys_ni_syscall	/* 0  -  old "setup()" system call */
+	.llong .sys_ni_syscall	/* 0  -  reserved - restart_syscall */
 	.llong .sys_exit
 	.llong .sys_fork
 	.llong .sys_read
@@ -1034,23 +1060,48 @@ _GLOBAL(sys_call_table)
 	.llong .sys_madvise		/* 205 */
 	.llong .sys_mincore		/* 206 */
 	.llong .sys_gettid		/* 207 */
-#if 0 /* Reserved syscalls */
-	.llong .sys_tkill		/* 208 */
-	.llong .sys_setxattr
-	.llong .sys_lsetxattr	/* 210 */
-	.llong .sys_fsetxattr
-	.llong .sys_getxattr
-	.llong .sys_lgetxattr
-	.llong .sys_fgetxattr
-	.llong .sys_listxattr	/* 215 */
-	.llong .sys_llistxattr
-	.llong .sys_flistxattr
-	.llong .sys_removexattr
-	.llong .sys_lremovexattr
-	.llong .sys_fremovexattr	/* 220 */
-	.llong .sys_futex
-#endif
+	.llong .sys_ni_syscall		/* 208 - reserved - .sys_tkill */
+	.llong .sys_ni_syscall		/* 209 - reserved - .sys_setxattr */
+	.llong .sys_ni_syscall		/* 210 - reserved - .sys_lsetxattr */
+	.llong .sys_ni_syscall		/* 211 - reserved - .sys_lsetxattr */
+	.llong .sys_ni_syscall		/* 212 - reserved - .sys_getxattr */
+	.llong .sys_ni_syscall		/* 213 - reserved - .sys_lgetxattr */
+	.llong .sys_ni_syscall		/* 214 - reserved - .sys_fgetxattr */
+	.llong .sys_ni_syscall		/* 215 - reserved - .sys_listxattr */
+	.llong .sys_ni_syscall		/* 216 - reserved - .sys_llistxattr */
+	.llong .sys_ni_syscall		/* 217 - reserved - .sys_flistxattr */
+	.llong .sys_ni_syscall		/* 218 - reserved - .sys_removexattr */
+	.llong .sys_ni_syscall		/* 219 - reserved - .sys_lremovexattr */
+	.llong .sys_ni_syscall		/* 220 - resreved - .sys_fremovexattr */
+	.llong .sys_ni_syscall		/* 221 - reserved - .sys_futex */
+	.llong .sys_ni_syscall		/* 222 - reserved - sched_setaffinity */
+	.llong .sys_ni_syscall		/* 223 - reserved - sched_getaffinity */
+	.llong .sys_ni_syscall		/* 224 - currently unused */
+	.llong .sys_ni_syscall		/* 225 - reserved - tuxcall */
+	.llong .sys_ni_syscall		/* 226 - reserved - sendfile64 */
+	.llong .sys_ni_syscall		/* 227 - reserved - io_setup */
+	.llong .sys_ni_syscall		/* 228 - reserved - io_destroy */
+	.llong .sys_ni_syscall		/* 229 - reserved - io_getevents */
+	.llong .sys_ni_syscall		/* 230 - reserved - io_submit */
+	.llong .sys_ni_syscall		/* 231 - reserved - io_cancel */
+	.llong .sys_ni_syscall		/* 232 - reserved - set_tid_address */
+	.llong .sys_ni_syscall		/* 233 - reserved - fadvise64 */
+	.llong .sys_ni_syscall		/* 234 - reserved - exit_group */
+	.llong .sys_ni_syscall		/* 235 - reserved - lookup_dcookie */
+	.llong .sys_ni_syscall		/* 236 - reserved - sys_epoll_create */
+	.llong .sys_ni_syscall		/* 237 - reserved - sys_epoll_ctl */
+	.llong .sys_ni_syscall		/* 238 - reserved - sys_epoll_wait */
+	.llong .sys_ni_syscall		/* 239 - reserved - remap_file_pages */
+	.llong .sys_ni_syscall		/* 240 - reserved - timer_create */
+	.llong .sys_ni_syscall		/* 241 - reserved - timer_settime */
+	.llong .sys_ni_syscall		/* 242 - reserved - timer_gettime */
+	.llong .sys_ni_syscall		/* 243 - reserved - timer_getoverrun */
+	.llong .sys_ni_syscall		/* 244 - reserved - timer_delete */
+	.llong .sys_ni_syscall		/* 245 - reserved - clock_settime */
+	.llong .sys_ni_syscall		/* 246 - reserved - clock_gettime */
+	.llong .sys_ni_syscall		/* 247 - reserved - clock_getres */
+	.llong .sys_ni_syscall		/* 248 - reserved - clock_nanosleep */
 	.llong .sys_perfmonctl   /* Put this here for now ... */
-	.rept NR_syscalls-222
+	.rept NR_syscalls-250
 	.llong .sys_ni_syscall
 	.endr
Index: include/asm-ppc64/unistd.h
===================================================================
RCS file: /home/linas/cvsroot/linux24/include/asm-ppc64/unistd.h,v
retrieving revision 1.1.1.2
diff -u -p -u -p -r1.1.1.2 unistd.h
--- include/asm-ppc64/unistd.h	23 Oct 2003 20:11:14 -0000	1.1.1.2
+++ include/asm-ppc64/unistd.h	10 Nov 2003 17:21:07 -0000
@@ -9,7 +9,7 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
-
+#define __NR_restart_syscall	  0
 #define __NR_exit		  1
 #define __NR_fork		  2
 #define __NR_read		  3
@@ -233,7 +233,7 @@
 #define __NR_futex		221
 #define __NR_sched_setaffinity	222
 #define __NR_sched_getaffinity	223
-#define __NR_security		224
+/* 224 currently unused */
 #define __NR_tuxcall		225
 #define __NR_sendfile64		226
 #define __NR_io_setup		227
@@ -241,9 +241,28 @@
 #define __NR_io_getevents	229
 #define __NR_io_submit		230
 #define __NR_io_cancel		231
-#define __NR_alloc_hugepages	232
-#define __NR_free_hugepages	233
+#define __NR_set_tid_address	232
+#define __NR_fadvise64		233
 #define __NR_exit_group		234
+#define __NR_lookup_dcookie	235
+#define __NR_sys_epoll_create	236
+#define __NR_sys_epoll_ctl	237
+#define __NR_sys_epoll_wait	238
+#define __NR_remap_file_pages	239
+#define __NR_timer_create	240
+#define __NR_timer_settime	241
+#define __NR_timer_gettime	242
+#define __NR_timer_getoverrun	243
+#define __NR_timer_delete	244
+#define __NR_clock_settime	245
+#define __NR_clock_gettime	246
+#define __NR_clock_getres	247
+#define __NR_clock_nanosleep	248
+
+#define __NR_syscalls		249
+#ifdef __KERNEL__
+#define NR_syscalls    __NR_syscalls
+#endif

 #define __NR(n)	#n



More information about the Linuxppc64-dev mailing list