This is the mail archive of the mailing list for the newlib project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

sysconf cleanup

sysconf.c was missing many (71) of the variables that POSIX requires of
so I re-wrote it to include them all.  Rather than doing lots of
hand editing to put in the missing cases, I deleted all the cases in
the switch and programmatically generated the new ones from the list
in the Opengroup man page.  This makes the patch show almost the whole
file as being changed.
Since all of the _SC defines were already in unistd.h, I did not check
to see if any of the items should be ifdef'd with a POSIX version
because none of the _SC defines in unistd.h are.
As noted in the ChangeLog entry, 5 of the cases are present but
commented out.
_SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX are supposed to return
something from getgrgid and getpwuid, but since newlib does not have
those, I left them out as there is not a value that I know how to get.
cases ran into a problem with their values being defined, but not
as numbers.  (They are redefined as other macros which never get
Since they didn't work before, I didn't bother to try and fix them.
As part of this, I had to correct 3 of the _SC_ values for so-called
"legacy" defines in sys/unistd.h to remove duplication.  (Opengroup
shows different returns for the legacy items, so the duplication that
in place made no sense.)
This change might address the problem just asked about in an email
titled "Compatibility with Debian 4.0?", where sysconf(_SC_PAGE_SIZE)
returned -1, since _SC_PAGE_SIZE did not previously have a case.
Craig Howland

Attachment: sysconf.patch
Description: sysconf.patch

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]