diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-02-14 09:01:41 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-02-14 09:01:41 +0200 |
commit | afefb2d592d3dc40ce683d4dd1b9dc09d8ac478d (patch) | |
tree | af69c88e532c9f4504b3e86c9bb8b12dd3bc2ee1 /main | |
parent | 8c2ef4a3ef2367031a88ce3f0c5af59b4e37ab23 (diff) | |
download | aports-afefb2d592d3dc40ce683d4dd1b9dc09d8ac478d.tar.bz2 aports-afefb2d592d3dc40ce683d4dd1b9dc09d8ac478d.tar.xz |
main/musl: upgrade to git snapshot 2014-02-13
Diffstat (limited to 'main')
6 files changed, 1882 insertions, 378 deletions
diff --git a/main/musl/0001-git-0.9.15-to-3e02ce1b411.patch b/main/musl/0001-git-0.9.15-to-3e02ce1b411.patch new file mode 100644 index 0000000000..07bd03f778 --- /dev/null +++ b/main/musl/0001-git-0.9.15-to-3e02ce1b411.patch @@ -0,0 +1,1877 @@ +diff --git a/arch/arm/bits/termios.h b/arch/arm/bits/termios.h +index 61c888f..f0d81b1 100644 +--- a/arch/arm/bits/termios.h ++++ b/arch/arm/bits/termios.h +@@ -42,6 +42,7 @@ struct termios + #define IXANY 0004000 + #define IXOFF 0010000 + #define IMAXBEL 0020000 ++#define IUTF8 0040000 + + #define OPOST 0000001 + #define OLCUC 0000002 +@@ -75,9 +76,6 @@ struct termios + #define VT0 0000000 + #define VT1 0040000 + +-/* ?? */ +-#define XTABS 0014000 +- + #define B0 0000000 + #define B50 0000001 + #define B75 0000002 +@@ -125,8 +123,6 @@ struct termios + #define HUPCL 0002000 + #define CLOCAL 0004000 + +-#define CRTSCTS 020000000000 +- + #define ISIG 0000001 + #define ICANON 0000002 + #define ECHO 0000010 +@@ -137,14 +133,11 @@ struct termios + #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 +@@ -158,3 +151,10 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0010000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0200000 ++#define XTABS 0014000 ++#endif +diff --git a/arch/i386/bits/termios.h b/arch/i386/bits/termios.h +index 61c888f..f0d81b1 100644 +--- a/arch/i386/bits/termios.h ++++ b/arch/i386/bits/termios.h +@@ -42,6 +42,7 @@ struct termios + #define IXANY 0004000 + #define IXOFF 0010000 + #define IMAXBEL 0020000 ++#define IUTF8 0040000 + + #define OPOST 0000001 + #define OLCUC 0000002 +@@ -75,9 +76,6 @@ struct termios + #define VT0 0000000 + #define VT1 0040000 + +-/* ?? */ +-#define XTABS 0014000 +- + #define B0 0000000 + #define B50 0000001 + #define B75 0000002 +@@ -125,8 +123,6 @@ struct termios + #define HUPCL 0002000 + #define CLOCAL 0004000 + +-#define CRTSCTS 020000000000 +- + #define ISIG 0000001 + #define ICANON 0000002 + #define ECHO 0000010 +@@ -137,14 +133,11 @@ struct termios + #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 +@@ -158,3 +151,10 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0010000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0200000 ++#define XTABS 0014000 ++#endif +diff --git a/arch/microblaze/bits/termios.h b/arch/microblaze/bits/termios.h +index 61c888f..f0d81b1 100644 +--- a/arch/microblaze/bits/termios.h ++++ b/arch/microblaze/bits/termios.h +@@ -42,6 +42,7 @@ struct termios + #define IXANY 0004000 + #define IXOFF 0010000 + #define IMAXBEL 0020000 ++#define IUTF8 0040000 + + #define OPOST 0000001 + #define OLCUC 0000002 +@@ -75,9 +76,6 @@ struct termios + #define VT0 0000000 + #define VT1 0040000 + +-/* ?? */ +-#define XTABS 0014000 +- + #define B0 0000000 + #define B50 0000001 + #define B75 0000002 +@@ -125,8 +123,6 @@ struct termios + #define HUPCL 0002000 + #define CLOCAL 0004000 + +-#define CRTSCTS 020000000000 +- + #define ISIG 0000001 + #define ICANON 0000002 + #define ECHO 0000010 +@@ -137,14 +133,11 @@ struct termios + #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 +@@ -158,3 +151,10 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0010000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0200000 ++#define XTABS 0014000 ++#endif +diff --git a/arch/mips/bits/termios.h b/arch/mips/bits/termios.h +index 179af8e..487c1d4 100644 +--- a/arch/mips/bits/termios.h ++++ b/arch/mips/bits/termios.h +@@ -77,9 +77,6 @@ struct termios + #define VT0 0000000 + #define VT1 0040000 + +-/* ?? */ +-#define XTABS 0014000 +- + #define B0 0000000 + #define B50 0000001 + #define B75 0000002 +@@ -129,12 +126,6 @@ struct termios + #define PARODD 0001000 + #define HUPCL 0002000 + #define CLOCAL 0004000 +-#define CBAUDEX 0010000 +- +-#define CIBAUD 002003600000 +-#define CMSPAR 010000000000 +-#define CRTSCTS 020000000000 +-#define IBSHIFT 16 + + #define ISIG 0000001 + #define ICANON 0000002 +@@ -152,9 +143,6 @@ struct termios + #define PENDIN 0040000 + #define TOSTOP 0100000 + #define ITOSTOP 0100000 +-#define EXTPROC 0200000 +- +-#define TIOCSER_TEMT 1 + + #define TCOOFF 0 + #define TCOON 1 +@@ -168,3 +156,14 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0010000 ++#define CIBAUD 002003600000 ++#define IBSHIFT 16 ++#define CMSPAR 010000000000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0200000 ++#define XTABS 0014000 ++#define TIOCSER_TEMT 1 ++#endif +diff --git a/arch/powerpc/bits/termios.h b/arch/powerpc/bits/termios.h +index 3022759..9f8016c 100644 +--- a/arch/powerpc/bits/termios.h ++++ b/arch/powerpc/bits/termios.h +@@ -66,7 +66,6 @@ struct termios + #define TAB1 00002000 + #define TAB2 00004000 + #define TAB3 00006000 +-#define XTABS 00006000 + #define CRDLY 00030000 + #define CR0 00000000 + #define CR1 00010000 +@@ -101,7 +100,6 @@ struct termios + #define B38400 0000017 + #define EXTA B19200 + #define EXTB B38400 +-#define CBAUDEX 0000000 + #define B57600 00020 + #define B115200 00021 + #define B230400 00022 +@@ -120,9 +118,6 @@ struct termios + #define B4000000 00036 + #define BOTHER 00037 + +-#define CIBAUD 077600000 +-#define IBSHIFT 16 +- + #define CSIZE 00001400 + #define CS5 00000000 + #define CS6 00000400 +@@ -136,8 +131,6 @@ struct termios + #define HUPCL 00040000 + + #define CLOCAL 00100000 +-#define CMSPAR 010000000000 +-#define CRTSCTS 020000000000 + + #define ISIG 0x00000080 + #define ICANON 0x00000100 +@@ -154,7 +147,6 @@ struct termios + #define FLUSHO 0x00800000 + #define PENDIN 0x20000000 + #define IEXTEN 0x00000400 +-#define EXTPROC 0x10000000 + + #define TCOOFF 0 + #define TCOON 1 +@@ -168,3 +160,13 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0000000 ++#define CIBAUD 077600000 ++#define IBSHIFT 16 ++#define CMSPAR 010000000000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0x10000000 ++#define XTABS 00006000 ++#endif +diff --git a/arch/x86_64/atomic.h b/arch/x86_64/atomic.h +index 0d3da6f..124b37a 100644 +--- a/arch/x86_64/atomic.h ++++ b/arch/x86_64/atomic.h +@@ -5,38 +5,36 @@ + + static inline int a_ctz_64(uint64_t x) + { +- long r; +- __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) ); +- return r; ++ __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) ); ++ return x; + } + + static inline int a_ctz_l(unsigned long x) + { +- long r; +- __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) ); +- return r; ++ __asm__( "bsf %1,%0" : "=r"(x) : "r"(x) ); ++ return x; + } + + static inline void a_and_64(volatile uint64_t *p, uint64_t v) + { +- __asm__( "lock ; andq %1, %0" +- : "=m"(*(long *)p) : "r"(v) : "memory" ); ++ __asm__( "lock ; and %1, %0" ++ : "=m"(*p) : "r"(v) : "memory" ); + } + + static inline void a_or_64(volatile uint64_t *p, uint64_t v) + { +- __asm__( "lock ; orq %1, %0" +- : "=m"(*(long *)p) : "r"(v) : "memory" ); ++ __asm__( "lock ; or %1, %0" ++ : "=m"(*p) : "r"(v) : "memory" ); + } + + static inline void a_store_l(volatile void *p, long x) + { +- __asm__( "movq %1, %0" : "=m"(*(long *)p) : "r"(x) : "memory" ); ++ __asm__( "mov %1, %0" : "=m"(*(long *)p) : "r"(x) : "memory" ); + } + + static inline void a_or_l(volatile void *p, long v) + { +- __asm__( "lock ; orq %1, %0" ++ __asm__( "lock ; or %1, %0" + : "=m"(*(long *)p) : "r"(v) : "memory" ); + } + +@@ -56,7 +54,7 @@ static inline long a_cas_l(volatile void *p, long t, long s) + + static inline int a_cas(volatile int *p, int t, int s) + { +- __asm__( "lock ; cmpxchgl %3, %1" ++ __asm__( "lock ; cmpxchg %3, %1" + : "=a"(t), "=m"(*p) : "a"(t), "r"(s) : "memory" ); + return t; + } +@@ -74,13 +72,13 @@ static inline long a_swap_l(volatile void *x, long v) + + static inline void a_or(volatile void *p, int v) + { +- __asm__( "lock ; orl %1, %0" ++ __asm__( "lock ; or %1, %0" + : "=m"(*(int *)p) : "r"(v) : "memory" ); + } + + static inline void a_and(volatile void *p, int v) + { +- __asm__( "lock ; andl %1, %0" ++ __asm__( "lock ; and %1, %0" + : "=m"(*(int *)p) : "r"(v) : "memory" ); + } + +@@ -110,7 +108,7 @@ static inline void a_dec(volatile int *x) + + static inline void a_store(volatile int *p, int x) + { +- __asm__( "movl %1, %0" : "=m"(*p) : "r"(x) : "memory" ); ++ __asm__( "mov %1, %0" : "=m"(*p) : "r"(x) : "memory" ); + } + + static inline void a_spin() +diff --git a/arch/x86_64/bits/stat.h b/arch/x86_64/bits/stat.h +index 2145796..081237c 100644 +--- a/arch/x86_64/bits/stat.h ++++ b/arch/x86_64/bits/stat.h +@@ -2,7 +2,7 @@ + * by the corresponding correctly-sized userspace types. */ + + struct stat { +- unsigned long st_dev; ++ dev_t st_dev; + ino_t st_ino; + nlink_t st_nlink; + +diff --git a/arch/x86_64/bits/termios.h b/arch/x86_64/bits/termios.h +index 61c888f..f0d81b1 100644 +--- a/arch/x86_64/bits/termios.h ++++ b/arch/x86_64/bits/termios.h +@@ -42,6 +42,7 @@ struct termios + #define IXANY 0004000 + #define IXOFF 0010000 + #define IMAXBEL 0020000 ++#define IUTF8 0040000 + + #define OPOST 0000001 + #define OLCUC 0000002 +@@ -75,9 +76,6 @@ struct termios + #define VT0 0000000 + #define VT1 0040000 + +-/* ?? */ +-#define XTABS 0014000 +- + #define B0 0000000 + #define B50 0000001 + #define B75 0000002 +@@ -125,8 +123,6 @@ struct termios + #define HUPCL 0002000 + #define CLOCAL 0004000 + +-#define CRTSCTS 020000000000 +- + #define ISIG 0000001 + #define ICANON 0000002 + #define ECHO 0000010 +@@ -137,14 +133,11 @@ struct termios + #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 +@@ -158,3 +151,10 @@ struct termios + #define TCSANOW 0 + #define TCSADRAIN 1 + #define TCSAFLUSH 2 ++ ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++#define CBAUDEX 0010000 ++#define CRTSCTS 020000000000 ++#define EXTPROC 0200000 ++#define XTABS 0014000 ++#endif +diff --git a/arch/x86_64/pthread_arch.h b/arch/x86_64/pthread_arch.h +index 77c8387..29e4590 100644 +--- a/arch/x86_64/pthread_arch.h ++++ b/arch/x86_64/pthread_arch.h +@@ -1,7 +1,7 @@ + static inline struct pthread *__pthread_self() + { + struct pthread *self; +- __asm__ __volatile__ ("movq %%fs:0,%0" : "=r" (self) ); ++ __asm__ __volatile__ ("mov %%fs:0,%0" : "=r" (self) ); + return self; + } + +diff --git a/include/arpa/inet.h b/include/arpa/inet.h +index 5dcadaa..37f8c11 100644 +--- a/include/arpa/inet.h ++++ b/include/arpa/inet.h +@@ -20,7 +20,7 @@ int inet_pton (int, const char *__restrict, void *__restrict); + const char *inet_ntop (int, const void *__restrict, char *__restrict, socklen_t); + + int inet_aton (const char *, struct in_addr *); +-struct in_addr inet_makeaddr(int, int); ++struct in_addr inet_makeaddr(in_addr_t, in_addr_t); + in_addr_t inet_lnaof(struct in_addr); + in_addr_t inet_netof(struct in_addr); + +diff --git a/include/dlfcn.h b/include/dlfcn.h +index db26194..78fb073 100644 +--- a/include/dlfcn.h ++++ b/include/dlfcn.h +@@ -31,7 +31,7 @@ typedef struct { + const char *dli_sname; + void *dli_saddr; + } Dl_info; +-int dladdr(void *, Dl_info *); ++int dladdr(const void *, Dl_info *); + int dlinfo(void *, int, void *); + #endif + +diff --git a/include/fcntl.h b/include/fcntl.h +index 55a89f9..e01a4d1 100644 +--- a/include/fcntl.h ++++ b/include/fcntl.h +@@ -148,6 +148,7 @@ struct f_owner_ex { + #define SPLICE_F_MORE 4 + #define SPLICE_F_GIFT 8 + int fallocate(int, int, off_t, off_t); ++#define fallocate64 fallocate + ssize_t readahead(int, off_t, size_t); + int sync_file_range(int, off_t, off_t, unsigned); + ssize_t vmsplice(int, const struct iovec *, size_t, unsigned); +diff --git a/include/netdb.h b/include/netdb.h +index 2dd799b..dfc70e2 100644 +--- a/include/netdb.h ++++ b/include/netdb.h +@@ -131,6 +131,7 @@ int *__h_errno_location(void); + #define TRY_AGAIN 2 + #define NO_RECOVERY 3 + #define NO_DATA 4 ++#define NO_ADDRESS NO_DATA + #endif + + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +diff --git a/include/netinet/in.h b/include/netinet/in.h +index db96144..2e25afe 100644 +--- a/include/netinet/in.h ++++ b/include/netinet/in.h +@@ -149,7 +149,7 @@ uint16_t ntohs(uint16_t); + (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0xe)) + + #define __ARE_4_EQUAL(a,b) \ +- (!( 0[a]-0[b] | 1[a]-1[b] | 2[a]-2[b] | 3[a]-3[b] )) ++ (!( (0[a]-0[b]) | (1[a]-1[b]) | (2[a]-2[b]) | (3[a]-3[b]) )) + #define IN6_ARE_ADDR_EQUAL(a,b) \ + __ARE_4_EQUAL((const uint32_t *)(a), (const uint32_t *)(b)) + +@@ -211,19 +211,6 @@ uint16_t ntohs(uint16_t); + #define IP_MULTICAST_ALL 49 + #define IP_UNICAST_IF 50 + +-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +-#define MCAST_JOIN_GROUP 42 +-#define MCAST_BLOCK_SOURCE 43 +-#define MCAST_UNBLOCK_SOURCE 44 +-#define MCAST_LEAVE_GROUP 45 +-#define MCAST_JOIN_SOURCE_GROUP 46 +-#define MCAST_LEAVE_SOURCE_GROUP 47 +-#define MCAST_MSFILTER 48 +- +-#define MCAST_EXCLUDE 0 +-#define MCAST_INCLUDE 1 +-#endif +- + #define IP_RECVRETOPTS IP_RETOPTS + + #define IP_PMTUDISC_DONT 0 +@@ -231,8 +218,6 @@ uint16_t ntohs(uint16_t); + #define IP_PMTUDISC_DO 2 + #define IP_PMTUDISC_PROBE 3 + +-#define SOL_IP 0 +- + #define IP_DEFAULT_MULTICAST_TTL 1 + #define IP_DEFAULT_MULTICAST_LOOP 1 + #define IP_MAX_MEMBERSHIPS 20 +@@ -243,6 +228,19 @@ struct ip_opts + char ip_opts[40]; + }; + ++#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) ++ ++#define MCAST_JOIN_GROUP 42 ++#define MCAST_BLOCK_SOURCE 43 ++#define MCAST_UNBLOCK_SOURCE 44 ++#define MCAST_LEAVE_GROUP 45 ++#define MCAST_JOIN_SOURCE_GROUP 46 ++#define MCAST_LEAVE_SOURCE_GROUP 47 ++#define MCAST_MSFILTER 48 ++ ++#define MCAST_EXCLUDE 0 ++#define MCAST_INCLUDE 1 ++ + struct ip_mreq + { + struct in_addr imr_multiaddr; +@@ -273,7 +271,6 @@ struct ip_msfilter { + (sizeof(struct ip_msfilter) - sizeof(struct in_addr) \ + + (numsrc) * sizeof(struct in_addr)) + +-#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) + struct group_req { + uint32_t gr_interface; + struct sockaddr_storage gr_group; +@@ -295,7 +292,6 @@ struct group_filter { + #define GROUP_FILTER_SIZE(numsrc) \ + (sizeof(struct group_filter) - sizeof(struct sockaddr_storage) \ + + (numsrc) * sizeof(struct sockaddr_storage)) +-#endif + + struct in_pktinfo + { +@@ -315,6 +311,7 @@ struct ip6_mtuinfo + struct sockaddr_in6 ip6m_addr; + uint32_t ip6m_mtu; + }; ++#endif + + #define IPV6_ADDRFORM 1 + #define IPV6_2292PKTINFO 2 +@@ -324,7 +321,6 @@ struct ip6_mtuinfo + #define IPV6_2292PKTOPTIONS 6 + #define IPV6_CHECKSUM 7 + #define IPV6_2292HOPLIMIT 8 +-#define SCM_SRCRT IPV6_RXSRCRT + #define IPV6_NEXTHOP 9 + #define IPV6_AUTHHDR 10 + #define IPV6_UNICAST_HOPS 16 +@@ -363,15 +359,11 @@ struct ip6_mtuinfo + #define IPV6_RXHOPOPTS IPV6_HOPOPTS + #define IPV6_RXDSTOPTS IPV6_DSTOPTS + +- + #define IPV6_PMTUDISC_DONT 0 + #define IPV6_PMTUDISC_WANT 1 + #define IPV6_PMTUDISC_DO 2 + #define IPV6_PMTUDISC_PROBE 3 + +-#define SOL_IPV6 41 +-#define SOL_ICMPV6 58 +- + #define IPV6_RTHDR_LOOSE 0 + #define IPV6_RTHDR_STRICT 1 + +diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h +index 5639b89..d3db042 100644 +--- a/include/netinet/tcp.h ++++ b/include/netinet/tcp.h +@@ -44,42 +44,80 @@ + #define SOL_TCP 6 + #include <sys/types.h> + #include <sys/socket.h> +-#endif ++#include <stdint.h> ++#include <endian.h> ++ ++typedef uint32_t tcp_seq; + ++#define TH_FIN 0x01 ++#define TH_SYN 0x02 ++#define TH_RST 0x04 ++#define TH_PUSH 0x08 ++#define TH_ACK 0x10 ++#define TH_URG 0x20 ++ ++struct tcphdr { + #ifdef _GNU_SOURCE +-#include <endian.h> +-struct tcphdr +-{ +- u_int16_t source; +- u_int16_t dest; +- u_int32_t seq; +- u_int32_t ack_seq; ++#ifdef __GNUC__ ++ __extension__ ++#endif ++ union { struct { ++ ++ uint16_t source; ++ uint16_t dest; ++ uint32_t seq; ++ uint32_t ack_seq; + #if __BYTE_ORDER == __LITTLE_ENDIAN +- u_int16_t res1:4; +- u_int16_t doff:4; +- u_int16_t fin:1; +- u_int16_t syn:1; +- u_int16_t rst:1; +- u_int16_t psh:1; +- u_int16_t ack:1; +- u_int16_t urg:1; +- u_int16_t res2:2; ++ uint16_t res1:4; ++ uint16_t doff:4; ++ uint16_t fin:1; ++ uint16_t syn:1; ++ uint16_t rst:1; ++ uint16_t psh:1; ++ uint16_t ack:1; ++ uint16_t urg:1; ++ uint16_t res2:2; + #else +- u_int16_t doff:4; +- u_int16_t res1:4; +- u_int16_t res2:2; +- u_int16_t urg:1; +- u_int16_t ack:1; +- u_int16_t psh:1; +- u_int16_t rst:1; +- u_int16_t syn:1; +- u_int16_t fin:1; ++ uint16_t doff:4; ++ uint16_t res1:4; ++ uint16_t res2:2; ++ uint16_t urg:1; ++ uint16_t ack:1; ++ uint16_t psh:1; ++ uint16_t rst:1; ++ uint16_t syn:1; ++ uint16_t fin:1; ++#endif ++ uint16_t window; ++ uint16_t check; ++ uint16_t urg_ptr; ++ ++ }; struct { ++#endif ++ ++ uint16_t th_sport; ++ uint16_t th_dport; ++ uint32_t th_seq; ++ uint32_t th_ack; ++#if __BYTE_ORDER == __LITTLE_ENDIAN ++ uint8_t th_x2:4; ++ uint8_t th_off:4; ++#else ++ uint8_t th_off:4; ++ uint8_t th_x2:4; ++#endif ++ uint8_t th_flags; ++ uint16_t th_win; ++ uint16_t th_sum; ++ uint16_t th_urp; ++ ++#ifdef _GNU_SOURCE ++ }; }; + #endif +- u_int16_t window; +- u_int16_t check; +- u_int16_t urg_ptr; + }; ++#endif + ++#ifdef _GNU_SOURCE + #define TCPI_OPT_TIMESTAMPS 1 + #define TCPI_OPT_SACK 2 + #define TCPI_OPT_WSCALE 4 +@@ -93,37 +131,37 @@ struct tcphdr + + struct tcp_info + { +- u_int8_t tcpi_state; +- u_int8_t tcpi_ca_state; +- u_int8_t tcpi_retransmits; +- u_int8_t tcpi_probes; +- u_int8_t tcpi_backoff; +- u_int8_t tcpi_options; +- u_int8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; +- u_int32_t tcpi_rto; +- u_int32_t tcpi_ato; +- u_int32_t tcpi_snd_mss; +- u_int32_t tcpi_rcv_mss; +- u_int32_t tcpi_unacked; +- u_int32_t tcpi_sacked; +- u_int32_t tcpi_lost; +- u_int32_t tcpi_retrans; +- u_int32_t tcpi_fackets; +- u_int32_t tcpi_last_data_sent; +- u_int32_t tcpi_last_ack_sent; +- u_int32_t tcpi_last_data_recv; +- u_int32_t tcpi_last_ack_recv; +- u_int32_t tcpi_pmtu; +- u_int32_t tcpi_rcv_ssthresh; +- u_int32_t tcpi_rtt; +- u_int32_t tcpi_rttvar; +- u_int32_t tcpi_snd_ssthresh; +- u_int32_t tcpi_snd_cwnd; +- u_int32_t tcpi_advmss; +- u_int32_t tcpi_reordering; +- u_int32_t tcpi_rcv_rtt; +- u_int32_t tcpi_rcv_space; +- u_int32_t tcpi_total_retrans; ++ uint8_t tcpi_state; ++ uint8_t tcpi_ca_state; ++ uint8_t tcpi_retransmits; ++ uint8_t tcpi_probes; ++ uint8_t tcpi_backoff; ++ uint8_t tcpi_options; ++ uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; ++ uint32_t tcpi_rto; ++ uint32_t tcpi_ato; ++ uint32_t tcpi_snd_mss; ++ uint32_t tcpi_rcv_mss; ++ uint32_t tcpi_unacked; ++ uint32_t tcpi_sacked; ++ uint32_t tcpi_lost; ++ uint32_t tcpi_retrans; ++ uint32_t tcpi_fackets; ++ uint32_t tcpi_last_data_sent; ++ uint32_t tcpi_last_ack_sent; ++ uint32_t tcpi_last_data_recv; ++ uint32_t tcpi_last_ack_recv; ++ uint32_t tcpi_pmtu; ++ uint32_t tcpi_rcv_ssthresh; ++ uint32_t tcpi_rtt; ++ uint32_t tcpi_rttvar; ++ uint32_t tcpi_snd_ssthresh; ++ uint32_t tcpi_snd_cwnd; ++ uint32_t tcpi_advmss; ++ uint32_t tcpi_reordering; ++ uint32_t tcpi_rcv_rtt; ++ uint32_t tcpi_rcv_space; ++ uint32_t tcpi_total_retrans; + }; + + #define TCP_MD5SIG_MAXKEYLEN 80 +@@ -131,10 +169,10 @@ struct tcp_info + struct tcp_md5sig + { + struct sockaddr_storage tcpm_addr; +- u_int16_t __tcpm_pad1; +- u_int16_t tcpm_keylen; +- u_int32_t __tcpm_pad2; +- u_int8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; ++ uint16_t __tcpm_pad1; ++ uint16_t tcpm_keylen; ++ uint32_t __tcpm_pad2; ++ uint8_t tcpm_key[TCP_MD5SIG_MAXKEYLEN]; + }; + + #endif +diff --git a/include/netinet/udp.h b/include/netinet/udp.h +index 15b9145..b1b0eb8 100644 +--- a/include/netinet/udp.h ++++ b/include/netinet/udp.h +@@ -5,19 +5,22 @@ + extern "C" { + #endif + ++#include <features.h> + #include <stdint.h> + +-struct udphdr { +- uint16_t source; +- uint16_t dest; +- uint16_t len; +- uint16_t check; +-}; +- ++#ifdef _GNU_SOURCE + #define uh_sport source + #define uh_dport dest + #define uh_ulen len + #define uh_sum check ++#endif ++ ++struct udphdr { ++ uint16_t uh_sport; ++ uint16_t uh_dport; ++ uint16_t uh_ulen; ++ uint16_t uh_sum; ++}; + + #define UDP_CORK 1 + #define UDP_ENCAP 100 +diff --git a/include/sched.h b/include/sched.h +index 6a6b2fc..105dac9 100644 +--- a/include/sched.h ++++ b/include/sched.h +@@ -78,7 +78,7 @@ int __sched_cpucount(size_t, const cpu_set_t *); + int sched_getaffinity(pid_t, size_t, cpu_set_t *); + int sched_setaffinity(pid_t, size_t, const cpu_set_t *); + +-#define __CPU_op_S(i, size, set, op) ( (i)/8 >= (size) ? 0 : \ ++#define __CPU_op_S(i, size, set, op) ( (i)/8U >= (size) ? 0 : \ + ((set)->__bits[(i)/8/sizeof(long)] op (1UL<<((i)%(8*sizeof(long))))) ) + + #define CPU_SET_S(i, size, set) __CPU_op_S(i, size, set, |=) +diff --git a/include/signal.h b/include/signal.h +index 6f10a118..8ef5ff1 100644 +--- a/include/signal.h ++++ b/include/signal.h +@@ -227,8 +227,8 @@ typedef void (*sig_t)(int); + typedef void (*sighandler_t)(int); + void (*bsd_signal(int, void (*)(int)))(int); + int sigisemptyset(const sigset_t *); +-int sigorset (sigset_t *, sigset_t *, sigset_t *); +-int sigandset(sigset_t *, sigset_t *, sigset_t *); ++int sigorset (sigset_t *, const sigset_t *, const sigset_t *); ++int sigandset(sigset_t *, const sigset_t *, const sigset_t *); + + #define SA_NOMASK SA_NODEFER + #define SA_ONESHOT SA_RESETHAND +diff --git a/include/stdlib.h b/include/stdlib.h +index 1e67b89..f034c6e 100644 +--- a/include/stdlib.h ++++ b/include/stdlib.h +@@ -93,7 +93,7 @@ size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t); + #define WSTOPSIG(s) WEXITSTATUS(s) + #define WIFEXITED(s) (!WTERMSIG(s)) + #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00) +-#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu) ++#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) + + int posix_memalign (void **, size_t, size_t); + int setenv (const char *, const char *, int); +diff --git a/include/sys/inotify.h b/include/sys/inotify.h +index a5bf96a..46638ca 100644 +--- a/include/sys/inotify.h ++++ b/include/sys/inotify.h +@@ -48,7 +48,7 @@ struct inotify_event { + int inotify_init(void); + int inotify_init1(int); + int inotify_add_watch(int, const char *, uint32_t); +-int inotify_rm_watch(int, uint32_t); ++int inotify_rm_watch(int, int); + + #ifdef __cplusplus + } +diff --git a/include/sys/mman.h b/include/sys/mman.h +index 9a1e60f..a34448a 100644 +--- a/include/sys/mman.h ++++ b/include/sys/mman.h +@@ -33,7 +33,7 @@ int munlockall (void); + + #ifdef _GNU_SOURCE + void *mremap (void *, size_t, size_t, int, ...); +-int remap_file_pages (void *, size_t, int, ssize_t, int); ++int remap_file_pages (void *, size_t, int, size_t, int); + #endif + + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +diff --git a/include/sys/shm.h b/include/sys/shm.h +index c20f033..d97e582 100644 +--- a/include/sys/shm.h ++++ b/include/sys/shm.h +@@ -37,14 +37,16 @@ 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]; ++#define __used_ids used_ids ++#define __swap_attempts swap_attempts ++#define __swap_successes swap_successes + #endif ++ ++struct shm_info { ++ int __used_ids; ++ unsigned long shm_tot, shm_rss, shm_swp; ++ unsigned long __swap_attempts, __swap_successes; + }; + + typedef unsigned long shmatt_t; +diff --git a/include/sys/socket.h b/include/sys/socket.h +index 82edd6f..79a41cc 100644 +--- a/include/sys/socket.h ++++ b/include/sys/socket.h +@@ -207,6 +207,10 @@ struct linger + #define SOL_SOCKET 1 + #endif + ++#define SOL_IP 0 ++#define SOL_IPV6 41 ++#define SOL_ICMPV6 58 ++ + #define SOL_RAW 255 + #define SOL_DECNET 261 + #define SOL_X25 262 +diff --git a/include/sys/sysctl.h b/include/sys/sysctl.h +deleted file mode 100644 +index c358b79..0000000 +--- a/include/sys/sysctl.h ++++ /dev/null +@@ -1,17 +0,0 @@ +-#ifndef _SYS_SYSCTL_H +-#define _SYS_SYSCTL_H +- +-#ifdef __cplusplus +-extern "C" { +-#endif +- +-#define __NEED_size_t +-#include <bits/alltypes.h> +- +-int sysctl (int *, int, void *, size_t *, void *, size_t); +- +-#ifdef __cplusplus +-} +-#endif +- +-#endif +diff --git a/include/sys/time.h b/include/sys/time.h +index b6787c3..bfe1414 100644 +--- a/include/sys/time.h ++++ b/include/sys/time.h +@@ -51,6 +51,17 @@ int adjtime (const struct timeval *, struct timeval *); + ((a)->tv_usec += 1000000, (a)->tv_sec--) ) + #endif + ++#if defined(_GNU_SOURCE) ++#define TIMEVAL_TO_TIMESPEC(tv, ts) ( \ ++ (ts)->tv_sec = (tv)->tv_sec, \ ++ (ts)->tv_nsec = (tv)->tv_usec * 1000, \ ++ (void)0 ) ++#define TIMESPEC_TO_TIMEVAL(tv, ts) ( \ ++ (tv)->tv_sec = (ts)->tv_sec, \ ++ (tv)->tv_usec = (ts)->tv_nsec / 1000, \ ++ (void)0 ) ++#endif ++ + #ifdef __cplusplus + } + #endif +diff --git a/include/sys/wait.h b/include/sys/wait.h +index c794f5d..50c5c70 100644 +--- a/include/sys/wait.h ++++ b/include/sys/wait.h +@@ -50,7 +50,7 @@ pid_t wait4 (pid_t, int *, int, struct rusage *); + #define WCOREDUMP(s) ((s) & 0x80) + #define WIFEXITED(s) (!WTERMSIG(s)) + #define WIFSTOPPED(s) ((short)((((s)&0xffff)*0x10001)>>8) > 0x7f00) +-#define WIFSIGNALED(s) (((s)&0xffff)-1 < 0xffu) ++#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) + #define WIFCONTINUED(s) ((s) == 0xffff) + + #ifdef __cplusplus +diff --git a/include/syslog.h b/include/syslog.h +index f7f545f..71dbd99 100644 +--- a/include/syslog.h ++++ b/include/syslog.h +@@ -21,7 +21,7 @@ extern "C" { + #define LOG_MAKEPRI(f, p) (((f)<<3)|(p)) + + #define LOG_MASK(p) (1<<(p)) +-#define LOG_UPTO(p) ((1<<(p)+1)-1) ++#define LOG_UPTO(p) ((1<<((p)+1))-1) + + #define LOG_KERN (0<<3) + #define LOG_USER (1<<3) +diff --git a/include/time.h b/include/time.h +index 7057409..dc88070 100644 +--- a/include/time.h ++++ b/include/time.h +@@ -125,7 +125,7 @@ struct tm *getdate (const char *); + + + #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) +-int stime(time_t *); ++int stime(const time_t *); + time_t timegm(struct tm *); + #endif + +diff --git a/include/utmp.h b/include/utmp.h +index b357ac8..e9ba23e 100644 +--- a/include/utmp.h ++++ b/include/utmp.h +@@ -10,6 +10,7 @@ extern "C" { + #define ACCOUNTING 9 + #define UT_NAMESIZE 32 + #define UT_HOSTSIZE 256 ++#define UT_LINESIZE 32 + + struct lastlog { + time_t ll_time; +@@ -22,6 +23,8 @@ struct lastlog { + #define ut_addr ut_addr_v6[0] + #define utmp utmpx + #define utmpname(x) (-1) ++#define e_exit __e_exit ++#define e_termination __e_termination + + void endutent(void); + struct utmp *getutent(void); +diff --git a/include/utmpx.h b/include/utmpx.h +index fd5f515..f0c3b01 100644 +--- a/include/utmpx.h ++++ b/include/utmpx.h +@@ -5,6 +5,8 @@ + extern "C" { + #endif + ++#include <features.h> ++ + #define __NEED_pid_t + #define __NEED_time_t + #define __NEED_suseconds_t +@@ -12,19 +14,17 @@ extern "C" { + + #include <bits/alltypes.h> + +-#define UT_LINESIZE 32 +- + struct utmpx + { + short ut_type; + pid_t ut_pid; +- char ut_line[UT_LINESIZE]; ++ char ut_line[32]; + char ut_id[4]; + char ut_user[32]; + char ut_host[256]; + struct { +- short e_termination; +- short e_exit; ++ short __e_termination; ++ short __e_exit; + } ut_exit; + long ut_session; + struct timeval ut_tv; +@@ -39,7 +39,11 @@ struct utmpx *getutxline(const struct utmpx *); + struct utmpx *pututxline(const struct utmpx *); + void setutxent(void); + ++#if defined(_BSD_SOURCE) | defined(_GNU_SOURCE) ++#define e_exit __e_exit ++#define e_termination __e_termination + void updwtmpx(const char *, const struct utmpx *); ++#endif + + #define EMPTY 0 + #define RUN_LVL 1 +diff --git a/src/crypt/crypt_des.c b/src/crypt/crypt_des.c +index dc95dca..d5766a7 100644 +--- a/src/crypt/crypt_des.c ++++ b/src/crypt/crypt_des.c +@@ -692,7 +692,7 @@ static uint32_t setup_salt(uint32_t salt) + return saltbits; + } + +-static void des_setkey(const unsigned char *key, struct expanded_key *ekey) ++void __des_setkey(const unsigned char *key, struct expanded_key *ekey) + { + uint32_t k0, k1, rawkey0, rawkey1; + unsigned int shifts, round, i, ibit; +@@ -753,7 +753,7 @@ static void des_setkey(const unsigned char *key, struct expanded_key *ekey) + /* + * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. + */ +-static void do_des(uint32_t l_in, uint32_t r_in, ++void __do_des(uint32_t l_in, uint32_t r_in, + uint32_t *l_out, uint32_t *r_out, + uint32_t count, uint32_t saltbits, const struct expanded_key *ekey) + { +@@ -862,7 +862,7 @@ static void des_cipher(const unsigned char *in, unsigned char *out, + ((uint32_t)in[5] << 16) | + ((uint32_t)in[4] << 24); + +- do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey); ++ __do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey); + + out[0] = l_out >> 24; + out[1] = l_out >> 16; +@@ -894,7 +894,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char + if (*key) + key++; + } +- des_setkey(keybuf, &ekey); ++ __des_setkey(keybuf, &ekey); + + if (*setting == _PASSWORD_EFMT1) { + /* +@@ -929,7 +929,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char + q = keybuf; + while (q <= &keybuf[sizeof(keybuf) - 1] && *key) + *q++ ^= *key++ << 1; +- des_setkey(keybuf, &ekey); ++ __des_setkey(keybuf, &ekey); + } + + memcpy(output, setting, 9); +@@ -957,7 +957,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char + /* + * Do it. + */ +- do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey); ++ __do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey); + + /* + * Now encode the result... +diff --git a/src/crypt/encrypt.c b/src/crypt/encrypt.c +new file mode 100644 +index 0000000..9332a6d +--- /dev/null ++++ b/src/crypt/encrypt.c +@@ -0,0 +1,60 @@ ++#include <stdint.h> ++#include <stdlib.h> ++#include <unistd.h> ++ ++struct expanded_key { ++ uint32_t l[16], r[16]; ++}; ++ ++void __des_setkey(const unsigned char *key, struct expanded_key *ekey); ++void __do_des(uint32_t l_in, uint32_t r_in, ++ uint32_t *l_out, uint32_t *r_out, ++ uint32_t count, uint32_t saltbits, const struct expanded_key *ekey); ++ ++ ++static struct expanded_key __encrypt_key; ++ ++void setkey(const char *key) ++{ ++ unsigned char bkey[8]; ++ int i, j; ++ ++ for (i = 0; i < 8; i++) { ++ bkey[i] = 0; ++ for (j = 7; j >= 0; j--, key++) ++ bkey[i] |= (uint32_t)(*key & 1) << j; ++ } ++ ++ __des_setkey(bkey, &__encrypt_key); ++} ++ ++void encrypt(char *block, int edflag) ++{ ++ struct expanded_key decrypt_key, *key; ++ uint32_t b[2]; ++ int i, j; ++ char *p; ++ ++ p = block; ++ for (i = 0; i < 2; i++) { ++ b[i] = 0; ++ for (j = 31; j >= 0; j--, p++) ++ b[i] |= (uint32_t)(*p & 1) << j; ++ } ++ ++ key = &__encrypt_key; ++ if (edflag) { ++ key = &decrypt_key; ++ for (i = 0; i < 16; i++) { ++ decrypt_key.l[i] = __encrypt_key.l[15-i]; ++ decrypt_key.r[i] = __encrypt_key.r[15-i]; ++ } ++ } ++ ++ __do_des(b[0], b[1], b, b + 1, 1, 0, key); ++ ++ p = block; ++ for (i = 0; i < 2; i++) ++ for (j = 31; j >= 0; j--) ++ *p++ = b[i]>>j & 1; ++} +diff --git a/src/fcntl/fcntl.c b/src/fcntl/fcntl.c +index 4c34ba0..4a713fd 100644 +--- a/src/fcntl/fcntl.c ++++ b/src/fcntl/fcntl.c +@@ -13,11 +13,11 @@ int fcntl(int fd, int cmd, ...) + arg = va_arg(ap, long); + va_end(ap); + if (cmd == F_SETFL) arg |= O_LARGEFILE; +- if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, arg); ++ if (cmd == F_SETLKW) return syscall_cp(SYS_fcntl, fd, cmd, (void *)arg); + if (cmd == F_GETOWN) { + struct f_owner_ex ex; + int ret = __syscall(SYS_fcntl, fd, F_GETOWN_EX, &ex); +- if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, arg); ++ if (ret == -EINVAL) return __syscall(SYS_fcntl, fd, cmd, (void *)arg); + if (ret) return __syscall_ret(ret); + return ex.type == F_OWNER_PGRP ? -ex.pid : ex.pid; + } +@@ -37,5 +37,14 @@ int fcntl(int fd, int cmd, ...) + if (ret >= 0) __syscall(SYS_fcntl, ret, F_SETFD, FD_CLOEXEC); + return __syscall_ret(ret); + } +- return syscall(SYS_fcntl, fd, cmd, arg); ++ switch (cmd) { ++ case F_SETLK: ++ case F_SETLKW: ++ case F_GETLK: ++ case F_GETOWN_EX: ++ case F_SETOWN_EX: ++ return syscall(SYS_fcntl, fd, cmd, (void *)arg); ++ default: ++ return syscall(SYS_fcntl, fd, cmd, arg); ++ } + } +diff --git a/src/fcntl/posix_fadvise.c b/src/fcntl/posix_fadvise.c +index 2170209..d5360e0 100644 +--- a/src/fcntl/posix_fadvise.c ++++ b/src/fcntl/posix_fadvise.c +@@ -1,8 +1,11 @@ + #include <fcntl.h> + #include "syscall.h" ++#include "libc.h" + + int posix_fadvise(int fd, off_t base, off_t len, int advice) + { + return -(__syscall)(SYS_fadvise, fd, __SYSCALL_LL_O(base), + __SYSCALL_LL_E(len), advice); + } ++ ++LFS64(posix_fadvise); +diff --git a/src/fcntl/posix_fallocate.c b/src/fcntl/posix_fallocate.c +index 80a65cb..91d8063 100644 +--- a/src/fcntl/posix_fallocate.c ++++ b/src/fcntl/posix_fallocate.c +@@ -1,8 +1,11 @@ + #include <fcntl.h> + #include "syscall.h" ++#include "libc.h" + + int posix_fallocate(int fd, off_t base, off_t len) + { + return -__syscall(SYS_fallocate, fd, 0, __SYSCALL_LL_E(base), + __SYSCALL_LL_E(len)); + } ++ ++LFS64(posix_fallocate); +diff --git a/src/fenv/i386/fenv.s b/src/fenv/i386/fenv.s +index f6036d6..a189ca2 100644 +--- a/src/fenv/i386/fenv.s ++++ b/src/fenv/i386/fenv.s +@@ -126,7 +126,7 @@ fesetenv: + push %eax + push %eax + push %eax +- push %eax ++ pushl $0xffff + push %eax + pushl $0x37f + fldenv (%esp) +diff --git a/src/fenv/x86_64/fenv.s b/src/fenv/x86_64/fenv.s +index 6aaf25e..b5aeaf4 100644 +--- a/src/fenv/x86_64/fenv.s ++++ b/src/fenv/x86_64/fenv.s +@@ -76,7 +76,7 @@ fesetenv: + ret + 1: push %rax + push %rax +- push %rax ++ pushq $0xffff + pushq $0x37f + fldenv (%rsp) + pushq $0x1f80 +diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h +index 2083b2f..79be9fd 100644 +--- a/src/internal/stdio_impl.h ++++ b/src/internal/stdio_impl.h +@@ -17,6 +17,7 @@ + #define F_EOF 16 + #define F_ERR 32 + #define F_SVB 64 ++#define F_APP 128 + + struct _IO_FILE { + unsigned flags; +diff --git a/src/ipc/semctl.c b/src/ipc/semctl.c +index 274e2cf..3d79f50 100644 +--- a/src/ipc/semctl.c ++++ b/src/ipc/semctl.c +@@ -3,16 +3,22 @@ + #include "syscall.h" + #include "ipc.h" + ++union semun { ++ int val; ++ struct semid_ds *buf; ++ unsigned short *array; ++}; ++ + int semctl(int id, int num, int cmd, ...) + { +- long arg; ++ union semun arg; + va_list ap; + va_start(ap, cmd); +- arg = va_arg(ap, long); ++ arg = va_arg(ap, union semun); + va_end(ap); + #ifdef SYS_semctl +- return syscall(SYS_semctl, id, num, cmd | IPC_64, arg); ++ return syscall(SYS_semctl, id, num, cmd | IPC_64, arg.buf); + #else +- return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg); ++ return syscall(SYS_ipc, IPCOP_semctl, id, num, cmd | IPC_64, &arg.buf); + #endif + } +diff --git a/src/ldso/dladdr.c b/src/ldso/dladdr.c +index 265bb68..7ca718f 100644 +--- a/src/ldso/dladdr.c ++++ b/src/ldso/dladdr.c +@@ -1,9 +1,9 @@ + #define _GNU_SOURCE + #include <dlfcn.h> + +-int __dladdr(void *, Dl_info *); ++int __dladdr(const void *, Dl_info *); + +-int dladdr(void *addr, Dl_info *info) ++int dladdr(const void *addr, Dl_info *info) + { + return __dladdr(addr, info); + } +diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c +index 27d92f2..a1bdf0f 100644 +--- a/src/ldso/dynlink.c ++++ b/src/ldso/dynlink.c +@@ -253,7 +253,8 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri + name = strings + sym->st_name; + ctx = IS_COPY(type) ? head->next : head; + def = find_sym(ctx, name, IS_PLT(type)); +- if (!def.sym && sym->st_info>>4 != STB_WEAK) { ++ if (!def.sym && (sym->st_shndx != SHN_UNDEF ++ || sym->st_info>>4 != STB_WEAK)) { + snprintf(errbuf, sizeof errbuf, + "Error relocating %s: %s: symbol not found", + dso->name, name); +@@ -1331,7 +1332,7 @@ failed: + return 0; + } + +-int __dladdr(void *addr, Dl_info *info) ++int __dladdr(const void *addr, Dl_info *info) + { + struct dso *p; + Sym *sym; +@@ -1441,7 +1442,7 @@ void *__dlsym(void *restrict p, const char *restrict s, void *restrict ra) + { + return 0; + } +-int __dladdr (void *addr, Dl_info *info) ++int __dladdr (const void *addr, Dl_info *info) + { + return 0; + } +diff --git a/src/linux/clone.c b/src/linux/clone.c +new file mode 100644 +index 0000000..b9e5594 +--- /dev/null ++++ b/src/linux/clone.c +@@ -0,0 +1,19 @@ ++#include <stdarg.h> ++#include <unistd.h> ++#include "pthread_impl.h" ++#include "syscall.h" ++ ++int clone(int (*func)(void *), void *stack, int flags, void *arg, ...) ++{ ++ va_list ap; ++ pid_t *ptid, *ctid; ++ void *tls; ++ ++ va_start(ap, arg); ++ ptid = va_arg(ap, pid_t *); ++ tls = va_arg(ap, void *); ++ ctid = va_arg(ap, pid_t *); ++ va_end(ap); ++ ++ return __syscall_ret(__clone(func, stack, flags, arg, ptid, tls, ctid)); ++} +diff --git a/src/linux/fallocate.c b/src/linux/fallocate.c +index 9146350..ae766d5 100644 +--- a/src/linux/fallocate.c ++++ b/src/linux/fallocate.c +@@ -1,9 +1,13 @@ + #define _GNU_SOURCE + #include <fcntl.h> + #include "syscall.h" ++#include "libc.h" + + int fallocate(int fd, int mode, off_t base, off_t len) + { + return syscall(SYS_fallocate, fd, mode, __SYSCALL_LL_E(base), + __SYSCALL_LL_E(len)); + } ++ ++#undef fallocate64 ++LFS64(fallocate); +diff --git a/src/linux/inotify.c b/src/linux/inotify.c +index d3b4fa0..a417c89 100644 +--- a/src/linux/inotify.c ++++ b/src/linux/inotify.c +@@ -15,7 +15,7 @@ int inotify_add_watch(int fd, const char *pathname, uint32_t mask) + return syscall(SYS_inotify_add_watch, fd, pathname, mask); + } + +-int inotify_rm_watch(int fd, uint32_t wd) ++int inotify_rm_watch(int fd, int wd) + { + return syscall(SYS_inotify_rm_watch, fd, wd); + } +diff --git a/src/linux/remap_file_pages.c b/src/linux/remap_file_pages.c +index f95c4cc..a9699ce 100644 +--- a/src/linux/remap_file_pages.c ++++ b/src/linux/remap_file_pages.c +@@ -2,7 +2,7 @@ + #include <sys/mman.h> + #include "syscall.h" + +-int remap_file_pages(void *addr, size_t size, int prot, ssize_t pgoff, int flags) ++int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags) + { + return syscall(SYS_remap_file_pages, addr, size, prot, pgoff, flags); + } +diff --git a/src/linux/stime.c b/src/linux/stime.c +index 29a1ec6..7d0443b 100644 +--- a/src/linux/stime.c ++++ b/src/linux/stime.c +@@ -2,7 +2,7 @@ + #include <time.h> + #include <sys/time.h> + +-int stime(time_t *t) ++int stime(const time_t *t) + { + struct timeval tv = { .tv_sec = *t, .tv_usec = 0 }; + return settimeofday(&tv, (void *)0); +diff --git a/src/locale/wcsxfrm.c b/src/locale/wcsxfrm.c +index cb79c97..5d89e7d 100644 +--- a/src/locale/wcsxfrm.c ++++ b/src/locale/wcsxfrm.c +@@ -6,10 +6,12 @@ + size_t __wcsxfrm_l(wchar_t *restrict dest, const wchar_t *restrict src, size_t n, locale_t loc) + { + size_t l = wcslen(src); +- if (l >= n) { ++ if (l < n) { ++ wmemcpy(dest, src, l+1); ++ } else if (n) { + wmemcpy(dest, src, n-1); + dest[n-1] = 0; +- } else wcscpy(dest, src); ++ } + return l; + } + +diff --git a/src/math/i386/remainder.s b/src/math/i386/remainder.s +index 47ee340..7f4be05 100644 +--- a/src/math/i386/remainder.s ++++ b/src/math/i386/remainder.s +@@ -1,6 +1,9 @@ + .global remainder + .type remainder,@function + remainder: ++.weak drem ++.type drem,@function ++drem: + fldl 12(%esp) + fldl 4(%esp) + 1: fprem1 +diff --git a/src/math/i386/remainderf.s b/src/math/i386/remainderf.s +index 5b5fc23..ac6e367 100644 +--- a/src/math/i386/remainderf.s ++++ b/src/math/i386/remainderf.s +@@ -1,6 +1,9 @@ + .global remainderf + .type remainderf,@function + remainderf: ++.weak dremf ++.type dremf,@function ++dremf: + flds 8(%esp) + flds 4(%esp) + 1: fprem1 +diff --git a/src/misc/nftw.c b/src/misc/nftw.c +index b2e84bc..efb2b89 100644 +--- a/src/misc/nftw.c ++++ b/src/misc/nftw.c +@@ -46,8 +46,7 @@ static int do_nftw(char *path, int (*fn)(const char *, const struct stat *, int, + type = FTW_F; + } + +- if ((flags & FTW_MOUNT) && h +- && (st.st_dev != h->dev || st.st_ino != h->ino)) ++ if ((flags & FTW_MOUNT) && h && st.st_dev != h->dev) + return 0; + + new.chain = h; +diff --git a/src/network/inet_legacy.c b/src/network/inet_legacy.c +index 0a0ad6f..de5b75c 100644 +--- a/src/network/inet_legacy.c ++++ b/src/network/inet_legacy.c +@@ -16,9 +16,8 @@ int inet_aton(const char *cp, struct in_addr *inp) + return 1; + } + +-struct in_addr inet_makeaddr(int net, int host) ++struct in_addr inet_makeaddr(in_addr_t n, in_addr_t h) + { +- uint32_t n = net, h = host; + if (n < 256) h |= n<<24; + else if (n < 65536) h |= n<<16; + else h |= n<<8; +diff --git a/src/network/proto.c b/src/network/proto.c +index 031003a..3d0f584 100644 +--- a/src/network/proto.c ++++ b/src/network/proto.c +@@ -4,7 +4,7 @@ + /* do we really need all these?? */ + + static int idx; +-static const unsigned char protos[][6] = { ++static const unsigned char protos[][8] = { + "\000ip", + "\001icmp", + "\002igmp", +@@ -13,7 +13,9 @@ static const unsigned char protos[][6] = { + "\014pup", + "\021udp", + "\026idp", +- "\377raw" ++ "\051ipv6", ++ "\072icmpv6", ++ "\377raw", + "\0\0" + }; + +diff --git a/src/prng/random.c b/src/prng/random.c +index 4ad6205..e250e28 100644 +--- a/src/prng/random.c ++++ b/src/prng/random.c +@@ -1,10 +1,3 @@ +-/* +- * random.c - Copyright © 2011 Szabolcs Nagy +- * Permission to use, copy, modify, and/or distribute this code +- * for any purpose with or without fee is hereby granted. +- * There is no warranty. +-*/ +- + #include <stdlib.h> + #include <stdint.h> + #include "libc.h" +@@ -12,11 +5,7 @@ + /* + this code uses the same lagged fibonacci generator as the + original bsd random implementation except for the seeding +- +-different seeds produce different sequences with long period +-(other libcs seed the state with a park-miller generator +-when seed=0 some fail to produce good random sequence +-others produce the same sequence as another seed) ++which was broken in the original + */ + + static uint32_t init[] = { +@@ -98,6 +87,7 @@ char *initstate(unsigned seed, char *state, size_t size) { + n = 63; + x = (uint32_t*)state + 1; + __srandom(seed); ++ savestate(); + UNLOCK(lock); + return old; + } +diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c +index eb98f9f..f675a13 100644 +--- a/src/process/posix_spawn.c ++++ b/src/process/posix_spawn.c +@@ -166,7 +166,7 @@ int __posix_spawnx(pid_t *restrict res, const char *restrict path, + + close(args.p[0]); + +- if (!ec) *res = pid; ++ if (!ec && res) *res = pid; + + pthread_sigmask(SIG_SETMASK, &args.oldmask, 0); + pthread_setcancelstate(cs, 0); +diff --git a/src/signal/sigandset.c b/src/signal/sigandset.c +index e0c6f48..974186f 100644 +--- a/src/signal/sigandset.c ++++ b/src/signal/sigandset.c +@@ -3,7 +3,7 @@ + + #define SST_SIZE (_NSIG/8/sizeof(long)) + +-int sigandset(sigset_t *dest, sigset_t *left, sigset_t *right) ++int sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right) + { + unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right; + for(; i < SST_SIZE; i++) d[i] = l[i] & r[i]; +diff --git a/src/signal/sigorset.c b/src/signal/sigorset.c +index df1b1b1..ed48873 100644 +--- a/src/signal/sigorset.c ++++ b/src/signal/sigorset.c +@@ -3,7 +3,7 @@ + + #define SST_SIZE (_NSIG/8/sizeof(long)) + +-int sigorset(sigset_t *dest, sigset_t *left, sigset_t *right) ++int sigorset(sigset_t *dest, const sigset_t *left, const sigset_t *right) + { + unsigned long i = 0, *d = (void*) dest, *l = (void*) left, *r = (void*) right; + for(; i < SST_SIZE; i++) d[i] = l[i] | r[i]; +diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c +index 59690f6..a6ae73a 100644 +--- a/src/stdio/__fdopen.c ++++ b/src/stdio/__fdopen.c +@@ -32,7 +32,9 @@ FILE *__fdopen(int fd, const char *mode) + /* Set append mode on fd if opened for append */ + if (*mode == 'a') { + int flags = __syscall(SYS_fcntl, fd, F_GETFL); +- __syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND); ++ if (!(flags & O_APPEND)) ++ __syscall(SYS_fcntl, fd, F_SETFL, flags | O_APPEND); ++ f->flags |= F_APP; + } + + f->fd = fd; +diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c +index 82371e3..bb62897 100644 +--- a/src/stdio/ftell.c ++++ b/src/stdio/ftell.c +@@ -4,7 +4,9 @@ + + off_t __ftello_unlocked(FILE *f) + { +- off_t pos = f->seek(f, 0, SEEK_CUR); ++ off_t pos = f->seek(f, 0, ++ (f->flags & F_APP) && f->wpos > f->wbase ++ ? SEEK_END : SEEK_CUR); + if (pos < 0) return pos; + + /* Adjust for data in buffer. */ +diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c +index 0091a8d..d4d2454 100644 +--- a/src/stdio/vfscanf.c ++++ b/src/stdio/vfscanf.c +@@ -328,3 +328,5 @@ match_fail: + FUNLOCK(f); + return matches; + } ++ ++weak_alias(vfscanf,__isoc99_vfscanf); +diff --git a/src/thread/__wait.c b/src/thread/__wait.c +index 041a066..a1e4780 100644 +--- a/src/thread/__wait.c ++++ b/src/thread/__wait.c +@@ -10,6 +10,6 @@ void __wait(volatile int *addr, volatile int *waiters, int val, int priv) + } + if (waiters) a_inc(waiters); + while (*addr==val) +- __syscall(SYS_futex, (long)addr, FUTEX_WAIT|priv, val, 0); ++ __syscall(SYS_futex, addr, FUTEX_WAIT|priv, val, 0); + if (waiters) a_dec(waiters); + } +diff --git a/src/thread/arm/clone.s b/src/thread/arm/clone.s +index daf8f55..d146999 100644 +--- a/src/thread/arm/clone.s ++++ b/src/thread/arm/clone.s +@@ -1,10 +1,7 @@ + .text + .global __clone +-.weak clone + .type __clone,%function +-.type clone,%function + __clone: +-clone: + stmfd sp!,{r4,r5,r6,r7} + mov r7,#120 + mov r6,r3 +diff --git a/src/thread/clone.c b/src/thread/clone.c +index 339e28a..be80c8e 100644 +--- a/src/thread/clone.c ++++ b/src/thread/clone.c +@@ -1,10 +1,7 @@ + #include <errno.h> +-#include "libc.h" ++#include "pthread_impl.h" + + int __clone(int (*func)(void *), void *stack, int flags, void *arg, ...) + { +- errno = ENOSYS; +- return -1; ++ return -ENOSYS; + } +- +-weak_alias(__clone, clone); +diff --git a/src/thread/i386/clone.s b/src/thread/i386/clone.s +index bebf01a..52fe7ef 100644 +--- a/src/thread/i386/clone.s ++++ b/src/thread/i386/clone.s +@@ -1,10 +1,7 @@ + .text + .global __clone +-.weak clone + .type __clone,@function +-.type clone,@function + __clone: +-clone: + push %ebp + mov %esp,%ebp + push %ebx +diff --git a/src/thread/microblaze/clone.s b/src/thread/microblaze/clone.s +index 030a9c3..13448a3 100644 +--- a/src/thread/microblaze/clone.s ++++ b/src/thread/microblaze/clone.s +@@ -1,14 +1,11 @@ + .global __clone +-.weak clone + .type __clone,@function +-.type clone,@function + + # r5, r6, r7, r8, r9, r10, stack + # fn, st, fl, ar, pt, tl, ct + # fl, st, __, pt, ct, tl + + __clone: +-clone: + andi r6, r6, -16 + addi r6, r6, -16 + swi r5, r6, 0 +@@ -23,7 +20,7 @@ clone: + beqi r3, 1f + rtsd r15, 8 + nop +- ++ + 1: lwi r3, r1, 0 + lwi r5, r1, 4 + brald r15, r3 +diff --git a/src/thread/x86_64/clone.s b/src/thread/x86_64/clone.s +index 4db081c..ee59903 100644 +--- a/src/thread/x86_64/clone.s ++++ b/src/thread/x86_64/clone.s +@@ -1,10 +1,7 @@ + .text + .global __clone +-.weak clone + .type __clone,@function +-.type clone,@function + __clone: +-clone: + xor %eax,%eax + mov $56,%al + mov %rdi,%r11 +diff --git a/src/time/timer_delete.c b/src/time/timer_delete.c +index c81f921..7c97eeb 100644 +--- a/src/time/timer_delete.c ++++ b/src/time/timer_delete.c +@@ -10,5 +10,5 @@ int timer_delete(timer_t t) + __wake(&td->timer_id, 1, 1); + return 0; + } +- return __syscall(SYS_timer_delete, (long)t); ++ return __syscall(SYS_timer_delete, t); + } +diff --git a/src/time/timer_getoverrun.c b/src/time/timer_getoverrun.c +index 5336128..e7f891e 100644 +--- a/src/time/timer_getoverrun.c ++++ b/src/time/timer_getoverrun.c +@@ -8,5 +8,5 @@ int timer_getoverrun(timer_t t) + pthread_t td = (void *)((uintptr_t)t << 1); + t = (void *)(uintptr_t)(td->timer_id & INT_MAX); + } +- return syscall(SYS_timer_getoverrun, (long)t); ++ return syscall(SYS_timer_getoverrun, t); + } +diff --git a/src/time/timer_gettime.c b/src/time/timer_gettime.c +index 1d90207..ed6d8d6 100644 +--- a/src/time/timer_gettime.c ++++ b/src/time/timer_gettime.c +@@ -8,5 +8,5 @@ int timer_gettime(timer_t t, struct itimerspec *val) + pthread_t td = (void *)((uintptr_t)t << 1); + t = (void *)(uintptr_t)(td->timer_id & INT_MAX); + } +- return syscall(SYS_timer_gettime, (long)t, val); ++ return syscall(SYS_timer_gettime, t, val); + } +diff --git a/src/time/timer_settime.c b/src/time/timer_settime.c +index f5f36fe..62631aa 100644 +--- a/src/time/timer_settime.c ++++ b/src/time/timer_settime.c +@@ -8,5 +8,5 @@ int timer_settime(timer_t t, int flags, const struct itimerspec *restrict val, s + pthread_t td = (void *)((uintptr_t)t << 1); + t = (void *)(uintptr_t)(td->timer_id & INT_MAX); + } +- return syscall(SYS_timer_settime, (long)t, flags, val, old); ++ return syscall(SYS_timer_settime, t, flags, val, old); + } +diff --git a/tools/install.sh b/tools/install.sh +index 4e5a8b9..d913b60 100755 +--- a/tools/install.sh ++++ b/tools/install.sh +@@ -51,6 +51,7 @@ if test "$symlink" ; then + ln -s "$1" "$tmp" + else + cat < "$1" > "$tmp" ++chmod "$mode" "$tmp" + fi + + mv -f "$tmp" "$2" +@@ -60,6 +61,4 @@ printf "%s: %s is a directory\n" "$0" "$dst" 1>&2 + exit 1 + } + +-test "$symlink" || chmod "$mode" "$2" +- + exit 0 diff --git a/main/musl/1002-add-legacy-functions-setkey-and-encrypt.patch b/main/musl/1002-add-legacy-functions-setkey-and-encrypt.patch deleted file mode 100644 index 0a25d9061d..0000000000 --- a/main/musl/1002-add-legacy-functions-setkey-and-encrypt.patch +++ /dev/null @@ -1,141 +0,0 @@ -From 8546e9be8757a9406a8c05fae9efc55eaab3e984 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Mon, 13 Jan 2014 13:05:14 +0200 -Subject: [PATCH] add legacy functions setkey() and encrypt() - ---- - src/crypt/crypt_des.c | 12 +++++----- - src/crypt/encrypt.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++ - 2 files changed, 69 insertions(+), 6 deletions(-) - create mode 100644 src/crypt/encrypt.c - -diff --git a/src/crypt/crypt_des.c b/src/crypt/crypt_des.c -index dc95dca..d5766a7 100644 ---- a/src/crypt/crypt_des.c -+++ b/src/crypt/crypt_des.c -@@ -692,7 +692,7 @@ static uint32_t setup_salt(uint32_t salt) - return saltbits; - } - --static void des_setkey(const unsigned char *key, struct expanded_key *ekey) -+void __des_setkey(const unsigned char *key, struct expanded_key *ekey) - { - uint32_t k0, k1, rawkey0, rawkey1; - unsigned int shifts, round, i, ibit; -@@ -753,7 +753,7 @@ static void des_setkey(const unsigned char *key, struct expanded_key *ekey) - /* - * l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format. - */ --static void do_des(uint32_t l_in, uint32_t r_in, -+void __do_des(uint32_t l_in, uint32_t r_in, - uint32_t *l_out, uint32_t *r_out, - uint32_t count, uint32_t saltbits, const struct expanded_key *ekey) - { -@@ -862,7 +862,7 @@ static void des_cipher(const unsigned char *in, unsigned char *out, - ((uint32_t)in[5] << 16) | - ((uint32_t)in[4] << 24); - -- do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey); -+ __do_des(rawl, rawr, &l_out, &r_out, count, saltbits, ekey); - - out[0] = l_out >> 24; - out[1] = l_out >> 16; -@@ -894,7 +894,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char - if (*key) - key++; - } -- des_setkey(keybuf, &ekey); -+ __des_setkey(keybuf, &ekey); - - if (*setting == _PASSWORD_EFMT1) { - /* -@@ -929,7 +929,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char - q = keybuf; - while (q <= &keybuf[sizeof(keybuf) - 1] && *key) - *q++ ^= *key++ << 1; -- des_setkey(keybuf, &ekey); -+ __des_setkey(keybuf, &ekey); - } - - memcpy(output, setting, 9); -@@ -957,7 +957,7 @@ static char *_crypt_extended_r_uut(const char *_key, const char *_setting, char - /* - * Do it. - */ -- do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey); -+ __do_des(0, 0, &r0, &r1, count, setup_salt(salt), &ekey); - - /* - * Now encode the result... -diff --git a/src/crypt/encrypt.c b/src/crypt/encrypt.c -new file mode 100644 -index 0000000..3b414f1 ---- /dev/null -+++ b/src/crypt/encrypt.c -@@ -0,0 +1,63 @@ -+#include <stdint.h> -+#include <stdlib.h> -+#include <unistd.h> -+ -+struct expanded_key { -+ uint32_t l[16], r[16]; -+}; -+ -+void __des_setkey(const unsigned char *key, struct expanded_key *ekey); -+void __do_des(uint32_t l_in, uint32_t r_in, -+ uint32_t *l_out, uint32_t *r_out, -+ uint32_t count, uint32_t saltbits, const struct expanded_key *ekey); -+ -+ -+static struct expanded_key __encrypt_key; -+ -+void setkey(const char *key) -+{ -+ unsigned char bkey[8]; -+ int i, j; -+ -+ for (i = 0; i < 8; i++) { -+ bkey[i] = 0; -+ for (j = 7; j >= 0; j--, key++) { -+ if (*key & 1) -+ bkey[i] |= 1 << j; -+ } -+ } -+ -+ __des_setkey(bkey, &__encrypt_key); -+} -+ -+void encrypt(char *block, int edflag) -+{ -+ struct expanded_key decrypt_key, *key; -+ uint32_t b[2]; -+ int i, j; -+ char *p; -+ -+ p = block; -+ for (i = 0; i < 2; i++) { -+ b[i] = 0; -+ for (j = 31; j >= 0; j--, p++) -+ if (*p & 1) -+ b[i] |= 1 << j; -+ } -+ -+ key = &__encrypt_key; -+ if (edflag) { -+ key = &decrypt_key; -+ for (i = 0; i < 16; i++) { -+ decrypt_key.l[i] = __encrypt_key.l[15-i]; -+ decrypt_key.r[i] = __encrypt_key.r[15-i]; -+ } -+ } -+ -+ __do_des(b[0], b[1], b, b + 1, 1, 0, key); -+ -+ p = block; -+ for (i = 0; i < 2; i++) -+ for (j = 31; j >= 0; j--) -+ *p++ = (b[i] & (1 << j)) ? 1 : 0; -+} --- -1.8.5.2 - diff --git a/main/musl/1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch b/main/musl/1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch deleted file mode 100644 index c5b81083d5..0000000000 --- a/main/musl/1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch +++ /dev/null @@ -1,162 +0,0 @@ -From 643c0776155ec3165198c21708f7a2f88fc02adc Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Mon, 13 Jan 2014 13:29:10 +0200 -Subject: [PATCH] use anonymous union to provide bsd and gnu variants of struct - tcphdr and udphdr - ---- - include/netinet/tcp.h | 92 ++++++++++++++++++++++++++++++++++----------------- - include/netinet/udp.h | 26 ++++++++++----- - 2 files changed, 79 insertions(+), 39 deletions(-) - -diff --git a/include/netinet/tcp.h b/include/netinet/tcp.h -index 5639b89..09c9279 100644 ---- a/include/netinet/tcp.h -+++ b/include/netinet/tcp.h -@@ -44,42 +44,74 @@ - #define SOL_TCP 6 - #include <sys/types.h> - #include <sys/socket.h> --#endif -- --#ifdef _GNU_SOURCE - #include <endian.h> --struct tcphdr --{ -- u_int16_t source; -- u_int16_t dest; -- u_int32_t seq; -- u_int32_t ack_seq; -+ -+typedef u_int32_t tcp_seq; -+ -+#define TH_FIN 0x01 -+#define TH_SYN 0x02 -+#define TH_RST 0x04 -+#define TH_PUSH 0x08 -+#define TH_ACK 0x10 -+#define TH_URG 0x20 -+ -+struct tcphdr { -+#ifdef __GNUC__ -+ __extension__ -+#endif -+ union { -+ struct { -+ u_int16_t source; -+ u_int16_t dest; -+ u_int32_t seq; -+ u_int32_t ack_seq; -+#if __BYTE_ORDER == __LITTLE_ENDIAN -+ u_int16_t res1:4; -+ u_int16_t doff:4; -+ u_int16_t fin:1; -+ u_int16_t syn:1; -+ u_int16_t rst:1; -+ u_int16_t psh:1; -+ u_int16_t ack:1; -+ u_int16_t urg:1; -+ u_int16_t res2:2; -+#else -+ u_int16_t doff:4; -+ u_int16_t res1:4; -+ u_int16_t res2:2; -+ u_int16_t urg:1; -+ u_int16_t ack:1; -+ u_int16_t psh:1; -+ u_int16_t rst:1; -+ u_int16_t syn:1; -+ u_int16_t fin:1; -+#endif -+ u_int16_t window; -+ u_int16_t check; -+ u_int16_t urg_ptr; -+ }; -+ struct { -+ u_int16_t th_sport; -+ u_int16_t th_dport; -+ tcp_seq th_seq; -+ tcp_seq th_ack; - #if __BYTE_ORDER == __LITTLE_ENDIAN -- u_int16_t res1:4; -- u_int16_t doff:4; -- u_int16_t fin:1; -- u_int16_t syn:1; -- u_int16_t rst:1; -- u_int16_t psh:1; -- u_int16_t ack:1; -- u_int16_t urg:1; -- u_int16_t res2:2; -+ u_int8_t th_x2:4; -+ u_int8_t th_off:4; - #else -- u_int16_t doff:4; -- u_int16_t res1:4; -- u_int16_t res2:2; -- u_int16_t urg:1; -- u_int16_t ack:1; -- u_int16_t psh:1; -- u_int16_t rst:1; -- u_int16_t syn:1; -- u_int16_t fin:1; -+ u_int8_t th_off:4; -+ u_int8_t th_x2:4; - #endif -- u_int16_t window; -- u_int16_t check; -- u_int16_t urg_ptr; -+ u_int8_t th_flags; -+ u_int16_t th_win; -+ u_int16_t th_sum; -+ u_int16_t th_urp; -+ }; -+ }; - }; -+#endif - -+#ifdef _GNU_SOURCE - #define TCPI_OPT_TIMESTAMPS 1 - #define TCPI_OPT_SACK 2 - #define TCPI_OPT_WSCALE 4 -diff --git a/include/netinet/udp.h b/include/netinet/udp.h -index 15b9145..223a5e3 100644 ---- a/include/netinet/udp.h -+++ b/include/netinet/udp.h -@@ -8,17 +8,25 @@ extern "C" { - #include <stdint.h> - - struct udphdr { -- uint16_t source; -- uint16_t dest; -- uint16_t len; -- uint16_t check; -+#ifdef __GNUC__ -+ __extension__ -+#endif -+ union { -+ struct { -+ uint16_t source; -+ uint16_t dest; -+ uint16_t len; -+ uint16_t check; -+ }; -+ struct { -+ uint16_t uh_sport; -+ uint16_t uh_dport; -+ uint16_t uh_ulen; -+ uint16_t uh_sum; -+ }; -+ }; - }; - --#define uh_sport source --#define uh_dport dest --#define uh_ulen len --#define uh_sum check -- - #define UDP_CORK 1 - #define UDP_ENCAP 100 - --- -1.8.5.2 - diff --git a/main/musl/1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch b/main/musl/1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch deleted file mode 100644 index 30a4d1e688..0000000000 --- a/main/musl/1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch +++ /dev/null @@ -1,24 +0,0 @@ -From b6d93b2791665581ca662adb4cdc9554e17f072f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Mon, 13 Jan 2014 13:36:03 +0200 -Subject: [PATCH] add NO_ADDRESS to alias as NO_DATA like glibc does - ---- - include/netdb.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/include/netdb.h b/include/netdb.h -index 2dd799b..dfc70e2 100644 ---- a/include/netdb.h -+++ b/include/netdb.h -@@ -131,6 +131,7 @@ int *__h_errno_location(void); - #define TRY_AGAIN 2 - #define NO_RECOVERY 3 - #define NO_DATA 4 -+#define NO_ADDRESS NO_DATA - #endif - - #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE) --- -1.8.5.2 - diff --git a/main/musl/1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch b/main/musl/1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch deleted file mode 100644 index 168316504c..0000000000 --- a/main/musl/1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch +++ /dev/null @@ -1,34 +0,0 @@ -From d0d389bcd65c2d8ca519a6dbe6f083d5a34ec249 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Mon, 13 Jan 2014 21:19:44 +0200 -Subject: [PATCH] add TIMEVAL_TO_TIMESPEC and TIMESPEC_TO_TIMEVAL - ---- - include/sys/time.h | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/include/sys/time.h b/include/sys/time.h -index b6787c3..9fd791c 100644 ---- a/include/sys/time.h -+++ b/include/sys/time.h -@@ -10,6 +10,17 @@ extern "C" { - - int gettimeofday (struct timeval *__restrict, void *__restrict); - -+#if defined(_GNU_SOURCE) -+#define TIMEVAL_TO_TIMESPEC(tv, ts) { \ -+ (ts)->tv_sec = (tv)->tv_sec; \ -+ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ -+} -+#define TIMESPEC_TO_TIMEVAL(tv, ts) { \ -+ (tv)->tv_sec = (ts)->tv_sec; \ -+ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ -+} -+#endif -+ - #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \ - || defined(_BSD_SOURCE) - --- -1.8.5.2 - diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index a5ebca83de..d9dd4056b2 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs <timo.teras@iki.fi> pkgname=musl pkgver=0.9.15 -pkgrel=2 +pkgrel=3 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -14,11 +14,8 @@ install="" subpackages="$pkgname-dev $pkgname-utils" [ "${CTARGET#*musl}" = "$CTARGET" ] && subpackages="$subpackages musl-gcc:crosstool" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz + 0001-git-0.9.15-to-3e02ce1b411.patch 1001-add-basic-dns-record-parsing-functions.patch - 1002-add-legacy-functions-setkey-and-encrypt.patch - 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch - 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch - 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch 2001-workaround-gcc-pr58245.patch getopt_long.c @@ -111,33 +108,24 @@ crosstool() { } md5sums="06f590a38c85722ee9343db2416425f4 musl-0.9.15.tar.gz +06ec0e41d9b426acbd47869038ba0588 0001-git-0.9.15-to-3e02ce1b411.patch a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch -ab5e596aae4a55ea3a0c17004c28c991 1002-add-legacy-functions-setkey-and-encrypt.patch -405bd5b61acc9e44c39a8badb82f15bd 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch -08956121f90f9f16d0c26df767309c0b 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch -e8b0d4ab4364a8581162d5727383f427 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch 7a09c5cd7b3e9532e6902f54a5e928bb 2001-workaround-gcc-pr58245.patch 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c ef81489a6258501cf45db58dfc6d5211 getent 33e4fd94e2560e008e2c3b431d0e3419 ldconfig" sha256sums="4a7baab8f295511196dee48d33b8b82a159a81233facb89433707c792033cbe7 musl-0.9.15.tar.gz +8c03e089985384e2fc2765db3b7c09c91bce1144f5ebf2456ce8ca642104e4b0 0001-git-0.9.15-to-3e02ce1b411.patch 758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch -45ab39525f5902d17913185817769d654611f193d81fa36bc6faed905451bdbb 1002-add-legacy-functions-setkey-and-encrypt.patch -d7e6dc31feb23b07063a62e7ad4f63216dd83ab4bdbde0e5750095c8b18d8c20 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch -c3bb37b28cb8e5724ec81314a2188e774412e2caa567c1d0f499d0d2f1c74c9d 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch -b22e83321a8f872a0000e4c63e878d460d8f278759216369d97ed943ba8eef01 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch 45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f 2001-workaround-gcc-pr58245.patch d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent 306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb ldconfig" sha512sums="2c5f3e742cf29fd76db8079b6012b1b359eda635593995ea8add008abc9744f0ca504e915f7828692aeafc3bddc66e0716492182cd5696e2fa24d9a2289601b8 musl-0.9.15.tar.gz +b721a91b5ff520b5406ecf43f033a82dc71686ccf2d025293b6457d6e77f3a6619fefeb3f3af620d8297b79f820d2bb7c94ca5695b0a284e19305bd4e54c8bed 0001-git-0.9.15-to-3e02ce1b411.patch dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch -1b3c162985fa9b1699004007c811ca1f3ff8e144722c7d3bae7f118b8c46694888f125d00aef66eef4c836cbc2000daa0f5c7a728981eb7746c84d64b1bc3d96 1002-add-legacy-functions-setkey-and-encrypt.patch -33b3d574cd508f557d799f11d8aa884fe9404384093ea869efbe3677e642eeb761ac95ccb9125eaadf0a2b4433e8fd7aa3ea9d52e3919696c2735273e68108c4 1003-use-anonymous-union-to-provide-bsd-and-gnu-variants-.patch -b4eee38bb18883cee2c9317cc06a0fce7b805206afb3846e1dbd86be75f161f70ad5a6b4918dbbfcfdbec9300400ebd2b8e65e233a1b409898e40479d45cbb1d 1004-add-NO_ADDRESS-to-alias-as-NO_DATA-like-glibc-does.patch -3cea9ba259362455526f841b9dac79a4d50016e58581db071ba7c5fb1c176e4f994744286c3491b376ff3b5a0815f2a76d382a37474c5b09bcaa06dcf283e4d4 1005-add-TIMEVAL_TO_TIMESPEC-and-TIMESPEC_TO_TIMEVAL.patch 69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 2001-workaround-gcc-pr58245.patch 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c |