c - Process ID is always 0 in linux, Is it valid? -


my program finds pid in linux. it’s returning 0. supposed this? used gcc. valid? when process ids without 0? here code.

#include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/types.h>  int main() {         pid_t pid;         /* process id */         if ((pid = getpid()) < 0)                 perror(" unable pid");         else                 printf(" process id %d", pid);         return (0); } 

so after compiling program prints in terminal “the process id is: 0”.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -