⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clone3.c

📁 gdb-6.8 Linux下的调试程序 最新版本
💻 C
字号:
/* Check that exiting from a parent thread does not kill the child.#notarget: cris*-*-elf*/#include <stddef.h>#include <stdlib.h>#include <stdio.h>#include <limits.h>#include <unistd.h>#include <sched.h>#include <signal.h>#include <errno.h>#include <sys/types.h>#include <sys/wait.h>intprocess (void *arg){  int i;  for (i = 0; i < 50; i++)    if (sched_yield ())      abort ();  printf ("pass\n");  return 0;}intmain (void){  int pid;  long stack[16384];  pid = clone (process, (char *) stack + sizeof (stack) - 64,	       (CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND)	       | SIGCHLD, "ab");  if (pid <= 0)    {      fprintf (stderr, "Bad clone %d\n", pid);      abort ();    }  exit (0);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -