Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 10 May 2013 18:35:16 +0400
From: Solar Designer <>
Subject: Re: os.h usage

Jim -

On Fri, May 10, 2013 at 07:24:04AM -0400, wrote:
> Shouldn't we add to this?  I think another area where there is a lot of OS dependent stuff, is in includes.
> I was just wondering if the os.h file is 'open' for modifications?  There already is one issue that I know of in the os.h. That is in the FLOCK section.  The whole flock section should be wrapped with a #if defined (_MSC_VER)  setting OS_FLOCK to 0 for it.  There is no <sys/file.h> for VC

VC support is something (only) you work on, and only in jumbo - so yes,
it's up to you to add that. :-)

> But I think a lot of the very ugliness in the #include block, can be hidden with 'less' ugly defines.
> So instead of:
> #if !defined (_MSC_VER) && !defined (__MINGW32__) && !defined (__SOME_OTHER_OS__)
> #include <somefile.h>
> #endif
> We could have:
> #include <somefile.h>
> #endif
> Then set the HAS_SOMEFILE_H in os.h using the OS specific defines.

You may experiment with this in jumbo and see if it actually ends up
simplifying things.  I think "#ifdef HAVE_SOMETHING" is more standard
for this - and we already define some HAVE_*'s in the Makefile.

> Also, I am really not sold on the 'NEEDS_OS_TIMER', 'NEEDS_OS_FLOCK', .....  Would it not be better to simply set all of the defined constants, whenever os.h is loaded?

The problem is that we have os.h itself include other files and test for
certain conditions in order to define the corresponding OS_* macros.
If we have this happen for all OS_* macros all the time, we'd end up
including extra files and also setting _XOPEN_SOURCE and
_DARWIN_C_SOURCE for all source files that include os.h.  While it may
be OK and it may actually simplify things if the feature macros are set
in the exact same way for all source files, this is not what has been
tested so far, and to arrive at it consistently changes outside of os.h
would be needed as well.


Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.