[tor-dev] pid_t and MSVC

Gisle Vanem gvanem at broadpark.no
Tue Oct 11 11:16:50 UTC 2011


The use of 'pid_t' confuses me a bit:

  In common/procmon.c (inside MS_WINDOWS), it's typedef'ed to 
  'int' unconditionally.

  And then in common/util.* (tor_terminate_process()) it is assumed to be 
  defined in orconfig.h or somewhere else. It's not AFAICS.

It is true that _getpid() returns an 'int', but the way Tor uses it seems
wrong; the last argument to OpenProcess() takes a 'DWORD'. So 'pid_t'
should be 'DWORD' IMHO.

So maybe we should introduce a 'typedef DWORD tor_pid_t;' in orconfig.h?

Btw. MingW does have 'pid_t' in it's <sys/types.h>.

--gv


More information about the tor-dev mailing list