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

📄 cloning.c

📁 多线程库
💻 C
字号:
/***************************************************************************                          cloning.c  -  description                             -------------------    begin                : Mon Jan 31 2000    copyright            : (C) 2000 by 豶n E. Hansen    email                : oe.hansen@gamma.telenordia.se ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   *  *                                                                         * ***************************************************************************/#include <stdarg.h>#include <termio.h>#include <sched.h>#include <unistd.h>#include <sys/file.h>#include <sys/stat.h>#include <sys/ioctl.h>#include <sys/types.h>#include <sys/resource.h>#include <malloc.h>#include <memory.h>#include <string.h>#include <pthread.h>#include <langinfo.h>#include <libintl.h>#include <syslog.h>#include <ctype.h>#include "cloning.h"do_clone(int (*_fn)(void *), void *_arg, void **_sp){  char *sp;  int pid;  if (*_sp)    sp = (char *)*_sp;  else    sp = malloc(4*PAGE_SIZE);  if (sp == NULL)    return -2;  pid = __clone(_fn, sp+(4*PAGE_SIZE), CLONE_VM|CLONE_FS|CLONE_FILES, _arg);  if (pid < 0) {    if (*_sp == NULL)      free(sp);    sp = NULL;  }  *_sp = (void *)sp;  return pid;}

⌨️ 快捷键说明

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