I have a short snippet of a code mentioned below: //--------------------------------------------- #include <stdio.h> #include <unistd.h>
int main() { pid_t pid = getpid(); system("ps aux"); printf("PID: %llu\n", pid); return 0; } //--------------------------------------------- After compiling the code in MinGW 64-bit bash terminal, I get the following output: ####### Console output PID PPID PGID WINPID TTY UID STIME COMMAND 1785 1 1785 1640 ? 197609 12:53:28 /usr/bin/mintty 1786 1785 1786 12684 pty0 197609 12:53:29 /usr/bin/bash 2066 1 2065 13916 pty0 197609 13:20:00 /usr/bin/ps 2065 1786 2065 14420 pty0 197609 13:20:00 /home/Ameya/apps/src/pth_test/get_pid PID: 14420 ####### The print PID: 14420 is returning the WINPID from the `ps aux` command, whereas the value is equal to PID when trying to run from MSYS2 terminal. Is there an API in MinGW to get the PID value from the ps aux command? I actually need this value in an application I am working on using the MinGW tools as a base platform. Thanks in advance. -- Regards, Ameya Vikram Singh _______________________________________________ Msys2-users mailing list Msys2-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/msys2-users