Chinaunix首页 | 论坛 | 博客
  • 博客访问: 646092
  • 博文数量: 156
  • 博客积分: 4833
  • 博客等级: 上校
  • 技术积分: 1554
  • 用 户 组: 普通用户
  • 注册时间: 2007-05-21 19:36
文章分类

全部博文(156)

文章存档

2016年(2)

2013年(1)

2012年(13)

2011年(30)

2010年(46)

2009年(29)

2008年(23)

2007年(12)

分类: 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;
   
}
阅读(943) | 评论(0) | 转发(0) |
0

上一篇:Linux 网络配置

下一篇:RAW socket 收发包

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