httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <>
Subject Re: OS abstraction
Date Mon, 23 Jun 1997 05:51:55 GMT
On Sun, 22 Jun 1997, Dean Gaudet wrote:
> On Fri, 20 Jun 1997, Paul Sutton wrote:
> > os-unix.h
> >  #define AP_FILE_CREATE_PERMS \
> >               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH
> >  #define ap_pipe(fds) pipe(fds)
> >  #define ap_is_path_absolute(file) (file && file[0] == '/' ? 1 : 0)
> >  #define ap_guess_if_path_is_uri(x) (strchr(x, ':')!= NULL)
> I always get concerned about inadvertant use of a param with a side-effect
> in a macro ... like what if file there has a side effect.  I'd prefer
> this to be one of those cases where we use some of gcc's extensions if
> __GNUC__ and otherwise put it in a function.

Yes, sounds good. Do you mean use "inline" under GCC?

So this means we need an abstraction layer .c file as well as a .h.  So we
can get started, does anyone object to the following proposal (some of
this has already been discussed): 

  - create an abstraction directory (/src/os)

  - inside here, create a directory for each abstraction
     (/src/os/unix, /src/os/emx, /src/os/win32)

  - in each of those directories create a header file (os.h) for
     OS-specific macros (AP_*, some HAVE_*)

  - in each of these directories create a source file (os.c) for
     OS-specific implementations of ap_*() functions

  - move any other sources files tied completed to a single platform
     into the appropriate directory (e.g. Win32's service.c)

  - add code to conf.h to #include the appropriate /src/os/*/os.h file

We have a directory per platform (which Unix all lumped together).  When
this is all done we can start abstracting the OS specific stuff.


View raw message