To bring more to the table:
From includes
typedef unsigned long       DWORD;
Our pid_t is defined:
https://github.com/openvswitch/ovs/blob/master/include/windows/windefs.h#L41

I'm wondering if it would be best not to cut corners on this one and just stick 
to _getpid and do the same thing as we already have for `string.h`.

What do you think?

Thanks,
Alin.
> -----Original Message-----
> From: Ben Pfaff [mailto:[email protected]]
> Sent: Saturday, April 15, 2017 6:27 AM
> To: Sairam Venugopal <[email protected]>
> Cc: Alin Serdean <[email protected]>;
> [email protected]
> Subject: Re: [ovs-dev] [PATCH 02/10] windows: add definition of getpid and
> getcwd
> 
> If GetCurrentProcessId() is a reasonable substitute for getpid(), but the
> return type is different, then I would suggest an inline function, like this:
> 
> static inline pid_t
> getpid(void)
> {
>     return GetCurrentProcessId();
> }
> 
> Thanks,
> 
> Ben.
> 
> On Tue, Mar 07, 2017 at 09:07:55AM +0000, Sairam Venugopal wrote:
> > Shouldn’t we cast the DWORD to unsigned int for the
> GetCurrentProcessId?
> >
> >
> >
> >
> > On 2/5/17, 8:41 PM, "[email protected] on behalf of Alin
> Serdean" <[email protected] on behalf of
> [email protected]> wrote:
> >
> > >getcwd - is used in lib/util.c. getcwd is deprecated on Windows but
> > >has _getcwd which is defined in <direct.h>:
> > >https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__msdn.microsoft.c
> > >om_en-2Dus_library_sf98bd4y-28v-3Dvs.120-
> 29.aspx&d=DwICAg&c=uilaK90D4
> >
> >TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo
> &m=og4savU
> > >MMSe8GoOfKq6AMAirivJFLgVTMx5lx7hx6gk&s=CVjSRN456APj3-
> mMAQuXYxdJ4oUgdu
> > >wqZHzkod6cLvQ&e=
> > >
> > >getpid - is used in several files (i.e. lib/vlog.c). getpid is also
> > >and deprecated and _getpid should be used:
> > >https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__msdn.microsoft.c
> > >om_en-2Dus_library_t2y34y40-28v-3Dvs.120-
> 29.aspx&d=DwICAg&c=uilaK90D4
> >
> >TOVoH58JNXRgQ&r=Z6vowHUOjP5ysP_g372c49Nqc1vEKqHKNBkR5Q5Z7uo
> &m=og4savU
> >
> >MMSe8GoOfKq6AMAirivJFLgVTMx5lx7hx6gk&s=pDh2W8ECiQdxZdHgHBdW
> HIDhLPcTJ9
> > >A6rb2n1YcRZ94&e= The problem using _getpid is that the definition is
> > >in <process.h>.
> > >A file called process.h also exists in the lib folder. This will mess
> > >up includes.
> > >An option would be to use a wrapper like we use for lib/string.h(.in)
> > >but that would mean to also add it to the automake chain.
> > >A simple solution would be to map it to GetCurrentProcessId
> > >https://urldefense.proofpoint.com/v2/url?u=https-
> 3A__msdn.microsoft.c
> > >om_en-2Dus_library_windows_desktop_ms683180-28v-3Dvs.85-
> 29.aspx&d=DwI

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to