linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Shift key-related error codes up and insert ECANCELED
@ 2004-10-22 16:57 David Howells
  2004-10-22 17:14 ` Jakub Jelinek
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: David Howells @ 2004-10-22 16:57 UTC (permalink / raw)
  To: torvalds, akpm, jakub; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 547 bytes --]


This patch shifts the key-related error codes up by one and inserts an
ECANCELED error code where not already defined. It seems that has been defined
in glibc without passing it back to the kernel:-/

Who arbitrates error number allocations anyway?

Signed-Off-By: David Howells <dhowells@redhat.com>
---
warthog>diffstat errno-269bk5.diff 
 asm-alpha/errno.h   |    9 +++++----
 asm-generic/errno.h |    9 +++++----
 asm-sparc/errno.h   |    9 +++++----
 asm-sparc64/errno.h |    9 +++++----
 4 files changed, 20 insertions(+), 16 deletions(-)


[-- Attachment #2: errno-269bk5.diff --]
[-- Type: application/octet-stream, Size: 3541 bytes --]

diff -uNrp linux-2.6.9-bk5/include/asm-alpha/errno.h linux-2.6.9-bk5-keys/include/asm-alpha/errno.h
--- linux-2.6.9-bk5/include/asm-alpha/errno.h	2004-10-21 11:22:06.000000000 +0100
+++ linux-2.6.9-bk5-keys/include/asm-alpha/errno.h	2004-10-22 10:56:53.694968904 +0100
@@ -110,9 +110,10 @@
 
 #define ENOMEDIUM	129	/* No medium found */
 #define EMEDIUMTYPE	130	/* Wrong medium type */
-#define	ENOKEY		131	/* Required key not available */
-#define	EKEYEXPIRED	132	/* Key has expired */
-#define	EKEYREVOKED	133	/* Key has been revoked */
-#define	EKEYREJECTED	134	/* Key was rejected by service */
+#define	ECANCELED	131	/* Operation Cancelled */
+#define	ENOKEY		132	/* Required key not available */
+#define	EKEYEXPIRED	133	/* Key has expired */
+#define	EKEYREVOKED	134	/* Key has been revoked */
+#define	EKEYREJECTED	135	/* Key was rejected by service */
 
 #endif
diff -uNrp linux-2.6.9-bk5/include/asm-generic/errno.h linux-2.6.9-bk5-keys/include/asm-generic/errno.h
--- linux-2.6.9-bk5/include/asm-generic/errno.h	2004-10-21 11:22:06.000000000 +0100
+++ linux-2.6.9-bk5-keys/include/asm-generic/errno.h	2004-10-22 10:53:41.000000000 +0100
@@ -96,9 +96,10 @@
 
 #define	ENOMEDIUM	123	/* No medium found */
 #define	EMEDIUMTYPE	124	/* Wrong medium type */
-#define	ENOKEY		125	/* Required key not available */
-#define	EKEYEXPIRED	126	/* Key has expired */
-#define	EKEYREVOKED	127	/* Key has been revoked */
-#define	EKEYREJECTED	128	/* Key was rejected by service */
+#define	ECANCELED	125	/* Operation Canceled */
+#define	ENOKEY		126	/* Required key not available */
+#define	EKEYEXPIRED	127	/* Key has expired */
+#define	EKEYREVOKED	128	/* Key has been revoked */
+#define	EKEYREJECTED	129	/* Key was rejected by service */
 
 #endif
diff -uNrp linux-2.6.9-bk5/include/asm-sparc/errno.h linux-2.6.9-bk5-keys/include/asm-sparc/errno.h
--- linux-2.6.9-bk5/include/asm-sparc/errno.h	2004-10-21 11:22:08.000000000 +0100
+++ linux-2.6.9-bk5-keys/include/asm-sparc/errno.h	2004-10-22 10:56:37.393313534 +0100
@@ -101,9 +101,10 @@
 
 #define	ENOMEDIUM	125	/* No medium found */
 #define	EMEDIUMTYPE	126	/* Wrong medium type */
-#define	ENOKEY		127	/* Required key not available */
-#define	EKEYEXPIRED	128	/* Key has expired */
-#define	EKEYREVOKED	129	/* Key has been revoked */
-#define	EKEYREJECTED	130	/* Key was rejected by service */
+#define	ECANCELED	127	/* Operation Cancelled */
+#define	ENOKEY		128	/* Required key not available */
+#define	EKEYEXPIRED	129	/* Key has expired */
+#define	EKEYREVOKED	130	/* Key has been revoked */
+#define	EKEYREJECTED	131	/* Key was rejected by service */
 
 #endif
diff -uNrp linux-2.6.9-bk5/include/asm-sparc64/errno.h linux-2.6.9-bk5-keys/include/asm-sparc64/errno.h
--- linux-2.6.9-bk5/include/asm-sparc64/errno.h	2004-10-21 11:22:08.000000000 +0100
+++ linux-2.6.9-bk5-keys/include/asm-sparc64/errno.h	2004-10-22 10:57:10.858553145 +0100
@@ -101,9 +101,10 @@
 
 #define ENOMEDIUM       125     /* No medium found */
 #define EMEDIUMTYPE     126     /* Wrong medium type */
-#define	ENOKEY		127	/* Required key not available */
-#define	EKEYEXPIRED	128	/* Key has expired */
-#define	EKEYREVOKED	129	/* Key has been revoked */
-#define	EKEYREJECTED	130	/* Key was rejected by service */
+#define	ECANCELED	127	/* Operation Cancelled */
+#define	ENOKEY		128	/* Required key not available */
+#define	EKEYEXPIRED	129	/* Key has expired */
+#define	EKEYREVOKED	130	/* Key has been revoked */
+#define	EKEYREJECTED	131	/* Key was rejected by service */
 
 #endif /* !(_SPARC64_ERRNO_H) */

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

* Re: [PATCH] Shift key-related error codes up and insert ECANCELED
  2004-10-22 16:57 [PATCH] Shift key-related error codes up and insert ECANCELED David Howells
@ 2004-10-22 17:14 ` Jakub Jelinek
  2004-10-22 18:34 ` Alan Cox
  2004-10-25  9:31 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Jelinek @ 2004-10-22 17:14 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, linux-kernel

On Fri, Oct 22, 2004 at 05:57:42PM +0100, David Howells wrote:
> 
> This patch shifts the key-related error codes up by one and inserts an
> ECANCELED error code where not already defined. It seems that has been defined
> in glibc without passing it back to the kernel:-/

Not sure what's the story behind ECANCELED not being in kernel headers,
certainly it is something only userland needs ATM.
It is a POSIX mandated errno code used in aio_* that glibc is using
since 1998, so it would be really bad to break all apps using aio.

The values you posted match exactly what glibc is using:

libc/sysdeps/unix/sysv/sysv4/solaris2/bits/errno.h:# define ECANCELED   47      /* Operation canceled.  */
libc/sysdeps/unix/sysv/aix/bits/errno.h:# define ECANCELED      117     /* Asynchronous i/o cancelled.  */
libc/sysdeps/unix/sysv/linux/alpha/bits/errno.h:#  define ECANCELED     131
libc/sysdeps/unix/sysv/linux/sparc/bits/errno.h:#  define ECANCELED     127
libc/sysdeps/unix/sysv/linux/bits/errno.h:#  define ECANCELED   125
libc/sysdeps/unix/sysv/linux/hppa/bits/errno.h:#  define ECANCELED      ECANCELLED
libc/sysdeps/mach/hurd/bits/errno.h:#define     ECANCELED       _HURD_ERRNO (118)/* Operation canceled */

just maybe asm-parisc/errno.h could have
#define ECANCELED ECANCELLED
added (ECANCELED is the POSIX mandated spelling, while asm-parisc/errno.h
for some reason defines ECANCELLED).

	Jakub

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

* Re: [PATCH] Shift key-related error codes up and insert ECANCELED
  2004-10-22 16:57 [PATCH] Shift key-related error codes up and insert ECANCELED David Howells
  2004-10-22 17:14 ` Jakub Jelinek
@ 2004-10-22 18:34 ` Alan Cox
  2004-10-25  9:31 ` David Howells
  2 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2004-10-22 18:34 UTC (permalink / raw)
  To: David Howells; +Cc: torvalds, akpm, jakub, Linux Kernel Mailing List

On Gwe, 2004-10-22 at 17:57, David Howells wrote:
> This patch shifts the key-related error codes up by one and inserts an
> ECANCELED error code where not already defined. It seems that has been defined
> in glibc without passing it back to the kernel:-/
> 
> Who arbitrates error number allocations anyway?

Generally nobody because new error codes are almost always a mistake in
the first place especially when they don't appear in standards so no
application will correctly or sanely handle them.

You should use existing codes IMHO. Lets see

EKEYEXPIRED		-	ETIME (ETIMEDOUT ? ENOLINK ?)
ENOKEY			-	ENOENT
EKEYREJECTED		-	EILSEQ / EMSGSIZE / EPROTOTYPE ..
EKEYREVOKED		-	EREMCHG / ESHUTDOWN

And now I can use your key stuff with an existing C library and in LSB
compliant or cross platform code and give more information. If you look
through the kernel history we've almost never ever added an error code,
adding them just causes compatibility pain for everyone


Alan


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

* Re: [PATCH] Shift key-related error codes up and insert ECANCELED
  2004-10-22 16:57 [PATCH] Shift key-related error codes up and insert ECANCELED David Howells
  2004-10-22 17:14 ` Jakub Jelinek
  2004-10-22 18:34 ` Alan Cox
@ 2004-10-25  9:31 ` David Howells
  2004-10-25  9:48   ` Arjan van de Ven
  2 siblings, 1 reply; 5+ messages in thread
From: David Howells @ 2004-10-25  9:31 UTC (permalink / raw)
  To: Alan Cox; +Cc: torvalds, akpm, jakub, Linux Kernel Mailing List


> You should use existing codes IMHO. Lets see
> 
> EKEYEXPIRED		-	ETIME (ETIMEDOUT ? ENOLINK ?)
> ENOKEY			-	ENOENT
> EKEYREJECTED		-	EILSEQ / EMSGSIZE / EPROTOTYPE ..
> EKEYREVOKED		-	EREMCHG / ESHUTDOWN

The problem with doing that is that these error codes have specific meanings
that we're then violating the standards by overloading. Take open() for
example: it's possible that this will return ENOENT because there's no file
there to be opened; I think it's a bad idea for it to return ENOENT when there
is a file there, but we don't have a key, hence ENOKEY.

David

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

* Re: [PATCH] Shift key-related error codes up and insert ECANCELED
  2004-10-25  9:31 ` David Howells
@ 2004-10-25  9:48   ` Arjan van de Ven
  0 siblings, 0 replies; 5+ messages in thread
From: Arjan van de Ven @ 2004-10-25  9:48 UTC (permalink / raw)
  To: David Howells; +Cc: Alan Cox, torvalds, akpm, jakub, Linux Kernel Mailing List

On Mon, 2004-10-25 at 10:31 +0100, David Howells wrote:
>  Take open() for
> example: it's possible that this will return ENOENT because there's no file
> there to be opened; I think it's a bad idea for it to return ENOENT when there
> is a file there, but we don't have a key, hence ENOKEY.

take open....
you don't have access to the file because you don't have a matching key
to get to it. Doesn't that kinda say EACCESS (or EPERM) would be a/the
proper return code ?
-- 


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

end of thread, other threads:[~2004-10-25  9:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-22 16:57 [PATCH] Shift key-related error codes up and insert ECANCELED David Howells
2004-10-22 17:14 ` Jakub Jelinek
2004-10-22 18:34 ` Alan Cox
2004-10-25  9:31 ` David Howells
2004-10-25  9:48   ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).