os/libc/unistd.c

15 lines
234 B
C
Raw Permalink Normal View History

#include <sys/syscalls.h>
2019-09-01 13:49:01 -05:00
#include <sys/types.h>
#define QUAUX(X) #X
#define QU(X) QUAUX(X)
2019-09-01 13:49:01 -05:00
pid_t getpid() {
pid_t pid;
asm volatile(" \
mov $" QU(SYSCALL_GET_PID) ", %%eax; \
2019-09-01 13:49:01 -05:00
int $80; \
":"=b"(pid));
return pid;
}