Roughly half of the headers under include/api are symbolic links to their
copies from musl/include. Others seems to be the modified versions that
probably originate from musl as well and modified later.

This patch replaces 23 more of the headers with the symbolic links to
their identical copies under musl/include.

Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 include/api/arpa/nameser_compat.h |   2 +-
 include/api/arpa/tftp.h           |  31 +-----
 include/api/errno.h               |  27 +----
 include/api/scsi/scsi.h           | 150 +---------------------------
 include/api/scsi/sg.h             | 130 +-----------------------
 include/api/sys/cachectl.h        |  23 +----
 include/api/sys/times.h           |  26 +----
 include/api/x64/bits/endian.h     |   2 +-
 include/api/x64/bits/errno.h      | 135 +------------------------
 include/api/x64/bits/fcntl.h      |  39 +-------
 include/api/x64/bits/io.h         |  78 +--------------
 include/api/x64/bits/ipc.h        |  15 +--
 include/api/x64/bits/posix.h      |   3 +-
 include/api/x64/bits/reg.h        |  30 +-----
 include/api/x64/bits/setjmp.h     |   2 +-
 include/api/x64/bits/shm.h        |  16 +--
 include/api/x64/bits/signal.h     | 119 +---------------------
 include/api/x64/bits/statfs.h     |   8 +-
 include/api/x64/bits/stdarg.h     |   5 +-
 include/api/x64/bits/termios.h    | 161 +-----------------------------
 include/api/x64/bits/user.h       |  45 +--------
 include/api/x64/pthread_arch.h    |  11 +-
 include/api/x64/syscall_arch.h    |  63 +-----------
 23 files changed, 23 insertions(+), 1098 deletions(-)
 mode change 100644 => 120000 include/api/arpa/nameser_compat.h
 mode change 100644 => 120000 include/api/arpa/tftp.h
 mode change 100644 => 120000 include/api/errno.h
 mode change 100644 => 120000 include/api/scsi/scsi.h
 mode change 100644 => 120000 include/api/scsi/sg.h
 mode change 100644 => 120000 include/api/sys/cachectl.h
 mode change 100644 => 120000 include/api/sys/times.h
 mode change 100644 => 120000 include/api/x64/bits/endian.h
 mode change 100644 => 120000 include/api/x64/bits/errno.h
 mode change 100644 => 120000 include/api/x64/bits/fcntl.h
 mode change 100644 => 120000 include/api/x64/bits/io.h
 mode change 100644 => 120000 include/api/x64/bits/ipc.h
 mode change 100644 => 120000 include/api/x64/bits/posix.h
 mode change 100644 => 120000 include/api/x64/bits/reg.h
 mode change 100644 => 120000 include/api/x64/bits/setjmp.h
 mode change 100644 => 120000 include/api/x64/bits/shm.h
 mode change 100644 => 120000 include/api/x64/bits/signal.h
 mode change 100644 => 120000 include/api/x64/bits/statfs.h
 mode change 100644 => 120000 include/api/x64/bits/stdarg.h
 mode change 100644 => 120000 include/api/x64/bits/termios.h
 mode change 100644 => 120000 include/api/x64/bits/user.h
 mode change 100644 => 120000 include/api/x64/pthread_arch.h
 mode change 100644 => 120000 include/api/x64/syscall_arch.h

diff --git a/include/api/arpa/nameser_compat.h 
b/include/api/arpa/nameser_compat.h
deleted file mode 100644
index ee3b1a90..00000000
--- a/include/api/arpa/nameser_compat.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <arpa/nameser.h>
diff --git a/include/api/arpa/nameser_compat.h 
b/include/api/arpa/nameser_compat.h
new file mode 120000
index 00000000..8918e0c5
--- /dev/null
+++ b/include/api/arpa/nameser_compat.h
@@ -0,0 +1 @@
+../../../musl/include/arpa/nameser_compat.h
\ No newline at end of file
diff --git a/include/api/arpa/tftp.h b/include/api/arpa/tftp.h
deleted file mode 100644
index 5cacd2b5..00000000
--- a/include/api/arpa/tftp.h
+++ /dev/null
@@ -1,30 +0,0 @@
-#ifndef _ARPA_TFTP_H
-#define _ARPA_TFTP_H
-#define SEGSIZE 512
-#define RRQ 01
-#define WRQ 02
-#define DATA 03
-#define ACK 04
-#define ERROR 05
-struct tftphdr {
-       short th_opcode;
-       union {
-               unsigned short tu_block;
-               short tu_code;
-               char tu_stuff[1];
-       } th_u;
-       char th_data[1];
-};
-#define th_block th_u.tu_block
-#define th_code th_u.tu_code
-#define th_stuff th_u.tu_stuff
-#define th_msg th_data
-#define EUNDEF 0
-#define ENOTFOUND 1
-#define EACCESS 2
-#define ENOSPACE 3
-#define EBADOP 4
-#define EBADID 5
-#define EEXISTS 6
-#define ENOUSER 7
-#endif
diff --git a/include/api/arpa/tftp.h b/include/api/arpa/tftp.h
new file mode 120000
index 00000000..9b71b595
--- /dev/null
+++ b/include/api/arpa/tftp.h
@@ -0,0 +1 @@
+../../../musl/include/arpa/tftp.h
\ No newline at end of file
diff --git a/include/api/errno.h b/include/api/errno.h
deleted file mode 100644
index 1aed0a29..00000000
--- a/include/api/errno.h
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef        _ERRNO_H
-#define _ERRNO_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <features.h>
-
-#include <bits/errno.h>
-
-#ifdef __GNUC__
-__attribute__((const))
-#endif
-int *__errno_location(void);
-#define errno (*__errno_location())
-
-#ifdef _GNU_SOURCE
-extern char *program_invocation_short_name, *program_invocation_name;
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/errno.h b/include/api/errno.h
new file mode 120000
index 00000000..a84b35cc
--- /dev/null
+++ b/include/api/errno.h
@@ -0,0 +1 @@
+../../musl/include/errno.h
\ No newline at end of file
diff --git a/include/api/scsi/scsi.h b/include/api/scsi/scsi.h
deleted file mode 100644
index ee50432d..00000000
--- a/include/api/scsi/scsi.h
+++ /dev/null
@@ -1,149 +0,0 @@
-#ifndef _SCSI_SCSI_H
-#define _SCSI_SCSI_H
-
-#define TEST_UNIT_READY 0x00
-#define REZERO_UNIT 0x01
-#define REQUEST_SENSE 0x03
-#define FORMAT_UNIT 0x04
-#define READ_BLOCK_LIMITS 0x05
-#define REASSIGN_BLOCKS 0x07
-#define READ_6 0x08
-#define WRITE_6 0x0a
-#define SEEK_6 0x0b
-#define READ_REVERSE 0x0f
-#define WRITE_FILEMARKS 0x10
-#define SPACE 0x11
-#define INQUIRY 0x12
-#define RECOVER_BUFFERED_DATA 0x14
-#define MODE_SELECT 0x15
-#define RESERVE 0x16
-#define RELEASE 0x17
-#define COPY 0x18
-#define ERASE 0x19
-#define MODE_SENSE 0x1a
-#define START_STOP 0x1b
-#define RECEIVE_DIAGNOSTIC 0x1c
-#define SEND_DIAGNOSTIC 0x1d
-#define ALLOW_MEDIUM_REMOVAL 0x1e
-#define SET_WINDOW 0x24
-#define READ_CAPACITY 0x25
-#define READ_10 0x28
-#define WRITE_10 0x2a
-#define SEEK_10 0x2b
-#define WRITE_VERIFY 0x2e
-#define VERIFY 0x2f
-#define SEARCH_HIGH 0x30
-#define SEARCH_EQUAL 0x31
-#define SEARCH_LOW 0x32
-#define SET_LIMITS 0x33
-#define PRE_FETCH 0x34
-#define READ_POSITION 0x34
-#define SYNCHRONIZE_CACHE 0x35
-#define LOCK_UNLOCK_CACHE 0x36
-#define READ_DEFECT_DATA 0x37
-#define MEDIUM_SCAN 0x38
-#define COMPARE 0x39
-#define COPY_VERIFY 0x3a
-#define WRITE_BUFFER 0x3b
-#define READ_BUFFER 0x3c
-#define UPDATE_BLOCK 0x3d
-#define READ_LONG 0x3e
-#define WRITE_LONG 0x3f
-#define CHANGE_DEFINITION 0x40
-#define WRITE_SAME 0x41
-#define READ_TOC 0x43
-#define LOG_SELECT 0x4c
-#define LOG_SENSE 0x4d
-#define MODE_SELECT_10 0x55
-#define RESERVE_10 0x56
-#define RELEASE_10 0x57
-#define MODE_SENSE_10 0x5a
-#define PERSISTENT_RESERVE_IN 0x5e
-#define PERSISTENT_RESERVE_OUT 0x5f
-#define MOVE_MEDIUM 0xa5
-#define READ_12 0xa8
-#define WRITE_12 0xaa
-#define WRITE_VERIFY_12 0xae
-#define SEARCH_HIGH_12 0xb0
-#define SEARCH_EQUAL_12 0xb1
-#define SEARCH_LOW_12 0xb2
-#define READ_ELEMENT_STATUS 0xb8
-#define SEND_VOLUME_TAG 0xb6
-#define WRITE_LONG_2 0xea
-#define GOOD 0x00
-#define CHECK_CONDITION 0x01
-#define CONDITION_GOOD 0x02
-#define BUSY 0x04
-#define INTERMEDIATE_GOOD 0x08
-#define INTERMEDIATE_C_GOOD 0x0a
-#define RESERVATION_CONFLICT 0x0c
-#define COMMAND_TERMINATED 0x11
-#define QUEUE_FULL 0x14
-#define STATUS_MASK 0x3e
-#define NO_SENSE 0x00
-#define RECOVERED_ERROR 0x01
-#define NOT_READY 0x02
-#define MEDIUM_ERROR 0x03
-#define HARDWARE_ERROR 0x04
-#define ILLEGAL_REQUEST 0x05
-#define UNIT_ATTENTION 0x06
-#define DATA_PROTECT 0x07
-#define BLANK_CHECK 0x08
-#define COPY_ABORTED 0x0a
-#define ABORTED_COMMAND 0x0b
-#define VOLUME_OVERFLOW 0x0d
-#define MISCOMPARE 0x0e
-#define TYPE_DISK 0x00
-#define TYPE_TAPE 0x01
-#define TYPE_PROCESSOR 0x03
-#define TYPE_WORM 0x04
-#define TYPE_ROM 0x05
-#define TYPE_SCANNER 0x06
-#define TYPE_MOD 0x07
-#define TYPE_MEDIUM_CHANGER 0x08
-#define TYPE_ENCLOSURE 0x0d
-#define TYPE_NO_LUN 0x7f
-#define COMMAND_COMPLETE 0x00
-#define EXTENDED_MESSAGE 0x01
-#define EXTENDED_MODIFY_DATA_POINTER 0x00
-#define EXTENDED_SDTR 0x01
-#define EXTENDED_EXTENDED_IDENTIFY 0x02
-#define EXTENDED_WDTR 0x03
-#define SAVE_POINTERS 0x02
-#define RESTORE_POINTERS 0x03
-#define DISCONNECT 0x04
-#define INITIATOR_ERROR 0x05
-#define ABORT 0x06
-#define MESSAGE_REJECT 0x07
-#define NOP 0x08
-#define MSG_PARITY_ERROR 0x09
-#define LINKED_CMD_COMPLETE 0x0a
-#define LINKED_FLG_CMD_COMPLETE 0x0b
-#define BUS_DEVICE_RESET 0x0c
-#define INITIATE_RECOVERY 0x0f
-#define RELEASE_RECOVERY 0x10
-#define SIMPLE_QUEUE_TAG 0x20
-#define HEAD_OF_QUEUE_TAG 0x21
-#define ORDERED_QUEUE_TAG 0x22
-#define SCSI_IOCTL_GET_IDLUN 0x5382
-#define SCSI_IOCTL_TAGGED_ENABLE 0x5383
-#define SCSI_IOCTL_TAGGED_DISABLE 0x5384
-#define SCSI_IOCTL_PROBE_HOST 0x5385
-#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386
-
-struct ccs_modesel_head {
-       unsigned char _r1;
-       unsigned char medium;
-       unsigned char _r2;
-       unsigned char block_desc_length;
-       unsigned char density;
-       unsigned char number_blocks_hi;
-       unsigned char number_blocks_med;
-       unsigned char number_blocks_lo;
-       unsigned char _r3;
-       unsigned char block_length_hi;
-       unsigned char block_length_med;
-       unsigned char block_length_lo;
-};
-
-#endif
diff --git a/include/api/scsi/scsi.h b/include/api/scsi/scsi.h
new file mode 120000
index 00000000..7a937030
--- /dev/null
+++ b/include/api/scsi/scsi.h
@@ -0,0 +1 @@
+../../../musl/include/scsi/scsi.h
\ No newline at end of file
diff --git a/include/api/scsi/sg.h b/include/api/scsi/sg.h
deleted file mode 100644
index 5f8f2867..00000000
--- a/include/api/scsi/sg.h
+++ /dev/null
@@ -1,129 +0,0 @@
-#ifndef _SCSI_SG_H
-#define _SCSI_SG_H
-
-#define SG_DXFER_NONE -1
-#define SG_DXFER_TO_DEV -2
-#define SG_DXFER_FROM_DEV -3
-#define SG_DXFER_TO_FROM_DEV -4
-#define SG_FLAG_DIRECT_IO 1
-#define SG_FLAG_LUN_INHIBIT 2
-#define SG_FLAG_NO_DXFER 0x10000
-#define SG_INFO_OK_MASK 0x1
-#define SG_INFO_OK 0x0
-#define SG_INFO_CHECK 0x1
-#define SG_INFO_DIRECT_IO_MASK 0x6
-#define SG_INFO_INDIRECT_IO 0x0
-#define SG_INFO_DIRECT_IO 0x2
-#define SG_INFO_MIXED_IO 0x4
-#define SG_EMULATED_HOST 0x2203
-#define SG_SET_TRANSFORM 0x2204
-#define SG_GET_TRANSFORM 0x2205
-#define SG_SET_RESERVED_SIZE 0x2275
-#define SG_GET_RESERVED_SIZE 0x2272
-#define SG_GET_SCSI_ID 0x2276
-#define SG_SET_FORCE_LOW_DMA 0x2279
-#define SG_GET_LOW_DMA 0x227a
-#define SG_SET_FORCE_PACK_ID 0x227b
-#define SG_GET_PACK_ID 0x227c
-#define SG_GET_NUM_WAITING 0x227d
-#define SG_GET_SG_TABLESIZE 0x227F
-#define SG_GET_VERSION_NUM 0x2282
-#define SG_SCSI_RESET 0x2284
-#define SG_SCSI_RESET_NOTHING 0
-#define SG_SCSI_RESET_DEVICE 1
-#define SG_SCSI_RESET_BUS 2
-#define SG_SCSI_RESET_HOST 3
-#define SG_IO 0x2285
-#define SG_GET_REQUEST_TABLE 0x2286
-#define SG_SET_KEEP_ORPHAN 0x2287
-#define SG_GET_KEEP_ORPHAN 0x2288
-#define SG_SCATTER_SZ (8 * 4096)
-#define SG_DEFAULT_RETRIES 1
-#define SG_DEF_FORCE_LOW_DMA 0
-#define SG_DEF_FORCE_PACK_ID 0
-#define SG_DEF_KEEP_ORPHAN 0
-#define SG_DEF_RESERVED_SIZE SG_SCATTER_SZ
-#define SG_MAX_QUEUE 16
-#define SG_BIG_BUFF SG_DEF_RESERVED_SIZE
-#define SG_MAX_SENSE 16
-#define SG_SET_TIMEOUT 0x2201
-#define SG_GET_TIMEOUT 0x2202
-#define SG_GET_COMMAND_Q 0x2270
-#define SG_SET_COMMAND_Q 0x2271
-#define SG_SET_DEBUG 0x227e
-#define SG_NEXT_CMD_LEN 0x2283
-#define SG_DEFAULT_TIMEOUT (60*100) /* 60*HZ */
-#define SG_DEF_COMMAND_Q 0
-#define SG_DEF_UNDERRUN_FLAG 0
-
-typedef struct sg_iovec {
-       void *iov_base;
-       unsigned long iov_len;
-} sg_iovec_t;
-
-typedef struct sg_io_hdr {
-       int interface_id;
-       int dxfer_direction;
-       unsigned char cmd_len;
-       unsigned char mx_sb_len;
-       unsigned short iovec_count;
-       unsigned dxfer_len;
-       void *dxferp;
-       unsigned char *cmdp;
-       unsigned char *sbp;
-       unsigned timeout;
-       unsigned flags;
-       int pack_id;
-       void *usr_ptr;
-       unsigned char status;
-       unsigned char masked_status;
-       unsigned char msg_status;
-       unsigned char sb_len_wr;
-       unsigned short host_status;
-       unsigned short driver_status;
-       int resid;
-       unsigned int duration;
-       unsigned int info;
-} sg_io_hdr_t;
-
-struct sg_scsi_id {
-       int host_no;
-       int channel;
-       int scsi_id;
-       int lun;
-       int scsi_type;
-       short h_cmd_per_lun;
-       short d_queue_depth;
-       int unused[2];
-};
-
-typedef struct sg_req_info {
-       char req_state;
-       char orphan;
-       char sg_io_owned;
-       char problem;
-       int pack_id;
-       void *usr_ptr;
-       unsigned duration;
-       int unused;
-} sg_req_info_t;
-
-typedef struct sg_io_hdr Sg_io_hdr;
-typedef struct sg_io_vec Sg_io_vec;
-typedef struct sg_scsi_id Sg_scsi_id;
-typedef struct sg_req_info Sg_req_info;
-
-struct sg_header {
-       int pack_len;
-       int reply_len;
-       int pack_id;
-       int result;
-       unsigned twelve_byte:1;
-       unsigned target_status:5;
-       unsigned host_status:8;
-       unsigned driver_status:8;
-       unsigned other_flags:10;
-       unsigned char sense_buffer[SG_MAX_SENSE];
-};
-
-#endif
diff --git a/include/api/scsi/sg.h b/include/api/scsi/sg.h
new file mode 120000
index 00000000..21779afa
--- /dev/null
+++ b/include/api/scsi/sg.h
@@ -0,0 +1 @@
+../../../musl/include/scsi/sg.h
\ No newline at end of file
diff --git a/include/api/sys/cachectl.h b/include/api/sys/cachectl.h
deleted file mode 100644
index f675dbe5..00000000
--- a/include/api/sys/cachectl.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _SYS_CACHECTL_H
-#define _SYS_CACHECTL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define ICACHE (1<<0)
-#define DCACHE (1<<1)
-#define BCACHE (ICACHE|DCACHE)
-#define CACHEABLE 0
-#define UNCACHEABLE 1
-
-int cachectl(void *, int, int);
-int cacheflush(void *, int, int);
-int _flush_cache(void *, int, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/sys/cachectl.h b/include/api/sys/cachectl.h
new file mode 120000
index 00000000..a6158d4d
--- /dev/null
+++ b/include/api/sys/cachectl.h
@@ -0,0 +1 @@
+../../../musl/include/sys/cachectl.h
\ No newline at end of file
diff --git a/include/api/sys/times.h b/include/api/sys/times.h
deleted file mode 100644
index 98d23246..00000000
--- a/include/api/sys/times.h
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef        _SYS_TIMES_H
-#define        _SYS_TIMES_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define __NEED_clock_t
-#include <bits/alltypes.h>
-
-struct tms
-{
-       clock_t tms_utime;
-       clock_t tms_stime;
-       clock_t tms_cutime;
-       clock_t tms_cstime;
-};
-
-clock_t times (struct tms *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/sys/times.h b/include/api/sys/times.h
new file mode 120000
index 00000000..92b669e9
--- /dev/null
+++ b/include/api/sys/times.h
@@ -0,0 +1 @@
+../../../musl/include/sys/times.h
\ No newline at end of file
diff --git a/include/api/x64/bits/endian.h b/include/api/x64/bits/endian.h
deleted file mode 100644
index 172c338f..00000000
--- a/include/api/x64/bits/endian.h
+++ /dev/null
@@ -1 +0,0 @@
-#define __BYTE_ORDER __LITTLE_ENDIAN
diff --git a/include/api/x64/bits/endian.h b/include/api/x64/bits/endian.h
new file mode 120000
index 00000000..392e7215
--- /dev/null
+++ b/include/api/x64/bits/endian.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/endian.h
\ No newline at end of file
diff --git a/include/api/x64/bits/errno.h b/include/api/x64/bits/errno.h
deleted file mode 100644
index d2e1eeee..00000000
--- a/include/api/x64/bits/errno.h
+++ /dev/null
@@ -1,134 +0,0 @@
-#define EPERM            1
-#define ENOENT           2
-#define ESRCH            3
-#define EINTR            4
-#define EIO              5
-#define ENXIO            6
-#define E2BIG            7
-#define ENOEXEC          8
-#define EBADF            9
-#define ECHILD          10
-#define EAGAIN          11
-#define ENOMEM          12
-#define EACCES          13
-#define EFAULT          14
-#define ENOTBLK         15
-#define EBUSY           16
-#define EEXIST          17
-#define EXDEV           18
-#define ENODEV          19
-#define ENOTDIR         20
-#define EISDIR          21
-#define EINVAL          22
-#define ENFILE          23
-#define EMFILE          24
-#define ENOTTY          25
-#define ETXTBSY         26
-#define EFBIG           27
-#define ENOSPC          28
-#define ESPIPE          29
-#define EROFS           30
-#define EMLINK          31
-#define EPIPE           32
-#define EDOM            33
-#define ERANGE          34
-#define EDEADLK         35
-#define ENAMETOOLONG    36
-#define ENOLCK          37
-#define ENOSYS          38
-#define ENOTEMPTY       39
-#define ELOOP           40
-#define EWOULDBLOCK     EAGAIN
-#define ENOMSG          42
-#define EIDRM           43
-#define ECHRNG          44
-#define EL2NSYNC        45
-#define EL3HLT          46
-#define EL3RST          47
-#define ELNRNG          48
-#define EUNATCH         49
-#define ENOCSI          50
-#define EL2HLT          51
-#define EBADE           52
-#define EBADR           53
-#define EXFULL          54
-#define ENOANO          55
-#define EBADRQC         56
-#define EBADSLT         57
-#define EDEADLOCK       EDEADLK
-#define EBFONT          59
-#define ENOSTR          60
-#define ENODATA         61
-#define ETIME           62
-#define ENOSR           63
-#define ENONET          64
-#define ENOPKG          65
-#define EREMOTE         66
-#define ENOLINK         67
-#define EADV            68
-#define ESRMNT          69
-#define ECOMM           70
-#define EPROTO          71
-#define EMULTIHOP       72
-#define EDOTDOT         73
-#define EBADMSG         74
-#define EOVERFLOW       75
-#define ENOTUNIQ        76
-#define EBADFD          77
-#define EREMCHG         78
-#define ELIBACC         79
-#define ELIBBAD         80
-#define ELIBSCN         81
-#define ELIBMAX         82
-#define ELIBEXEC        83
-#define EILSEQ          84
-#define ERESTART        85
-#define ESTRPIPE        86
-#define EUSERS          87
-#define ENOTSOCK        88
-#define EDESTADDRREQ    89
-#define EMSGSIZE        90
-#define EPROTOTYPE      91
-#define ENOPROTOOPT     92
-#define EPROTONOSUPPORT 93
-#define ESOCKTNOSUPPORT 94
-#define EOPNOTSUPP      95
-#define ENOTSUP         EOPNOTSUPP
-#define EPFNOSUPPORT    96
-#define EAFNOSUPPORT    97
-#define EADDRINUSE      98
-#define EADDRNOTAVAIL   99
-#define ENETDOWN        100
-#define ENETUNREACH     101
-#define ENETRESET       102
-#define ECONNABORTED    103
-#define ECONNRESET      104
-#define ENOBUFS         105
-#define EISCONN         106
-#define ENOTCONN        107
-#define ESHUTDOWN       108
-#define ETOOMANYREFS    109
-#define ETIMEDOUT       110
-#define ECONNREFUSED    111
-#define EHOSTDOWN       112
-#define EHOSTUNREACH    113
-#define EALREADY        114
-#define EINPROGRESS     115
-#define ESTALE          116
-#define EUCLEAN         117
-#define ENOTNAM         118
-#define ENAVAIL         119
-#define EISNAM          120
-#define EREMOTEIO       121
-#define EDQUOT          122
-#define ENOMEDIUM       123
-#define EMEDIUMTYPE     124
-#define ECANCELED       125
-#define ENOKEY          126
-#define EKEYEXPIRED     127
-#define EKEYREVOKED     128
-#define EKEYREJECTED    129
-#define EOWNERDEAD      130
-#define ENOTRECOVERABLE 131
-#define ERFKILL         132
-#define EHWPOISON       133
diff --git a/include/api/x64/bits/errno.h b/include/api/x64/bits/errno.h
new file mode 120000
index 00000000..babb760a
--- /dev/null
+++ b/include/api/x64/bits/errno.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/errno.h
\ No newline at end of file
diff --git a/include/api/x64/bits/fcntl.h b/include/api/x64/bits/fcntl.h
deleted file mode 100644
index 0949f31d..00000000
--- a/include/api/x64/bits/fcntl.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#define O_CREAT        0100
-#define O_EXCL         0200
-#define O_NOCTTY       0400
-#define O_TRUNC       01000
-#define O_APPEND      02000
-#define O_NONBLOCK    04000
-#define O_DSYNC      010000
-#define O_SYNC     04010000
-#define O_RSYNC    04010000
-#define O_DIRECTORY 0200000
-#define O_NOFOLLOW  0400000
-#define O_CLOEXEC  02000000
-
-#define O_ASYNC      020000
-#define O_DIRECT     040000
-#define O_LARGEFILE       0
-#define O_NOATIME  01000000
-#define O_NDELAY O_NONBLOCK
-
-#define F_DUPFD  0
-#define F_GETFD  1
-#define F_SETFD  2
-#define F_GETFL  3
-#define F_SETFL  4
-
-#define F_SETOWN 8
-#define F_GETOWN 9
-#define F_SETSIG 10
-#define F_GETSIG 11
-
-#define F_GETLK 5
-#define F_SETLK 6
-#define F_SETLKW 7
-
-#define F_SETOWN_EX 15
-#define F_GETOWN_EX 16
-
-#define F_GETOWNER_UIDS 17
diff --git a/include/api/x64/bits/fcntl.h b/include/api/x64/bits/fcntl.h
new file mode 120000
index 00000000..b0e76dcc
--- /dev/null
+++ b/include/api/x64/bits/fcntl.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/fcntl.h
\ No newline at end of file
diff --git a/include/api/x64/bits/io.h b/include/api/x64/bits/io.h
deleted file mode 100644
index dd5bddc9..00000000
--- a/include/api/x64/bits/io.h
+++ /dev/null
@@ -1,77 +0,0 @@
-static __inline void outb(unsigned char __val, unsigned short __port)
-{
-       __asm__ volatile ("outb %0,%1" : : "a" (__val), "dN" (__port));
-}
-
-static __inline void outw(unsigned short __val, unsigned short __port)
-{
-       __asm__ volatile ("outw %0,%1" : : "a" (__val), "dN" (__port));
-}
-
-static __inline void outl(unsigned int __val, unsigned short __port)
-{
-       __asm__ volatile ("outl %0,%1" : : "a" (__val), "dN" (__port));
-}
-
-static __inline unsigned char inb(unsigned short __port)
-{
-       unsigned char __val;
-       __asm__ volatile ("inb %1,%0" : "=a" (__val) : "dN" (__port));
-       return __val;
-}
-
-static __inline unsigned short inw(unsigned short __port)
-{
-       unsigned short __val;
-       __asm__ volatile ("inw %1,%0" : "=a" (__val) : "dN" (__port));
-       return __val;
-}
-
-static __inline unsigned int inl(unsigned short __port)
-{
-       unsigned int __val;
-       __asm__ volatile ("inl %1,%0" : "=a" (__val) : "dN" (__port));
-       return __val;
-}
-
-static __inline void outsb(unsigned short __port, const void *__buf, unsigned 
long __n)
-{
-       __asm__ volatile ("cld; rep; outsb"
-                     : "+S" (__buf), "+c" (__n)
-                     : "d" (__port));
-}
-
-static __inline void outsw(unsigned short __port, const void *__buf, unsigned 
long __n)
-{
-       __asm__ volatile ("cld; rep; outsw"
-                     : "+S" (__buf), "+c" (__n)
-                     : "d" (__port));
-}
-
-static __inline void outsl(unsigned short __port, const void *__buf, unsigned 
long __n)
-{
-       __asm__ volatile ("cld; rep; outsl"
-                     : "+S" (__buf), "+c"(__n)
-                     : "d" (__port));
-}
-
-static __inline void insb(unsigned short __port, void *__buf, unsigned long 
__n)
-{
-       __asm__ volatile ("cld; rep; insb"
-                     : "+D" (__buf), "+c" (__n)
-                     : "d" (__port));
-}
-
-static __inline void insw(unsigned short __port, void *__buf, unsigned long 
__n)
-{
-       __asm__ volatile ("cld; rep; insw"
-                     : "+D" (__buf), "+c" (__n)
-                     : "d" (__port));
-}
-
-static __inline void insl(unsigned short __port, void *__buf, unsigned long 
__n)
-{
-       __asm__ volatile ("cld; rep; insl"
-                     : "+D" (__buf), "+c" (__n)
-                     : "d" (__port));
-}
diff --git a/include/api/x64/bits/io.h b/include/api/x64/bits/io.h
new file mode 120000
index 00000000..c282bc3d
--- /dev/null
+++ b/include/api/x64/bits/io.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/io.h
\ No newline at end of file
diff --git a/include/api/x64/bits/ipc.h b/include/api/x64/bits/ipc.h
deleted file mode 100644
index ac5d0979..00000000
--- a/include/api/x64/bits/ipc.h
+++ /dev/null
@@ -1,14 +0,0 @@
-struct ipc_perm
-{
-       key_t __ipc_perm_key;
-       uid_t uid;
-       gid_t gid;
-       uid_t cuid;
-       gid_t cgid;
-       mode_t mode;
-       int __ipc_perm_seq;
-       long __pad1;
-       long __pad2;
-};
-
-#define IPC_64 0
diff --git a/include/api/x64/bits/ipc.h b/include/api/x64/bits/ipc.h
new file mode 120000
index 00000000..4d58823e
--- /dev/null
+++ b/include/api/x64/bits/ipc.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/ipc.h
\ No newline at end of file
diff --git a/include/api/x64/bits/posix.h b/include/api/x64/bits/posix.h
deleted file mode 100644
index c37b94c1..00000000
--- a/include/api/x64/bits/posix.h
+++ /dev/null
@@ -1,2 +0,0 @@
-#define _POSIX_V6_LP64_OFF64  1
-#define _POSIX_V7_LP64_OFF64  1
diff --git a/include/api/x64/bits/posix.h b/include/api/x64/bits/posix.h
new file mode 120000
index 00000000..59f398e6
--- /dev/null
+++ b/include/api/x64/bits/posix.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/posix.h
\ No newline at end of file
diff --git a/include/api/x64/bits/reg.h b/include/api/x64/bits/reg.h
deleted file mode 100644
index a4df04ce..00000000
--- a/include/api/x64/bits/reg.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#undef __WORDSIZE
-#define __WORDSIZE 64
-#define R15    0
-#define R14    1
-#define R13    2
-#define R12    3
-#define RBP    4
-#define RBX    5
-#define R11    6
-#define R10    7
-#define R9     8
-#define R8     9
-#define RAX    10
-#define RCX    11
-#define RDX    12
-#define RSI    13
-#define RDI    14
-#define ORIG_RAX 15
-#define RIP    16
-#define CS     17
-#define EFLAGS 18
-#define RSP    19
-#define SS     20
-#define FS_BASE 21
-#define GS_BASE 22
-#define DS     23
-#define ES     24
-#define FS     25
-#define GS     26
diff --git a/include/api/x64/bits/reg.h b/include/api/x64/bits/reg.h
new file mode 120000
index 00000000..ddf303b0
--- /dev/null
+++ b/include/api/x64/bits/reg.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/reg.h
\ No newline at end of file
diff --git a/include/api/x64/bits/setjmp.h b/include/api/x64/bits/setjmp.h
deleted file mode 100644
index 63973a80..00000000
--- a/include/api/x64/bits/setjmp.h
+++ /dev/null
@@ -1 +0,0 @@
-typedef unsigned long __jmp_buf[8];
diff --git a/include/api/x64/bits/setjmp.h b/include/api/x64/bits/setjmp.h
new file mode 120000
index 00000000..aa168e6a
--- /dev/null
+++ b/include/api/x64/bits/setjmp.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/setjmp.h
\ No newline at end of file
diff --git a/include/api/x64/bits/shm.h b/include/api/x64/bits/shm.h
deleted file mode 100644
index abf1d506..00000000
--- a/include/api/x64/bits/shm.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#define SHMLBA 4096
-
-struct shmid_ds
-{
-       struct ipc_perm shm_perm;
-       size_t shm_segsz;
-       time_t shm_atime;
-       time_t shm_dtime;
-       time_t shm_ctime;
-       pid_t shm_cpid;
-       pid_t shm_lpid;
-       unsigned long shm_nattch;
-       unsigned long __pad1;
-       unsigned long __pad2;
-};
diff --git a/include/api/x64/bits/shm.h b/include/api/x64/bits/shm.h
new file mode 120000
index 00000000..877cd1b9
--- /dev/null
+++ b/include/api/x64/bits/shm.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/shm.h
\ No newline at end of file
diff --git a/include/api/x64/bits/signal.h b/include/api/x64/bits/signal.h
deleted file mode 100644
index cb30cadc..00000000
--- a/include/api/x64/bits/signal.h
+++ /dev/null
@@ -1,118 +0,0 @@
-#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
- || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-
-#ifdef _GNU_SOURCE
-#define REG_R8          0
-#define REG_R9          1
-#define REG_R10         2
-#define REG_R11         3
-#define REG_R12         4
-#define REG_R13         5
-#define REG_R14         6
-#define REG_R15         7
-#define REG_RDI         8
-#define REG_RSI         9
-#define REG_RBP         10
-#define REG_RBX         11
-#define REG_RDX         12
-#define REG_RAX         13
-#define REG_RCX         14
-#define REG_RSP         15
-#define REG_RIP         16
-#define REG_EFL         17
-#define REG_CSGSFS      18
-#define REG_ERR         19
-#define REG_TRAPNO      20
-#define REG_OLDMASK     21
-#define REG_CR2         22
-#endif
-
-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
-typedef long long greg_t, gregset_t[23];
-typedef struct _fpstate {
-       unsigned short cwd, swd, ftw, fop;
-       unsigned long long rip, rdp;
-       unsigned mxcsr, mxcr_mask;
-       struct {
-               unsigned short significand[4], exponent, padding[3];
-       } _st[8];
-       struct {
-               unsigned element[4];
-       } _xmm[16];
-       unsigned padding[24];
-} *fpregset_t;
-struct sigcontext {
-       unsigned long r8, r9, r10, r11, r12, r13, r14, r15;
-       unsigned long rdi, rsi, rbp, rbx, rdx, rax, rcx, rsp, rip, eflags;
-       unsigned short cs, gs, fs, __pad0;
-       unsigned long err, trapno, oldmask, cr2;
-       struct _fpstate *fpstate;
-       unsigned long __reserved1[8];
-};
-typedef struct {
-       gregset_t gregs;
-       fpregset_t fpregs;
-       unsigned long long __reserved1[8];
-} mcontext_t;
-#else
-typedef struct {
-       unsigned long __space[32];
-} mcontext_t;
-#endif
-
-typedef struct __ucontext {
-       unsigned long uc_flags;
-       struct __ucontext *uc_link;
-       stack_t uc_stack;
-       mcontext_t uc_mcontext;
-       sigset_t uc_sigmask;
-       unsigned long __fpregs_mem[64];
-} ucontext_t;
-
-#define SA_NOCLDSTOP  1
-#define SA_NOCLDWAIT  2
-#define SA_SIGINFO    4
-#define SA_ONSTACK    0x08000000
-#define SA_RESTART    0x10000000
-#define SA_NODEFER    0x40000000
-#define SA_RESETHAND  0x80000000
-#define SA_RESTORER   0x04000000
-
-#endif
-
-#define SIGHUP    1
-#define SIGINT    2
-#define SIGQUIT   3
-#define SIGILL    4
-#define SIGTRAP   5
-#define SIGABRT   6
-#define SIGIOT    SIGABRT
-#define SIGBUS    7
-#define SIGFPE    8
-#define SIGKILL   9
-#define SIGUSR1   10
-#define SIGSEGV   11
-#define SIGUSR2   12
-#define SIGPIPE   13
-#define SIGALRM   14
-#define SIGTERM   15
-#define SIGSTKFLT 16
-#define SIGCHLD   17
-#define SIGCONT   18
-#define SIGSTOP   19
-#define SIGTSTP   20
-#define SIGTTIN   21
-#define SIGTTOU   22
-#define SIGURG    23
-#define SIGXCPU   24
-#define SIGXFSZ   25
-#define SIGVTALRM 26
-#define SIGPROF   27
-#define SIGWINCH  28
-#define SIGIO     29
-#define SIGPOLL   29
-#define SIGPWR    30
-#define SIGSYS    31
-#define SIGUNUSED SIGSYS
-
-#define _NSIG 65
diff --git a/include/api/x64/bits/signal.h b/include/api/x64/bits/signal.h
new file mode 120000
index 00000000..ab142ab4
--- /dev/null
+++ b/include/api/x64/bits/signal.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/signal.h
\ No newline at end of file
diff --git a/include/api/x64/bits/statfs.h b/include/api/x64/bits/statfs.h
deleted file mode 100644
index f103f4e4..00000000
--- a/include/api/x64/bits/statfs.h
+++ /dev/null
@@ -1,7 +0,0 @@
-struct statfs {
-       unsigned long f_type, f_bsize;
-       fsblkcnt_t f_blocks, f_bfree, f_bavail;
-       fsfilcnt_t f_files, f_ffree;
-       fsid_t f_fsid;
-       unsigned long f_namelen, f_frsize, f_flags, f_spare[4];
-};
diff --git a/include/api/x64/bits/statfs.h b/include/api/x64/bits/statfs.h
new file mode 120000
index 00000000..d08749fc
--- /dev/null
+++ b/include/api/x64/bits/statfs.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/statfs.h
\ No newline at end of file
diff --git a/include/api/x64/bits/stdarg.h b/include/api/x64/bits/stdarg.h
deleted file mode 100644
index fde37814..00000000
--- a/include/api/x64/bits/stdarg.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#define va_start(v,l)   __builtin_va_start(v,l)
-#define va_end(v)       __builtin_va_end(v)
-#define va_arg(v,l)     __builtin_va_arg(v,l)
-#define va_copy(d,s)    __builtin_va_copy(d,s)
diff --git a/include/api/x64/bits/stdarg.h b/include/api/x64/bits/stdarg.h
new file mode 120000
index 00000000..133456b3
--- /dev/null
+++ b/include/api/x64/bits/stdarg.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/stdarg.h
\ No newline at end of file
diff --git a/include/api/x64/bits/termios.h b/include/api/x64/bits/termios.h
deleted file mode 100644
index 61c888f4..00000000
--- a/include/api/x64/bits/termios.h
+++ /dev/null
@@ -1,160 +0,0 @@
-struct termios
-{
-       tcflag_t c_iflag;
-       tcflag_t c_oflag;
-       tcflag_t c_cflag;
-       tcflag_t c_lflag;
-       cc_t c_line;
-       cc_t c_cc[NCCS];
-       speed_t __c_ispeed;
-       speed_t __c_ospeed;
-};
-
-#define VINTR     0
-#define VQUIT     1
-#define VERASE    2
-#define VKILL     3
-#define VEOF      4
-#define VTIME     5
-#define VMIN      6
-#define VSWTC     7
-#define VSTART    8
-#define VSTOP     9
-#define VSUSP    10
-#define VEOL     11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE  14
-#define VLNEXT   15
-#define VEOL2    16
-
-#define IGNBRK  0000001
-#define BRKINT  0000002
-#define IGNPAR  0000004
-#define PARMRK  0000010
-#define INPCK   0000020
-#define ISTRIP  0000040
-#define INLCR   0000100
-#define IGNCR   0000200
-#define ICRNL   0000400
-#define IUCLC   0001000
-#define IXON    0002000
-#define IXANY   0004000
-#define IXOFF   0010000
-#define IMAXBEL 0020000
-
-#define OPOST  0000001
-#define OLCUC  0000002
-#define ONLCR  0000004
-#define OCRNL  0000010
-#define ONOCR  0000020
-#define ONLRET 0000040
-#define OFILL  0000100
-#define OFDEL  0000200
-#define NLDLY  0000400
-#define NL0    0000000
-#define NL1    0000400
-#define CRDLY  0003000
-#define CR0    0000000
-#define CR1    0001000
-#define CR2    0002000
-#define CR3    0003000
-#define TABDLY 0014000
-#define TAB0   0000000
-#define TAB1   0004000
-#define TAB2   0010000
-#define TAB3   0014000
-#define BSDLY  0020000
-#define BS0    0000000
-#define BS1    0020000
-#define FFDLY  0100000
-#define FF0    0000000
-#define FF1    0100000
-
-#define VTDLY  0040000
-#define VT0    0000000
-#define VT1    0040000
-
-/* ?? */
-#define XTABS  0014000
-
-#define B0       0000000
-#define B50      0000001
-#define B75      0000002
-#define B110     0000003
-#define B134     0000004
-#define B150     0000005
-#define B200     0000006
-#define B300     0000007
-#define B600     0000010
-#define B1200    0000011
-#define B1800    0000012
-#define B2400    0000013
-#define B4800    0000014
-#define B9600    0000015
-#define B19200   0000016
-#define B38400   0000017
-
-#define B57600   0010001
-#define B115200  0010002
-#define B230400  0010003
-#define B460800  0010004
-#define B500000  0010005
-#define B576000  0010006
-#define B921600  0010007
-#define B1000000 0010010
-#define B1152000 0010011
-#define B1500000 0010012
-#define B2000000 0010013
-#define B2500000 0010014
-#define B3000000 0010015
-#define B3500000 0010016
-#define B4000000 0010017
-
-#define CBAUD    0010017
-
-#define CSIZE  0000060
-#define CS5    0000000
-#define CS6    0000020
-#define CS7    0000040
-#define CS8    0000060
-#define CSTOPB 0000100
-#define CREAD  0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL  0002000
-#define CLOCAL 0004000
-
-#define CRTSCTS  020000000000
-
-#define ISIG   0000001
-#define ICANON 0000002
-#define ECHO   0000010
-#define ECHOE  0000020
-#define ECHOK  0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#define IEXTEN 0100000
-
-/* Extensions? */
-#define CBAUDEX 0010000
-#define ECHOCTL 0001000
-#define ECHOPRT 0002000
-#define ECHOKE 0004000
-#define FLUSHO 0010000
-#define PENDIN 0040000
-#define EXTPROC 0200000
-
-#define TCOOFF 0
-#define TCOON  1
-#define TCIOFF 2
-#define TCION  3
-
-#define TCIFLUSH  0
-#define TCOFLUSH  1
-#define TCIOFLUSH 2
-
-#define TCSANOW   0
-#define TCSADRAIN 1
-#define TCSAFLUSH 2
diff --git a/include/api/x64/bits/termios.h b/include/api/x64/bits/termios.h
new file mode 120000
index 00000000..639f866f
--- /dev/null
+++ b/include/api/x64/bits/termios.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/termios.h
\ No newline at end of file
diff --git a/include/api/x64/bits/user.h b/include/api/x64/bits/user.h
deleted file mode 100644
index 8b42632f..00000000
--- a/include/api/x64/bits/user.h
+++ /dev/null
@@ -1,44 +0,0 @@
-#undef __WORDSIZE
-#define __WORDSIZE 64
-
-typedef struct user_fpregs_struct
-{
-       uint16_t cwd, swd, ftw, fop;
-       uint64_t rip, rdp;
-       uint32_t mxcsr, mxcs_mask;
-       uint32_t st_space[32], xmm_space[64], padding[24];
-} elf_fpregset_t;
-
-struct user_regs_struct
-{
-       unsigned long r15, r14, r13, r12, rbp, rbx, r11, r10, r9, r8;
-       unsigned long rax, rcx, rdx, rsi, rdi, orig_rax, rip;
-       unsigned long cs, eflags, rsp, ss, fs_base, gs_base, ds, es, fs, gs;
-};
-#define ELF_NGREG 27
-typedef unsigned long long elf_greg_t, elf_gregset_t[ELF_NGREG];
-
-struct user
-{
-       struct user_regs_struct         regs;
-       int                             u_fpvalid;
-       struct user_fpregs_struct       i387;
-       unsigned long                   u_tsize;
-       unsigned long                   u_dsize;
-       unsigned long                   u_ssize;
-       unsigned long                   start_code;
-       unsigned long                   start_stack;
-       long                            signal;
-       int                             reserved;
-       struct user_regs_struct         *u_ar0;
-       struct user_fpregs_struct       *u_fpstate;
-       unsigned long                   magic;
-       char                            u_comm[32];
-       unsigned long                   u_debugreg[8];
-};
-
-#define PAGE_MASK              (~(PAGE_SIZE-1))
-#define NBPG                   PAGE_SIZE
-#define UPAGES                 1
-#define HOST_TEXT_START_ADDR   (u.start_code)
-#define HOST_STACK_END_ADDR    (u.start_stack + u.u_ssize * NBPG)
diff --git a/include/api/x64/bits/user.h b/include/api/x64/bits/user.h
new file mode 120000
index 00000000..023557ef
--- /dev/null
+++ b/include/api/x64/bits/user.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/user.h
\ No newline at end of file
diff --git a/include/api/x64/pthread_arch.h b/include/api/x64/pthread_arch.h
deleted file mode 100644
index 77c8387c..00000000
--- a/include/api/x64/pthread_arch.h
+++ /dev/null
@@ -1,10 +0,0 @@
-static inline struct pthread *__pthread_self()
-{
-       struct pthread *self;
-       __asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) );
-       return self;
-}
-
-#define TP_ADJ(p) (p)
-
-#define CANCEL_REG_IP 16
diff --git a/include/api/x64/pthread_arch.h b/include/api/x64/pthread_arch.h
new file mode 120000
index 00000000..dd7e1ae9
--- /dev/null
+++ b/include/api/x64/pthread_arch.h
@@ -0,0 +1 @@
+../../../musl/arch/x86_64/pthread_arch.h
\ No newline at end of file
diff --git a/include/api/x64/syscall_arch.h b/include/api/x64/syscall_arch.h
deleted file mode 100644
index a85c440c..00000000
--- a/include/api/x64/syscall_arch.h
+++ /dev/null
@@ -1,62 +0,0 @@
-#define __SYSCALL_LL_E(x) (x)
-#define __SYSCALL_LL_O(x) (x)
-
-static __inline long __syscall0(long n)
-{
-       unsigned long ret;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n) : "rcx", "r11", 
"memory");
-       return ret;
-}
-
-static __inline long __syscall1(long n, long a1)
-{
-       unsigned long ret;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1) : "rcx", 
"r11", "memory");
-       return ret;
-}
-
-static __inline long __syscall2(long n, long a1, long a2)
-{
-       unsigned long ret;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2)
-                                                 : "rcx", "r11", "memory");
-       return ret;
-}
-
-static __inline long __syscall3(long n, long a1, long a2, long a3)
-{
-       unsigned long ret;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
-                                                 "d"(a3) : "rcx", "r11", 
"memory");
-       return ret;
-}
-
-static __inline long __syscall4(long n, long a1, long a2, long a3, long a4)
-{
-       unsigned long ret;
-       register long r10 __asm__("r10") = a4;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
-                                                 "d"(a3), "r"(r10): "rcx", 
"r11", "memory");
-       return ret;
-}
-
-static __inline long __syscall5(long n, long a1, long a2, long a3, long a4, 
long a5)
-{
-       unsigned long ret;
-       register long r10 __asm__("r10") = a4;
-       register long r8 __asm__("r8") = a5;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
-                                                 "d"(a3), "r"(r10), "r"(r8) : 
"rcx", "r11", "memory");
-       return ret;
-}
-
-static __inline long __syscall6(long n, long a1, long a2, long a3, long a4, 
long a5, long a6)
-{
-       unsigned long ret;
-       register long r10 __asm__("r10") = a4;
-       register long r8 __asm__("r8") = a5;
-       register long r9 __asm__("r9") = a6;
-       __asm__ __volatile__ ("syscall" : "=a"(ret) : "a"(n), "D"(a1), "S"(a2),
-                                                 "d"(a3), "r"(r10), "r"(r8), 
"r"(r9) : "rcx", "r11", "memory");
-       return ret;
-}
diff --git a/include/api/x64/syscall_arch.h b/include/api/x64/syscall_arch.h
new file mode 120000
index 00000000..f6fa60e4
--- /dev/null
+++ b/include/api/x64/syscall_arch.h
@@ -0,0 +1 @@
+../../../musl/arch/x86_64/syscall_arch.h
\ No newline at end of file
-- 
2.26.2

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/osv-dev/20200801043412.88883-1-jwkozaczuk%40gmail.com.

Reply via email to