Skip to content
Snippets Groups Projects
  • Nadav Har'El's avatar
    05c34106
    Don't abort on unknown sysconf. · 05c34106
    Nadav Har'El authored
    Don't abort on an unimplemented sysconf parameter. One of the documented
    functions of sysconf(3) is to "test ... whether certain options are
    supported", so programs are free to test for features we don't support
    yet, and we're supposed to return -1 with errno set to EINVAL.
    
    For example, Boost tested _SC_THREAD_SAFE_FUNCTIONS which we didn't
    support. It would have been fine if we set EINVAL (it would switch
    from *_r functions to the non-reenatrant ones) - but it wasn't fine
    that we abort()ed because of this test :-)
    
    To be on the safe side, this patch still prints a message if we see an
    unknown sysconf - in case in the future we'll come across a new one we
    must treat. But eventually, the message should go away too.
    05c34106
    History
    Don't abort on unknown sysconf.
    Nadav Har'El authored
    Don't abort on an unimplemented sysconf parameter. One of the documented
    functions of sysconf(3) is to "test ... whether certain options are
    supported", so programs are free to test for features we don't support
    yet, and we're supposed to return -1 with errno set to EINVAL.
    
    For example, Boost tested _SC_THREAD_SAFE_FUNCTIONS which we didn't
    support. It would have been fine if we set EINVAL (it would switch
    from *_r functions to the non-reenatrant ones) - but it wasn't fine
    that we abort()ed because of this test :-)
    
    To be on the safe side, this patch still prints a message if we see an
    unknown sysconf - in case in the future we'll come across a new one we
    must treat. But eventually, the message should go away too.
runtime.cc 8.75 KiB