diff options
author | Davide Libenzi <davidel@xmailserver.org> | 2008-02-05 01:27:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-05 12:44:07 -0500 |
commit | 4d672e7ac79b5ec5cdc90e450823441e20464691 (patch) | |
tree | 66da3aa0bf7f7ac80376a93f17edbb2246b2df06 /arch | |
parent | 5e05ad7d4e3b11f935998882b5d9c3b257137f1b (diff) |
timerfd: new timerfd API
This is the new timerfd API as it is implemented by the following patch:
int timerfd_create(int clockid, int flags);
int timerfd_settime(int ufd, int flags,
const struct itimerspec *utmr,
struct itimerspec *otmr);
int timerfd_gettime(int ufd, struct itimerspec *otmr);
The timerfd_create() API creates an un-programmed timerfd fd. The "clockid"
parameter can be either CLOCK_MONOTONIC or CLOCK_REALTIME.
The timerfd_settime() API give new settings by the timerfd fd, by optionally
retrieving the previous expiration time (in case the "otmr" parameter is not
NULL).
The time value specified in "utmr" is absolute, if the TFD_TIMER_ABSTIME bit
is set in the "flags" parameter. Otherwise it's a relative time.
The timerfd_gettime() API returns the next expiration time of the timer, or
{0, 0} if the timerfd has not been set yet.
Like the previous timerfd API implementation, read(2) and poll(2) are
supported (with the same interface). Here's a simple test program I used to
exercise the new timerfd APIs:
http://www.xmailserver.org/timerfd-test2.c
[akpm@linux-foundation.org: coding-style cleanups]
[akpm@linux-foundation.org: fix ia64 build]
[akpm@linux-foundation.org: fix m68k build]
[akpm@linux-foundation.org: fix mips build]
[akpm@linux-foundation.org: fix alpha, arm, blackfin, cris, m68k, s390, sparc and sparc64 builds]
[heiko.carstens@de.ibm.com: fix s390]
[akpm@linux-foundation.org: fix powerpc build]
[akpm@linux-foundation.org: fix sparc64 more]
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Davide Libenzi <davidel@xmailserver.org>
Cc: Michael Kerrisk <mtk-manpages@gmx.net>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/systbls.S | 2 | ||||
-rw-r--r-- | arch/arm/kernel/calls.S | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-common/entry.S | 2 | ||||
-rw-r--r-- | arch/cris/arch-v10/kernel/entry.S | 2 | ||||
-rw-r--r-- | arch/ia64/kernel/entry.S | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/entry.S | 2 | ||||
-rw-r--r-- | arch/m68knommu/kernel/syscalltable.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall32-o32.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-64.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-n32.S | 2 | ||||
-rw-r--r-- | arch/mips/kernel/scall64-o32.S | 2 | ||||
-rw-r--r-- | arch/s390/kernel/compat_wrapper.S | 8 | ||||
-rw-r--r-- | arch/s390/kernel/syscalls.S | 2 | ||||
-rw-r--r-- | arch/sparc/kernel/systbls.S | 2 | ||||
-rw-r--r-- | arch/sparc64/kernel/systbls.S | 4 |
15 files changed, 15 insertions, 23 deletions
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 79de99e32c35..ba914af18c4f 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -495,7 +495,7 @@ sys_call_table: | |||
495 | .quad sys_epoll_pwait | 495 | .quad sys_epoll_pwait |
496 | .quad sys_utimensat /* 475 */ | 496 | .quad sys_utimensat /* 475 */ |
497 | .quad sys_signalfd | 497 | .quad sys_signalfd |
498 | .quad sys_timerfd | 498 | .quad sys_ni_syscall |
499 | .quad sys_eventfd | 499 | .quad sys_eventfd |
500 | 500 | ||
501 | .size sys_call_table, . - sys_call_table | 501 | .size sys_call_table, . - sys_call_table |
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S index cecf658e3625..283e14fff993 100644 --- a/arch/arm/kernel/calls.S +++ b/arch/arm/kernel/calls.S | |||
@@ -359,7 +359,7 @@ | |||
359 | CALL(sys_kexec_load) | 359 | CALL(sys_kexec_load) |
360 | CALL(sys_utimensat) | 360 | CALL(sys_utimensat) |
361 | CALL(sys_signalfd) | 361 | CALL(sys_signalfd) |
362 | /* 350 */ CALL(sys_timerfd) | 362 | /* 350 */ CALL(sys_ni_syscall) |
363 | CALL(sys_eventfd) | 363 | CALL(sys_eventfd) |
364 | CALL(sys_fallocate) | 364 | CALL(sys_fallocate) |
365 | #ifndef syscalls_counted | 365 | #ifndef syscalls_counted |
diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S index 56ff51bc8c21..fdd9bf43361e 100644 --- a/arch/blackfin/mach-common/entry.S +++ b/arch/blackfin/mach-common/entry.S | |||
@@ -1373,7 +1373,7 @@ ENTRY(_sys_call_table) | |||
1373 | .long _sys_epoll_pwait | 1373 | .long _sys_epoll_pwait |
1374 | .long _sys_utimensat | 1374 | .long _sys_utimensat |
1375 | .long _sys_signalfd | 1375 | .long _sys_signalfd |
1376 | .long _sys_timerfd | 1376 | .long _sys_ni_syscall |
1377 | .long _sys_eventfd /* 350 */ | 1377 | .long _sys_eventfd /* 350 */ |
1378 | .long _sys_pread64 | 1378 | .long _sys_pread64 |
1379 | .long _sys_pwrite64 | 1379 | .long _sys_pwrite64 |
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S index ec62c951fa3c..d1361dc119e2 100644 --- a/arch/cris/arch-v10/kernel/entry.S +++ b/arch/cris/arch-v10/kernel/entry.S | |||
@@ -1167,7 +1167,7 @@ sys_call_table: | |||
1167 | .long sys_epoll_pwait | 1167 | .long sys_epoll_pwait |
1168 | .long sys_utimensat /* 320 */ | 1168 | .long sys_utimensat /* 320 */ |
1169 | .long sys_signalfd | 1169 | .long sys_signalfd |
1170 | .long sys_timerfd | 1170 | .long sys_ni_syscall |
1171 | .long sys_eventfd | 1171 | .long sys_eventfd |
1172 | .long sys_fallocate | 1172 | .long sys_fallocate |
1173 | 1173 | ||
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S index c36f43c94600..f5d3efbfbeda 100644 --- a/arch/ia64/kernel/entry.S +++ b/arch/ia64/kernel/entry.S | |||
@@ -1586,7 +1586,7 @@ sys_call_table: | |||
1586 | data8 sys_epoll_pwait // 1305 | 1586 | data8 sys_epoll_pwait // 1305 |
1587 | data8 sys_utimensat | 1587 | data8 sys_utimensat |
1588 | data8 sys_signalfd | 1588 | data8 sys_signalfd |
1589 | data8 sys_timerfd | 1589 | data8 sys_ni_syscall |
1590 | data8 sys_eventfd | 1590 | data8 sys_eventfd |
1591 | 1591 | ||
1592 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls | 1592 | .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 918f5dbeaef6..6dfa3b3c0e2a 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -742,7 +742,7 @@ sys_call_table: | |||
742 | .long sys_epoll_pwait /* 315 */ | 742 | .long sys_epoll_pwait /* 315 */ |
743 | .long sys_utimensat | 743 | .long sys_utimensat |
744 | .long sys_signalfd | 744 | .long sys_signalfd |
745 | .long sys_timerfd | 745 | .long sys_ni_syscall |
746 | .long sys_eventfd | 746 | .long sys_eventfd |
747 | .long sys_fallocate /* 320 */ | 747 | .long sys_fallocate /* 320 */ |
748 | 748 | ||
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S index 9620093514bc..1b02b8820068 100644 --- a/arch/m68knommu/kernel/syscalltable.S +++ b/arch/m68knommu/kernel/syscalltable.S | |||
@@ -336,7 +336,7 @@ ENTRY(sys_call_table) | |||
336 | .long sys_epoll_pwait /* 315 */ | 336 | .long sys_epoll_pwait /* 315 */ |
337 | .long sys_utimensat | 337 | .long sys_utimensat |
338 | .long sys_signalfd | 338 | .long sys_signalfd |
339 | .long sys_timerfd | 339 | .long sys_ni_syscall |
340 | .long sys_eventfd | 340 | .long sys_eventfd |
341 | .long sys_fallocate /* 320 */ | 341 | .long sys_fallocate /* 320 */ |
342 | 342 | ||
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index 82480a1717d8..f798139e888e 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S | |||
@@ -660,7 +660,7 @@ einval: li v0, -EINVAL | |||
660 | sys sys_ioprio_get 2 /* 4315 */ | 660 | sys sys_ioprio_get 2 /* 4315 */ |
661 | sys sys_utimensat 4 | 661 | sys sys_utimensat 4 |
662 | sys sys_signalfd 3 | 662 | sys sys_signalfd 3 |
663 | sys sys_timerfd 4 | 663 | sys sys_ni_syscall 0 |
664 | sys sys_eventfd 1 | 664 | sys sys_eventfd 1 |
665 | sys sys_fallocate 6 /* 4320 */ | 665 | sys sys_fallocate 6 /* 4320 */ |
666 | .endm | 666 | .endm |
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S index c2c10876da2e..a626be6baea3 100644 --- a/arch/mips/kernel/scall64-64.S +++ b/arch/mips/kernel/scall64-64.S | |||
@@ -475,7 +475,7 @@ sys_call_table: | |||
475 | PTR sys_ioprio_get | 475 | PTR sys_ioprio_get |
476 | PTR sys_utimensat /* 5275 */ | 476 | PTR sys_utimensat /* 5275 */ |
477 | PTR sys_signalfd | 477 | PTR sys_signalfd |
478 | PTR sys_timerfd | 478 | PTR sys_ni_syscall |
479 | PTR sys_eventfd | 479 | PTR sys_eventfd |
480 | PTR sys_fallocate | 480 | PTR sys_fallocate |
481 | .size sys_call_table,.-sys_call_table | 481 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index 01993ec3368b..9d5bcaf1b389 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S | |||
@@ -401,7 +401,7 @@ EXPORT(sysn32_call_table) | |||
401 | PTR sys_ioprio_get | 401 | PTR sys_ioprio_get |
402 | PTR compat_sys_utimensat | 402 | PTR compat_sys_utimensat |
403 | PTR compat_sys_signalfd /* 5280 */ | 403 | PTR compat_sys_signalfd /* 5280 */ |
404 | PTR compat_sys_timerfd | 404 | PTR sys_ni_syscall |
405 | PTR sys_eventfd | 405 | PTR sys_eventfd |
406 | PTR sys_fallocate | 406 | PTR sys_fallocate |
407 | .size sysn32_call_table,.-sysn32_call_table | 407 | .size sysn32_call_table,.-sysn32_call_table |
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index dd68afce7da5..fd2019c1ec2d 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S | |||
@@ -523,7 +523,7 @@ sys_call_table: | |||
523 | PTR sys_ioprio_get /* 4315 */ | 523 | PTR sys_ioprio_get /* 4315 */ |
524 | PTR compat_sys_utimensat | 524 | PTR compat_sys_utimensat |
525 | PTR compat_sys_signalfd | 525 | PTR compat_sys_signalfd |
526 | PTR compat_sys_timerfd | 526 | PTR sys_ni_syscall |
527 | PTR sys_eventfd | 527 | PTR sys_eventfd |
528 | PTR sys32_fallocate /* 4320 */ | 528 | PTR sys32_fallocate /* 4320 */ |
529 | .size sys_call_table,.-sys_call_table | 529 | .size sys_call_table,.-sys_call_table |
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S index 6ee1bedbd1bf..062c3d4c0394 100644 --- a/arch/s390/kernel/compat_wrapper.S +++ b/arch/s390/kernel/compat_wrapper.S | |||
@@ -1698,14 +1698,6 @@ compat_sys_signalfd_wrapper: | |||
1698 | llgfr %r4,%r4 # compat_size_t | 1698 | llgfr %r4,%r4 # compat_size_t |
1699 | jg compat_sys_signalfd | 1699 | jg compat_sys_signalfd |
1700 | 1700 | ||
1701 | .globl compat_sys_timerfd_wrapper | ||
1702 | compat_sys_timerfd_wrapper: | ||
1703 | lgfr %r2,%r2 # int | ||
1704 | lgfr %r3,%r3 # int | ||
1705 | lgfr %r4,%r4 # int | ||
1706 | llgtr %r5,%r5 # struct compat_itimerspec * | ||
1707 | jg compat_sys_timerfd | ||
1708 | |||
1709 | .globl sys_eventfd_wrapper | 1701 | .globl sys_eventfd_wrapper |
1710 | sys_eventfd_wrapper: | 1702 | sys_eventfd_wrapper: |
1711 | llgfr %r2,%r2 # unsigned int | 1703 | llgfr %r2,%r2 # unsigned int |
diff --git a/arch/s390/kernel/syscalls.S b/arch/s390/kernel/syscalls.S index 9e26ed9fe4e7..25eac7802fc4 100644 --- a/arch/s390/kernel/syscalls.S +++ b/arch/s390/kernel/syscalls.S | |||
@@ -325,5 +325,5 @@ SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) | |||
325 | SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) | 325 | SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) |
326 | SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ | 326 | SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ |
327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) | 327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) |
328 | SYSCALL(sys_timerfd,sys_timerfd,compat_sys_timerfd_wrapper) | 328 | NI_SYSCALL /* 317 old sys_timer_fd */ |
329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) | 329 | SYSCALL(sys_eventfd,sys_eventfd,sys_eventfd_wrapper) |
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S index 55722840859c..ee010f4532a0 100644 --- a/arch/sparc/kernel/systbls.S +++ b/arch/sparc/kernel/systbls.S | |||
@@ -79,7 +79,7 @@ sys_call_table: | |||
79 | /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare | 79 | /*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare |
80 | /*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy | 80 | /*300*/ .long sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy |
81 | /*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait | 81 | /*305*/ .long sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait |
82 | /*310*/ .long sys_utimensat, sys_signalfd, sys_timerfd, sys_eventfd, sys_fallocate | 82 | /*310*/ .long sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate |
83 | 83 | ||
84 | #ifdef CONFIG_SUNOS_EMUL | 84 | #ifdef CONFIG_SUNOS_EMUL |
85 | /* Now the SunOS syscall table. */ | 85 | /* Now the SunOS syscall table. */ |
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S index 06d10907d8ce..b8058906e727 100644 --- a/arch/sparc64/kernel/systbls.S +++ b/arch/sparc64/kernel/systbls.S | |||
@@ -80,7 +80,7 @@ sys_call_table32: | |||
80 | .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare | 80 | .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll, sys_unshare |
81 | /*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy | 81 | /*300*/ .word compat_sys_set_robust_list, compat_sys_get_robust_list, compat_sys_migrate_pages, compat_sys_mbind, compat_sys_get_mempolicy |
82 | .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait | 82 | .word compat_sys_set_mempolicy, compat_sys_kexec_load, compat_sys_move_pages, sys_getcpu, compat_sys_epoll_pwait |
83 | /*310*/ .word compat_sys_utimensat, compat_sys_signalfd, compat_sys_timerfd, sys_eventfd, compat_sys_fallocate | 83 | /*310*/ .word compat_sys_utimensat, compat_sys_signalfd, sys_ni_syscall, sys_eventfd, compat_sys_fallocate |
84 | 84 | ||
85 | #endif /* CONFIG_COMPAT */ | 85 | #endif /* CONFIG_COMPAT */ |
86 | 86 | ||
@@ -152,7 +152,7 @@ sys_call_table: | |||
152 | .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare | 152 | .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll, sys_unshare |
153 | /*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy | 153 | /*300*/ .word sys_set_robust_list, sys_get_robust_list, sys_migrate_pages, sys_mbind, sys_get_mempolicy |
154 | .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait | 154 | .word sys_set_mempolicy, sys_kexec_load, sys_move_pages, sys_getcpu, sys_epoll_pwait |
155 | /*310*/ .word sys_utimensat, sys_signalfd, sys_timerfd, sys_eventfd, sys_fallocate | 155 | /*310*/ .word sys_utimensat, sys_signalfd, sys_ni_syscall, sys_eventfd, sys_fallocate |
156 | 156 | ||
157 | #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ | 157 | #if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ |
158 | defined(CONFIG_SOLARIS_EMUL_MODULE) | 158 | defined(CONFIG_SOLARIS_EMUL_MODULE) |