BarryServer : Git

All the code for all my projects
// BarryServer : Git / OrionLibC / blob / master / sys / wait.c

// Related

OrionLibC

Barry Importing existing Orion LibC 03048a9 (2 years, 3 months ago)
#include <sys/syscall.h>
#include <sys/wait.h>
#include <errno.h>

/* Wait for a process to change state */
pid_t
wait(int *wstatus)
{
	return waitpid(-1, wstatus, 0);
}

/* Wait for a specific process to change state */
pid_t
waitpid(pid_t pid, int *wstatus, int options)
{
	int ret;
	asm volatile("int $0x80" : "=a" (ret) : "0" (SYSCALL_WAITPID),
	             "c" (3), "S" (&pid));
	if (ret >= 0)
		return ret;
	errno = -ret;
	return -1;
}