[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: w32 unistd.h

From: Eli Zaretskii
Subject: Re: w32 unistd.h
Date: Thu, 28 Apr 2005 22:30:59 +0300

> Date: Thu, 28 Apr 2005 14:16:04 +0200
> From: Alessandro Vesely <address@hidden>
> CC: address@hidden
> Eli Zaretskii wrote:
> > [...]
> >       a w32/include/unistd.h that will hold
> > prototypes of functions that on Posix platforms are expected to be
> > found in unistd.h.  Examples include chdir, getcwd, dup2, getpid.
> The underlying functionality is different in win32. The examples you
> put are typical cases where one wanders if it is not better to use
> native functions...

Sorry, I don't think I understand what you are saying.  What different
underlying functionality do these functions exhibit on Windows?

In any case, Make already uses those functions, so any different
functionality is already part of Make's behavior on Windows.  We might
decide to fix some of the differences (if there are indeed
differences), but that would be an entirely different project.

Right now, we are talking about getting Make to compile without
compiler errors and with minimum (ideally, zero) amount of warnings.
I suggested to craft a w32/include/unistd.h as a means to that end.
This is because Make's sources test for HAVE_UNISTD_H and if that
header is not available, they provide prototypes for the functions
declared on unistd.h.  However, the prototypes provided are okay for
Posix platforms, not for Windows.  Instead of adding more ugly
conditionals, I think it will be much cleaner to provide a minimal
w32-specific unistd.h, which will simply copy the prototypes of the
functions used by Make from Windows system header files.  Then we
could define HAVE_UNISTD_H on Windows and be done with that.

What I cannot figure out is whether you agree or disagree with this
suggestion, and if the latter, what are your reasons for the

> Of course, porting from Unix platforms has always been taken into
> consideration, in DOS before and in win32 after.

The DOS (a.k.a. DJGPP) port of GNU Make doesn't have these problems
because (a) it uses GCC, and (b) it has Posix-compliant unistd.h.

> However, there is
> no win32 unistd.h, except for various projects that had a "win32/unistd.h"
> (can google that string) where they used to put just a few missing bits,
> e.g. define S_ISREG or declare usleep(). Hmmm...

All I want to put there are those ``bits'' that Make needs, nothing
more.  That is, only unistd.h functions that Make needs, and then only
those which exist in the Windows libraries and runtime, will be
declared there.  Okay?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]