libc

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

waitpid.c (322B)


      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   long ret = syscall(SYS_wait4, (long)pid, (long)status, (long)options, 0, 0, 0);
     10 
     11   if (ret < 0) {
     12     errno = -ret;
     13     return -1;
     14   }
     15 
     16   return (int)ret;
     17 }