All these files were copied from musl and then modified to
rename fields like __unused and __unused2 to ___unused and ___unused2
respectively to avoid conflicts with exactly same named macros
in BSD source tree headers.

Because previous patch renamed those BSD macros to
__bsd_unused and __bsd_unused2 we are reverting these files
to musl copies with symlinks.

Signed-off-by: Waldemar Kozaczuk <[email protected]>
---
 include/api/mqueue.h          |  37 +------
 include/api/netinet/ip_icmp.h | 193 +---------------------------------
 include/api/sys/sem.h         |  75 +------------
 include/api/sys/shm.h         |  60 +----------
 include/api/utmpx.h           |  58 +---------
 include/api/x64/bits/fenv.h   |  35 +-----
 include/api/x64/bits/msg.h    |  14 +--
 include/api/x64/bits/stat.h   |  23 +---
 8 files changed, 8 insertions(+), 487 deletions(-)
 mode change 100644 => 120000 include/api/mqueue.h
 mode change 100644 => 120000 include/api/netinet/ip_icmp.h
 mode change 100644 => 120000 include/api/sys/sem.h
 mode change 100644 => 120000 include/api/sys/shm.h
 mode change 100644 => 120000 include/api/utmpx.h
 mode change 100644 => 120000 include/api/x64/bits/fenv.h
 mode change 100644 => 120000 include/api/x64/bits/msg.h
 mode change 100644 => 120000 include/api/x64/bits/stat.h

diff --git a/include/api/mqueue.h b/include/api/mqueue.h
deleted file mode 100644
index 41f20149..00000000
--- a/include/api/mqueue.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef _MQUEUE_H
-#define _MQUEUE_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <features.h>
-
-#define __NEED_size_t
-#define __NEED_ssize_t
-#define __NEED_pthread_attr_t
-#define __NEED_time_t
-#define __NEED_struct_timespec
-#include <bits/alltypes.h>
-
-typedef int mqd_t;
-struct mq_attr {
-       long mq_flags, mq_maxmsg, mq_msgsize, mq_curmsgs, ___unused[4];
-};
-struct sigevent;
-
-int mq_close(mqd_t);
-int mq_getattr(mqd_t, struct mq_attr *);
-int mq_notify(mqd_t, const struct sigevent *);
-mqd_t mq_open(const char *, int, ...);
-ssize_t mq_receive(mqd_t, char *, size_t, unsigned *);
-int mq_send(mqd_t, const char *, size_t, unsigned);
-int mq_setattr(mqd_t, const struct mq_attr *__restrict, struct mq_attr 
*__restrict);
-ssize_t mq_timedreceive(mqd_t, char *__restrict, size_t, unsigned *__restrict, 
const struct timespec *__restrict);
-int mq_timedsend(mqd_t, const char *, size_t, unsigned, const struct timespec 
*);
-int mq_unlink(const char *);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/api/mqueue.h b/include/api/mqueue.h
new file mode 120000
index 00000000..1a854280
--- /dev/null
+++ b/include/api/mqueue.h
@@ -0,0 +1 @@
+../../musl/include/mqueue.h
\ No newline at end of file
diff --git a/include/api/netinet/ip_icmp.h b/include/api/netinet/ip_icmp.h
deleted file mode 100644
index 30118b0a..00000000
--- a/include/api/netinet/ip_icmp.h
+++ /dev/null
@@ -1,192 +0,0 @@
-#ifndef _NETINET_IP_ICMP_H
-#define _NETINET_IP_ICMP_H
-
-#include <stdint.h>
-#include <netinet/in.h>
-#include <netinet/ip.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-struct icmphdr {
-       uint8_t type;
-       uint8_t code;
-       uint16_t checksum;
-       union {
-               struct {
-                       uint16_t id;
-                       uint16_t sequence;
-               } echo;
-               uint32_t gateway;
-               struct {
-                       uint16_t ___unused;
-                       uint16_t mtu;
-               } frag;
-       } un;
-};
-
-#define ICMP_ECHOREPLY         0
-#define ICMP_DEST_UNREACH      3
-#define ICMP_SOURCE_QUENCH     4
-#define ICMP_REDIRECT          5
-#define ICMP_ECHO              8
-#define ICMP_TIME_EXCEEDED     11
-#define ICMP_PARAMETERPROB     12
-#define ICMP_TIMESTAMP         13
-#define ICMP_TIMESTAMPREPLY    14
-#define ICMP_INFO_REQUEST      15
-#define ICMP_INFO_REPLY                16
-#define ICMP_ADDRESS           17
-#define ICMP_ADDRESSREPLY      18
-#define NR_ICMP_TYPES          18
-
-
-#define ICMP_NET_UNREACH       0
-#define ICMP_HOST_UNREACH      1
-#define ICMP_PROT_UNREACH      2
-#define ICMP_PORT_UNREACH      3
-#define ICMP_FRAG_NEEDED       4
-#define ICMP_SR_FAILED         5
-#define ICMP_NET_UNKNOWN       6
-#define ICMP_HOST_UNKNOWN      7
-#define ICMP_HOST_ISOLATED     8
-#define ICMP_NET_ANO           9
-#define ICMP_HOST_ANO          10
-#define ICMP_NET_UNR_TOS       11
-#define ICMP_HOST_UNR_TOS      12
-#define ICMP_PKT_FILTERED      13
-#define ICMP_PREC_VIOLATION    14
-#define ICMP_PREC_CUTOFF       15
-#define NR_ICMP_UNREACH                15
-
-#define ICMP_REDIR_NET         0
-#define ICMP_REDIR_HOST                1
-#define ICMP_REDIR_NETTOS      2
-#define ICMP_REDIR_HOSTTOS     3
-
-#define ICMP_EXC_TTL           0
-#define ICMP_EXC_FRAGTIME      1
-
-
-struct icmp_ra_addr {
-       uint32_t ira_addr;
-       uint32_t ira_preference;
-};
-
-struct icmp {
-       uint8_t  icmp_type;
-       uint8_t  icmp_code;
-       uint16_t icmp_cksum;
-       union {
-               uint8_t ih_pptr;
-               struct in_addr ih_gwaddr;
-               struct ih_idseq {
-                       uint16_t icd_id;
-                       uint16_t icd_seq;
-               } ih_idseq;
-               uint32_t ih_void;
-
-               struct ih_pmtu {
-                       uint16_t ipm_void;
-                       uint16_t ipm_nextmtu;
-               } ih_pmtu;
-
-               struct ih_rtradv {
-                       uint8_t irt_num_addrs;
-                       uint8_t irt_wpa;
-                       uint16_t irt_lifetime;
-               } ih_rtradv;
-       } icmp_hun;
-       union {
-               struct {
-                       uint32_t its_otime;
-                       uint32_t its_rtime;
-                       uint32_t its_ttime;
-               } id_ts;
-               struct {
-                       struct ip idi_ip;
-               } id_ip;
-               struct icmp_ra_addr id_radv;
-               uint32_t   id_mask;
-               uint8_t    id_data[1];
-       } icmp_dun;
-};
-
-#define        icmp_pptr       icmp_hun.ih_pptr
-#define        icmp_gwaddr     icmp_hun.ih_gwaddr
-#define        icmp_id         icmp_hun.ih_idseq.icd_id
-#define        icmp_seq        icmp_hun.ih_idseq.icd_seq
-#define        icmp_void       icmp_hun.ih_void
-#define        icmp_pmvoid     icmp_hun.ih_pmtu.ipm_void
-#define        icmp_nextmtu    icmp_hun.ih_pmtu.ipm_nextmtu
-#define        icmp_num_addrs  icmp_hun.ih_rtradv.irt_num_addrs
-#define        icmp_wpa        icmp_hun.ih_rtradv.irt_wpa
-#define        icmp_lifetime   icmp_hun.ih_rtradv.irt_lifetime
-#define        icmp_otime      icmp_dun.id_ts.its_otime
-#define        icmp_rtime      icmp_dun.id_ts.its_rtime
-#define        icmp_ttime      icmp_dun.id_ts.its_ttime
-#define        icmp_ip         icmp_dun.id_ip.idi_ip
-#define        icmp_radv       icmp_dun.id_radv
-#define        icmp_mask       icmp_dun.id_mask
-#define        icmp_data       icmp_dun.id_data
-
-#define        ICMP_MINLEN     8
-#define        ICMP_TSLEN      (8 + 3 * sizeof (n_time))
-#define        ICMP_MASKLEN    12
-#define        ICMP_ADVLENMIN  (8 + sizeof (struct ip) + 8)
-#define        ICMP_ADVLEN(p)  (8 + ((p)->icmp_ip.ip_hl << 2) + 8)
-
-#define        ICMP_UNREACH            3
-#define        ICMP_SOURCEQUENCH       4
-#define        ICMP_ROUTERADVERT       9
-#define        ICMP_ROUTERSOLICIT      10
-#define        ICMP_TIMXCEED           11
-#define        ICMP_PARAMPROB          12
-#define        ICMP_TSTAMP             13
-#define        ICMP_TSTAMPREPLY        14
-#define        ICMP_IREQ               15
-#define        ICMP_IREQREPLY          16
-#define        ICMP_MASKREQ            17
-#define        ICMP_MASKREPLY          18
-#define        ICMP_MAXTYPE            18
-
-#define        ICMP_UNREACH_NET                0
-#define        ICMP_UNREACH_HOST               1
-#define        ICMP_UNREACH_PROTOCOL           2
-#define        ICMP_UNREACH_PORT               3
-#define        ICMP_UNREACH_NEEDFRAG           4
-#define        ICMP_UNREACH_SRCFAIL            5
-#define        ICMP_UNREACH_NET_UNKNOWN        6
-#define        ICMP_UNREACH_HOST_UNKNOWN       7
-#define        ICMP_UNREACH_ISOLATED           8
-#define        ICMP_UNREACH_NET_PROHIB         9
-#define        ICMP_UNREACH_HOST_PROHIB        10
-#define        ICMP_UNREACH_TOSNET             11
-#define        ICMP_UNREACH_TOSHOST            12
-#define        ICMP_UNREACH_FILTER_PROHIB      13
-#define        ICMP_UNREACH_HOST_PRECEDENCE    14
-#define        ICMP_UNREACH_PRECEDENCE_CUTOFF  15
-
-#define        ICMP_REDIRECT_NET       0
-#define        ICMP_REDIRECT_HOST      1
-#define        ICMP_REDIRECT_TOSNET    2
-#define        ICMP_REDIRECT_TOSHOST   3
-
-#define        ICMP_TIMXCEED_INTRANS   0
-#define        ICMP_TIMXCEED_REASS     1
-
-#define        ICMP_PARAMPROB_OPTABSENT 1
-
-#define        ICMP_INFOTYPE(type) \
-       ((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || \
-       (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || \
-       (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || \
-       (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || \
-       (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/netinet/ip_icmp.h b/include/api/netinet/ip_icmp.h
new file mode 120000
index 00000000..cf14b3c7
--- /dev/null
+++ b/include/api/netinet/ip_icmp.h
@@ -0,0 +1 @@
+../../../musl/include/netinet/ip_icmp.h
\ No newline at end of file
diff --git a/include/api/sys/sem.h b/include/api/sys/sem.h
deleted file mode 100644
index b7265eed..00000000
--- a/include/api/sys/sem.h
+++ /dev/null
@@ -1,74 +0,0 @@
-#ifndef _SYS_SEM_H
-#define _SYS_SEM_H
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <features.h>
-
-#define __NEED_size_t
-#define __NEED_pid_t
-#define __NEED_time_t
-#ifdef _GNU_SOURCE
-#define __NEED_struct_timespec
-#endif
-#include <bits/alltypes.h>
-
-#include <sys/ipc.h>
-
-#define SEM_UNDO       0x1000
-#define GETPID         11
-#define GETVAL         12
-#define GETALL         13
-#define GETNCNT                14
-#define GETZCNT                15
-#define SETVAL         16
-#define SETALL         17
-
-struct semid_ds {
-       struct ipc_perm sem_perm;
-       long sem_otime;
-       unsigned long ___unused1;
-       long sem_ctime;
-       unsigned long ___unused2;
-       unsigned long sem_nsems;
-       unsigned long ___unused3;
-       unsigned long ___unused4;
-};
-
-#define _SEM_SEMUN_UNDEFINED 1
-
-#define SEM_STAT 18
-#define SEM_INFO 19
-
-struct  seminfo {
-       int semmap;
-       int semmni;
-       int semmns;
-       int semmnu;
-       int semmsl;
-       int semopm;
-       int semume;
-       int semusz;
-       int semvmx;
-       int semaem;
-};
-
-struct sembuf {
-       unsigned short sem_num;
-       short sem_op;
-       short sem_flg;
-};
-
-int semctl(int, int, int, ...);
-int semget(key_t, int, int);
-int semop(int, struct sembuf *, size_t);
-
-#ifdef _GNU_SOURCE
-int semtimedop(int, struct sembuf *, size_t, const struct timespec *);
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/include/api/sys/sem.h b/include/api/sys/sem.h
new file mode 120000
index 00000000..18eaa8aa
--- /dev/null
+++ b/include/api/sys/sem.h
@@ -0,0 +1 @@
+../../../musl/include/sys/sem.h
\ No newline at end of file
diff --git a/include/api/sys/shm.h b/include/api/sys/shm.h
deleted file mode 100644
index c84d10c7..00000000
--- a/include/api/sys/shm.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef _SYS_SHM_H
-#define _SYS_SHM_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <features.h>
-
-#define __NEED_time_t
-#define __NEED_size_t
-#define __NEED_pid_t
-
-#include <bits/alltypes.h>
-
-#include <sys/ipc.h>
-#include <bits/shm.h>
-
-#define SHM_R 0400
-#define SHM_W 0200
-
-#define SHM_RDONLY 010000
-#define SHM_RND    020000
-#define SHM_REMAP  040000
-#define SHM_EXEC   0100000
-
-#define SHM_LOCK 11
-#define SHM_UNLOCK 12
-#define SHM_STAT 13
-#define SHM_INFO 14
-#define SHM_DEST 01000
-#define SHM_LOCKED 02000
-#define SHM_HUGETLB 04000
-#define SHM_NORESERVE 010000
-
-struct shminfo {
-       unsigned long shmmax, shmmin, shmmni, shmseg, shmall, ___unused[4];
-};
-
-struct shm_info {
-       int used_ids;
-       unsigned long shm_tot, shm_rss, shm_swp;
-#ifdef _GNU_SOURCE
-       unsigned long swap_attempts, swap_successes;
-#else
-       unsigned long __reserved[2];
-#endif
-};
-
-void *shmat(int, const void *, int);
-int shmctl(int, int, struct shmid_ds *);
-int shmdt(const void *);
-int shmget(key_t, size_t, int);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/sys/shm.h b/include/api/sys/shm.h
new file mode 120000
index 00000000..aa2bf39c
--- /dev/null
+++ b/include/api/sys/shm.h
@@ -0,0 +1 @@
+../../../musl/include/sys/shm.h
\ No newline at end of file
diff --git a/include/api/utmpx.h b/include/api/utmpx.h
deleted file mode 100644
index cb1ec80b..00000000
--- a/include/api/utmpx.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#ifndef _UTMPX_H
-#define _UTMPX_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define __NEED_pid_t
-#define __NEED_time_t
-#define __NEED_struct_timeval
-
-#include <bits/alltypes.h>
-
-#define UT_LINESIZE 32
-
-struct utmpx
-{
-       short ut_type;
-       pid_t ut_pid;
-       char ut_line[UT_LINESIZE];
-       char ut_id[4];
-       char ut_user[32];
-       char ut_host[256];
-       struct {
-               short e_termination;
-               short e_exit;
-       } ut_exit;
-       long ut_session;
-       struct timeval ut_tv;
-       unsigned ut_addr_v6[4];
-       char ___unused[20];
-};
-
-void          endutxent(void);
-struct utmpx *getutxent(void);
-struct utmpx *getutxid(const struct utmpx *);
-struct utmpx *getutxline(const struct utmpx *);
-struct utmpx *pututxline(const struct utmpx *);
-void          setutxent(void);
-
-void updwtmpx(const char *, const struct utmpx *);
-
-#define EMPTY           0
-#define RUN_LVL         1
-#define BOOT_TIME       2
-#define NEW_TIME        3
-#define OLD_TIME        4
-#define INIT_PROCESS    5
-#define LOGIN_PROCESS   6
-#define USER_PROCESS    7
-#define DEAD_PROCESS    8
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/api/utmpx.h b/include/api/utmpx.h
new file mode 120000
index 00000000..34af2ffa
--- /dev/null
+++ b/include/api/utmpx.h
@@ -0,0 +1 @@
+../../musl/include/utmpx.h
\ No newline at end of file
diff --git a/include/api/x64/bits/fenv.h b/include/api/x64/bits/fenv.h
deleted file mode 100644
index 60c6ef64..00000000
--- a/include/api/x64/bits/fenv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#define FE_INVALID    1
-#define __FE_DENORM   2
-#define FE_DIVBYZERO  4
-#define FE_OVERFLOW   8
-#define FE_UNDERFLOW  16
-#define FE_INEXACT    32
-
-#define FE_ALL_EXCEPT 63
-
-#define FE_TONEAREST  0
-#define FE_DOWNWARD   0x400
-#define FE_UPWARD     0x800
-#define FE_TOWARDZERO 0xc00
-
-typedef unsigned short fexcept_t;
-
-typedef struct {
-       unsigned short __control_word;
-       unsigned short ___unused1;
-       unsigned short __status_word;
-       unsigned short ___unused2;
-       unsigned short __tags;
-       unsigned short ___unused3;
-       unsigned int __eip;
-       unsigned short __cs_selector;
-       unsigned int __opcode:11;
-       unsigned int ___unused4:5;
-       unsigned int __data_offset;
-       unsigned short __data_selector;
-       unsigned short ___unused5;
-       unsigned int __mxcsr;
-} fenv_t;
-
-#define FE_DFL_ENV      ((const fenv_t *) -1)
diff --git a/include/api/x64/bits/fenv.h b/include/api/x64/bits/fenv.h
new file mode 120000
index 00000000..2555544f
--- /dev/null
+++ b/include/api/x64/bits/fenv.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/fenv.h
\ No newline at end of file
diff --git a/include/api/x64/bits/msg.h b/include/api/x64/bits/msg.h
deleted file mode 100644
index b5194687..00000000
--- a/include/api/x64/bits/msg.h
+++ /dev/null
@@ -1,13 +0,0 @@
-struct msqid_ds
-{
-       struct ipc_perm msg_perm;
-       time_t msg_stime;
-       time_t msg_rtime;
-       time_t msg_ctime;
-       unsigned long msg_cbytes;
-       msgqnum_t msg_qnum;
-       msglen_t msg_qbytes;
-       pid_t msg_lspid;
-       pid_t msg_lrpid;
-       unsigned long ___unused[2];
-};
diff --git a/include/api/x64/bits/msg.h b/include/api/x64/bits/msg.h
new file mode 120000
index 00000000..3d200408
--- /dev/null
+++ b/include/api/x64/bits/msg.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/msg.h
\ No newline at end of file
diff --git a/include/api/x64/bits/stat.h b/include/api/x64/bits/stat.h
deleted file mode 100644
index a30e47a9..00000000
--- a/include/api/x64/bits/stat.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* copied from kernel definition, but with padding replaced
- * by the corresponding correctly-sized userspace types. */
-
-struct stat {
-       unsigned long st_dev;
-       ino_t st_ino;
-       nlink_t st_nlink;
-
-       mode_t st_mode;
-       uid_t st_uid;
-       gid_t st_gid;
-       unsigned int    __pad0;
-       dev_t st_rdev;
-       off_t st_size;
-       blksize_t st_blksize;
-       blkcnt_t st_blocks;
-
-       struct timespec st_atim;
-       struct timespec st_mtim;
-       struct timespec st_ctim;
-       long ___unused[3];
-};
diff --git a/include/api/x64/bits/stat.h b/include/api/x64/bits/stat.h
new file mode 120000
index 00000000..ef28c1c9
--- /dev/null
+++ b/include/api/x64/bits/stat.h
@@ -0,0 +1 @@
+../../../../musl/arch/x86_64/bits/stat.h
\ No newline at end of file
-- 
2.25.1

-- 
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/20200827045723.29698-1-jwkozaczuk%40gmail.com.

Reply via email to