当前位置: 技术问答>linux和unix
刚接触linux,结果就让我晕了一把。 fork?!
来源: 互联网 发布时间:2016-02-10
本文导语: #include #include main() { pid_t pid; printf("nPID before is :%d",getpid()); pid=fork(); if(pid 6, base_addr:0xb7ea06b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0 2337 munmap(0xb...
#include
#include
main()
{
pid_t pid;
printf("nPID before is :%d",getpid());
pid=fork();
if(pid 6, base_addr:0xb7ea06b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
2337 munmap(0xb7f8c000, 29618) = 0
2337 getpid() = 2337
2337 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 2), ...}) = 0
2337 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
2337 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f93000
2337 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7ea06f8) = 2338
2337 write(1, "PID before is :2337n", 20) = 20
2337 write(1, "I 'm parent process: 2337n", 26) = 26
2337 munmap(0xb7f93000, 4096) = 0
2337 exit_group(0) = ?
2338 write(1, "PID before is :2337n", 20) = 20
2338 write(1, "I 'm child process: 2338n", 25) = 25
2338 munmap(0xb7f93000, 4096) = 0
2338 exit_group(0) = ?
#include
main()
{
pid_t pid;
printf("nPID before is :%d",getpid());
pid=fork();
if(pid 6, base_addr:0xb7ea06b0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
2337 munmap(0xb7f8c000, 29618) = 0
2337 getpid() = 2337
2337 fstat64(1, {st_mode=S_IFCHR|0600, st_rdev=makedev(4, 2), ...}) = 0
2337 ioctl(1, SNDCTL_TMR_TIMEBASE or TCGETS, {B9600 opost isig icanon echo ...}) = 0
2337 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb7f93000
2337 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7ea06f8) = 2338
2337 write(1, "PID before is :2337n", 20) = 20
2337 write(1, "I 'm parent process: 2337n", 26) = 26
2337 munmap(0xb7f93000, 4096) = 0
2337 exit_group(0) = ?
2338 write(1, "PID before is :2337n", 20) = 20
2338 write(1, "I 'm child process: 2338n", 25) = 25
2338 munmap(0xb7f93000, 4096) = 0
2338 exit_group(0) = ?
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。