summaryrefslogtreecommitdiff
path: root/include/unistd.h
blob: c63ac6a856abfd9c6f0e1a383f64874f7998ffd4 (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
#ifndef _UNISTD_H
#define _UNISTD_H

#define __SYS_print 0

#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; \
  }

#endif