mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-08 07:42:09 +03:00
extensive header cleanup for standards conformance & correctness
thanks to Peter Mazinger (psm) for pointing many of these issues out and submitting a patch on which this commit is loosely based
This commit is contained in:
parent
80695b1d1e
commit
74eea628cf
@ -68,9 +68,9 @@ TYPEDEF long long intmax_t;
|
|||||||
TYPEDEF unsigned long long uintmax_t;
|
TYPEDEF unsigned long long uintmax_t;
|
||||||
|
|
||||||
TYPEDEF long time_t;
|
TYPEDEF long time_t;
|
||||||
TYPEDEF unsigned int useconds_t;
|
TYPEDEF unsigned useconds_t;
|
||||||
TYPEDEF int suseconds_t;
|
TYPEDEF int suseconds_t;
|
||||||
STRUCT timeval { time_t tv_sec; long tv_usec; };
|
STRUCT timeval { time_t tv_sec; int tv_usec; };
|
||||||
STRUCT timespec { time_t tv_sec; long tv_nsec; };
|
STRUCT timespec { time_t tv_sec; long tv_nsec; };
|
||||||
|
|
||||||
TYPEDEF int pid_t;
|
TYPEDEF int pid_t;
|
||||||
@ -111,5 +111,6 @@ TYPEDEF int nl_item;
|
|||||||
|
|
||||||
TYPEDEF struct __locale * locale_t;
|
TYPEDEF struct __locale * locale_t;
|
||||||
|
|
||||||
|
STRUCT iovec { void *iov_base; size_t iov_len; };
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
struct iovec;
|
|
||||||
|
|
||||||
struct msghdr
|
struct msghdr
|
||||||
{
|
{
|
||||||
void *msg_name;
|
void *msg_name;
|
||||||
|
@ -15,11 +15,8 @@ struct stat
|
|||||||
off_t st_size;
|
off_t st_size;
|
||||||
blksize_t st_blksize;
|
blksize_t st_blksize;
|
||||||
blkcnt_t st_blocks;
|
blkcnt_t st_blocks;
|
||||||
time_t st_atime;
|
struct timespec st_atim;
|
||||||
unsigned long __st_atime_nsec;
|
struct timespec st_mtim;
|
||||||
time_t st_mtime;
|
struct timespec st_ctim;
|
||||||
unsigned long __st_mtime_nsec;
|
|
||||||
time_t st_ctime;
|
|
||||||
unsigned long __st_ctime_nsec;
|
|
||||||
ino_t st_ino;
|
ino_t st_ino;
|
||||||
};
|
};
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
struct iovec {
|
|
||||||
void *iov_base;
|
|
||||||
size_t iov_len;
|
|
||||||
};
|
|
@ -6,6 +6,8 @@
|
|||||||
#define WCONTINUED 8
|
#define WCONTINUED 8
|
||||||
#define WNOWAIT 0x1000000
|
#define WNOWAIT 0x1000000
|
||||||
|
|
||||||
|
#if defined(__XOPEN_SOURCE) || defined(__GNU_SOURCE)
|
||||||
#define P_ALL 0
|
#define P_ALL 0
|
||||||
#define P_PID 1
|
#define P_PID 1
|
||||||
#define P_PGID 2
|
#define P_PGID 2
|
||||||
|
#endif
|
||||||
|
@ -16,12 +16,6 @@ int isxdigit(int);
|
|||||||
int tolower(int);
|
int tolower(int);
|
||||||
int toupper(int);
|
int toupper(int);
|
||||||
|
|
||||||
int isascii(int);
|
|
||||||
int toascii(int);
|
|
||||||
|
|
||||||
#define _tolower(a) ((a)|0x20)
|
|
||||||
#define _toupper(a) ((a)&0x5f)
|
|
||||||
|
|
||||||
#define isalpha(a) ((unsigned)(((a)|32)-'a') < 26)
|
#define isalpha(a) ((unsigned)(((a)|32)-'a') < 26)
|
||||||
#define isdigit(a) ((unsigned)((a)-'0') < 10)
|
#define isdigit(a) ((unsigned)((a)-'0') < 10)
|
||||||
#define islower(a) ((unsigned)((a)-'a') < 26)
|
#define islower(a) ((unsigned)((a)-'a') < 26)
|
||||||
@ -29,7 +23,10 @@ int toascii(int);
|
|||||||
#define isprint(a) ((unsigned)((a)-0x20) < 0x5f)
|
#define isprint(a) ((unsigned)((a)-0x20) < 0x5f)
|
||||||
#define isgraph(a) ((unsigned)((a)-0x21) < 0x5e)
|
#define isgraph(a) ((unsigned)((a)-0x21) < 0x5e)
|
||||||
|
|
||||||
#if 1
|
|
||||||
|
|
||||||
|
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
||||||
|
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
|
||||||
|
|
||||||
#define __NEED_locale_t
|
#define __NEED_locale_t
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
@ -48,6 +45,12 @@ int isupper_l(int, locale_t);
|
|||||||
int isxdigit_l(int, locale_t);
|
int isxdigit_l(int, locale_t);
|
||||||
int tolower_l(int, locale_t);
|
int tolower_l(int, locale_t);
|
||||||
int toupper_l(int, locale_t);
|
int toupper_l(int, locale_t);
|
||||||
|
|
||||||
|
int isascii(int);
|
||||||
|
int toascii(int);
|
||||||
|
#define _tolower(a) ((a)|0x20)
|
||||||
|
#define _toupper(a) ((a)&0x5f)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,6 +6,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __NEED_nl_item
|
#define __NEED_nl_item
|
||||||
|
#define __NEED_locale_t
|
||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
@ -77,6 +78,7 @@ extern "C" {
|
|||||||
#define NOSTR 0x50003
|
#define NOSTR 0x50003
|
||||||
|
|
||||||
char *nl_langinfo(nl_item);
|
char *nl_langinfo(nl_item);
|
||||||
|
char *nl_langinfo_l(nl_item, locale_t);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
#define NL_SETMAX 255
|
#define NL_SETMAX 255
|
||||||
#define NL_TEXTMAX 2048
|
#define NL_TEXTMAX 2048
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/* POSIX/SUS requirements follow. These numbers come directly
|
/* POSIX/SUS requirements follow. These numbers come directly
|
||||||
* from SUS and have nothing to do with the host system. */
|
* from SUS and have nothing to do with the host system. */
|
||||||
|
|
||||||
@ -56,6 +58,7 @@
|
|||||||
#define _POSIX_AIO_MAX 1
|
#define _POSIX_AIO_MAX 1
|
||||||
#define _POSIX_ARG_MAX 4096
|
#define _POSIX_ARG_MAX 4096
|
||||||
#define _POSIX_CHILD_MAX 25
|
#define _POSIX_CHILD_MAX 25
|
||||||
|
#define _POSIX_CLOCKRES_MIN 20000000
|
||||||
#define _POSIX_DELAYTIMER_MAX 32
|
#define _POSIX_DELAYTIMER_MAX 32
|
||||||
#define _POSIX_HOST_NAME_MAX 255
|
#define _POSIX_HOST_NAME_MAX 255
|
||||||
#define _POSIX_LINK_MAX 8
|
#define _POSIX_LINK_MAX 8
|
||||||
@ -104,5 +107,3 @@
|
|||||||
#define _XOPEN_PATH_MAX 1024
|
#define _XOPEN_PATH_MAX 1024
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
|
@ -6,20 +6,6 @@
|
|||||||
#define __NEED___uint64_t
|
#define __NEED___uint64_t
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
#define M_E 2.7182818284590452354 /* e */
|
|
||||||
#define M_LOG2E 1.4426950408889634074 /* log_2 e */
|
|
||||||
#define M_LOG10E 0.43429448190325182765 /* log_10 e */
|
|
||||||
#define M_LN2 0.69314718055994530942 /* log_e 2 */
|
|
||||||
#define M_LN10 2.30258509299404568402 /* log_e 10 */
|
|
||||||
#define M_PI 3.14159265358979323846 /* pi */
|
|
||||||
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
|
||||||
#define M_PI_4 0.78539816339744830962 /* pi/4 */
|
|
||||||
#define M_1_PI 0.31830988618379067154 /* 1/pi */
|
|
||||||
#define M_2_PI 0.63661977236758134308 /* 2/pi */
|
|
||||||
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
|
|
||||||
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
|
||||||
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
|
||||||
|
|
||||||
#define __MAKE_FLOAT(i) (((union { int __i; float __f; }){ .__i = i }).__f)
|
#define __MAKE_FLOAT(i) (((union { int __i; float __f; }){ .__i = i }).__f)
|
||||||
|
|
||||||
#define NAN __MAKE_FLOAT(0x7fc00000)
|
#define NAN __MAKE_FLOAT(0x7fc00000)
|
||||||
@ -286,15 +272,31 @@ double trunc(double);
|
|||||||
float truncf(float);
|
float truncf(float);
|
||||||
long double truncl(long double);
|
long double truncl(long double);
|
||||||
|
|
||||||
/* XSI stuff */
|
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
|
||||||
|
#define M_E 2.7182818284590452354 /* e */
|
||||||
|
#define M_LOG2E 1.4426950408889634074 /* log_2 e */
|
||||||
|
#define M_LOG10E 0.43429448190325182765 /* log_10 e */
|
||||||
|
#define M_LN2 0.69314718055994530942 /* log_e 2 */
|
||||||
|
#define M_LN10 2.30258509299404568402 /* log_e 10 */
|
||||||
|
#define M_PI 3.14159265358979323846 /* pi */
|
||||||
|
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
||||||
|
#define M_PI_4 0.78539816339744830962 /* pi/4 */
|
||||||
|
#define M_1_PI 0.31830988618379067154 /* 1/pi */
|
||||||
|
#define M_2_PI 0.63661977236758134308 /* 2/pi */
|
||||||
|
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
|
||||||
|
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
||||||
|
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
||||||
double j0(double);
|
double j0(double);
|
||||||
double j1(double);
|
double j1(double);
|
||||||
double jn(int, double);
|
double jn(int, double);
|
||||||
double scalb(double, double);
|
|
||||||
double y0(double);
|
double y0(double);
|
||||||
double y1(double);
|
double y1(double);
|
||||||
double yn(int, double);
|
double yn(int, double);
|
||||||
|
|
||||||
extern int signgam;
|
extern int signgam;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _GNU_SOURCE
|
||||||
|
double scalb(double, double);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -6,19 +6,27 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <bits/setjmp.h>
|
#include <bits/setjmp.h>
|
||||||
typedef unsigned long sigjmp_buf[(1024+sizeof(jmp_buf))/sizeof(long)];
|
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
||||||
|
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
|
||||||
|
typedef unsigned long sigjmp_buf[(1024+sizeof(jmp_buf))/sizeof(long)];
|
||||||
#ifdef _GNU_SOURCE
|
#ifdef _GNU_SOURCE
|
||||||
#define jmp_buf sigjmp_buf
|
#define jmp_buf sigjmp_buf
|
||||||
#endif
|
#endif
|
||||||
|
int sigsetjmp (sigjmp_buf, int);
|
||||||
|
void siglongjmp (sigjmp_buf, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
|
||||||
|
int _setjmp (jmp_buf);
|
||||||
|
void _longjmp (jmp_buf, int);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int setjmp (jmp_buf);
|
int setjmp (jmp_buf);
|
||||||
int _setjmp (jmp_buf);
|
|
||||||
int sigsetjmp (sigjmp_buf, int);
|
|
||||||
|
|
||||||
void longjmp (jmp_buf, int);
|
void longjmp (jmp_buf, int);
|
||||||
void _longjmp (jmp_buf, int);
|
|
||||||
void siglongjmp (sigjmp_buf, int);
|
|
||||||
|
|
||||||
#define setjmp setjmp
|
#define setjmp setjmp
|
||||||
#define longjmp longjmp
|
#define longjmp longjmp
|
||||||
|
@ -5,13 +5,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#undef NULL
|
|
||||||
#ifdef __cplusplus
|
|
||||||
#define NULL 0
|
|
||||||
#else
|
|
||||||
#define NULL ((void*)0)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define __NEED_size_t
|
#define __NEED_size_t
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
@ -11,6 +11,7 @@ extern "C" {
|
|||||||
#define __NEED_uid_t
|
#define __NEED_uid_t
|
||||||
#define __NEED_pid_t
|
#define __NEED_pid_t
|
||||||
#define __NEED_gid_t
|
#define __NEED_gid_t
|
||||||
|
#define __NEED_struct_iovec
|
||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
|
@ -14,11 +14,16 @@ extern "C" {
|
|||||||
#define __NEED_time_t
|
#define __NEED_time_t
|
||||||
#define __NEED_blksize_t
|
#define __NEED_blksize_t
|
||||||
#define __NEED_blkcnt_t
|
#define __NEED_blkcnt_t
|
||||||
|
#define __NEED_struct_timespec
|
||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
#include <bits/stat.h>
|
#include <bits/stat.h>
|
||||||
|
|
||||||
|
#define st_atime st_atim.tv_sec
|
||||||
|
#define st_mtime st_mtim.tv_sec
|
||||||
|
#define st_ctime st_ctim.tv_sec
|
||||||
|
|
||||||
#define S_IFMT 0170000
|
#define S_IFMT 0170000
|
||||||
|
|
||||||
#define S_IFDIR 0040000
|
#define S_IFDIR 0040000
|
||||||
|
@ -9,7 +9,7 @@ extern "C" {
|
|||||||
|
|
||||||
#define __NEED_time_t
|
#define __NEED_time_t
|
||||||
#define __NEED_suseconds_t
|
#define __NEED_suseconds_t
|
||||||
#define __NEED_timeval
|
#define __NEED_struct_timeval
|
||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
|
@ -3,11 +3,10 @@
|
|||||||
|
|
||||||
#define __NEED_size_t
|
#define __NEED_size_t
|
||||||
#define __NEED_ssize_t
|
#define __NEED_ssize_t
|
||||||
|
#define __NEED_struct_iovec
|
||||||
|
|
||||||
#include <bits/alltypes.h>
|
#include <bits/alltypes.h>
|
||||||
|
|
||||||
#include <bits/uio.h>
|
|
||||||
|
|
||||||
ssize_t readv (int, const struct iovec *, int);
|
ssize_t readv (int, const struct iovec *, int);
|
||||||
ssize_t writev (int, const struct iovec *, int);
|
ssize_t writev (int, const struct iovec *, int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user