Chinaunix首页 | 论坛 | 博客
  • 博客访问: 10508242
  • 博文数量: 2905
  • 博客积分: 20098
  • 博客等级: 上将
  • 技术积分: 36298
  • 用 户 组: 普通用户
  • 注册时间: 2009-03-23 05:00
文章存档

2012年(1)

2011年(3)

2009年(2901)

分类: LINUX

2009-03-23 11:09:05

#include
#include
#include
#include

int main(int argc, char **argv)
{
    /* first disable all our signals */   
    sigset_t set;
    sigfillset(&set);
    sigprocmask(SIG_BLOCK, &set, NULL);

    /* send signals to all processes  _except_ pid 1 */
    printf("sending SIGTERM signal to all processes\n");
    kill(-1, SIGTERM);
    sync();
    sleep(3);
   
    printf("sending SIGKILL signal to all processes\n");
    kill(-1, SIGKILL);
    sync();
    sleep(3);
   
    /* shutdown */
    printf("system shutdown\n");
    sleep(2);
    reboot(RB_POWER_OFF);
}

阅读(398) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~