_NutQueryPid()

return the process ID of the calling process 

Function


SYNOPSIS

#include <nutc.h>

pid_t _NutQueryPid(void);


DESCRIPTION

The _NutQueryPid() function returns the process ID of the calling process. This function differs from getpid() because getpid() returns the Win32 process identifier whereas _NutQueryPid() returns the same process ID that was returned when the process was created. The process ID returned when the process was created (using fork() or vfork()]) differs from the Win32 process identifier after exec() is called.

Use _NutQueryPid() when the process ID must remain constant across uses of exec(). After an exec(), if the application uses its process ID to make use of any IPC resource created before calling exec(), it should use _NutQueryPid() to get the process ID that matches the return value of fork() or vfork().

When using vfork(), no new process is created until exec() is used. Consequently, getpid() and _NutQueryPid() return information about the (parent) process that called vfork().


PARAMETERS

None.


RETURN VALUES

_NutQueryPid() returns the process id of the calling process following UNIX semantics. This call always returns successfully.


CONFORMANCE

PTC MKS Toolkit UNIX APIs extension.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
execl(), execle(), execlp(), execlpe(), execv(), execve(), execvp(), execvpe(), fork(), getpid(), vfork()


PTC MKS Toolkit 10.5 Documentation Build 40.