/*** *getpid.c - get current process id * * Copyright (c) 1989-1997, Microsoft Corporation. All rights reserved. * *Purpose: * Defines _getpid() - get current process id * *******************************************************************************/ #ifndef _MAC #include #include /*** *int _getpid() - get current process id * *Purpose: * Returns the current process id for the calling process. * *Entry: * None. * *Exit: * Returns the current process id. * *Uses: * *Exceptions: * *******************************************************************************/ int __cdecl _getpid ( void ) { return GetCurrentProcessId(); } #else /* _MAC */ #include #include #include #include #include #include #include #include #include #include #include #include #include /*** *int _getpid() - get current process id * *Purpose: * Returns the current process id for the calling process. * *Entry: * None. * *Exit: * Returns the current process id. * *Uses: * *Exceptions: * *******************************************************************************/ extern time_t _GetApplicationStartTime(); int __cdecl _getpid ( void ) { ProcessSerialNumber psn; REG3 unsigned number; if (__TrapFromGestalt(gestaltOSAttr, gestaltLaunchControl)) { GetCurrentProcess(&psn); number = (unsigned) psn.lowLongOfPSN; } else { number = (unsigned)_GetApplicationStartTime(); } return number; } #endif /* _MAC */