进程的编程简单实现

2008-03-16 12:58:49 / 个人分类:linux应用

[keven@localhost systemCall]$ cat -n get_process_information.cLUPA开源社区f"Ep%O \:L
     1  #include <stdio.h>
S4[wm6X \yr0     2  #include <unistd.h>LUPA开源社区+[-M R3O7GUaU
     3  #include <sys/resource.h>
d~#qa;{}!}%NN0     4LUPA开源社区;AQ o,BQZz
     5  int main(/*int argc,char **argv*/)
kp.O r{ f"Zfp4`0     6  {LUPA开源社区;t5m/k:l_ ^9t5A*n
     7          printf("This process's pid is:%d",getpid());LUPA开源社区8o)r:vLA$O5V
     8          printf("\nThis process's farther pid is:%d",getppid());
i(Ft/e~+| _|0     9          printf("\nThis process's group pid is:%d",getpgid(getpid()));
M8x(g,m@;M,C0    10          printf("\nThis process's group pid is:%d",getpgrp());LUPA开源社区3ek Yv%R8v\
    11          printf("\nThis process's priority is:%d\n",getpriority(PRIO_PROCESS,getpid()));LUPA开源社区;s~Cb!r5`Q
    12          return 0;
VJ,Nz ~|YG@u0    13  }
!v@C9kJ#JF$GO#U0[keven@localhost systemCall]$ ./get_process_informationLUPA开源社区['S+lUbE~y
This process's pid is:6172LUPA开源社区&f*OP+A?#x
This process's farther pid is:5681LUPA开源社区/k0e2N k7PI\e W
This process's group pid is:6172
N~ R;\q0This process's group pid is:6172
x-j _{.n4IU0This process's priority is:0LUPA开源社区4|!U Z4CUwp$G
[keven@localhost systemCall]$ 
/s8L4Q.B9Vg/U;u0
i(@'H dN0只是最简单的练习一下。           

TAG: linux应用

我来说两句

-5 -3 -1 - +1 +3 +5

Open Toolbar