libc

my libc
git clone git://git.evenfri.xyz/libc.git
Log | Files | Refs | README

waitpid.c (300B)


      1 /*
      2  * waitpid.c - waitpid system call wrapper
      3  * Copyright (C) 2026. All rights reserved.
      4  */
      5 
      6 #include "libc.h"
      7 
      8 int waitpid(int pid, int *status, int options) {
      9   int ret = syscall(SYS_wait4, pid, status, options, NULL);
     10 
     11   if (ret < 0) {
     12     errno = -ret;
     13     return -1;
     14   }
     15 
     16   return (int)ret;
     17 }