diff options
author | Christoph Hellwig <hch@lst.de> | 2006-01-09 23:52:08 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-10 11:01:32 -0500 |
commit | 3a0f69d59ba41fbcad6a17b6e8aab02bf45e20ce (patch) | |
tree | 8ba042dda77490f574f2c46bd038fd99a7f977e4 /arch | |
parent | f042e0f80b0a9f5bb57c36d60a2798de6ca943b2 (diff) |
[PATCH] common compat_sys_timer_create
The comment in compat.c is wrong, every architecture provides a
get_compat_sigevent() for the IPC compat code already.
This basically moves the x86_64 version to common code and removes all the
others.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Paul Mackerras <paulus@samba.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Acked-by: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/ia64/ia32/ia32_entry.S | 2 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 28 | ||||
-rw-r--r-- | arch/powerpc/kernel/sys_ppc32.c | 32 | ||||
-rw-r--r-- | arch/powerpc/kernel/systbl.S | 2 | ||||
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 32 | ||||
-rw-r--r-- | arch/s390/kernel/compat_wrapper.S | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/sys_sparc32.c | 36 | ||||
-rw-r--r-- | arch/sparc64/kernel/systbls.S | 2 | ||||
-rw-r--r-- | arch/x86_64/ia32/ia32entry.S | 2 | ||||
-rw-r--r-- | arch/x86_64/ia32/sys_ia32.c | 19 |
10 files changed, 5 insertions, 152 deletions
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S index 494fad6bf37..95fe04400f6 100644 --- a/arch/ia64/ia32/ia32_entry.S +++ b/arch/ia64/ia32/ia32_entry.S | |||
@@ -469,7 +469,7 @@ ia32_syscall_table: | |||
469 | data8 sys32_epoll_wait | 469 | data8 sys32_epoll_wait |
470 | data8 sys_remap_file_pages | 470 | data8 sys_remap_file_pages |
471 | data8 sys_set_tid_address | 471 | data8 sys_set_tid_address |
472 | data8 sys32_timer_create | 472 | data8 compat_sys_timer_create |
473 | data8 compat_sys_timer_settime /* 260 */ | 473 | data8 compat_sys_timer_settime /* 260 */ |
474 | data8 compat_sys_timer_gettime | 474 | data8 compat_sys_timer_gettime |
475 | data8 sys_timer_getoverrun | 475 | data8 sys_timer_getoverrun |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 9f8e8d55887..5ea38286d8d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -2553,34 +2553,6 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info) | |||
2553 | return 0; | 2553 | return 0; |
2554 | } | 2554 | } |
2555 | 2555 | ||
2556 | asmlinkage long | ||
2557 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id) | ||
2558 | { | ||
2559 | struct sigevent se; | ||
2560 | mm_segment_t oldfs; | ||
2561 | timer_t t; | ||
2562 | long err; | ||
2563 | |||
2564 | if (se32 == NULL) | ||
2565 | return sys_timer_create(clock, NULL, timer_id); | ||
2566 | |||
2567 | if (get_compat_sigevent(&se, se32)) | ||
2568 | return -EFAULT; | ||
2569 | |||
2570 | if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t))) | ||
2571 | return -EFAULT; | ||
2572 | |||
2573 | oldfs = get_fs(); | ||
2574 | set_fs(KERNEL_DS); | ||
2575 | err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t); | ||
2576 | set_fs(oldfs); | ||
2577 | |||
2578 | if (!err) | ||
2579 | err = __put_user (t, timer_id); | ||
2580 | |||
2581 | return err; | ||
2582 | } | ||
2583 | |||
2584 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, | 2556 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, |
2585 | __u32 len_low, __u32 len_high, int advice) | 2557 | __u32 len_low, __u32 len_high, int advice) |
2586 | { | 2558 | { |
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c index 9c921d1c408..0ee44be4ab7 100644 --- a/arch/powerpc/kernel/sys_ppc32.c +++ b/arch/powerpc/kernel/sys_ppc32.c | |||
@@ -956,38 +956,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low, | |||
956 | advice); | 956 | advice); |
957 | } | 957 | } |
958 | 958 | ||
959 | long ppc32_timer_create(clockid_t clock, | ||
960 | struct compat_sigevent __user *ev32, | ||
961 | timer_t __user *timer_id) | ||
962 | { | ||
963 | sigevent_t event; | ||
964 | timer_t t; | ||
965 | long err; | ||
966 | mm_segment_t savefs; | ||
967 | |||
968 | if (ev32 == NULL) | ||
969 | return sys_timer_create(clock, NULL, timer_id); | ||
970 | |||
971 | if (get_compat_sigevent(&event, ev32)) | ||
972 | return -EFAULT; | ||
973 | |||
974 | if (!access_ok(VERIFY_WRITE, timer_id, sizeof(timer_t))) | ||
975 | return -EFAULT; | ||
976 | |||
977 | savefs = get_fs(); | ||
978 | set_fs(KERNEL_DS); | ||
979 | /* The __user pointer casts are valid due to the set_fs() */ | ||
980 | err = sys_timer_create(clock, | ||
981 | (sigevent_t __user *) &event, | ||
982 | (timer_t __user *) &t); | ||
983 | set_fs(savefs); | ||
984 | |||
985 | if (err == 0) | ||
986 | err = __put_user(t, timer_id); | ||
987 | |||
988 | return err; | ||
989 | } | ||
990 | |||
991 | asmlinkage long compat_sys_add_key(const char __user *_type, | 959 | asmlinkage long compat_sys_add_key(const char __user *_type, |
992 | const char __user *_description, | 960 | const char __user *_description, |
993 | const void __user *_payload, | 961 | const void __user *_payload, |
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S index 65463a1076e..dd2ab85e351 100644 --- a/arch/powerpc/kernel/systbl.S +++ b/arch/powerpc/kernel/systbl.S | |||
@@ -281,7 +281,7 @@ SYSCALL(epoll_create) | |||
281 | SYSCALL(epoll_ctl) | 281 | SYSCALL(epoll_ctl) |
282 | SYSCALL(epoll_wait) | 282 | SYSCALL(epoll_wait) |
283 | SYSCALL(remap_file_pages) | 283 | SYSCALL(remap_file_pages) |
284 | SYSX(sys_timer_create,ppc32_timer_create,sys_timer_create) | 284 | SYSX(sys_timer_create,compat_sys_timer_create,sys_timer_create) |
285 | COMPAT_SYS(timer_settime) | 285 | COMPAT_SYS(timer_settime) |
286 | COMPAT_SYS(timer_gettime) | 286 | COMPAT_SYS(timer_gettime) |
287 | SYSCALL(timer_getoverrun) | 287 | SYSCALL(timer_getoverrun) |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 41b197a3f3a..cd3b3c3e7a9 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -1014,38 +1014,6 @@ asmlinkage long sys32_clone(struct pt_regs regs) | |||
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | /* | 1016 | /* |
1017 | * Wrapper function for sys_timer_create. | ||
1018 | */ | ||
1019 | extern asmlinkage long | ||
1020 | sys_timer_create(clockid_t, struct sigevent *, timer_t *); | ||
1021 | |||
1022 | asmlinkage long | ||
1023 | sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32, | ||
1024 | timer_t *timer_id) | ||
1025 | { | ||
1026 | struct sigevent se; | ||
1027 | timer_t ktimer_id; | ||
1028 | mm_segment_t old_fs; | ||
1029 | long ret; | ||
1030 | |||
1031 | if (se32 == NULL) | ||
1032 | return sys_timer_create(which_clock, NULL, timer_id); | ||
1033 | |||
1034 | if (get_compat_sigevent(&se, se32)) | ||
1035 | return -EFAULT; | ||
1036 | |||
1037 | old_fs = get_fs(); | ||
1038 | set_fs(KERNEL_DS); | ||
1039 | ret = sys_timer_create(which_clock, &se, &ktimer_id); | ||
1040 | set_fs(old_fs); | ||
1041 | |||
1042 | if (!ret) | ||
1043 | ret = put_user (ktimer_id, timer_id); | ||
1044 | |||
1045 | return ret; | ||
1046 | } | ||
1047 | |||
1048 | /* | ||
1049 | * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. | 1017 | * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. |
1050 | * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} | 1018 | * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} |
1051 | * because the 31 bit values differ from the 64 bit values. | 1019 | * because the 31 bit values differ from the 64 bit values. |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 23fe94e5868..cfde1905d07 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1289,7 +1289,7 @@ sys32_timer_create_wrapper: | |||
1289 | lgfr %r2,%r2 # timer_t (int) | 1289 | lgfr %r2,%r2 # timer_t (int) |
1290 | llgtr %r3,%r3 # struct compat_sigevent * | 1290 | llgtr %r3,%r3 # struct compat_sigevent * |
1291 | llgtr %r4,%r4 # timer_t * | 1291 | llgtr %r4,%r4 # timer_t * |
1292 | jg sys32_timer_create | 1292 | jg compat_sys_timer_create |
1293 | 1293 | ||
1294 | .globl sys32_timer_settime_wrapper | 1294 | .globl sys32_timer_settime_wrapper |
1295 | sys32_timer_settime_wrapper: | 1295 | sys32_timer_settime_wrapper: |
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c index 7f6239ed252..de342ee3116 100644 --- a/arch/sparc64/kernel/sys_sparc32.c +++ b/arch/sparc64/kernel/sys_sparc32.c | |||
@@ -1120,39 +1120,3 @@ long sys32_lookup_dcookie(unsigned long cookie_high, | |||
1120 | return sys_lookup_dcookie((cookie_high << 32) | cookie_low, | 1120 | return sys_lookup_dcookie((cookie_high << 32) | cookie_low, |
1121 | buf, len); | 1121 | buf, len); |
1122 | } | 1122 | } |
1123 | |||
1124 | extern asmlinkage long | ||
1125 | sys_timer_create(clockid_t which_clock, | ||
1126 | struct sigevent __user *timer_event_spec, | ||
1127 | timer_t __user *created_timer_id); | ||
1128 | |||
1129 | long | ||
1130 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, | ||
1131 | timer_t __user *timer_id) | ||
1132 | { | ||
1133 | struct sigevent se; | ||
1134 | mm_segment_t oldfs; | ||
1135 | timer_t t; | ||
1136 | long err; | ||
1137 | |||
1138 | if (se32 == NULL) | ||
1139 | return sys_timer_create(clock, NULL, timer_id); | ||
1140 | |||
1141 | if (get_compat_sigevent(&se, se32)) | ||
1142 | return -EFAULT; | ||
1143 | |||
1144 | if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t))) | ||
1145 | return -EFAULT; | ||
1146 | |||
1147 | oldfs = get_fs(); | ||
1148 | set_fs(KERNEL_DS); | ||
1149 | err = sys_timer_create(clock, | ||
1150 | (struct sigevent __user *) &se, | ||
1151 | (timer_t __user *) &t); | ||
1152 | set_fs(oldfs); | ||
1153 | |||
1154 | if (!err) | ||
1155 | err = __put_user (t, timer_id); | ||
1156 | |||
1157 | return err; | ||
1158 | } | ||
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index 53eaf2345fe..37e9acc9e58 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S | |||
@@ -73,7 +73,7 @@ sys_call_table32: | |||
73 | /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl | 73 | /*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl |
74 | .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep | 74 | .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep |
75 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun | 75 | /*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun |
76 | .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy | 76 | .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy |
77 | /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink | 77 | /*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink |
78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid | 78 | .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid |
79 | /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl | 79 | /*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl |
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S index 1f0ff5adc80..2ff07b47ea9 100644 --- a/arch/x86_64/ia32/ia32entry.S +++ b/arch/x86_64/ia32/ia32entry.S | |||
@@ -608,7 +608,7 @@ ia32_sys_call_table: | |||
608 | .quad sys_epoll_wait | 608 | .quad sys_epoll_wait |
609 | .quad sys_remap_file_pages | 609 | .quad sys_remap_file_pages |
610 | .quad sys_set_tid_address | 610 | .quad sys_set_tid_address |
611 | .quad sys32_timer_create | 611 | .quad compat_sys_timer_create |
612 | .quad compat_sys_timer_settime /* 260 */ | 612 | .quad compat_sys_timer_settime /* 260 */ |
613 | .quad compat_sys_timer_gettime | 613 | .quad compat_sys_timer_gettime |
614 | .quad sys_timer_getoverrun | 614 | .quad sys_timer_getoverrun |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 5389df610e7..54481af5344 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -969,25 +969,6 @@ long sys32_kill(int pid, int sig) | |||
969 | return sys_kill(pid, sig); | 969 | return sys_kill(pid, sig); |
970 | } | 970 | } |
971 | 971 | ||
972 | extern asmlinkage long | ||
973 | sys_timer_create(clockid_t which_clock, | ||
974 | struct sigevent __user *timer_event_spec, | ||
975 | timer_t __user * created_timer_id); | ||
976 | |||
977 | long | ||
978 | sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id) | ||
979 | { | ||
980 | struct sigevent __user *p = NULL; | ||
981 | if (se32) { | ||
982 | struct sigevent se; | ||
983 | p = compat_alloc_user_space(sizeof(struct sigevent)); | ||
984 | if (get_compat_sigevent(&se, se32) || | ||
985 | copy_to_user(p, &se, sizeof(se))) | ||
986 | return -EFAULT; | ||
987 | } | ||
988 | return sys_timer_create(clock, p, timer_id); | ||
989 | } | ||
990 | |||
991 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, | 972 | long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, |
992 | __u32 len_low, __u32 len_high, int advice) | 973 | __u32 len_low, __u32 len_high, int advice) |
993 | { | 974 | { |