All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] fix shmat
       [not found] <E1AvBNO-0004QF-00@bkwatch.colorfullife.com>
@ 2004-02-23 18:15 ` Manfred Spraul
  2004-02-23 18:21   ` Randy.Dunlap
                     ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Manfred Spraul @ 2004-02-23 18:15 UTC (permalink / raw)
  To: piggin; +Cc: linux-kernel, Andrew Morton, torvalds

 From the bitkeeper commit message queue:

>	
>	sys_shmat() need to be declared asmlinkage.  This causes breakage when we
>	actually get the proper prototypes into caller's scope.
>  
>
Why? sys_shmat is not a system call. Or at least there is a comment just 
before the implementation that this is not a syscall.
I think either the asmlinkage or the comment are wrong:
/*
 * Fix shmaddr, allocate descriptor, map shm, add attach descriptor to 
lists.
 *
 * NOTE! Despite the name, this is NOT a direct system call entrypoint. The

>  * "raddr" thing points to kernel space, and there has to be a wrapper around
>  * this.
>  */
>-long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
>+asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
> {
> 	struct shmid_kernel *shp;
> 	unsigned long addr;
>

I'd propose to remove the asmlinkage and to move the prototype (without 
asmlinkage) back from syscalls.h to shm.h - what do you think?
--
    Manfred


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 18:15 ` [PATCH] fix shmat Manfred Spraul
@ 2004-02-23 18:21   ` Randy.Dunlap
  2004-02-23 18:36   ` Linus Torvalds
  2004-02-23 19:02   ` Christoph Hellwig
  2 siblings, 0 replies; 7+ messages in thread
From: Randy.Dunlap @ 2004-02-23 18:21 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: piggin, linux-kernel, akpm, torvalds

On Mon, 23 Feb 2004 19:15:04 +0100 Manfred Spraul <manfred@colorfullife.com> wrote:

|  From the bitkeeper commit message queue:
| 
| >	
| >	sys_shmat() need to be declared asmlinkage.  This causes breakage when we
| >	actually get the proper prototypes into caller's scope.
| >  
| >
| Why? sys_shmat is not a system call. Or at least there is a comment just 
| before the implementation that this is not a syscall.
| I think either the asmlinkage or the comment are wrong:
| /*
|  * Fix shmaddr, allocate descriptor, map shm, add attach descriptor to 
| lists.
|  *
|  * NOTE! Despite the name, this is NOT a direct system call entrypoint. The
| 
| >  * "raddr" thing points to kernel space, and there has to be a wrapper around
| >  * this.
| >  */
| >-long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
| >+asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
| > {
| > 	struct shmid_kernel *shp;
| > 	unsigned long addr;
| >
| 
| I'd propose to remove the asmlinkage and to move the prototype (without 
| asmlinkage) back from syscalls.h to shm.h - what do you think?

It's not a syscall AFAICT.
It's not listed in any .S files, like most syscalls are.
However, it is listed in kernel/sys.c as a "cond_syscall",
which I'm guessing is incorrect.

I'd like to rename it so that it doesn't begin with "sys_".

--
~Randy

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 18:15 ` [PATCH] fix shmat Manfred Spraul
  2004-02-23 18:21   ` Randy.Dunlap
@ 2004-02-23 18:36   ` Linus Torvalds
  2004-02-23 20:33     ` Manfred Spraul
  2004-02-23 19:02   ` Christoph Hellwig
  2 siblings, 1 reply; 7+ messages in thread
From: Linus Torvalds @ 2004-02-23 18:36 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: piggin, linux-kernel, Andrew Morton



On Mon, 23 Feb 2004, Manfred Spraul wrote:
> 
> I'd propose to remove the asmlinkage and to move the prototype (without 
> asmlinkage) back from syscalls.h to shm.h - what do you think?

Please. Maybe it might even be worth-while renaming it to "do_sys_shmat()"  
to make it clear that it's not a "sys_xxx()" at all.

		Linus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 18:15 ` [PATCH] fix shmat Manfred Spraul
  2004-02-23 18:21   ` Randy.Dunlap
  2004-02-23 18:36   ` Linus Torvalds
@ 2004-02-23 19:02   ` Christoph Hellwig
  2 siblings, 0 replies; 7+ messages in thread
From: Christoph Hellwig @ 2004-02-23 19:02 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: piggin, linux-kernel, Andrew Morton, torvalds

On Mon, Feb 23, 2004 at 07:15:04PM +0100, Manfred Spraul wrote:
> Why? sys_shmat is not a system call. Or at least there is a comment just 
> before the implementation that this is not a syscall.
> I think either the asmlinkage or the comment are wrong:

On 64bit mips kernels it's a syscall.  On parics, too but they use a
wrapper neverless.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 18:36   ` Linus Torvalds
@ 2004-02-23 20:33     ` Manfred Spraul
  2004-02-23 20:57       ` Andrew Morton
  0 siblings, 1 reply; 7+ messages in thread
From: Manfred Spraul @ 2004-02-23 20:33 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: piggin, linux-kernel, Andrew Morton



On Mon, 23 Feb 2004, Linus Torvalds wrote:
>
> Please. Maybe it might even be worth-while renaming it to "do_sys_shmat()"
> to make it clear that it's not a "sys_xxx()" at all.
>

Below is a patch that renames sys_shmat to do_shmat. Additionally, I've
replaced the cond_syscall with a conditional inline function.

It touches all archs - only i386 is tested.
The patch is against 2.6.3-bk5 (latest slapshot)

--
	Manfred
<<<<
diff -ur 2.6/arch/alpha/kernel/osf_sys.c build-2.6/arch/alpha/kernel/osf_sys.c
--- 2.6/arch/alpha/kernel/osf_sys.c	2004-01-09 07:59:02.000000000 +0100
+++ build-2.6/arch/alpha/kernel/osf_sys.c	2004-02-23 20:51:48.000000000 +0100
@@ -464,7 +464,7 @@
 	unsigned long raddr;
 	long err;

-	err = sys_shmat(shmid, shmaddr, shmflg, &raddr);
+	err = do_shmat(shmid, shmaddr, shmflg, &raddr);

 	/*
 	 * This works because all user-level addresses are
diff -ur 2.6/arch/arm/kernel/sys_arm.c build-2.6/arch/arm/kernel/sys_arm.c
--- 2.6/arch/arm/kernel/sys_arm.c	2004-01-09 07:59:10.000000000 +0100
+++ build-2.6/arch/arm/kernel/sys_arm.c	2004-02-23 20:53:02.000000000 +0100
@@ -210,7 +210,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				return ret;
 			return put_user (raddr, (ulong *) third);
@@ -218,7 +218,7 @@
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
-			return sys_shmat (first, (char *) ptr,
+			return do_shmat (first, (char *) ptr,
 					  second, (ulong *) third);
 		}
 	case SHMDT:
diff -ur 2.6/arch/arm26/kernel/sys_arm.c build-2.6/arch/arm26/kernel/sys_arm.c
--- 2.6/arch/arm26/kernel/sys_arm.c	2004-01-09 07:59:44.000000000 +0100
+++ build-2.6/arch/arm26/kernel/sys_arm.c	2004-02-23 20:44:18.000000000 +0100
@@ -211,7 +211,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				return ret;
 			return put_user (raddr, (ulong *) third);
@@ -219,7 +219,7 @@
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
-			return sys_shmat (first, (char *) ptr,
+			return do_shmat (first, (char *) ptr,
 					  second, (ulong *) third);
 		}
 	case SHMDT:
diff -ur 2.6/arch/cris/kernel/sys_cris.c build-2.6/arch/cris/kernel/sys_cris.c
--- 2.6/arch/cris/kernel/sys_cris.c	2004-01-09 07:59:04.000000000 +0100
+++ build-2.6/arch/cris/kernel/sys_cris.c	2004-02-23 20:43:21.000000000 +0100
@@ -155,7 +155,7 @@

 	case SHMAT: {
                 ulong raddr;
-                ret = sys_shmat (first, (char __user *) ptr, second, &raddr);
+                ret = do_shmat (first, (char __user *) ptr, second, &raddr);
                 if (ret)
                         return ret;
                 return put_user (raddr, (ulong __user *) third);
diff -ur 2.6/arch/h8300/kernel/sys_h8300.c build-2.6/arch/h8300/kernel/sys_h8300.c
--- 2.6/arch/h8300/kernel/sys_h8300.c	2004-01-09 07:59:56.000000000 +0100
+++ build-2.6/arch/h8300/kernel/sys_h8300.c	2004-02-23 20:53:28.000000000 +0100
@@ -240,7 +240,7 @@
 			switch (version) {
 			default: {
 				ulong raddr;
-				ret = sys_shmat (first, (char *) ptr,
+				ret = do_shmat (first, (char *) ptr,
 						 second, &raddr);
 				if (ret)
 					return ret;
diff -ur 2.6/arch/i386/kernel/sys_i386.c build-2.6/arch/i386/kernel/sys_i386.c
--- 2.6/arch/i386/kernel/sys_i386.c	2004-01-09 08:00:04.000000000 +0100
+++ build-2.6/arch/i386/kernel/sys_i386.c	2004-02-23 20:39:47.000000000 +0100
@@ -186,7 +186,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char __user *) ptr, second, &raddr);
+			ret = do_shmat (first, (char __user *) ptr, second, &raddr);
 			if (ret)
 				return ret;
 			return put_user (raddr, (ulong __user *) third);
@@ -195,7 +195,7 @@
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
 			/* The "(ulong *) third" is valid _only_ because of the kernel segment thing */
-			return sys_shmat (first, (char __user *) ptr, second, (ulong *) third);
+			return do_shmat (first, (char __user *) ptr, second, (ulong *) third);
 		}
 	case SHMDT:
 		return sys_shmdt ((char __user *)ptr);
diff -ur 2.6/arch/ia64/ia32/sys_ia32.c build-2.6/arch/ia64/ia32/sys_ia32.c
--- 2.6/arch/ia64/ia32/sys_ia32.c	2004-02-23 20:37:01.000000000 +0100
+++ build-2.6/arch/ia64/ia32/sys_ia32.c	2004-02-23 20:51:44.000000000 +0100
@@ -1447,7 +1447,7 @@

 	if (version == 1)
 		return -EINVAL;	/* iBCS2 emulator entry point: unsupported */
-	err = sys_shmat(first, uptr, second, &raddr);
+	err = do_shmat(first, uptr, second, &raddr);
 	if (err)
 		return err;
 	return put_user(raddr, uaddr);
diff -ur 2.6/arch/ia64/kernel/sys_ia64.c build-2.6/arch/ia64/kernel/sys_ia64.c
--- 2.6/arch/ia64/kernel/sys_ia64.c	2004-01-09 07:59:44.000000000 +0100
+++ build-2.6/arch/ia64/kernel/sys_ia64.c	2004-02-23 20:51:25.000000000 +0100
@@ -98,7 +98,7 @@
 	unsigned long raddr;
 	int retval;

-	retval = sys_shmat(shmid, shmaddr, shmflg, &raddr);
+	retval = do_shmat(shmid, shmaddr, shmflg, &raddr);
 	if (retval < 0)
 		return retval;

diff -ur 2.6/arch/m68k/kernel/sys_m68k.c build-2.6/arch/m68k/kernel/sys_m68k.c
--- 2.6/arch/m68k/kernel/sys_m68k.c	2004-01-09 07:59:10.000000000 +0100
+++ build-2.6/arch/m68k/kernel/sys_m68k.c	2004-02-23 20:44:39.000000000 +0100
@@ -241,7 +241,7 @@
 			switch (version) {
 			default: {
 				ulong raddr;
-				ret = sys_shmat (first, (char *) ptr,
+				ret = do_shmat (first, (char *) ptr,
 						 second, &raddr);
 				if (ret)
 					return ret;
diff -ur 2.6/arch/mips/kernel/linux32.c build-2.6/arch/mips/kernel/linux32.c
--- 2.6/arch/mips/kernel/linux32.c	2004-02-23 20:37:03.000000000 +0100
+++ build-2.6/arch/mips/kernel/linux32.c	2004-02-23 20:41:21.000000000 +0100
@@ -1460,7 +1460,7 @@

 	if (version == 1)
 		return err;
-	err = sys_shmat (first, uptr, second, &raddr);
+	err = do_shmat (first, uptr, second, &raddr);
 	if (err)
 		return err;
 	err = put_user (raddr, uaddr);
diff -ur 2.6/arch/mips/kernel/syscall.c build-2.6/arch/mips/kernel/syscall.c
--- 2.6/arch/mips/kernel/syscall.c	2004-02-23 20:37:03.000000000 +0100
+++ build-2.6/arch/mips/kernel/syscall.c	2004-02-23 20:41:50.000000000 +0100
@@ -342,7 +342,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				return ret;
 			return put_user (raddr, (ulong *) third);
@@ -350,7 +350,7 @@
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
-			return sys_shmat (first, (char *) ptr, second, (ulong *) third);
+			return do_shmat (first, (char *) ptr, second, (ulong *) third);
 		}
 	case SHMDT:
 		return sys_shmdt ((char *)ptr);
diff -ur 2.6/arch/mips/kernel/sysirix.c build-2.6/arch/mips/kernel/sysirix.c
--- 2.6/arch/mips/kernel/sysirix.c	2004-02-23 20:37:03.000000000 +0100
+++ build-2.6/arch/mips/kernel/sysirix.c	2004-02-23 20:42:51.000000000 +0100
@@ -968,7 +968,7 @@
 {
 	switch (opcode) {
 	case 0:
-		return sys_shmat((int) arg0, (char *)arg1, (int) arg2,
+		return do_shmat((int) arg0, (char *)arg1, (int) arg2,
 				 (unsigned long *) arg3);
 	case 1:
 		return sys_shmctl((int)arg0, (int)arg1, (struct shmid_ds *)arg2);
diff -ur 2.6/arch/parisc/kernel/sys_parisc.c build-2.6/arch/parisc/kernel/sys_parisc.c
--- 2.6/arch/parisc/kernel/sys_parisc.c	2004-02-23 20:24:13.000000000 +0100
+++ build-2.6/arch/parisc/kernel/sys_parisc.c	2004-02-23 20:53:14.000000000 +0100
@@ -173,7 +173,7 @@
 	unsigned long raddr;
 	int r;

-	r = sys_shmat(shmid, shmaddr, shmflag, &raddr);
+	r = do_shmat(shmid, shmaddr, shmflag, &raddr);
 	if (r < 0)
 		return r;
 	return raddr;
diff -ur 2.6/arch/ppc/kernel/syscalls.c build-2.6/arch/ppc/kernel/syscalls.c
--- 2.6/arch/ppc/kernel/syscalls.c	2004-02-23 20:23:30.000000000 +0100
+++ build-2.6/arch/ppc/kernel/syscalls.c	2004-02-23 20:40:51.000000000 +0100
@@ -119,7 +119,7 @@
 		if ((ret = verify_area(VERIFY_WRITE, (ulong __user *) third,
 				       sizeof(ulong))))
 			break;
-		ret = sys_shmat (first, (char __user *) ptr, second, &raddr);
+		ret = do_shmat (first, (char __user *) ptr, second, &raddr);
 		if (ret)
 			break;
 		ret = put_user (raddr, (ulong __user *) third);
diff -ur 2.6/arch/ppc64/kernel/syscalls.c build-2.6/arch/ppc64/kernel/syscalls.c
--- 2.6/arch/ppc64/kernel/syscalls.c	2004-02-23 20:23:31.000000000 +0100
+++ build-2.6/arch/ppc64/kernel/syscalls.c	2004-02-23 20:52:24.000000000 +0100
@@ -122,7 +122,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				break;
 			ret = put_user (raddr, (ulong *) third);
@@ -132,7 +132,7 @@
 			ret = -EINVAL;
 			if (!segment_eq(get_fs(), get_ds()))
 				break;
-			ret = sys_shmat (first, (char *) ptr, second,
+			ret = do_shmat (first, (char *) ptr, second,
 					 (ulong *) third);
 			break;
 		}
diff -ur 2.6/arch/ppc64/kernel/sys_ppc32.c build-2.6/arch/ppc64/kernel/sys_ppc32.c
--- 2.6/arch/ppc64/kernel/sys_ppc32.c	2004-02-23 20:24:17.000000000 +0100
+++ build-2.6/arch/ppc64/kernel/sys_ppc32.c	2004-02-23 20:52:50.000000000 +0100
@@ -1649,7 +1649,7 @@

 	if (version == 1)
 		return err;
-	err = sys_shmat(first, uptr, second, &raddr);
+	err = do_shmat(first, uptr, second, &raddr);
 	if (err)
 		return err;
 	err = put_user(raddr, uaddr);
diff -ur 2.6/arch/s390/kernel/compat_linux.c build-2.6/arch/s390/kernel/compat_linux.c
--- 2.6/arch/s390/kernel/compat_linux.c	2004-02-23 20:37:05.000000000 +0100
+++ build-2.6/arch/s390/kernel/compat_linux.c	2004-02-23 20:55:06.000000000 +0100
@@ -721,7 +721,7 @@

 	if (version == 1)
 		goto out;
-	err = sys_shmat (first, uptr, second, &raddr);
+	err = do_shmat (first, uptr, second, &raddr);
 	if (err)
 		goto out;
 	err = put_user (raddr, uaddr);
diff -ur 2.6/arch/s390/kernel/sys_s390.c build-2.6/arch/s390/kernel/sys_s390.c
--- 2.6/arch/s390/kernel/sys_s390.c	2004-02-23 20:23:31.000000000 +0100
+++ build-2.6/arch/s390/kernel/sys_s390.c	2004-02-23 20:55:02.000000000 +0100
@@ -225,7 +225,7 @@

 	case SHMAT: {
 		ulong raddr;
-		ret = sys_shmat (first, (char *) ptr, second, &raddr);
+		ret = do_shmat (first, (char *) ptr, second, &raddr);
 		if (ret)
 			return ret;
 		return put_user (raddr, (ulong *) third);
diff -ur 2.6/arch/sh/kernel/sys_sh.c build-2.6/arch/sh/kernel/sys_sh.c
--- 2.6/arch/sh/kernel/sys_sh.c	2004-02-23 20:23:31.000000000 +0100
+++ build-2.6/arch/sh/kernel/sys_sh.c	2004-02-23 20:43:44.000000000 +0100
@@ -200,7 +200,7 @@
 			switch (version) {
 			default: {
 				ulong raddr;
-				ret = sys_shmat (first, (char __user *) ptr,
+				ret = do_shmat (first, (char __user *) ptr,
 						 second, &raddr);
 				if (ret)
 					return ret;
@@ -209,7 +209,7 @@
 			case 1:	/* iBCS2 emulator entry point */
 				if (!segment_eq(get_fs(), get_ds()))
 					return -EINVAL;
-				return sys_shmat (first, (char __user *) ptr,
+				return do_shmat (first, (char __user *) ptr,
 						  second, (ulong *) third);
 			}
 		case SHMDT:
diff -ur 2.6/arch/sparc/kernel/sys_sparc.c build-2.6/arch/sparc/kernel/sys_sparc.c
--- 2.6/arch/sparc/kernel/sys_sparc.c	2004-01-09 07:59:26.000000000 +0100
+++ build-2.6/arch/sparc/kernel/sys_sparc.c	2004-02-23 20:39:03.000000000 +0100
@@ -185,7 +185,7 @@
 			switch (version) {
 			case 0: default: {
 				ulong raddr;
-				err = sys_shmat (first, (char __user *) ptr, second, &raddr);
+				err = do_shmat (first, (char __user *) ptr, second, &raddr);
 				if (err)
 					goto out;
 				err = -EFAULT;
@@ -195,7 +195,7 @@
 				goto out;
 				}
 			case 1:	/* iBCS2 emulator entry point */
-				err = sys_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
+				err = do_shmat (first, (char __user *) ptr, second, (ulong __user *) third);
 				goto out;
 			}
 		case SHMDT:
diff -ur 2.6/arch/sparc/kernel/sys_sunos.c build-2.6/arch/sparc/kernel/sys_sunos.c
--- 2.6/arch/sparc/kernel/sys_sunos.c	2004-01-09 07:59:26.000000000 +0100
+++ build-2.6/arch/sparc/kernel/sys_sunos.c	2004-02-23 20:39:21.000000000 +0100
@@ -1006,8 +1006,8 @@

 	switch(op) {
 	case 0:
-		/* sys_shmat(): attach a shared memory area */
-		rval = sys_shmat((int)arg1,(char *)arg2,(int)arg3,&raddr);
+		/* do_shmat(): attach a shared memory area */
+		rval = do_shmat((int)arg1,(char *)arg2,(int)arg3,&raddr);
 		if(!rval)
 			rval = (int) raddr;
 		break;
diff -ur 2.6/arch/sparc64/kernel/sys_sparc32.c build-2.6/arch/sparc64/kernel/sys_sparc32.c
--- 2.6/arch/sparc64/kernel/sys_sparc32.c	2004-02-23 20:37:06.000000000 +0100
+++ build-2.6/arch/sparc64/kernel/sys_sparc32.c	2004-02-23 20:40:35.000000000 +0100
@@ -642,7 +642,7 @@

 	if (version == 1)
 		goto out;
-	err = sys_shmat (first, uptr, second, &raddr);
+	err = do_shmat (first, uptr, second, &raddr);
 	if (err)
 		goto out;
 	err = put_user (raddr, uaddr);
diff -ur 2.6/arch/sparc64/kernel/sys_sparc.c build-2.6/arch/sparc64/kernel/sys_sparc.c
--- 2.6/arch/sparc64/kernel/sys_sparc.c	2004-01-09 07:59:43.000000000 +0100
+++ build-2.6/arch/sparc64/kernel/sys_sparc.c	2004-02-23 20:40:04.000000000 +0100
@@ -254,7 +254,7 @@
 		switch (call) {
 		case SHMAT: {
 			ulong raddr;
-			err = sys_shmat (first, (char *) ptr, second, &raddr);
+			err = do_shmat (first, (char *) ptr, second, &raddr);
 			if (!err) {
 				if (put_user(raddr, (ulong __user *) third))
 					err = -EFAULT;
diff -ur 2.6/arch/sparc64/kernel/sys_sunos32.c build-2.6/arch/sparc64/kernel/sys_sunos32.c
--- 2.6/arch/sparc64/kernel/sys_sunos32.c	2004-01-09 07:59:45.000000000 +0100
+++ build-2.6/arch/sparc64/kernel/sys_sunos32.c	2004-02-23 20:40:22.000000000 +0100
@@ -1139,8 +1139,8 @@

 	switch(op) {
 	case 0:
-		/* sys_shmat(): attach a shared memory area */
-		rval = sys_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr);
+		/* do_shmat(): attach a shared memory area */
+		rval = do_shmat((int)arg1,(char *)A(arg2),(int)arg3,&raddr);
 		if(!rval)
 			rval = (int) raddr;
 		break;
diff -ur 2.6/arch/um/kernel/syscall_kern.c build-2.6/arch/um/kernel/syscall_kern.c
--- 2.6/arch/um/kernel/syscall_kern.c	2004-01-09 07:59:47.000000000 +0100
+++ build-2.6/arch/um/kernel/syscall_kern.c	2004-02-23 20:41:07.000000000 +0100
@@ -235,7 +235,7 @@
 		switch (version) {
 		default: {
 			ulong raddr;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				return ret;
 			return put_user (raddr, (ulong *) third);
@@ -243,7 +243,7 @@
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				return -EINVAL;
-			return sys_shmat (first, (char *) ptr, second, (ulong *) third);
+			return do_shmat (first, (char *) ptr, second, (ulong *) third);
 		}
 	case SHMDT:
 		return sys_shmdt ((char *)ptr);
diff -ur 2.6/arch/v850/kernel/syscalls.c build-2.6/arch/v850/kernel/syscalls.c
--- 2.6/arch/v850/kernel/syscalls.c	2004-01-09 07:59:45.000000000 +0100
+++ build-2.6/arch/v850/kernel/syscalls.c	2004-02-23 20:54:38.000000000 +0100
@@ -106,7 +106,7 @@
 			if ((ret = verify_area(VERIFY_WRITE, (ulong*) third,
 					       sizeof(ulong))))
 				break;
-			ret = sys_shmat (first, (char *) ptr, second, &raddr);
+			ret = do_shmat (first, (char *) ptr, second, &raddr);
 			if (ret)
 				break;
 			ret = put_user (raddr, (ulong *) third);
@@ -115,7 +115,7 @@
 		case 1:	/* iBCS2 emulator entry point */
 			if (!segment_eq(get_fs(), get_ds()))
 				break;
-			ret = sys_shmat (first, (char *) ptr, second,
+			ret = do_shmat (first, (char *) ptr, second,
 					 (ulong *) third);
 			break;
 		}
diff -ur 2.6/arch/x86_64/ia32/ipc32.c build-2.6/arch/x86_64/ia32/ipc32.c
--- 2.6/arch/x86_64/ia32/ipc32.c	2004-01-09 07:59:27.000000000 +0100
+++ build-2.6/arch/x86_64/ia32/ipc32.c	2004-02-23 20:54:55.000000000 +0100
@@ -457,7 +457,7 @@

 	if (version == 1)
 		return -EINVAL;	/* iBCS2 emulator entry point: unsupported */
-	err = sys_shmat(first, uptr, second, &raddr);
+	err = do_shmat(first, uptr, second, &raddr);
 	if (err)
 		return err;
 	return put_user(raddr, uaddr);
diff -ur 2.6/arch/x86_64/kernel/sys_x86_64.c build-2.6/arch/x86_64/kernel/sys_x86_64.c
--- 2.6/arch/x86_64/kernel/sys_x86_64.c	2004-02-23 20:24:17.000000000 +0100
+++ build-2.6/arch/x86_64/kernel/sys_x86_64.c	2004-02-23 20:54:48.000000000 +0100
@@ -155,7 +155,7 @@
 asmlinkage long wrap_sys_shmat(int shmid, char *shmaddr, int shmflg)
 {
 	unsigned long raddr;
-	return sys_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
+	return do_shmat(shmid,shmaddr,shmflg,&raddr) ?: (long)raddr;
 }

 asmlinkage long sys_time64(long * tloc)
diff -ur 2.6/include/linux/shm.h build-2.6/include/linux/shm.h
--- 2.6/include/linux/shm.h	2004-01-09 07:59:48.000000000 +0100
+++ build-2.6/include/linux/shm.h	2004-02-23 20:56:01.000000000 +0100
@@ -90,7 +90,14 @@
 #define SHM_LOCKED      02000   /* segment will not be swapped */
 #define SHM_HUGETLB     04000   /* segment will use huge TLB pages */

-long sys_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
+#ifdef CONFIG_SYSVIPC
+long do_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr);
+#else
+inline long do_shmat (int shmid, char __user *shmaddr, int shmflg, unsigned long *addr)
+{
+	return -ENOSYS;
+}
+#endif
 asmlinkage long sys_shmget (key_t key, size_t size, int flag);
 asmlinkage long sys_shmdt (char __user *shmaddr);
 asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf);
Only in build-2.6/ipc: .Makefile.swp
diff -ur 2.6/ipc/shm.c build-2.6/ipc/shm.c
--- 2.6/ipc/shm.c	2004-02-23 20:37:26.000000000 +0100
+++ build-2.6/ipc/shm.c	2004-02-23 20:38:09.000000000 +0100
@@ -635,7 +635,7 @@
  * "raddr" thing points to kernel space, and there has to be a wrapper around
  * this.
  */
-asmlinkage long sys_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
+long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
 {
 	struct shmid_kernel *shp;
 	unsigned long addr;
diff -ur 2.6/kernel/sys.c build-2.6/kernel/sys.c
--- 2.6/kernel/sys.c	2004-02-23 20:37:27.000000000 +0100
+++ build-2.6/kernel/sys.c	2004-02-23 20:46:54.000000000 +0100
@@ -258,7 +258,6 @@
 cond_syscall(sys_msgrcv)
 cond_syscall(sys_msgctl)
 cond_syscall(sys_shmget)
-cond_syscall(sys_shmat)
 cond_syscall(sys_shmdt)
 cond_syscall(sys_shmctl)



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 20:33     ` Manfred Spraul
@ 2004-02-23 20:57       ` Andrew Morton
  2004-02-23 23:29         ` Anton Blanchard
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2004-02-23 20:57 UTC (permalink / raw)
  To: Manfred Spraul; +Cc: torvalds, piggin, linux-kernel

Manfred Spraul <manfred@colorfullife.com> wrote:
>
> On Mon, 23 Feb 2004, Linus Torvalds wrote:
> >
> > Please. Maybe it might even be worth-while renaming it to "do_sys_shmat()"
> > to make it clear that it's not a "sys_xxx()" at all.
> >
> 
> Below is a patch that renames sys_shmat to do_shmat. Additionally, I've
> replaced the cond_syscall with a conditional inline function.

It doesn't update arch/mips/kernel/scall64-64.S and
arch/mips/kernel/scall64-n32.S?

I'd be inclined to leave it as sys_shmat().  It is logically a syscall, and
the fact that everyone except mips (and ia64) sticks a multiplexer in front
of it is a sad historical note.

It's simply a matter of getting the appropriate prototype in scope for all
the C callers.  For now, I'd be inclined to bung the prototype in kernel.h,
because Randy's syscalls.h patches will fix all this for real in a week or
two.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fix shmat
  2004-02-23 20:57       ` Andrew Morton
@ 2004-02-23 23:29         ` Anton Blanchard
  0 siblings, 0 replies; 7+ messages in thread
From: Anton Blanchard @ 2004-02-23 23:29 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Manfred Spraul, torvalds, piggin, linux-kernel

 
> I'd be inclined to leave it as sys_shmat().  It is logically a syscall, and
> the fact that everyone except mips (and ia64) sticks a multiplexer in front
> of it is a sad historical note.

I still live in hope that we break it back out into syscalls on ppc32/64
one day.

Anton

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-02-23 23:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <E1AvBNO-0004QF-00@bkwatch.colorfullife.com>
2004-02-23 18:15 ` [PATCH] fix shmat Manfred Spraul
2004-02-23 18:21   ` Randy.Dunlap
2004-02-23 18:36   ` Linus Torvalds
2004-02-23 20:33     ` Manfred Spraul
2004-02-23 20:57       ` Andrew Morton
2004-02-23 23:29         ` Anton Blanchard
2004-02-23 19:02   ` Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.