C snipt.info - Index - Arhiva

download | new post | after_exec on April Mon 13th 12:19 PM - Never Expires

  1. /* after_exec.c */
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. #include <fcntl.h>
  5.  
  6. char tab_ref[1000];
  7.  
  8. void main()
  9. {
  10.   int nrBytesRead;
  11.   char ch;
  12.   printf("Caracteristici dupa exec\n");
  13.   printf("------------------------\n");
  14.   printf("ID-ul procesului : %d\n",getpid());
  15.   printf("ID-ul parintelui : %d\n",getppid());
  16.   printf("Proprietarul real : %d\n",getuid());
  17.   printf("Proprietarul efectiv : %d\n",geteuid());
  18.   printf("Directorul de lucru : %s\n\n",getcwd(tab_ref,1000));
  19.  
  20.   nrBytesRead = read(STDIN_FILENO, &ch, 1);
  21.   printf("Numarul de caractere citite: %d\n",nrBytesRead);
  22.   if( nrBytesRead = -1 ) perror("Error reading stdin (because it is closed !) ");
  23. }

Submit a correction or amendment below. (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
Syntax Highlighting:
To highlight particular lines, prefix each line with @@
Pressing TAB inserts 3 spaces