mirror of
git://git.musl-libc.org/musl
synced 2024-12-25 08:02:28 +00:00
41c632824c
mips has signal numbers up to 127 (formerly, up to 128, but the last one never worked right and caused kernel panic when used), so 127 in the "signal number" field of the wait status is insufficient for determining that the process was stopped. in addition, a nonzero value in the upper bits must be present, indicating the signal number which caused the process to be stopped. details on this issue can be seen in the email with message id CAAG0J9-d4BfEhbQovFqUAJ3QoOuXScrpsY1y95PrEPxA5DWedQ@mail.gmail.com on the linux-mips mailing list, archived at: http://www.linux-mips.org/archives/linux-mips/2013-06/msg00552.html and in the associated thread about fixing the mips kernel bug. commit 4a96b948687166da26a6c327e6c6733ad2336c5c fixed the corresponding issue in uClibc, but introduced a multiple-evaluation issue for the WIFSTOPPED macro. for the most part, none of these issues affected pure musl systems, since musl has up until now (incorrectly) defined SIGRTMAX as 64 on all archs, even mips. however, interpreting status of non-musl programs on mips may have caused problems. with this change, the full range of signal numbers can be made available on mips.
168 lines
4.2 KiB
C
168 lines
4.2 KiB
C
#ifndef _STDLIB_H
|
|
#define _STDLIB_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include <features.h>
|
|
|
|
#define NULL 0L
|
|
|
|
#define __NEED_size_t
|
|
#define __NEED_wchar_t
|
|
|
|
#include <bits/alltypes.h>
|
|
|
|
int atoi (const char *);
|
|
long atol (const char *);
|
|
long long atoll (const char *);
|
|
double atof (const char *);
|
|
|
|
float strtof (const char *__restrict, char **__restrict);
|
|
double strtod (const char *__restrict, char **__restrict);
|
|
long double strtold (const char *__restrict, char **__restrict);
|
|
|
|
long strtol (const char *__restrict, char **__restrict, int);
|
|
unsigned long strtoul (const char *__restrict, char **__restrict, int);
|
|
long long strtoll (const char *__restrict, char **__restrict, int);
|
|
unsigned long long strtoull (const char *__restrict, char **__restrict, int);
|
|
|
|
int rand (void);
|
|
void srand (unsigned);
|
|
|
|
void *malloc (size_t);
|
|
void *calloc (size_t, size_t);
|
|
void *realloc (void *, size_t);
|
|
void free (void *);
|
|
void *aligned_alloc(size_t alignment, size_t size);
|
|
|
|
_Noreturn void abort (void);
|
|
int atexit (void (*) (void));
|
|
_Noreturn void exit (int);
|
|
_Noreturn void _Exit (int);
|
|
int at_quick_exit (void (*) (void));
|
|
_Noreturn void quick_exit (int);
|
|
|
|
char *getenv (const char *);
|
|
|
|
int system (const char *);
|
|
|
|
void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
|
|
void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
|
|
|
|
int abs (int);
|
|
long labs (long);
|
|
long long llabs (long long);
|
|
|
|
typedef struct { int quot, rem; } div_t;
|
|
typedef struct { long quot, rem; } ldiv_t;
|
|
typedef struct { long long quot, rem; } lldiv_t;
|
|
|
|
div_t div (int, int);
|
|
ldiv_t ldiv (long, long);
|
|
lldiv_t lldiv (long long, long long);
|
|
|
|
int mblen (const char *, size_t);
|
|
int mbtowc (wchar_t *__restrict, const char *__restrict, size_t);
|
|
int wctomb (char *, wchar_t);
|
|
size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t);
|
|
size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t);
|
|
|
|
#define EXIT_FAILURE 1
|
|
#define EXIT_SUCCESS 0
|
|
|
|
#define MB_CUR_MAX ((size_t)+4)
|
|
|
|
#define RAND_MAX (0x7fffffff)
|
|
|
|
|
|
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
|
|
|| defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
|
|| defined(_BSD_SOURCE)
|
|
|
|
#define WNOHANG 1
|
|
#define WUNTRACED 2
|
|
|
|
#define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
|
|
#define WTERMSIG(s) ((s) & 0x7f)
|
|
#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)
|
|
|
|
int posix_memalign (void **, size_t, size_t);
|
|
int setenv (const char *, const char *, int);
|
|
int unsetenv (const char *);
|
|
int mkstemp (char *);
|
|
int mkostemp (char *, int);
|
|
char *mkdtemp (char *);
|
|
int getsubopt (char **, char *const *, char **);
|
|
int rand_r (unsigned *);
|
|
|
|
#endif
|
|
|
|
|
|
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
|
|
|| defined(_BSD_SOURCE)
|
|
char *realpath (const char *__restrict, char *__restrict);
|
|
long int random (void);
|
|
void srandom (unsigned int);
|
|
char *initstate (unsigned int, char *, size_t);
|
|
char *setstate (char *);
|
|
#endif
|
|
|
|
#if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
|
|
int putenv (char *);
|
|
int posix_openpt (int);
|
|
int grantpt (int);
|
|
int unlockpt (int);
|
|
char *ptsname (int);
|
|
char *l64a (long);
|
|
long a64l (const char *);
|
|
void setkey (const char *);
|
|
double drand48 (void);
|
|
double erand48 (unsigned short [3]);
|
|
long int lrand48 (void);
|
|
long int nrand48 (unsigned short [3]);
|
|
long mrand48 (void);
|
|
long jrand48 (unsigned short [3]);
|
|
void srand48 (long);
|
|
unsigned short *seed48 (unsigned short [3]);
|
|
void lcong48 (unsigned short [7]);
|
|
#endif
|
|
|
|
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
#include <alloca.h>
|
|
char *mktemp (char *);
|
|
int mkstemps (char *, int);
|
|
int mkostemps (char *, int, int);
|
|
void *valloc (size_t);
|
|
void *memalign(size_t, size_t);
|
|
#define WCOREDUMP(s) ((s) & 0x80)
|
|
#define WIFCONTINUED(s) ((s) == 0xffff)
|
|
#endif
|
|
|
|
#ifdef _GNU_SOURCE
|
|
int clearenv(void);
|
|
int ptsname_r(int, char *, size_t);
|
|
char *ecvt(double, int, int *, int *);
|
|
char *fcvt(double, int, int *, int *);
|
|
char *gcvt(double, int, char *);
|
|
#endif
|
|
|
|
#if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
|
|
#define mkstemp64 mkstemp
|
|
#define mkostemp64 mkostemp
|
|
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
|
|
#define mkstemps64 mkstemps
|
|
#define mkostemps64 mkostemps
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|