Skip to contentSkip to conversation

POSIX timers for 2.4.0

PATCH New Robert H. de Vries 1 participant 1 message Jan 25, 2001

Subsystems (12)
Arm (32-bit) VFS MIPS MM core +8 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 POSIX timers for 2.4.0

Hi Linus,

Please accept this patch for inclusion. The impact on the kernel is negligible and it makes the kernel a bit more POSIX feature complete. I have received good feedback from people who have used the patch and I have used it a lot myself without any problems.

This patch should not impact processes not using POSIX timers. The pointer to the array of POSIX timers is left NULL. Nothing is done. When the first timer is created and when a clone with the TIMER_CLONE flag is called, the timer overhead is created.

As a reaction to the question if this should be in the kernel in the first
place: IMHO, there is no way to emulate these calls in user space by using the setitimer() system call. For the following reasons:

a. setitimer() sends only SIGALRM, POSIX timers can send any signal.

b. setitimer() does not know about overruns, POSIX timers do.

c. setitimer() can be used only once in a given process, you can have
upto 32 (configurable) POSIX timers at the same time in your process.

d. setitimer() cannot send extra information with its signal, POSIX timers
can send a si_value when using RT signals.

There have been no changes to the code for almost half a year now. The code has been shown to work on UP and SMP on x86 platforms. There is (untested) support for most other platforms.

The patch is attached to this mail.

Test code and some other patches can be found on:
http://www.rhdv.cistron.nl/posix.html

Robert

Signature · 2 lines
Robert de Vries
[email protected]

Index: linux/arch/alpha/kernel/entry.S

arch/alpha/kernel/entry.S renamed from arch/alpha/kernel/entry.S:1.1.1.11 +5 -0
diff -u linux/arch/alpha/kernel/entry.S:1.1.1.11 linux/arch/alpha/kernel/entry.S:1.1.2.9
@@ -1161,3 +1161,8 @@
 	.quad sys_mincore			/* 375 */
 	.quad sys_pciconfig_iobase
 	.quad sys_getdents64
+	.quad sys_timer_create
+	.quad sys_timer_settime
+	.quad sys_timer_gettime			/* 380 */
+	.quad sys_timer_getoverrun
+	.quad sys_timer_delete

Index: linux/arch/alpha/kernel/signal.c

arch/alpha/kernel/signal.c renamed from arch/alpha/kernel/signal.c:1.1.1.4 +4 -0
diff -u linux/arch/alpha/kernel/signal.c:1.1.1.4 linux/arch/alpha/kernel/signal.c:1.1.2.4
@@ -53,6 +53,10 @@
 		err = __put_user(*(long *)&from->si_signo, (long *)&to->si_signo);
 		err |= __put_user((short)from->si_code, &to->si_code);
 		switch (from->si_code >> 16) {
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/arm/kernel/calls.S

arch/arm/kernel/calls.S renamed from arch/arm/kernel/calls.S:1.1.1.6 +6 -1
diff -u linux/arch/arm/kernel/calls.S:1.1.1.6 linux/arch/arm/kernel/calls.S:1.1.2.6
@@ -231,8 +231,13 @@
 /* 215 */	.long	SYMBOL_NAME(sys_setfsuid)
 		.long	SYMBOL_NAME(sys_setfsgid)
 		.long	SYMBOL_NAME(sys_getdents64)
+		.long	SYMBOL_NAME(sys_timer_create)
+		.long	SYMBOL_NAME(sys_timer_settime)
+/* 220 */	.long	SYMBOL_NAME(sys_timer_gettime)
+		.long	SYMBOL_NAME(sys_timer_getoverrun)
+		.long	SYMBOL_NAME(sys_timer_delete)
 
-		.rept	NR_syscalls-217
+		.rept	NR_syscalls-222
 			.long	SYMBOL_NAME(sys_ni_syscall)
 		.endr
 #endif

Index: linux/arch/arm/kernel/signal.c

arch/arm/kernel/signal.c renamed from arch/arm/kernel/signal.c:1.1.1.9 +4 -0
diff -u linux/arch/arm/kernel/signal.c:1.1.1.9 linux/arch/arm/kernel/signal.c:1.1.2.7
@@ -59,6 +59,10 @@
 	switch (from->si_code >> 16) {
 	case __SI_FAULT >> 16:
 		break;
+	case __SI_TIMER >> 16:
+		err |= __put_user(from->si_tid, &to->si_tid);
+		err |= __put_user(from->si_ptr, &to->si_ptr);
+		break;
 	case __SI_CHLD >> 16:
 		err |= __put_user(from->si_utime, &to->si_utime);
 		err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/i386/kernel/entry.S

arch/i386/kernel/entry.S renamed from arch/i386/kernel/entry.S:1.1.1.14 +6 -1
diff -u linux/arch/i386/kernel/entry.S:1.1.1.14 linux/arch/i386/kernel/entry.S:1.1.2.13
@@ -646,6 +646,11 @@
 	.long SYMBOL_NAME(sys_getdents64)	/* 220 */
 	.long SYMBOL_NAME(sys_fcntl64)
 	.long SYMBOL_NAME(sys_ni_syscall)	/* reserved for TUX */
+	.long SYMBOL_NAME(sys_timer_create)
+	.long SYMBOL_NAME(sys_timer_settime)
+	.long SYMBOL_NAME(sys_timer_gettime)	/* 225 */
+	.long SYMBOL_NAME(sys_timer_getoverrun)
+	.long SYMBOL_NAME(sys_timer_delete)
 
 	/*
 	 * NOTE!! This doesn't have to be exact - we just have
@@ -653,6 +658,6 @@
 	 * entries. Don't panic if you notice that this hasn't
 	 * been shrunk every time we add a new system call.
 	 */
-	.rept NR_syscalls-221
+	.rept NR_syscalls-227
 		.long SYMBOL_NAME(sys_ni_syscall)
 	.endr

Index: linux/arch/i386/kernel/signal.c

arch/i386/kernel/signal.c renamed from arch/i386/kernel/signal.c:1.1.1.9 +4 -0
diff -u linux/arch/i386/kernel/signal.c:1.1.1.9 linux/arch/i386/kernel/signal.c:1.1.2.8
@@ -52,6 +52,10 @@
 		switch (from->si_code >> 16) {
 		case __SI_FAULT >> 16:
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/ia64/kernel/entry.S

arch/ia64/kernel/entry.S renamed from arch/ia64/kernel/entry.S:1.1.1.11 +5 -5
diff -u linux/arch/ia64/kernel/entry.S:1.1.1.11 linux/arch/ia64/kernel/entry.S:1.1.4.11
@@ -1247,11 +1247,11 @@
 	data8 sys_newfstat
 	data8 sys_clone2
 	data8 sys_getdents64
-	data8 ia64_ni_syscall			// 1215
-	data8 ia64_ni_syscall
-	data8 ia64_ni_syscall
-	data8 ia64_ni_syscall
-	data8 ia64_ni_syscall
+	data8 sys_timer_create			// 1215
+	data8 sys_timer_settime
+	data8 sys_timer_gettime
+	data8 sys_timer_getoverrun
+	data8 sys_timer_delete
 	data8 ia64_ni_syscall			// 1220
 	data8 ia64_ni_syscall
 	data8 ia64_ni_syscall

Index: linux/arch/ia64/kernel/signal.c

arch/ia64/kernel/signal.c renamed from arch/ia64/kernel/signal.c:1.1.1.7 +4 -0
diff -u linux/arch/ia64/kernel/signal.c:1.1.1.7 linux/arch/ia64/kernel/signal.c:1.1.4.8
@@ -180,6 +180,10 @@
 		err |= __put_user(from->si_errno, &to->si_errno);
 		err |= __put_user((short)from->si_code, &to->si_code);
 		switch (from->si_code >> 16) {
+		      case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		      case __SI_FAULT >> 16:
 			err |= __put_user(from->si_isr, &to->si_isr);
 		      case __SI_POLL >> 16:

Index: linux/arch/m68k/kernel/entry.S

arch/m68k/kernel/entry.S renamed from arch/m68k/kernel/entry.S:1.1.1.6 +5 -0
diff -u linux/arch/m68k/kernel/entry.S:1.1.1.6 linux/arch/m68k/kernel/entry.S:1.1.2.6
@@ -646,6 +646,11 @@
 	.long SYMBOL_NAME(sys_ni_syscall)
 	.long SYMBOL_NAME(sys_ni_syscall)
 	.long SYMBOL_NAME(sys_getdents64)	/* 220 */
+	.long SYMBOL_NAME(sys_timer_create)
+	.long SYMBOL_NAME(sys_timer_settime)
+	.long SYMBOL_NAME(sys_timer_gettime)
+	.long SYMBOL_NAME(sys_timer_getoverrun)
+	.long SYMBOL_NAME(sys_timer_delete)	/* 225 */
 
 	.rept NR_syscalls-(.-SYMBOL_NAME(sys_call_table))/4
 		.long SYMBOL_NAME(sys_ni_syscall)

Index: linux/arch/m68k/kernel/signal.c

arch/m68k/kernel/signal.c renamed from arch/m68k/kernel/signal.c:1.1.1.6 +4 -0
diff -u linux/arch/m68k/kernel/signal.c:1.1.1.6 linux/arch/m68k/kernel/signal.c:1.1.2.6
@@ -211,6 +211,10 @@
 		switch (from->si_code >> 16) {
 		case __SI_FAULT >> 16:
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/mips/kernel/irix5sys.h

arch/mips/kernel/irix5sys.h renamed from arch/mips/kernel/irix5sys.h:1.1.1.2 +1 -1
diff -u linux/arch/mips/kernel/irix5sys.h:1.1.1.2 linux/arch/mips/kernel/irix5sys.h:1.1.2.2
@@ -235,7 +235,7 @@
 SYS(irix_unimp, 0)			/* 1213  XXX timer_delete()	*/
 SYS(irix_unimp, 0)			/* 1214  XXX timer_settime()	*/
 SYS(irix_unimp, 0)			/* 1215  XXX timer_gettime()	*/
-SYS(irix_unimp, 0)			/* 1216  XXX timer_setoverrun()	*/
+SYS(irix_unimp, 0)			/* 1216  XXX timer_getoverrun()	*/
 SYS(sys_sched_rr_get_interval, 2)	/* 1217  sched_rr_get_interval()V*/
 SYS(sys_sched_yield, 0)			/* 1218  sched_yield()	       V*/
 SYS(sys_sched_getscheduler, 1)		/* 1219  sched_getscheduler()  V*/

Index: linux/arch/mips/kernel/signal.c

arch/mips/kernel/signal.c renamed from arch/mips/kernel/signal.c:1.1.1.6 +4 -0
diff -u linux/arch/mips/kernel/signal.c:1.1.1.6 linux/arch/mips/kernel/signal.c:1.1.2.5
@@ -60,6 +60,10 @@
 		switch (from->si_code >> 16) {
 		case __SI_FAULT >> 16:
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/mips/kernel/syscalls.h

arch/mips/kernel/syscalls.h renamed from arch/mips/kernel/syscalls.h:1.1.1.4 +5 -0
diff -u linux/arch/mips/kernel/syscalls.h:1.1.1.4 linux/arch/mips/kernel/syscalls.h:1.1.2.4
@@ -235,3 +235,8 @@
 SYS(sys_mincore, 3)
 SYS(sys_madvise, 3)
 SYS(sys_getdents64, 3)
+SYS(sys_timer_create, 3)			/* 4220 */
+SYS(sys_timer_settime, 4)
+SYS(sys_timer_gettime, 2)
+SYS(sys_timer_getoverrun, 1)
+SYS(sys_timer_delete, 1)

Index: linux/arch/mips64/kernel/signal.c

arch/mips64/kernel/signal.c renamed from arch/mips64/kernel/signal.c:1.1.1.5 +4 -0
diff -u linux/arch/mips64/kernel/signal.c:1.1.1.5 linux/arch/mips64/kernel/signal.c:1.1.2.5
@@ -60,6 +60,10 @@
 		case __SI_FAULT >> 16:
 			err |= __put_user((long)from->si_addr, &to->si_addr);
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/ppc/kernel/misc.S

arch/ppc/kernel/misc.S renamed from arch/ppc/kernel/misc.S:1.1.1.13 +5 -0
diff -u linux/arch/ppc/kernel/misc.S:1.1.1.13 linux/arch/ppc/kernel/misc.S:1.1.2.11
@@ -1254,6 +1254,11 @@
 	.long sys_pciconfig_iobase 	/* 200 */
 	.long sys_ni_syscall		/* 201 - reserved - MacOnLinux - new */
 	.long sys_getdents64		/* 202 */
+	.long sys_timer_create		/* 203 */
+	.long sys_timer_settime		/* 204 */
+	.long sys_timer_gettime		/* 205 */
+	.long sys_timer_getoverrun	/* 206 */
+	.long sys_timer_delete		/* 207 */
 	.rept NR_syscalls-(.-sys_call_table)/4
 		.long sys_ni_syscall
 	.endr

Index: linux/arch/ppc/kernel/signal.c

arch/ppc/kernel/signal.c renamed from arch/ppc/kernel/signal.c:1.1.1.5 +4 -0
diff -u linux/arch/ppc/kernel/signal.c:1.1.1.5 linux/arch/ppc/kernel/signal.c:1.1.2.5
@@ -78,6 +78,10 @@
 		switch (from->si_code >> 16) {
 		case __SI_FAULT >> 16:
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/s390/kernel/entry.S

arch/s390/kernel/entry.S renamed from arch/s390/kernel/entry.S:1.1.1.3 +6 -1
diff -u linux/arch/s390/kernel/entry.S:1.1.1.3 linux/arch/s390/kernel/entry.S:1.1.2.4
@@ -604,7 +604,12 @@
         .long  sys_mincore
         .long  sys_madvise
 	.long  sys_getdents64		 /* 220 */
-	.rept  255-220
+	.long  sys_timer_create
+	.long  sys_timer_settime
+	.long  sys_timer_gettime
+	.long  sys_timer_getoverrun
+	.long  sys_timer_delete		 /* 225 */
+	.rept  255-225
 	.long  sys_ni_syscall
 	.endr
 

Index: linux/arch/sh/kernel/signal.c

arch/sh/kernel/signal.c renamed from arch/sh/kernel/signal.c:1.1.1.9 +4 -0
diff -u linux/arch/sh/kernel/signal.c:1.1.1.9 linux/arch/sh/kernel/signal.c:1.1.2.9
@@ -55,6 +55,10 @@
 		switch (from->si_code >> 16) {
 		case __SI_FAULT >> 16:
 			break;
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/sparc/kernel/signal.c

arch/sparc/kernel/signal.c renamed from arch/sparc/kernel/signal.c:1.1.1.9 +4 -0
diff -u linux/arch/sparc/kernel/signal.c:1.1.1.9 linux/arch/sparc/kernel/signal.c:1.1.2.8
@@ -113,6 +113,10 @@
 		err |= __put_user(from->si_errno, &to->si_errno);
 		err |= __put_user((short)from->si_code, &to->si_code);
 		switch (from->si_code >> 16) {
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/sparc/kernel/systbls.S

arch/sparc/kernel/systbls.S renamed from arch/sparc/kernel/systbls.S:1.1.1.10 +2 -2
diff -u linux/arch/sparc/kernel/systbls.S:1.1.1.10 linux/arch/sparc/kernel/systbls.S:1.1.2.9
@@ -51,8 +51,8 @@
 /*150*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 /*155*/	.long sys_fcntl64, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
 /*160*/	.long sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
-/*165*/	.long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
-/*170*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getdents
+/*165*/	.long sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_timer_create
+/*170*/	.long sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun, sys_timer_delete, sys_getdents
 /*175*/	.long sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
 /*180*/	.long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_sigpending, sys_query_module
 /*185*/	.long sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_newuname

Index: linux/arch/sparc64/kernel/signal.c

arch/sparc64/kernel/signal.c renamed from arch/sparc64/kernel/signal.c:1.1.1.7 +4 -0
diff -u linux/arch/sparc64/kernel/signal.c:1.1.1.7 linux/arch/sparc64/kernel/signal.c:1.1.2.6
@@ -59,6 +59,10 @@
 		err = __put_user(*(long *)&from->si_signo, (long *)&to->si_signo);
 		err |= __put_user((short)from->si_code, &to->si_code);
 		switch (from->si_code >> 16) {
+		case __SI_TIMER >> 16:
+			err |= __put_user(from->si_tid, &to->si_tid);
+			err |= __put_user(from->si_ptr, &to->si_ptr);
+			break;
 		case __SI_CHLD >> 16:
 			err |= __put_user(from->si_utime, &to->si_utime);
 			err |= __put_user(from->si_stime, &to->si_stime);

Index: linux/arch/sparc64/kernel/sys_sparc32.c

arch/sparc64/kernel/sys_sparc32.c renamed from arch/sparc64/kernel/sys_sparc32.c:1.1.1.26 +110 -0

113 lines not on this page · raw message

Index: linux/arch/sparc64/kernel/systbls.S

arch/sparc64/kernel/systbls.S renamed from arch/sparc64/kernel/systbls.S:1.1.1.12 +4 -4
diff -u linux/arch/sparc64/kernel/systbls.S:1.1.1.12 linux/arch/sparc64/kernel/systbls.S:1.1.2.11
@@ -52,8 +52,8 @@
 /*150*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 	.word sys32_fcntl64, sys_nis_syscall, sys32_statfs, sys32_fstatfs, sys_oldumount
 /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_nis_syscall
-	.word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys_nis_syscall
-/*170*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_getdents
+	.word sys32_quotactl, sys_nis_syscall, sys32_mount, sys_ustat, sys32_timer_create
+/*170*/	.word sys32_timer_settime, sys32_timer_gettime, sys32_timer_getoverrun, sys32_timer_delete, sys32_getdents
 	.word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
 /*180*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys32_sigpending, sys32_query_module
 	.word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname
@@ -111,8 +111,8 @@
 /*150*/	.word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64
 	.word sys_nis_syscall, sys_nis_syscall, sys_statfs, sys_fstatfs, sys_oldumount
 /*160*/	.word sys_nis_syscall, sys_nis_syscall, sys_getdomainname, sys_setdomainname, sys_utrap_install
-	.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_nis_syscall
-/*170*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_getdents
+	.word sys_quotactl, sys_nis_syscall, sys_mount, sys_ustat, sys_timer_create
+/*170*/	.word sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun, sys_timer_delete, sys_getdents
 	.word sys_setsid, sys_fchdir, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
 /*180*/	.word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_query_module
 	.word sys_setpgid, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sparc64_newuname

Index: linux/fs/exec.c

fs/exec.c renamed from fs/exec.c:1.1.1.21 +1 -0
diff -u linux/fs/exec.c:1.1.1.21 linux/fs/exec.c:1.1.2.18
@@ -571,6 +571,7 @@
 			
 	flush_signal_handlers(current);
 	flush_old_files(current->files);
+	exit_itimers(current);
 
 	return 0;
 

Index: linux/include/asm-alpha/posix_types.h

include/asm-alpha/posix_types.h renamed from include/asm-alpha/posix_types.h:1.1.1.2 +2 -0
diff -u linux/include/asm-alpha/posix_types.h:1.1.1.2 linux/include/asm-alpha/posix_types.h:1.1.2.2
@@ -23,6 +23,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned long	__kernel_sigset_t;	/* at least 32 bits */

Index: linux/include/asm-alpha/siginfo.h

include/asm-alpha/siginfo.h renamed from include/asm-alpha/siginfo.h:1.1.1.3 +5 -3
diff -u linux/include/asm-alpha/siginfo.h:1.1.1.3 linux/include/asm-alpha/siginfo.h:1.1.2.4
@@ -29,8 +29,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -67,6 +68,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -85,7 +87,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-alpha/unistd.h

include/asm-alpha/unistd.h renamed from include/asm-alpha/unistd.h:1.1.1.5 +5 -0
diff -u linux/include/asm-alpha/unistd.h:1.1.1.5 linux/include/asm-alpha/unistd.h:1.1.2.4
@@ -315,6 +315,11 @@
 #define __NR_mincore			375
 #define __NR_pciconfig_iobase		376
 #define __NR_getdents64			377
+#define __NR_timer_create		378
+#define __NR_timer_settime		379
+#define __NR_timer_gettime		380
+#define __NR_timer_getoverrun		381
+#define __NR_timer_delete		382
 
 #if defined(__GNUC__)
 

Index: linux/include/asm-arm/posix_types.h

include/asm-arm/posix_types.h renamed from include/asm-arm/posix_types.h:1.1.1.3 +2 -0
diff -u linux/include/asm-arm/posix_types.h:1.1.1.3 linux/include/asm-arm/posix_types.h:1.1.2.3
@@ -34,6 +34,8 @@
 typedef long			__kernel_time_t;
 typedef long			__kernel_suseconds_t;
 typedef long			__kernel_clock_t;
+typedef int			__kernel_timer_t;
+typedef int			__kernel_clockid_t;
 typedef int			__kernel_daddr_t;
 typedef char *			__kernel_caddr_t;
 typedef unsigned short		__kernel_uid16_t;

Index: linux/include/asm-arm/siginfo.h

include/asm-arm/siginfo.h renamed from include/asm-arm/siginfo.h:1.1.1.3 +5 -3
diff -u linux/include/asm-arm/siginfo.h:1.1.1.3 linux/include/asm-arm/siginfo.h:1.1.2.4
@@ -29,8 +29,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -67,6 +68,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -85,7 +87,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-arm/unistd.h

include/asm-arm/unistd.h renamed from include/asm-arm/unistd.h:1.1.1.5 +5 -0
diff -u linux/include/asm-arm/unistd.h:1.1.1.5 linux/include/asm-arm/unistd.h:1.1.2.5
@@ -224,6 +224,11 @@
 #define __NR_setfsuid32			(__NR_SYSCALL_BASE+215)
 #define __NR_setfsgid32			(__NR_SYSCALL_BASE+216)
 #define __NR_getdents64			(__NR_SYSCALL_BASE+217)
+#define __NR_timer_create		(__NR_SYSCALL_BASE+218)
+#define __NR_timer_settime		(__NR_SYSCALL_BASE+219)
+#define __NR_timer_gettime		(__NR_SYSCALL_BASE+220)
+#define __NR_timer_getoverrun		(__NR_SYSCALL_BASE+221)
+#define __NR_timer_delete		(__NR_SYSCALL_BASE+222)
 
 #define __sys2(x) #x
 #define __sys1(x) __sys2(x)

Index: linux/include/asm-i386/posix_types.h

include/asm-i386/posix_types.h renamed from include/asm-i386/posix_types.h:1.1.1.2 +2 -0
diff -u linux/include/asm-i386/posix_types.h:1.1.1.2 linux/include/asm-i386/posix_types.h:1.1.2.2
@@ -22,6 +22,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;

Index: linux/include/asm-i386/siginfo.h

include/asm-i386/siginfo.h renamed from include/asm-i386/siginfo.h:1.1.1.3 +5 -3
diff -u linux/include/asm-i386/siginfo.h:1.1.1.3 linux/include/asm-i386/siginfo.h:1.1.2.4
@@ -29,8 +29,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -67,6 +68,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -85,7 +87,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-i386/unistd.h

include/asm-i386/unistd.h renamed from include/asm-i386/unistd.h:1.1.1.4 +5 -0
diff -u linux/include/asm-i386/unistd.h:1.1.1.4 linux/include/asm-i386/unistd.h:1.1.2.5
@@ -227,6 +227,11 @@
 #define __NR_madvise1		219	/* delete when C lib stub is removed */
 #define __NR_getdents64		220
 #define __NR_fcntl64		221
+#define __NR_timer_create	223
+#define __NR_timer_settime	224
+#define __NR_timer_gettime	225
+#define __NR_timer_getoverrun	226
+#define __NR_timer_delete	227
 
 /* user-visible error numbers are in the range -1 - -124: see <asm-i386/errno.h> */
 

Index: linux/include/asm-ia64/posix_types.h

include/asm-ia64/posix_types.h renamed from include/asm-ia64/posix_types.h:1.1.1.1 +2 -0
diff -u linux/include/asm-ia64/posix_types.h:1.1.1.1 linux/include/asm-ia64/posix_types.h:1.1.4.2
@@ -26,6 +26,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int             __kernel_timer_t;
+typedef int             __kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned long	__kernel_sigset_t;	/* at least 32 bits */

Index: linux/include/asm-ia64/siginfo.h

include/asm-ia64/siginfo.h renamed from include/asm-ia64/siginfo.h:1.1.1.6 +5 -3
diff -u linux/include/asm-ia64/siginfo.h:1.1.1.6 linux/include/asm-ia64/siginfo.h:1.1.4.7
@@ -33,8 +33,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -74,6 +75,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -98,7 +100,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-ia64/unistd.h

include/asm-ia64/unistd.h renamed from include/asm-ia64/unistd.h:1.1.1.7 +5 -0
diff -u linux/include/asm-ia64/unistd.h:1.1.1.7 linux/include/asm-ia64/unistd.h:1.1.4.8
@@ -204,6 +204,11 @@
 #define __NR_fstat			1212
 #define __NR_clone2			1213
 #define __NR_getdents64			1214
+#define __NR_timer_create		1215
+#define __NR_timer_settime		1216
+#define __NR_timer_gettime		1217
+#define __NR_timer_getoverrun		1218
+#define __NR_timer_delete		1219
 
 #if !defined(__ASSEMBLY__) && !defined(ASSEMBLER)
 

Index: linux/include/asm-m68k/posix_types.h

include/asm-m68k/posix_types.h renamed from include/asm-m68k/posix_types.h:1.1.1.2 +2 -0
diff -u linux/include/asm-m68k/posix_types.h:1.1.1.2 linux/include/asm-m68k/posix_types.h:1.1.2.2
@@ -22,6 +22,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef unsigned short	__kernel_uid16_t;

Index: linux/include/asm-m68k/siginfo.h

include/asm-m68k/siginfo.h renamed from include/asm-m68k/siginfo.h:1.1.1.4 +5 -3
diff -u linux/include/asm-m68k/siginfo.h:1.1.1.4 linux/include/asm-m68k/siginfo.h:1.1.2.5
@@ -30,8 +30,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -77,6 +78,7 @@
 #else
 #define si_uid		_sifields._kill._uid
 #endif /* __KERNEL__ */
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -95,7 +97,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-m68k/unistd.h

include/asm-m68k/unistd.h renamed from include/asm-m68k/unistd.h:1.1.1.3 +5 -0
diff -u linux/include/asm-m68k/unistd.h:1.1.1.3 linux/include/asm-m68k/unistd.h:1.1.2.3
@@ -222,6 +222,11 @@
 #define __NR_setfsuid32		215
 #define __NR_setfsgid32		216
 #define __NR_getdents64		220
+#define __NR_timer_create	221
+#define __NR_timer_settime	222
+#define __NR_timer_gettime	223
+#define __NR_timer_getoverrun	224
+#define __NR_timer_delete	225
 
 /* user-visible error numbers are in the range -1 - -122: see
    <asm-m68k/errno.h> */

Index: linux/include/asm-mips/posix_types.h

include/asm-mips/posix_types.h renamed from include/asm-mips/posix_types.h:1.1.1.4 +2 -0
diff -u linux/include/asm-mips/posix_types.h:1.1.1.4 linux/include/asm-mips/posix_types.h:1.1.2.4
@@ -32,6 +32,8 @@
 typedef long		__kernel_clock_t;
 typedef long		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 
 typedef unsigned short	__kernel_uid16_t;
 typedef unsigned short	__kernel_gid16_t;

Index: linux/include/asm-mips/siginfo.h

include/asm-mips/siginfo.h renamed from include/asm-mips/siginfo.h:1.1.1.5 +5 -3
diff -u linux/include/asm-mips/siginfo.h:1.1.1.5 linux/include/asm-mips/siginfo.h:1.1.2.6
@@ -68,8 +68,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -87,6 +88,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -105,7 +107,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-mips/unistd.h

include/asm-mips/unistd.h renamed from include/asm-mips/unistd.h:1.1.1.4 +6 -1
diff -u linux/include/asm-mips/unistd.h:1.1.1.4 linux/include/asm-mips/unistd.h:1.1.2.4
@@ -1206,11 +1206,16 @@
 #define __NR_mincore			(__NR_Linux + 217)
 #define __NR_madvise			(__NR_Linux + 218)
 #define __NR_getdents64			(__NR_Linux + 219)
+#define __NR_timer_create		(__NR_Linux + 220)
+#define __NR_timer_settime		(__NR_Linux + 221)
+#define __NR_timer_gettime		(__NR_Linux + 222)
+#define __NR_timer_getoverrun		(__NR_Linux + 223)
+#define __NR_timer_delete		(__NR_Linux + 224)
 
 /*
  * Offset of the last Linux flavoured syscall
  */
-#define __NR_Linux_syscalls		219
+#define __NR_Linux_syscalls		224
 
 #ifndef _LANGUAGE_ASSEMBLY
 

Index: linux/include/asm-mips64/siginfo.h

include/asm-mips64/siginfo.h renamed from include/asm-mips64/siginfo.h:1.1.1.3 +5 -3
diff -u linux/include/asm-mips64/siginfo.h:1.1.1.3 linux/include/asm-mips64/siginfo.h:1.1.2.4
@@ -68,8 +68,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -87,6 +88,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -105,7 +107,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-ppc/posix_types.h

include/asm-ppc/posix_types.h renamed from include/asm-ppc/posix_types.h:1.1.1.5 +2 -0
diff -u linux/include/asm-ppc/posix_types.h:1.1.1.5 linux/include/asm-ppc/posix_types.h:1.1.2.5
@@ -21,6 +21,8 @@
 typedef long		__kernel_time_t;
 typedef long		__kernel_suseconds_t;
 typedef long		__kernel_clock_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
 typedef short             __kernel_ipc_pid_t;

Index: linux/include/asm-ppc/siginfo.h

include/asm-ppc/siginfo.h renamed from include/asm-ppc/siginfo.h:1.1.1.5 +5 -3
diff -u linux/include/asm-ppc/siginfo.h:1.1.1.5 linux/include/asm-ppc/siginfo.h:1.1.2.5
@@ -27,8 +27,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -65,6 +66,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -83,7 +85,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-ppc/unistd.h

include/asm-ppc/unistd.h renamed from include/asm-ppc/unistd.h:1.1.1.5 +5 -0
diff -u linux/include/asm-ppc/unistd.h:1.1.1.5 linux/include/asm-ppc/unistd.h:1.1.2.5
@@ -206,6 +206,11 @@
 #define __NR_pciconfig_iobase	200
 #define __NR_multiplexer	201
 #define __NR_getdents64		202
+#define __NR_timer_create	203
+#define __NR_timer_settime	204
+#define __NR_timer_gettime	205
+#define __NR_timer_getoverrun	206
+#define __NR_timer_delete	207
 
 #define __NR(n)	#n
 

Index: linux/include/asm-s390/siginfo.h

include/asm-s390/siginfo.h renamed from include/asm-s390/siginfo.h:1.1.1.1 +4 -2
diff -u linux/include/asm-s390/siginfo.h:1.1.1.1 linux/include/asm-s390/siginfo.h:1.1.2.2
@@ -37,8 +37,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -75,6 +76,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime

Index: linux/include/asm-s390/unistd.h

include/asm-s390/unistd.h renamed from include/asm-s390/unistd.h:1.1.1.2 +5 -1
diff -u linux/include/asm-s390/unistd.h:1.1.1.2 linux/include/asm-s390/unistd.h:1.1.2.3
@@ -209,7 +209,11 @@
 #define __NR_mincore            218
 #define __NR_madvise            219
 #define __NR_getdents64		220
-
+#define __NR_timer_create	221
+#define __NR_timer_settime	222
+#define __NR_timer_gettime	223
+#define __NR_timer_getoverrun	224
+#define __NR_timer_delete	225
 
 /* user-visible error numbers are in the range -1 - -122: see <asm-s390/errno.h> */
 

Index: linux/include/asm-sh/posix_types.h

include/asm-sh/posix_types.h renamed from include/asm-sh/posix_types.h:1.1.1.2 +2 -0
diff -u linux/include/asm-sh/posix_types.h:1.1.1.2 linux/include/asm-sh/posix_types.h:1.1.2.2
@@ -24,6 +24,8 @@
 typedef long		__kernel_clock_t;
 typedef int		__kernel_daddr_t;
 typedef char *		__kernel_caddr_t;
+typedef int		__kernel_timer_t;
+typedef int		__kernel_clockid_t;
 typedef unsigned short	__kernel_uid16_t;
 typedef unsigned short	__kernel_gid16_t;
 typedef unsigned int	__kernel_uid32_t;

Index: linux/include/asm-sh/siginfo.h

include/asm-sh/siginfo.h renamed from include/asm-sh/siginfo.h:1.1.1.4 +5 -3
diff -u linux/include/asm-sh/siginfo.h:1.1.1.4 linux/include/asm-sh/siginfo.h:1.1.2.5
@@ -29,8 +29,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -67,6 +68,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -85,7 +87,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-sparc/posix_types.h

include/asm-sparc/posix_types.h renamed from include/asm-sparc/posix_types.h:1.1.1.2 +2 -0
diff -u linux/include/asm-sparc/posix_types.h:1.1.1.2 linux/include/asm-sparc/posix_types.h:1.1.2.2
@@ -13,6 +13,8 @@
 typedef long                   __kernel_time_t;
 typedef long		       __kernel_suseconds_t;
 typedef long                   __kernel_clock_t;
+typedef int		       __kernel_timer_t;
+typedef int		       __kernel_clockid_t;
 typedef int                    __kernel_pid_t;
 typedef unsigned short         __kernel_ipc_pid_t;
 typedef unsigned short         __kernel_uid_t;

Index: linux/include/asm-sparc/siginfo.h

include/asm-sparc/siginfo.h renamed from include/asm-sparc/siginfo.h:1.1.1.4 +5 -3
diff -u linux/include/asm-sparc/siginfo.h:1.1.1.4 linux/include/asm-sparc/siginfo.h:1.1.2.5
@@ -31,8 +31,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -70,6 +71,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -89,7 +91,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-sparc/unistd.h

include/asm-sparc/unistd.h renamed from include/asm-sparc/unistd.h:1.1.1.5 +10 -8
diff -u linux/include/asm-sparc/unistd.h:1.1.1.5 linux/include/asm-sparc/unistd.h:1.1.2.4
@@ -184,11 +184,11 @@
 /* #define __NR_exportfs        166    SunOS Specific                              */
 #define __NR_mount              167 /* Common                                      */
 #define __NR_ustat              168 /* Common                                      */
-/* #define __NR_semsys          169    SunOS Specific                              */
-/* #define __NR_msgsys          170    SunOS Specific                              */
-/* #define __NR_shmsys          171    SunOS Specific                              */
-/* #define __NR_auditsys        172    SunOS Specific                              */
-/* #define __NR_rfssys          173    SunOS Specific                              */
+#define __NR_timer_create       169 /* Linux Specific, semsys under SunOS          */
+#define __NR_timer_settime      170 /* Linux Specific, msgsys under SunOS          */
+#define __NR_timer_gettime      171 /* Linux Specific, shmsys under SunOS          */
+#define __NR_timer_getoverrun   172 /* Linux Specific, auditsys under SunOS        */
+#define __NR_timer_delete       173 /* Linux Specific, rfssys under SunOS          */
 #define __NR_getdents           174 /* Common                                      */
 #define __NR_setsid             175 /* Common                                      */
 #define __NR_fchdir             176 /* Common                                      */
@@ -201,9 +201,9 @@
 #define __NR_sigpending         183 /* Common                                      */
 #define __NR_query_module	184 /* Linux Specific				   */
 #define __NR_setpgid            185 /* Common                                      */
-/* #define __NR_pathconf        186    SunOS Specific                              */
-/* #define __NR_fpathconf       187    SunOS Specific                              */
-/* #define __NR_sysconf         188    SunOS Specific                              */
+/* #define __NR_clock_gettime	186    Linux Specific				   */
+/* #define __NR_clock_settime	187    Linux Specific				   */
+/* #define __NR_clock_getres	188    Linux Specific				   */
 #define __NR_uname              189 /* Linux Specific                              */
 #define __NR_init_module        190 /* Linux Specific                              */
 #define __NR_personality        191 /* Linux Specific                              */
@@ -271,6 +271,8 @@
 #define __NR_fdatasync          253
 #define __NR_nfsservctl         254
 #define __NR_aplib              255
+/* Please don't add syscalls above 255.
+   Contact [email protected] or [email protected] for number assignment.  */
 
 #define _syscall0(type,name) \
 type name(void) \

Index: linux/include/asm-sparc64/posix_types.h

include/asm-sparc64/posix_types.h renamed from include/asm-sparc64/posix_types.h:1.1.1.4 +4 -0
diff -u linux/include/asm-sparc64/posix_types.h:1.1.1.4 linux/include/asm-sparc64/posix_types.h:1.1.2.4
@@ -12,6 +12,8 @@
 typedef long                   __kernel_ptrdiff_t;
 typedef long                   __kernel_time_t;
 typedef long                   __kernel_clock_t;
+typedef int		       __kernel_timer_t;
+typedef int		       __kernel_clockid_t;
 typedef int                    __kernel_pid_t;
 typedef int                    __kernel_ipc_pid_t;
 typedef unsigned int           __kernel_uid_t;
@@ -67,6 +69,8 @@
 typedef unsigned int           __kernel_caddr_t32;
 typedef long		       __kernel_loff_t32;
 typedef __kernel_fsid_t        __kernel_fsid_t32;
+typedef int		       __kernel_timer_t32;
+typedef int		       __kernel_clockid_t32;
 
 #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
 

Index: linux/include/asm-sparc64/siginfo.h

include/asm-sparc64/siginfo.h renamed from include/asm-sparc64/siginfo.h:1.1.1.4 +8 -5
diff -u linux/include/asm-sparc64/siginfo.h:1.1.1.4 linux/include/asm-sparc64/siginfo.h:1.1.2.5
@@ -37,8 +37,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;		/* timer id */
+			int _pad;		/* padding */
+			sigval_t _sigval;	/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -89,8 +90,9 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t32 _tid;			/* timer id */
+			int _pad			/* padding */
+			sigval_t32 _sigval;		/* same as below */
 		} _timer;
 
 		/* POSIX.1b signals */
@@ -130,6 +132,7 @@
  */
 #define si_pid		_sifields._kill._pid
 #define si_uid		_sifields._kill._uid
+#define si_tid		_sifields._timer._tid
 #define si_status	_sifields._sigchld._status
 #define si_utime	_sifields._sigchld._utime
 #define si_stime	_sifields._sigchld._stime
@@ -149,7 +152,7 @@
 #define __SI_FAULT	(3 << 16)
 #define __SI_CHLD	(4 << 16)
 #define __SI_RT		(5 << 16)
-#define __SI_CODE(T,N)	((T) << 16 | ((N) & 0xffff))
+#define __SI_CODE(T,N)	((T) | ((N) & 0xffff))
 #else
 #define __SI_KILL	0
 #define __SI_TIMER	0

Index: linux/include/asm-sparc64/unistd.h

include/asm-sparc64/unistd.h renamed from include/asm-sparc64/unistd.h:1.1.1.6 +10 -8
diff -u linux/include/asm-sparc64/unistd.h:1.1.1.6 linux/include/asm-sparc64/unistd.h:1.1.2.5
@@ -184,11 +184,11 @@
 /* #define __NR_exportfs        166    SunOS Specific                              */
 #define __NR_mount              167 /* Common                                      */
 #define __NR_ustat              168 /* Common                                      */
-/* #define __NR_semsys          169    SunOS Specific                              */
-/* #define __NR_msgsys          170    SunOS Specific                              */
-/* #define __NR_shmsys          171    SunOS Specific                              */
-/* #define __NR_auditsys        172    SunOS Specific                              */
-/* #define __NR_rfssys          173    SunOS Specific                              */
+#define __NR_timer_create       169 /* Linux Specific, semsys under SunOS          */
+#define __NR_timer_settime      170 /* Linux Specific, msgsys under SunOS          */
+#define __NR_timer_gettime      171 /* Linux Specific, shmsys under SunOS          */
+#define __NR_timer_getoverrun   172 /* Linux Specific, auditsys under SunOS        */
+#define __NR_timer_delete       173 /* Linux Specific, rfssys under SunOS          */
 #define __NR_getdents           174 /* Common                                      */
 #define __NR_setsid             175 /* Common                                      */
 #define __NR_fchdir             176 /* Common                                      */
@@ -201,9 +201,9 @@
 #define __NR_sigpending         183 /* Common                                      */
 #define __NR_query_module	184 /* Linux Specific				   */
 #define __NR_setpgid            185 /* Common                                      */
-/* #define __NR_pathconf        186    SunOS Specific                              */
-/* #define __NR_fpathconf       187    SunOS Specific                              */
-/* #define __NR_sysconf         188    SunOS Specific                              */
+/* #define __NR_clock_gettime	186    Linux Specific				   */
+/* #define __NR_clock_settime	187    Linux Specific				   */
+/* #define __NR_clock_getres	188    Linux Specific				   */
 #define __NR_uname              189 /* Linux Specific                              */
 #define __NR_init_module        190 /* Linux Specific                              */
 #define __NR_personality        191 /* Linux Specific                              */
@@ -273,6 +273,8 @@
 #define __NR_fdatasync          253
 #define __NR_nfsservctl         254
 #define __NR_aplib              255
+/* Please don't add syscalls above 255.
+   Contact [email protected] or [email protected] for number assignment.  */
 
 #define _syscall0(type,name) \
 type name(void) \

Index: linux/include/linux/limits.h

include/linux/limits.h renamed from include/linux/limits.h:1.1.1.1 +3 -0
diff -u linux/include/linux/limits.h:1.1.1.1 linux/include/linux/limits.h:1.1.2.1
@@ -14,6 +14,9 @@
 #define PATH_MAX        4095	/* # chars in a path name */
 #define PIPE_BUF        4096	/* # bytes in atomic write to a pipe */
 
+#define TIMER_MAX         32    /* # POSIX.1b timers a process may have */
+#define DELAYTIMER_MAX INT_MAX	/* # timer expiration overruns a POSIX.1b timer may have */
+
 #define RTSIG_MAX	  32
 
 #endif

Index: linux/include/linux/sched.h

include/linux/sched.h renamed from include/linux/sched.h:1.1.1.19 +27 -0
diff -u linux/include/linux/sched.h:1.1.1.19 linux/include/linux/sched.h:1.1.2.18
@@ -40,6 +40,7 @@
 #define CLONE_VFORK	0x00004000	/* set if the parent wants the child to wake it up on mm_release */
 #define CLONE_PARENT	0x00008000	/* set if we want to have the same parent as the cloner */
 #define CLONE_THREAD	0x00010000	/* Same thread group? */
+#define CLONE_ITIMERS   0x00020000      /* set if POSIX.1b itimers are shared */
 
 #define CLONE_SIGNAL	(CLONE_SIGHAND | CLONE_THREAD)
 
@@ -274,6 +275,29 @@
 extern struct user_struct root_user;
 #define INIT_USER (&root_user)
 
+/* POSIX.1b interval timer structure. */
+struct k_itimer {
+	spinlock_t it_lock;
+	clockid_t it_clock;		/* which timer type */
+	timer_t it_id;			/* timer id */
+	int it_overrun;			/* number of signals overrun */
+	struct sigevent it_signal;	/* signal to be delivered */
+	struct timespec it_interval;	/* interval (rounded to jiffies) */
+	int it_incr;			/* interval specified in jiffies */
+	struct task_struct *it_process;	/* process to send signal to */
+	struct timer_list it_timer;
+};
+
+/* Structure to maintain the dynamically created POSIX.1b interval timers. */
+struct itimer_struct {
+	atomic_t count;
+	spinlock_t its_lock;
+	struct k_itimer *itimer[TIMER_MAX];	
+};
+
+extern struct itimer_struct *itimer_struct_new(void);
+extern void itimer_struct_delete(struct itimer_struct *timers);
+
 struct task_struct {
 	/*
 	 * offsets of these are hardcoded elsewhere - touch with care
@@ -345,6 +369,7 @@
 	unsigned long it_real_value, it_prof_value, it_virt_value;
 	unsigned long it_real_incr, it_prof_incr, it_virt_incr;
 	struct timer_list real_timer;
+	struct itimer_struct *posix_timers; /* POSIX.1b Interval Timers */
 	struct tms times;
 	unsigned long start_time;
 	long per_cpu_utime[NR_CPUS], per_cpu_stime[NR_CPUS];
@@ -459,6 +484,7 @@
     real_timer:		{						\
 	function:		it_real_fn				\
     },									\
+    posix_timers:	NULL,						\
     cap_effective:	CAP_INIT_EFF_SET,				\
     cap_inheritable:	CAP_INIT_INH_SET,				\
     cap_permitted:	CAP_FULL_SET,					\
@@ -737,6 +763,7 @@
 extern void exit_mm(struct task_struct *);
 extern void exit_files(struct task_struct *);
 extern void exit_sighand(struct task_struct *);
+extern void exit_itimers(struct task_struct *);
 
 extern void daemonize(void);
 

Index: linux/include/linux/time.h

include/linux/time.h renamed from include/linux/time.h:1.1.1.3 +30 -4
diff -u linux/include/linux/time.h:1.1.1.3 linux/include/linux/time.h:1.1.2.3
@@ -1,7 +1,7 @@
 #ifndef _LINUX_TIME_H
 #define _LINUX_TIME_H
 
-#include <asm/param.h>
+#include <linux/param.h>
 #include <linux/types.h>
 
 #ifndef _STRUCT_TIMESPEC
@@ -28,6 +28,19 @@
  */
 #define MAX_JIFFY_OFFSET ((~0UL >> 1)-1)
 
+/* Parameters used to convert the timespec values */
+#ifndef USEC_PER_SEC
+#define USEC_PER_SEC (1000000L)
+#endif
+
+#ifndef NSEC_PER_SEC
+#define NSEC_PER_SEC (1000000000L)
+#endif
+
+#ifndef NSEC_PER_USEC
+#define NSEC_PER_USEC (1000L)
+#endif
+
 static __inline__ unsigned long
 timespec_to_jiffies(struct timespec *value)
 {
@@ -36,15 +49,15 @@
 
 	if (sec >= (MAX_JIFFY_OFFSET / HZ))
 		return MAX_JIFFY_OFFSET;
-	nsec += 1000000000L / HZ - 1;
-	nsec /= 1000000000L / HZ;
+	nsec += NSEC_PER_SEC / HZ - 1;
+	nsec /= NSEC_PER_SEC / HZ;
 	return HZ * sec + nsec;
 }
 
 static __inline__ void
 jiffies_to_timespec(unsigned long jiffies, struct timespec *value)
 {
-	value->tv_nsec = (jiffies % HZ) * (1000000000L / HZ);
+	value->tv_nsec = (jiffies % HZ) * (NSEC_PER_SEC / HZ);
 	value->tv_sec = jiffies / HZ;
 }
 
@@ -127,5 +140,18 @@
 	struct	timeval it_interval;	/* timer interval */
 	struct	timeval it_value;	/* current value */
 };
+
+
+/*
+ * The IDs of the various system clocks (for POSIX.1b interval timers).
+ */
+#define CLOCK_REALTIME 0
+
+/*
+ * The various flags for setting POSIX.1b interval timers.
+ */
+
+#define TIMER_ABSTIME 0x01
+
 
 #endif

Index: linux/include/linux/types.h

include/linux/types.h renamed from include/linux/types.h:1.1.1.3 +2 -0
diff -u linux/include/linux/types.h:1.1.1.3 linux/include/linux/types.h:1.1.2.3
@@ -20,6 +20,8 @@
 typedef __kernel_daddr_t	daddr_t;
 typedef __kernel_key_t		key_t;
 typedef __kernel_suseconds_t	suseconds_t;
+typedef __kernel_timer_t	timer_t;
+typedef __kernel_clockid_t	clockid_t;
 
 #ifdef __KERNEL__
 typedef __kernel_uid32_t	uid_t;

Index: linux/kernel/exit.c

kernel/exit.c renamed from kernel/exit.c:1.1.1.20 +16 -0
diff -u linux/kernel/exit.c:1.1.1.20 linux/kernel/exit.c:1.1.2.18
@@ -294,6 +294,21 @@
 	mmdrop(active_mm);
 }
 
+static inline void __exit_itimers(struct task_struct *tsk)
+{
+	struct itimer_struct *timers = tsk->posix_timers;
+
+	if (timers) {
+		itimer_struct_delete(timers);
+		tsk->posix_timers = NULL;
+	}
+}
+
+void exit_itimers(struct task_struct *tsk)
+{
+	__exit_itimers(tsk);
+}
+
 /*
  * Turn us into a lazy TLB process if we
  * aren't already..
@@ -441,6 +456,7 @@
 	sem_exit();
 	__exit_files(tsk);
 	__exit_fs(tsk);
+	__exit_itimers(tsk);
 	exit_sighand(tsk);
 	exit_thread();
 

Index: linux/kernel/fork.c

kernel/fork.c renamed from kernel/fork.c:1.1.1.18 +21 -0
diff -u linux/kernel/fork.c:1.1.1.18 linux/kernel/fork.c:1.1.2.16
@@ -543,6 +543,23 @@
 	p->flags = new_flags;
 }
 
+
+static inline int copy_itimers(unsigned long clone_flags, struct task_struct * tsk)
+{
+	if (clone_flags & CLONE_ITIMERS) {
+		if (tsk->posix_timers == NULL) {
+			tsk->posix_timers = itimer_struct_new();
+			if (tsk->posix_timers == NULL) return -1;
+		}
+		atomic_inc(&tsk->posix_timers->count);
+		return 0;
+	}
+	tsk->posix_timers = NULL;
+
+	return 0;
+}
+
+
 /*
  *  Ok, this is the main fork-routine. It copies the system process
  * information (task[nr]) and sets up the necessary registers. It also
@@ -646,6 +663,8 @@
 		goto bad_fork_cleanup_files;
 	if (copy_sighand(clone_flags, p))
 		goto bad_fork_cleanup_fs;
+	if (copy_itimers(clone_flags, p))
+		goto bad_fork_cleanup_itimers;
 	if (copy_mm(clone_flags, p))
 		goto bad_fork_cleanup_sighand;
 	retval = copy_thread(0, clone_flags, stack_start, stack_size, p, regs);
@@ -704,6 +723,8 @@
 		down(&sem);
 	return retval;
 
+bad_fork_cleanup_itimers:
+	exit_itimers(p);
 bad_fork_cleanup_sighand:
 	exit_sighand(p);
 bad_fork_cleanup_fs:

Index: linux/kernel/itimer.c

kernel/itimer.c renamed from kernel/itimer.c:1.1.1.3 +430 -3

450 lines not on this page · raw message

Index: linux/kernel/signal.c

kernel/signal.c renamed from kernel/signal.c:1.1.1.12 +18 -2
diff -u linux/kernel/signal.c:1.1.1.12 linux/kernel/signal.c:1.1.2.12
@@ -255,8 +255,6 @@
 		if (!collect_signal(sig, &current->pending, info))
 			sig = 0;
 				
-		/* XXX: Once POSIX.1b timers are in, if si_code == SI_TIMER,
-		   we need to xchg out the timer overrun values.  */
 	}
 	recalc_sigpending(current);
 
@@ -540,6 +538,24 @@
 	   the signal. */
 	if (sig < SIGRTMIN && sigismember(&t->pending.signal, sig))
 		goto out;
+
+	/* In case of a POSIX timer generated signal you must check 
+	   if a signal from this timer is already in the queue.
+	   If that is true, the overrun count will be increased in
+	   itimer.c:posix_timer_fn(). */
+
+	if (((unsigned long)info > 1) && (info->si_code == SI_TIMER)) {
+		struct sigqueue *q;
+		for (q = t->pending.head; q; q = q->next) {
+			if ((q->info.si_code == SI_TIMER) &&
+			    (q->info.si_tid == info->si_tid)) {
+				/* this special value (1) is recognized
+				   only by posix_timer_fn() in itimer.c */
+				ret = 1;
+				goto out;
+			}
+		}
+	}
 
 	ret = deliver_signal(sig, info, t);
 out: