summaryrefslogtreecommitdiff
path: root/include/unistd.h
blob: 746c829abefe4a030014cd5100bd62272077ccb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef _UNISTD_H
#define _UNISTD_H

#include <stdint.h>

typedef uint16_t pid_t;

#define __SYS_puts      0
#define __SYS_time      1
#define __SYS_getpid    2
#define __SYS_getpdir   3
#define __SYS_signal    4
#define __SYS_alarm     5
#define __SYS_pause     6
#define __SYS_ctty      7

#define _syscall0(type, name) \
  type name(void) { \
    type __res; \
    __asm__ volatile ( \
        "int $0x80" \
        : "=a" (__res) \
        : "a" (__SYS_##name) \
        :); \
    return __res; \
  }

#define _syscall1(type, name, atype, a) \
  type name(atype a) { \
    type __res; \
    __asm__ volatile ( \
        "int $0x80" \
        : "=a" (__res) \
        : "a" (__SYS_##name), "b" (a) \
        :); \
    return __res; \
  }

pid_t getpid(void);
void *getpdir(void);

int pause(void);

#endif