_getppid.c

来自「MINIX2.0操作系统源码 MINIX2.0操作系统源码」· C语言 代码 · 共 17 行

C
17
字号
#include <lib.h>
#define getppid	_getppid
#include <unistd.h>

PUBLIC pid_t getppid()
{
  message m;

  /* POSIX says that this function is always successful and that no
   * return value is reserved to indicate an error.  Minix syscalls
   * are not always successful and Minix returns the reserved value
   * (pid_t) -1 when there is an error.
   */
  if (_syscall(MM, GETPID, &m) < 0) return ( (pid_t) -1);
  return( (pid_t) m.m2_i1);
}

⌨️ 快捷键说明

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