Skip to contentSkip to conversation

new timerfd API - wire the new timerfd API to the x86 family

PATCH In review Davide Libenzi 2 participants 5 messages Sep 23, 2007 – Sep 24, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 2/3 new timerfd API - wire the new timerfd API to the x86 family

Wires up the new timerfd API to the x86 family.

- Davide

---
 arch/i386/kernel/syscall_table.S |    5 ++++-
 arch/x86_64/ia32/ia32entry.S     |    4 +++-
 include/asm-i386/unistd.h        |    6 ++++--
 include/asm-x86_64/unistd.h      |    8 ++++++--
 4 files changed, 17 insertions(+), 6 deletions(-)
arch/i386/kernel/syscall_table.S +4 -1
Index: linux-2.6.mod/arch/i386/kernel/syscall_table.S
===================================================================
@@ -321,6 +321,9 @@
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_timerfd_create
 	.long sys_eventfd
 	.long sys_fallocate
+	.long sys_timerfd_settime	/* 325 */
+	.long sys_timerfd_gettime
+
arch/x86_64/ia32/ia32entry.S +3 -1
Index: linux-2.6.mod/arch/x86_64/ia32/ia32entry.S
===================================================================
@@ -730,7 +730,9 @@
 	.quad sys_epoll_pwait
 	.quad compat_sys_utimensat	/* 320 */
 	.quad compat_sys_signalfd
-	.quad compat_sys_timerfd
+	.quad sys_timerfd_create
 	.quad sys_eventfd
 	.quad sys32_fallocate
+	.quad compat_sys_timerfd_settime	/* 325 */
+	.quad compat_sys_timerfd_gettime
 ia32_syscall_end:
include/asm-i386/unistd.h +4 -2
Index: linux-2.6.mod/include/asm-i386/unistd.h
===================================================================
@@ -327,13 +327,15 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+#define __NR_timerfd_create	322
 #define __NR_eventfd		323
 #define __NR_fallocate		324
+#define __NR_timerfd_settime	325
+#define __NR_timerfd_gettime	326
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 325
+#define NR_syscalls 327
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR
include/asm-x86_64/unistd.h +6 -2
Index: linux-2.6.mod/include/asm-x86_64/unistd.h
===================================================================
@@ -626,12 +626,16 @@
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
 #define __NR_signalfd		282
 __SYSCALL(__NR_signalfd, sys_signalfd)
-#define __NR_timerfd		283
-__SYSCALL(__NR_timerfd, sys_timerfd)
+#define __NR_timerfd_create	283
+__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
 #define __NR_eventfd		284
 __SYSCALL(__NR_eventfd, sys_eventfd)
 #define __NR_fallocate		285
 __SYSCALL(__NR_fallocate, sys_fallocate)
+#define __NR_timerfd_settime	286
+__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
+#define __NR_timerfd_gettime	287
+__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
#1 lore raw

Davide,

Is it perhaps not better to group the three syscalls contiguously with respect to syscall numbers? The old timerfd slot can be re-used for some other syscall later.

Cheers,

Michael

Quoted 93 lines · Davide Libenzi

Wires up the new timerfd API to the x86 family.

- Davide

---
 arch/i386/kernel/syscall_table.S |    5 ++++-
 arch/x86_64/ia32/ia32entry.S     |    4 +++-
 include/asm-i386/unistd.h        |    6 ++++--
 include/asm-x86_64/unistd.h      |    8 ++++++--
 4 files changed, 17 insertions(+), 6 deletions(-)

Index: linux-2.6.mod/arch/i386/kernel/syscall_table.S
===================================================================

arch/i386/kernel/syscall_table.S +4 -1
@@ -321,6 +321,9 @@
 	.long sys_epoll_pwait
 	.long sys_utimensat		/* 320 */
 	.long sys_signalfd
-	.long sys_timerfd
+	.long sys_timerfd_create
 	.long sys_eventfd
 	.long sys_fallocate
+	.long sys_timerfd_settime	/* 325 */
+	.long sys_timerfd_gettime
+

Index: linux-2.6.mod/arch/x86_64/ia32/ia32entry.S
===================================================================

arch/x86_64/ia32/ia32entry.S +3 -1
@@ -730,7 +730,9 @@
 	.quad sys_epoll_pwait
 	.quad compat_sys_utimensat	/* 320 */
 	.quad compat_sys_signalfd
-	.quad compat_sys_timerfd
+	.quad sys_timerfd_create
 	.quad sys_eventfd
 	.quad sys32_fallocate
+	.quad compat_sys_timerfd_settime	/* 325 */
+	.quad compat_sys_timerfd_gettime
 ia32_syscall_end:

Index: linux-2.6.mod/include/asm-i386/unistd.h
===================================================================

include/asm-i386/unistd.h +4 -2
@@ -327,13 +327,15 @@
 #define __NR_epoll_pwait	319
 #define __NR_utimensat		320
 #define __NR_signalfd		321
-#define __NR_timerfd		322
+#define __NR_timerfd_create	322
 #define __NR_eventfd		323
 #define __NR_fallocate		324
+#define __NR_timerfd_settime	325
+#define __NR_timerfd_gettime	326
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 325
+#define NR_syscalls 327
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 #define __ARCH_WANT_OLD_READDIR

Index: linux-2.6.mod/include/asm-x86_64/unistd.h
===================================================================

include/asm-x86_64/unistd.h +6 -2
@@ -626,12 +626,16 @@
 __SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
 #define __NR_signalfd		282
 __SYSCALL(__NR_signalfd, sys_signalfd)
-#define __NR_timerfd		283
-__SYSCALL(__NR_timerfd, sys_timerfd)
+#define __NR_timerfd_create	283
+__SYSCALL(__NR_timerfd_create, sys_timerfd_create)
 #define __NR_eventfd		284
 __SYSCALL(__NR_eventfd, sys_eventfd)
 #define __NR_fallocate		285
 __SYSCALL(__NR_fallocate, sys_fallocate)
+#define __NR_timerfd_settime	286
+__SYSCALL(__NR_timerfd_settime, sys_timerfd_settime)
+#define __NR_timerfd_gettime	287
+__SYSCALL(__NR_timerfd_gettime, sys_timerfd_gettime)
 
 #ifndef __NO_STUBS
 #define __ARCH_WANT_OLD_READDIR
Signature · 6 lines
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?  Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages/
read the HOWTOHELP file and grep the source files for 'FIXME'.
#2 lore raw
Quoted 5 lines · Michael Kerrisk

Davide,

Is it perhaps not better to group the three syscalls contiguously with respect to syscall numbers? The old timerfd slot can be re-used for some other syscall later.

There's no problem if they're not contiguous. Holes, unless filled immediately, need to be remembered to be filled.

- Davide

#3 lore raw

Hi Davide,

Quoted 6 lines · Davide Libenzi
Quoted 3 lines · Michael Kerrisk

Is it perhaps not better to group the three syscalls contiguously with respect to syscall numbers? The old timerfd slot can be re-used for some other syscall later.

There's no problem if they're not contiguous.

I realise there is no problem, in a technical sense. But it strikes me as more aesthetic to make related syscalls numerically contiguous. Thus, we see such as the following in the kernel source

#define __NR_epoll_create       254
#define __NR_epoll_ctl          255
#define __NR_epoll_wait         256

and

#define __NR_timer_create       259
#define __NR_timer_settime      (__NR_timer_create+1)
#define __NR_timer_gettime      (__NR_timer_create+2)
#define __NR_timer_getoverrun   (__NR_timer_create+3)
#define __NR_timer_delete       (__NR_timer_create+4)

and

#define __NR_inotify_init       291
#define __NR_inotify_add_watch  292
#define __NR_inotify_rm_watch   293
Quoted 2 lines

Holes, unless filled
immediately, need to be remembered to be filled.

Well, in the past it seems they do get filled soon enough though. There's fair odds that you'll be the one to fill it with the next syscall you write ;-).

Cheers,

Michael

Signature · 6 lines
Michael Kerrisk
maintainer of Linux man pages Sections 2, 3, 4, 5, and 7

Want to help with man page maintenance?  Grab the latest tarball at
http://www.kernel.org/pub/linux/docs/manpages/
read the HOWTOHELP file and grep the source files for 'FIXME'.
#4 lore raw
Quoted 32 lines · Michael Kerrisk

Hi Davide,

Quoted 6 lines · Davide Libenzi
Quoted 3 lines · Michael Kerrisk

Is it perhaps not better to group the three syscalls contiguously with respect to syscall numbers? The old timerfd slot can be re-used for some other syscall later.

There's no problem if they're not contiguous.

I realise there is no problem, in a technical sense. But it strikes me as more aesthetic to make related syscalls numerically contiguous. Thus, we see such as the following in the kernel source

#define __NR_epoll_create       254
#define __NR_epoll_ctl          255
#define __NR_epoll_wait         256

and

#define __NR_timer_create       259
#define __NR_timer_settime      (__NR_timer_create+1)
#define __NR_timer_gettime      (__NR_timer_create+2)
#define __NR_timer_getoverrun   (__NR_timer_create+3)
#define __NR_timer_delete       (__NR_timer_create+4)

and

#define __NR_inotify_init       291
#define __NR_inotify_add_watch  292
#define __NR_inotify_rm_watch   293
Quoted 6 lines
Quoted 2 lines

Holes, unless filled
immediately, need to be remembered to be filled.

Well, in the past it seems they do get filled soon enough though. There's fair odds that you'll be the one to fill it with the next syscall you write ;-).

You have to talk to arch mantainers. I do not care. I simply provided the x86 hooks because I tested on x86.

- Davide