historically, unix used "int" for pids. the open group / ieee
standard defines pid_t  [1],  which is used e.g. for fork(), getpid(), 
kill() etc.
on linux, mac os x etc. Therefore, the use of pid_t instead of "int"
is a good thing, especially, since pids are passed around as
arguments and returned by naviserver functions.

for keeping the code portable, the best thing is
to define in naviserver pid_t  as well for windows, but using
HANDLE.

I've changed right now various places in naviserver, where
pids are assumed as "int", and added a definition for
pid_t for win as well. everything compiles still nicely
under unix, i have not testes with windows, but things
should have become there better as well. Please
get an update from bitbucket.

-g

[1] http://pubs.opengroup.org/onlinepubs/007904975/toc.htm

Am 18.09.14 01:26, schrieb Andrew Piskorski:
> On Windows with the VC 2012 compiler I get this error, which seems to
> then break a lot of other important stuff downstream:
>
>    thread.c(55) : error C2061: syntax error : identifier 'pid_t'
>
> Is pid_t defined anywhere for Windows?  AFAICT it is not.  Adding this
> in an appropriate spot in nsthread.h makes the error go away:
>
>    #ifndef pid_t
>    typedef int pid_t;
>    #endif
>
> But I don't know whether that's actually a correct fix for the various
> places that use pid_t.  Interestingly, in nsd/exec.c Ns_WaitForProcess
> uses pid_t ONLY on Unix, and has a completely different implementation
> for Windows, which uses a HANDLE type instead of pid_t.  And winthread.c
> definitely uses HANDLE.  So it looks like use of the Unix-only pid_t
> crept into a few of the nominally cross-platform files over time.  But
> what's the correct fix?
>

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to