This is the mail archive of the
mailing list for the newlib project.
unistd.h ifdefs on OS
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Fri, 22 Nov 2013 14:54:39 -0600
- Subject: unistd.h ifdefs on OS
- Authentication-results: sourceware.org; auth=none
In looking at unistd.h for the next restrict patch,
I noticed blocks like this:
#if defined(__CYGWIN__) || defined(__rtems__)
int _EXFUN(setegid, (gid_t __gid ));
int _EXFUN(seteuid, (uid_t __uid ));
These are POSIX methods which are not specific to RTEMS
or Cygwin. We just happen to be two targets that support
In other cases, newlib prototypes methods with no concern
whether they are implemented or not.
I know this was done historically but is there any reason
non-OS specific POSIX methods like these should be wrapped
by OS specific conditionals?
I rather like the idea of having POSIX .h files with methods
for which an implementation may not have the body. It avoids
a lot of unnecessary and ugly conditionals.
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985