errno.h: ESTRPIPE

Jeff Johnston jjohnstn@redhat.com
Tue Mar 17 22:10:00 GMT 2009


Ralf Corsepius wrote:
> Jeff Johnston wrote:
>> Ralf Corsepius wrote:
>>> Christopher Faylor wrote:
>>>> On Mon, Mar 16, 2009 at 08:29:26AM +0100, Ralf Corsepius wrote:
>>>>  
>>>>> newlib should stay with well established standards and not be 
>>>>> polluted
>>>>> with underdocumented, proprietary extensions.
>>>>>     
>>>>
>>>> Do you have any other irrational prejudices you'd like to share 
>>>> with us?
>>> No, simply point me to an official (POSIX, IEEE, ANSII or similar) 
>>> standard documenting ESTRPIPE.
>>>
>>> Ralf
>>>
>> Hi Ralf,
>>
>> According to Posix Section 2.4 states:
>>
>> "Implementations may support additional errors not listed in this 
>> clause, but shall not generate a different error number from one 
>> required  by this part of ISO/IEC 9945 for an error condition 
>> described in this part of ISO/IEC 9945...."
>>
>> Similarly under SUSV:
>>
>> "Additional implementation-dependent error numbers may be defined in 
>> <errno.h>"
> Well, this only applies from an OS's POV, i.e. an OS has the liberty 
> to add further errnos.
>
> Newlib is in a special position wrt. this: It is not part of the OS 
> (glibc is), it is used by the OS.
>
> I.e. what you are saying effectively means: Cygwin dictates to newlib 
> what other OS using newlib must support.
>
Well, actually, the majority of the extensions are Linux and in this 
matter, I have been Linux-biased based on my local OS and installed 
glibc header files.

That said, there is a legitimate reason to #ifdef these values as they 
add to the size of the strerror function which can now be enhanced to 
include all the extensions.   For small platforms, this would be 
particularly undesirable.

So, I have prepared a patch (attached) that segregates the majority of 
the extensions under __LINUX_ERRNO_EXTENSIONS__ and have put 3 errno 
values under __CYGWIN__.  There were 4 errnos I couldn't find in the 
Linux header files: ELBIN, EPROCLIM, EFTYPE, and ENMFILE but I put them 
under Linux extensions nonetheless.  If these are Cygwin-specific, 
please speak up, otherwise, I'll leave them asis for now.

In sys/config.h I have set __LINUX_ERRNO_EXTENSIONS__ to 1 for Cygwin so 
Cygwin sees all errnos by default.  Linux is already including the local 
glibc asm/errno.h so it isn't being used by Linux.  The extensions 
aren't being used in the shared code.  If it is felt that this should be 
configurable, I'll add a configuration option.

Comments?

-- Jeff J.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: errno.patch
URL: <http://sourceware.org/pipermail/newlib/attachments/20090317/367ea607/attachment.ksh>


More information about the Newlib mailing list