Skip to contentSkip to conversation

Opteron support for mqueues-4.00 +bug fixes

PATCH RESEND New Joe Korty 1 participant 1 message Nov 20, 2003

lore
Share & tools
lore

Joe Korty

author
#0 lore raw

PATCH RESEND 1/1 Opteron support for mqueues-4.00 +bug fixes

[ resending from another account, the previous didn't make it to the list ]

Hi Michal, Krzysztof,

Applies against 2.6.0-test9-bk1 + the mqueues-4.00 kernel patch.

o adds Opteron native and ia32 interfaces for posix message queues
o fixes sys_mq_unlink OOPs for nonexistant filename
o mq_open now returns EINVAL when (flags & 3) == 3

Some comments:

2.6.0-test9-bk1 was used as 2.6.0-test9 doesn't boot on Opteron.

Opteron (and probably the other 64 bit archs) require that a kernel system call definition return a long (hence the s/asmlinkage int sys_/asmlinkage long sys_/ changes throughout the patch).

Passes the mqueue portion of posixtestsuites-1.3.0 on i386, and also passes on Opteron in native and in ia32 compatibility mode.

Regards,
Joe

arch/x86_64/ia32/ia32entry.S +10 -0
diff -ura 4.00/arch/x86_64/ia32/ia32entry.S new/arch/x86_64/ia32/ia32entry.S
@@ -476,6 +476,16 @@
 	.quad sys_tgkill
 	.quad compat_sys_utimes
 	.quad sys32_fadvise64_64
+	.quad ni_syscall
+
+	.quad compat_sys_mq_open
+	.quad sys_mq_unlink
+	.quad compat_sys_mq_timedsend
+	.quad compat_sys_mq_timedreceive
+	.quad compat_sys_mq_notify
+	.quad compat_sys_mq_getattr
+	.quad compat_sys_mq_setattr
+
 	/* don't forget to change IA32_NR_syscalls */
 ia32_syscall_end:		
 	.rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
include/asm-x86_64/ia32_unistd.h +9 -1
diff -ura 4.00/include/asm-x86_64/ia32_unistd.h new/include/asm-x86_64/ia32_unistd.h
@@ -279,6 +279,14 @@
 #define __NR_ia32_utimes		271
 #define __NR_ia32_fadvise64_64		272
 
-#define IA32_NR_syscalls 275	/* must be > than biggest syscall! */	
+#define __NR_ia32_mq_open 		274
+#define __NR_ia32_mq_unlink		(__NR_ia32_mqopen+1)
+#define __NR_ia32_mq_timedsend		(__NR_ia32_mqopen+2)
+#define __NR_ia32_mq_timedreceive	(__NR_ia32_mqopen+3)
+#define __NR_ia32_mq_notify		(__NR_ia32_mqopen+4)
+#define __NR_ia32_mq_getattr		(__NR_ia32_mqopen+5)
+#define __NR_ia32_mq_setattr		(__NR_ia32_mqopen+6)
+
+#define IA32_NR_syscalls 281	/* must be > than biggest syscall! */	
 
 #endif /* _ASM_X86_64_IA32_UNISTD_H_ */
include/asm-x86_64/unistd.h +16 -1
diff -ura 4.00/include/asm-x86_64/unistd.h new/include/asm-x86_64/unistd.h
@@ -532,8 +532,23 @@
 __SYSCALL(__NR_utimes, sys_utimes)
 #define __NR_vserver		236
 __SYSCALL(__NR_vserver, sys_ni_syscall)
+#define __NR_mq_open			274
+__SYSCALL(__NR_mq_open, sys_mq_open)
+#define __NR_mq_unlink			275
+__SYSCALL(__NR_mq_unlink, sys_mq_unlink)
+#define __NR_mq_timedsend		276
+__SYSCALL(__NR_mq_timedsend, sys_mq_timedsend)
+#define __NR_mq_timedreceive		277
+__SYSCALL(__NR_mq_timedreceive, sys_mq_timedreceive)
+#define __NR_mq_notify			278
+__SYSCALL(__NR_mq_notify, sys_mq_notify)
+#define __NR_mq_getattr			279
+__SYSCALL(__NR_mq_getattr, sys_mq_getattr)
+#define __NR_mq_setattr			280
+__SYSCALL(__NR_mq_setattr, sys_mq_setattr)
 
-#define __NR_syscall_max __NR_vserver
+#undef __NR_syscall_max
+#define __NR_syscall_max __NR_mq_setattr
 #ifndef __NO_STUBS
 
 /* user-visible error numbers are in the range -1 - -4095 */
include/linux/compat.h +2 -2
diff -ura 4.00/include/linux/compat.h new/include/linux/compat.h
@@ -44,8 +44,8 @@
 } compat_sigset_t;
 
 extern int cp_compat_stat(struct kstat *, struct compat_stat *);
-extern int get_compat_timespec(struct timespec *, struct compat_timespec *);
-extern int put_compat_timespec(struct timespec *, struct compat_timespec *);
+extern int get_compat_timespec(struct timespec *, const struct compat_timespec *);
+extern int put_compat_timespec(struct timespec *, const struct compat_timespec *);
 
 struct compat_iovec {
 	compat_uptr_t	iov_base;
include/linux/mqueue.h +8 -6
diff -ura 4.00/include/linux/mqueue.h new/include/linux/mqueue.h
@@ -21,12 +21,14 @@
 	long mq_curmsgs;	/* number of messages currently queued */
 };
 
-asmlinkage mqd_t sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
-asmlinkage int sys_mq_unlink(const char __user *name);
-asmlinkage int mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
+#ifdef __KERNEL__
+asmlinkage long sys_mq_open(const char __user *name, int oflag, mode_t mode, struct mq_attr __user *attr);
+asmlinkage long sys_mq_unlink(const char __user *name);
+asmlinkage long mq_timedsend(mqd_t mqdes, const char __user *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec __user *abs_timeout);
 asmlinkage ssize_t mq_timedreceive(mqd_t mqdes, char __user *msg_ptr, size_t msg_len, unsigned int __user *msg_prio, const struct timespec __user *abs_timeout);
-asmlinkage int mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
-asmlinkage int mq_getattr(mqd_t mqdes, struct mq_attr __user *mqstat);
-asmlinkage int mq_setattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
+asmlinkage long mq_notify(mqd_t mqdes, const struct sigevent __user *notification);
+asmlinkage long mq_getattr(mqd_t mqdes, struct mq_attr __user *mqstat);
+asmlinkage long mq_setattr(mqd_t mqdes, const struct mq_attr __user *mqstat, struct mq_attr __user *omqstat);
+#endif
 
 #endif
ipc/mqueue.c +251 -17

351 lines not on this page · raw message

kernel/compat.c +2 -2
diff -ura 4.00/kernel/compat.c new/kernel/compat.c
@@ -22,14 +22,14 @@
 
 #include <asm/uaccess.h>
 
-int get_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int get_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_READ, cts, sizeof(*cts)) ||
 			__get_user(ts->tv_sec, &cts->tv_sec) ||
 			__get_user(ts->tv_nsec, &cts->tv_nsec)) ? -EFAULT : 0;
 }
 
-int put_compat_timespec(struct timespec *ts, struct compat_timespec *cts)
+int put_compat_timespec(struct timespec *ts, const struct compat_timespec *cts)
 {
 	return (verify_area(VERIFY_WRITE, cts, sizeof(*cts)) ||
 			__put_user(ts->tv_sec, &cts->tv_sec) ||