]> err.no Git - linux-2.6/commitdiff
[PATCH] common compat_sys_timer_create
authorChristoph Hellwig <hch@lst.de>
Tue, 10 Jan 2006 04:52:08 +0000 (20:52 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 10 Jan 2006 16:01:32 +0000 (08:01 -0800)
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>
arch/ia64/ia32/ia32_entry.S
arch/ia64/ia32/sys_ia32.c
arch/powerpc/kernel/sys_ppc32.c
arch/powerpc/kernel/systbl.S
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_wrapper.S
arch/sparc64/kernel/sys_sparc32.c
arch/sparc64/kernel/systbls.S
arch/x86_64/ia32/ia32entry.S
arch/x86_64/ia32/sys_ia32.c
kernel/compat.c

index 494fad6bf376dfdc845b2c25f3dcdfb40a02ac93..95fe04400f6b65f7cfe10eb5a6c0fac95cf9e51f 100644 (file)
@@ -469,7 +469,7 @@ ia32_syscall_table:
        data8 sys32_epoll_wait
        data8 sys_remap_file_pages
        data8 sys_set_tid_address
-       data8 sys32_timer_create
+       data8 compat_sys_timer_create
        data8 compat_sys_timer_settime  /* 260 */
        data8 compat_sys_timer_gettime
        data8 sys_timer_getoverrun
index 9f8e8d5588731066475d8dc235a3f8bc7d608e34..5ea38286d8d5856dc5005a4f159295c834322f9c 100644 (file)
@@ -2553,34 +2553,6 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info)
        return 0;
 }
 
-asmlinkage long
-sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id)
-{
-       struct sigevent se;
-       mm_segment_t oldfs;
-       timer_t t;
-       long err;
-
-       if (se32 == NULL)
-               return sys_timer_create(clock, NULL, timer_id);
-
-       if (get_compat_sigevent(&se, se32))
-               return -EFAULT;
-
-       if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t);
-       set_fs(oldfs);
-
-       if (!err)
-               err = __put_user (t, timer_id);
-
-       return err;
-}
-
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
                        __u32 len_low, __u32 len_high, int advice)
 { 
index 9c921d1c4084484b186249eed4ab7daa2e9ce550..0ee44be4ab730228925883a4db260fb6f8c744db 100644 (file)
@@ -956,38 +956,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
                             advice);
 }
 
-long ppc32_timer_create(clockid_t clock,
-                       struct compat_sigevent __user *ev32,
-                       timer_t __user *timer_id)
-{
-       sigevent_t event;
-       timer_t t;
-       long err;
-       mm_segment_t savefs;
-
-       if (ev32 == NULL)
-               return sys_timer_create(clock, NULL, timer_id);
-
-       if (get_compat_sigevent(&event, ev32))
-               return -EFAULT;
-
-       if (!access_ok(VERIFY_WRITE, timer_id, sizeof(timer_t)))
-               return -EFAULT;
-
-       savefs = get_fs();
-       set_fs(KERNEL_DS);
-       /* The __user pointer casts are valid due to the set_fs() */
-       err = sys_timer_create(clock,
-               (sigevent_t __user *) &event,
-               (timer_t __user *) &t);
-       set_fs(savefs);
-
-       if (err == 0)
-               err = __put_user(t, timer_id);
-
-       return err;
-}
-
 asmlinkage long compat_sys_add_key(const char __user *_type,
                              const char __user *_description,
                              const void __user *_payload,
index 65463a1076e8afc5e3abbe3e17726784ad27fb43..dd2ab85e3513112d5842a1dbb8628f8e3aeac006 100644 (file)
@@ -281,7 +281,7 @@ SYSCALL(epoll_create)
 SYSCALL(epoll_ctl)
 SYSCALL(epoll_wait)
 SYSCALL(remap_file_pages)
-SYSX(sys_timer_create,ppc32_timer_create,sys_timer_create)
+SYSX(sys_timer_create,compat_sys_timer_create,sys_timer_create)
 COMPAT_SYS(timer_settime)
 COMPAT_SYS(timer_gettime)
 SYSCALL(timer_getoverrun)
index 41b197a3f3a390c58fcac826dd20f2dfc482f910..cd3b3c3e7a9fe9438c423db548214337d01206af 100644 (file)
@@ -1013,38 +1013,6 @@ asmlinkage long sys32_clone(struct pt_regs regs)
                       parent_tidptr, child_tidptr);
 }
 
-/*
- * Wrapper function for sys_timer_create.
- */
-extern asmlinkage long
-sys_timer_create(clockid_t, struct sigevent *, timer_t *);
-
-asmlinkage long
-sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32,
-               timer_t *timer_id)
-{
-       struct sigevent se;
-       timer_t ktimer_id;
-       mm_segment_t old_fs;
-       long ret;
-
-       if (se32 == NULL)
-               return sys_timer_create(which_clock, NULL, timer_id);
-
-       if (get_compat_sigevent(&se, se32))
-               return -EFAULT;
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       ret = sys_timer_create(which_clock, &se, &ktimer_id);
-       set_fs(old_fs);
-
-       if (!ret)
-               ret = put_user (ktimer_id, timer_id);
-
-       return ret;
-}
-
 /*
  * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64.
  * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE}
index 23fe94e58688ec4d6659f16fa06287ac6e8cb174..cfde1905d07d77c5d2513e14a3c019e1d56f01d6 100644 (file)
@@ -1289,7 +1289,7 @@ sys32_timer_create_wrapper:
        lgfr    %r2,%r2                 # timer_t (int)
        llgtr   %r3,%r3                 # struct compat_sigevent *
        llgtr   %r4,%r4                 # timer_t *
-       jg      sys32_timer_create
+       jg      compat_sys_timer_create
 
        .globl  sys32_timer_settime_wrapper
 sys32_timer_settime_wrapper:
index 7f6239ed252142e52c45f2921de58b339d770086..de342ee3116b05b5412e4e91e01815805872e15e 100644 (file)
@@ -1120,39 +1120,3 @@ long sys32_lookup_dcookie(unsigned long cookie_high,
        return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
                                  buf, len);
 }
-
-extern asmlinkage long
-sys_timer_create(clockid_t which_clock,
-                struct sigevent __user *timer_event_spec,
-                timer_t __user *created_timer_id);
-
-long
-sys32_timer_create(u32 clock, struct compat_sigevent __user *se32,
-                  timer_t __user *timer_id)
-{
-       struct sigevent se;
-       mm_segment_t oldfs;
-       timer_t t;
-       long err;
-
-       if (se32 == NULL)
-               return sys_timer_create(clock, NULL, timer_id);
-
-       if (get_compat_sigevent(&se, se32))
-               return -EFAULT;
-
-       if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
-               return -EFAULT;
-
-       oldfs = get_fs();
-       set_fs(KERNEL_DS);
-       err = sys_timer_create(clock,
-                              (struct sigevent __user *) &se,
-                              (timer_t __user *) &t);
-       set_fs(oldfs);
-
-       if (!err)
-               err = __put_user (t, timer_id);
-
-       return err;
-}
index 53eaf2345fe97aa01aeaab2b528a64c6bfd39b2e..37e9acc9e58740d5307cee3dcba670bdabc77f42 100644 (file)
@@ -73,7 +73,7 @@ sys_call_table32:
 /*250*/        .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
        .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
 /*260*/        .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
-       .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
+       .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
 /*270*/        .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
        .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
 /*280*/        .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl
index 1f0ff5adc80e1b0babda930850aa29eb16e4bab0..2ff07b47ea9cfe99318f90663ba601287e36c52d 100644 (file)
@@ -608,7 +608,7 @@ ia32_sys_call_table:
        .quad sys_epoll_wait
        .quad sys_remap_file_pages
        .quad sys_set_tid_address
-       .quad sys32_timer_create
+       .quad compat_sys_timer_create
        .quad compat_sys_timer_settime  /* 260 */
        .quad compat_sys_timer_gettime
        .quad sys_timer_getoverrun
index 5389df610e78277d0a6329f98a16d3f1f52c27d0..54481af5344ab2c19be4427fa1c576bd17b2a5e7 100644 (file)
@@ -969,25 +969,6 @@ long sys32_kill(int pid, int sig)
        return sys_kill(pid, sig);
 }
  
-extern asmlinkage long
-sys_timer_create(clockid_t which_clock,
-                struct sigevent __user *timer_event_spec,
-                timer_t __user * created_timer_id);
-
-long
-sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id)
-{
-       struct sigevent __user *p = NULL;
-       if (se32) { 
-               struct sigevent se;
-               p = compat_alloc_user_space(sizeof(struct sigevent));
-               if (get_compat_sigevent(&se, se32) ||
-                   copy_to_user(p, &se, sizeof(se)))
-                       return -EFAULT;
-       } 
-       return sys_timer_create(clock, p, timer_id);
-} 
-
 long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 
                        __u32 len_low, __u32 len_high, int advice)
 { 
index 102296e21ea86671f10fb922acf67feb81b22b1e..256e5d9f06470480283a04cfc8f5f15e8113b30a 100644 (file)
@@ -514,6 +514,24 @@ static int put_compat_itimerspec(struct compat_itimerspec __user *dst,
        return 0;
 } 
 
+long compat_sys_timer_create(clockid_t which_clock,
+                       struct compat_sigevent __user *timer_event_spec,
+                       timer_t __user *created_timer_id)
+{
+       struct sigevent __user *event = NULL;
+
+       if (timer_event_spec) {
+               struct sigevent kevent;
+
+               event = compat_alloc_user_space(sizeof(*event));
+               if (get_compat_sigevent(&kevent, timer_event_spec) ||
+                   copy_to_user(event, &kevent, sizeof(*event)))
+                       return -EFAULT;
+       }
+
+       return sys_timer_create(which_clock, event, created_timer_id);
+}
+
 long compat_sys_timer_settime(timer_t timer_id, int flags,
                          struct compat_itimerspec __user *new, 
                          struct compat_itimerspec __user *old)
@@ -649,8 +667,6 @@ int get_compat_sigevent(struct sigevent *event,
                ? -EFAULT : 0;
 }
 
-/* timer_create is architecture specific because it needs sigevent conversion */
-
 long compat_get_bitmap(unsigned long *mask, compat_ulong_t __user *umask,
                       unsigned long bitmap_size)
 {