Chinaunix首页 | 论坛 | 博客
  • 博客访问: 173567
  • 博文数量: 108
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 1065
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-29 08:56
文章分类

全部博文(108)

文章存档

2011年(11)

2010年(46)

2009年(29)

2008年(22)

我的朋友

分类: LINUX

2010-11-10 12:07:25

#include
#include
#include
#include
#include
#include
#include
       
int main()
{
     
     
     int pid;
     int rc;
 
  setsid();
  ioctl(0, TIOCSCTTY, 0);
  rc = tcsetpgrp(0, getpid());
    printf("rc =%d\n",rc);
   
    pid = fork();
    if (pid < 0)
  {
          printf("error\n");
    }
    if (pid == 0)
    {
        execlp( "/bin/sh", "sh" ,NULL,NULL,NULL);
    }
    else
    {
            wait();
    }
   
    return 0;
   
}
阅读(733) | 评论(0) | 转发(0) |
0

上一篇:C&ASM 混编

下一篇:RAW socket 收发包

给主人留下些什么吧!~~