This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH-v2] Re: [PATCH] Add missing strerror() strings, clean up
- From: Nick Withers <nick dot withers at anu dot edu dot au>
- To: Craig Howland <howland at LGSInnovations dot com>
- Cc: <newlib at sourceware dot org>
- Date: Fri, 11 Jul 2014 12:46:31 +1000
- Subject: [PATCH-v2] Re: [PATCH] Add missing strerror() strings, clean up
- Authentication-results: sourceware.org; auth=none
- References: <1405037548 dot 2122 dot 16 dot camel at nuc211 dot anu dot edu dot au> <53BF3A66 dot 80806 at LGSInnovations dot com>
On Thu, 2014-07-10 at 21:14 -0400, Craig Howland wrote:
> On 07/10/2014 08:12 PM, Nick Withers wrote:
> > Hi Craig,
> >
> > Thanks for taking the time!
> >
> > Could you include me on any replies? I'm not subscribed.
> >
> >> On 07/10/2014 06:26 AM, Nick Withers wrote:
> >>> Hi all,
> >>>
> >>> The attached patch:
> >>> - Adds to strerror()'s strerror.c strings for:
> >>> ...
> >>>
> >>> - Changes the following comments in errno.h to match the implementation:
> >>> ...
> >>> - EDOM, from "Math arg out of domain of func" to "Math
> >>> argument" (would "Mathematics argument out of domain of function" or
> >>> "Mathematical (...)" be better?)
> >> "Math argument" would be a step backwards. If it were to be changed at
> >> all, use the POSIX "Mathematics argument out of domain of
> >> function." (The existing is POSIX with 3 abbreviations, and really
> >> could be left as-is.)
> > "Math argument" is the existing message. There's a comment in errno.h
> > though, that is meant to match the message proper, and currently does
> > not. That's what's addressed here.
> >
> > However, if you'd like me to change it to "Mathematics argument out of
> > domain of function", happy to do so (I certainly like that better...).
> Yes, I misunderstood the comment, getting it backwards as you point out. What I
> should have said: EDOM seems to be a better candidate for changing the
> implementation to match the errno.h comment. In the spirit of keeping size
> down, using the slightly-abbreviated existing "Math arg out of domain of func"
> from the errno.h comment seems to be a readily-understood good candidate for
> strerror.c. If there were a strong objection to this size growth of 16 bytes,
> perhaps "Math arg domain" (+2) or "Math domain" (-2) could be used, both being
> more precise and more easily associated with the EDOM name. Since my
> applications are not usually very tight for space, my personal preference would
> be for the longer string that essentially matches POSIX.
> Craig
Cheers Craig,
Attached is an updated patch, which:
____
- Adds to strerror()'s strerror.c strings for:
- EADDRNOTAVAIL, "Address not available"
- ECONNRESET, "Connection reset by peer"
- EILSEQ, "Illegal byte sequence"
- ENETRESET, "Connection aborted by network"
- ENODATA, "No data" (full comment in errno.h was "No data (for no
delay io)")
- EOVERFLOW, "Value too large for defined data type"
- Changes EDOM strerror() string from "Math argument" ("Math arg out of
domain of func" in errno.h comments) to "Mathematics argument out of
domain of function"
- Changes EMFILE's "Too many open files" to "File descriptor value too
large"
- Changes the following comments in errno.h to match the existing
implementation:
- EBADMSG, from "Trying to read unreadable message" to "Bad message"
- EBUSY, from "Mount device busy" to "Device or resource busy"
- ECONNABORTED, from "Connection aborted" to "Software caused
connection abort" (note that the previous comment reflected the
suggested text at
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html ,
perhaps here I should have changed the implementation instead?)
- EDEADLK, from "Deadlock condition" to "Deadlock"
- EILSEQ, from none to "Illegal byte sequence"
- ENOLCK, from "No record locks available" to "No lock"
- ENOLINK, from "The link has been severed" to "Virtual circuit is
gone" (reserved, according to
http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html )
- ENOMEM, from "Not enough core" to "Not enough space"
- ENOSR, from "Out of streams resources" to "No stream resources"
- ENOSTR, from "Device not a stream" to "Not a stream"
- ENOTTY, from "Not a typewriter" to "Not a character device"
- EOPNOTSUPP, from "Operation not supported on transport endpoint" to
"Operation not supported on socket"
- EPERM, from "Not super-user" to "Not owner"
- ERANGE, from "Math result not representable" to "Result too large"
- EROFS, from "Read only file system", to "Read-only file system"
- ETIME, from "Timer expired" to "Stream ioctl timeout"
- Adds strerror.c leading doc entries for:
- ENOBUFS, "No buffer space available"
- EOPNOTSUPP, "Operation not supported on socket"
- EWOULDBLOCK, EAGAIN
- Changes strerror.c's leading doc section entry for ENETDOWN from
"Network interface not configured" to "Network interface is not
configured" to match the implementation and errno.h (would "Network is
down" be better?)
- Re-orders ECANCELED, ENOTRECOVERABLE, EOWNERDEAD and ESTRPIPE
alphabetically in strerror.c's leading doc section, per instructions at
the top of the file
____
Differences from the previous patch are:
____
- Changes EDOM strerror() string from "Math argument" ("Math arg out of
domain of func" in errno.h comments) to "Mathematics argument out of
domain of function"
- Changes EMFILE's "Too many open files" to "File descriptor value too
large"
____
Ta all!
--
Nick Withers
Embedded Systems Programmer
Department of Nuclear Physics, Research School of Physics and Engineering
The Australian National University (CRICOS: 00120C)
Index: newlib/libc/include/sys/errno.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/errno.h,v
retrieving revision 1.18
diff -u -r1.18 errno.h
--- newlib/libc/include/sys/errno.h 26 Dec 2010 21:11:38 -0000 1.18
+++ newlib/libc/include/sys/errno.h 11 Jul 2014 02:43:37 -0000
@@ -28,7 +28,7 @@
#define __errno_r(ptr) ((ptr)->_errno)
-#define EPERM 1 /* Not super-user */
+#define EPERM 1 /* Not owner */
#define ENOENT 2 /* No such file or directory */
#define ESRCH 3 /* No such process */
#define EINTR 4 /* Interrupted system call */
@@ -39,13 +39,13 @@
#define EBADF 9 /* Bad file number */
#define ECHILD 10 /* No children */
#define EAGAIN 11 /* No more processes */
-#define ENOMEM 12 /* Not enough core */
+#define ENOMEM 12 /* Not enough space */
#define EACCES 13 /* Permission denied */
#define EFAULT 14 /* Bad address */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTBLK 15 /* Block device required */
#endif
-#define EBUSY 16 /* Mount device busy */
+#define EBUSY 16 /* Device or resource busy */
#define EEXIST 17 /* File exists */
#define EXDEV 18 /* Cross-device link */
#define ENODEV 19 /* No such device */
@@ -53,17 +53,17 @@
#define EISDIR 21 /* Is a directory */
#define EINVAL 22 /* Invalid argument */
#define ENFILE 23 /* Too many open files in system */
-#define EMFILE 24 /* Too many open files */
-#define ENOTTY 25 /* Not a typewriter */
+#define EMFILE 24 /* File descriptor value too large */
+#define ENOTTY 25 /* Not a character device */
#define ETXTBSY 26 /* Text file busy */
#define EFBIG 27 /* File too large */
#define ENOSPC 28 /* No space left on device */
#define ESPIPE 29 /* Illegal seek */
-#define EROFS 30 /* Read only file system */
+#define EROFS 30 /* Read-only file system */
#define EMLINK 31 /* Too many links */
#define EPIPE 32 /* Broken pipe */
-#define EDOM 33 /* Math arg out of domain of func */
-#define ERANGE 34 /* Math result not representable */
+#define EDOM 33 /* Mathematics argument out of domain of function */
+#define ERANGE 34 /* Result too large */
#define ENOMSG 35 /* No message of desired type */
#define EIDRM 36 /* Identifier removed */
#ifdef __LINUX_ERRNO_EXTENSIONS__
@@ -76,8 +76,8 @@
#define ENOCSI 43 /* No CSI structure available */
#define EL2HLT 44 /* Level 2 halted */
#endif
-#define EDEADLK 45 /* Deadlock condition */
-#define ENOLCK 46 /* No record locks available */
+#define EDEADLK 45 /* Deadlock */
+#define ENOLCK 46 /* No lock */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EBADE 50 /* Invalid exchange */
#define EBADR 51 /* Invalid request descriptor */
@@ -88,16 +88,16 @@
#define EDEADLOCK 56 /* File locking deadlock error */
#define EBFONT 57 /* Bad font file fmt */
#endif
-#define ENOSTR 60 /* Device not a stream */
+#define ENOSTR 60 /* Not a stream */
#define ENODATA 61 /* No data (for no delay io) */
-#define ETIME 62 /* Timer expired */
-#define ENOSR 63 /* Out of streams resources */
+#define ETIME 62 /* Stream ioctl timeout */
+#define ENOSR 63 /* No stream resources */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENONET 64 /* Machine is not on the network */
#define ENOPKG 65 /* Package not installed */
#define EREMOTE 66 /* The object is remote */
#endif
-#define ENOLINK 67 /* The link has been severed */
+#define ENOLINK 67 /* Virtual circuit is gone */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define EADV 68 /* Advertise error */
#define ESRMNT 69 /* Srmount error */
@@ -109,7 +109,7 @@
#define ELBIN 75 /* Inode is remote (not really error) */
#define EDOTDOT 76 /* Cross mount point (not really error) */
#endif
-#define EBADMSG 77 /* Trying to read unreadable message */
+#define EBADMSG 77 /* Bad message */
#define EFTYPE 79 /* Inappropriate file type or format */
#ifdef __LINUX_ERRNO_EXTENSIONS__
#define ENOTUNIQ 80 /* Given log. name not unique */
@@ -128,7 +128,7 @@
#define ENOTEMPTY 90 /* Directory not empty */
#define ENAMETOOLONG 91 /* File or path name too long */
#define ELOOP 92 /* Too many symbolic links */
-#define EOPNOTSUPP 95 /* Operation not supported on transport endpoint */
+#define EOPNOTSUPP 95 /* Operation not supported on socket */
#define EPFNOSUPPORT 96 /* Protocol family not supported */
#define ECONNRESET 104 /* Connection reset by peer */
#define ENOBUFS 105 /* No buffer space available */
@@ -141,7 +141,7 @@
#endif
#define ECONNREFUSED 111 /* Connection refused */
#define EADDRINUSE 112 /* Address already in use */
-#define ECONNABORTED 113 /* Connection aborted */
+#define ECONNABORTED 113 /* Software caused connection abort */
#define ENETUNREACH 114 /* Network is unreachable */
#define ENETDOWN 115 /* Network interface is not configured */
#define ETIMEDOUT 116 /* Connection timed out */
@@ -156,7 +156,7 @@
#define ESOCKTNOSUPPORT 124 /* Socket type not supported */
#endif
#define EADDRNOTAVAIL 125 /* Address not available */
-#define ENETRESET 126
+#define ENETRESET 126 /* Connection aborted by network */
#define EISCONN 127 /* Socket is already connected */
#define ENOTCONN 128 /* Socket is not connected */
#define ETOOMANYREFS 129
@@ -174,7 +174,7 @@
#define ENOSHARE 136 /* No such host or network path */
#define ECASECLASH 137 /* Filename exists with different case */
#endif
-#define EILSEQ 138
+#define EILSEQ 138 /* Illegal byte sequence */
#define EOVERFLOW 139 /* Value too large for defined data type */
#define ECANCELED 140 /* Operation canceled */
#define ENOTRECOVERABLE 141 /* State not recoverable */
Index: newlib/libc/string/strerror.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/strerror.c,v
retrieving revision 1.8
diff -u -r1.8 strerror.c
--- newlib/libc/string/strerror.c 25 May 2011 21:05:11 -0000 1.8
+++ newlib/libc/string/strerror.c 11 Jul 2014 02:43:37 -0000
@@ -45,6 +45,9 @@
o EADDRINUSE
Address already in use
+o EADDRNOTAVAIL
+Address not available
+
o EADV
Advertise error
@@ -66,6 +69,9 @@
o EBUSY
Device or resource busy
+o ECANCELED
+Operation canceled
+
o ECHILD
No children
@@ -78,6 +84,9 @@
o ECONNREFUSED
Connection refused
+o ECONNRESET
+Connection reset by peer
+
o EDEADLK
Deadlock
@@ -88,7 +97,7 @@
File exists
o EDOM
-Math argument
+Mathematics argument out of domain of function
o EFAULT
Bad address
@@ -105,6 +114,9 @@
o EIDRM
Identifier removed
+o EILSEQ
+Illegal byte sequence
+
o EINPROGRESS
Connection already in progress
@@ -139,7 +151,7 @@
<<.lib>> section in a.out corrupted
o EMFILE
-Too many open files
+File descriptor value too large
o EMLINK
Too many links
@@ -154,7 +166,10 @@
File or path name too long
o ENETDOWN
-Network interface not configured
+Network interface is not configured
+
+o ENETRESET
+Connection aborted by network
o ENETUNREACH
Network is unreachable
@@ -162,6 +177,12 @@
o ENFILE
Too many open files in system
+o ENOBUFS
+No buffer space available
+
+o ENODATA
+No data
+
o ENODEV
No such device
@@ -216,6 +237,9 @@
o ENOTEMPTY
Directory not empty
+o ENOTRECOVERABLE
+State not recoverable
+
o ENOTSOCK
Socket operation on non-socket
@@ -228,6 +252,15 @@
o ENXIO
No such device or address
+o EOPNOTSUPP
+Operation not supported on socket
+
+o EOVERFLOW
+Value too large for defined data type
+
+o EOWNERDEAD
+Previous owner died
+
o EPERM
Not owner
@@ -267,6 +300,9 @@
o ESRMNT
Srmount error
+o ESTRPIPE
+Strings pipe error
+
o ETIME
Stream ioctl timeout
@@ -276,21 +312,12 @@
o ETXTBSY
Text file busy
+o EWOULDBLOCK
+EAGAIN
+
o EXDEV
Cross-device link
-o ECANCELED
-Operation canceled
-
-o ENOTRECOVERABLE
-State not recoverable
-
-o EOWNERDEAD
-Previous owner died
-
-o ESTRPIPE
-Strings pipe error
-
o-
<<_strerror_r>> is a reentrant version of the above.
@@ -504,6 +531,11 @@
error = "Network interface is not configured";
break;
#endif
+#ifdef ENETRESET
+ case ENETRESET:
+ error = "Connection aborted by network";
+ break;
+#endif
#ifdef ENFILE
case ENFILE:
error = "Too many open files in system";
@@ -511,7 +543,7 @@
#endif
#ifdef EMFILE
case EMFILE:
- error = "Too many open files";
+ error = "File descriptor value too large";
break;
#endif
#ifdef ENOTTY
@@ -566,7 +598,7 @@
#endif
#ifdef EDOM
case EDOM:
- error = "Math argument";
+ error = "Mathematics argument out of domain of function";
break;
#endif
#ifdef ERANGE
@@ -584,6 +616,11 @@
error = "Identifier removed";
break;
#endif
+#ifdef EILSEQ
+ case EILSEQ:
+ error = "Illegal byte sequence";
+ break;
+#endif
#ifdef EDEADLK
case EDEADLK:
error = "Deadlock";
@@ -724,6 +761,11 @@
error = "No buffer space available";
break;
#endif
+#ifdef ENODATA
+ case ENODATA:
+ error = "No data";
+ break;
+#endif
#ifdef EAFNOSUPPORT
case EAFNOSUPPORT:
error = "Address family not supported by protocol family";
@@ -754,11 +796,21 @@
error = "Connection refused";
break;
#endif
+#ifdef ECONNRESET
+ case ECONNRESET:
+ error = "Connection reset by peer";
+ break;
+#endif
#ifdef EADDRINUSE
case EADDRINUSE:
error = "Address already in use";
break;
#endif
+#ifdef EADDRNOTAVAIL
+ case EADDRNOTAVAIL:
+ error = "Address not available";
+ break;
+#endif
#ifdef ECONNABORTED
case ECONNABORTED:
error = "Software caused connection abort";
@@ -809,6 +861,11 @@
error = "Operation not supported on socket";
break;
#endif
+#ifdef EOVERFLOW
+ case EOVERFLOW:
+ error = "Value too large for defined data type";
+ break;
+#endif
#ifdef EMSGSIZE
case EMSGSIZE:
error = "Message too long";