Compare commits

...

6 commits

Author SHA1 Message Date
Jonas 'Sortie' Termansen
b63e5af467 Add secure_getenv(3). 2024-06-23 23:31:37 +02:00
Jonas 'Sortie' Termansen
0ff1b68c09 Add WCOREDUMP. 2024-06-23 23:22:50 +02:00
Jonas 'Sortie' Termansen
85bad22f34 fixup! Recognize and advertise POSIX 2024 support. 2024-06-23 23:19:16 +02:00
Jonas 'Sortie' Termansen
3474d7f674 Add PTHREAD_NULL. 2024-06-23 23:04:04 +02:00
Jonas 'Sortie' Termansen
c3c59403c9 Add NSIG_MAX. 2024-06-23 22:50:02 +02:00
Jonas 'Sortie' Termansen
020c263d5d Add nl_langinfo(3) ALTMON_* and ABALTMON_*. 2024-06-23 22:32:13 +02:00
9 changed files with 91 additions and 30 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014 Jonas 'Sortie' Termansen.
* Copyright (c) 2014, 2024 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -42,6 +42,8 @@ extern "C" {
#define __WSTOPSIG(status) __WTERMSIG(status)
#define __WCOREDUMP(status) ((status) & 0)
#define __WCONSTRUCT(nature, exitcode, signal) \
(((nature) & 0xFF) << 16 | \
((exitcode) & 0xFF) << 8 | \

View file

@ -22,6 +22,8 @@
#include <sys/cdefs.h>
#include <sortix/__/sigset.h>
#if __USE_SORTIX || __USE_POSIX
#define HOST_NAME_MAX 255
#define TTY_NAME_MAX 32
@ -30,6 +32,7 @@
#if __USE_SORTIX || 202405L <= __USE_POSIX
#define GETENTROPY_MAX 256
#define NSIG_MAX __SIGSET_NUM_SIGNALS
#endif
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2014 Jonas 'Sortie' Termansen.
* Copyright (c) 2012, 2014, 2024 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -48,6 +48,8 @@ extern "C" {
#define WSTOPSIG(status) __WSTOPSIG(status)
#define WCOREDUMP(status) __WCOREDUMP(status)
#define WCONSTRUCT(nature, exitcode, signal) \
__WCONSTRUCT(nature, exitcode, signal)

View file

@ -164,6 +164,7 @@ stdlib/qsort.o \
stdlib/qsort_r.o \
stdlib/reallocarray.o \
stdlib/realloc.o \
stdlib/secure_getenv.o \
stdlib/strtod.o \
stdlib/strtof.o \
stdlib/strtold.o \

View file

@ -88,6 +88,30 @@ typedef int nl_item;
#define YESEXPR 53
#define NOEXPR 54
#define CRNCYSTR 55
#define ALTMON_1 56
#define ALTMON_2 57
#define ALTMON_3 58
#define ALTMON_4 59
#define ALTMON_5 60
#define ALTMON_6 61
#define ALTMON_7 62
#define ALTMON_8 63
#define ALTMON_9 64
#define ALTMON_10 65
#define ALTMON_11 66
#define ALTMON_12 67
#define ABALTMON_1 69
#define ABALTMON_2 70
#define ABALTMON_3 71
#define ABALTMON_4 72
#define ABALTMON_5 73
#define ABALTMON_6 74
#define ABALTMON_7 75
#define ABALTMON_8 76
#define ABALTMON_9 77
#define ABALTMON_10 78
#define ABALTMON_11 79
#define ABALTMON_12 80
#ifdef __cplusplus
extern "C" {

View file

@ -168,6 +168,8 @@ struct pthread_cond_elem
#define PTHREAD_ONCE_INIT { PTHREAD_NORMAL_MUTEX_INITIALIZER_NP, 0 }
#define PTHREAD_NULL ((pthread_t) 0)
#if defined(__is_sortix_libc)
struct pthread_key

View file

@ -115,8 +115,6 @@ size_t mbstowcs(wchar_t* __restrict, const char* __restrict, size_t);
int mbtowc(wchar_t *__restrict, const char* __restrict, size_t);
char* mkdtemp(char*);
char* mkdtemps(char*, size_t);
int mkostemp(char*, int);
int mkostemps(char*, int, int);
int mkstemp(char*);
int mkstemps(char*, int);
int on_exit(void (*function)(int, void*), void* arg);
@ -157,6 +155,8 @@ long long strtoll(const char* __restrict, char** __restrict, int);
/* Functions from POSIX 2024. */
#if __USE_SORTIX || 202405L <= __USE_POSIX
int mkostemp(char*, int);
int ptsname_r(int, char*, size_t);
void qsort_r(void*, size_t, size_t, int (*)(const void*, const void*, void*), void*);
#ifdef __TRACE_ALLOCATION_SITES
void* reallocarray_trace(struct __allocation_site*, void*, size_t, size_t);
@ -164,6 +164,7 @@ void* reallocarray_trace(struct __allocation_site*, void*, size_t, size_t);
#else
void* reallocarray(void*, size_t, size_t);
#endif
char* secure_getenv(const char*);
#endif
#if defined(__is_sortix_libc)
@ -214,7 +215,7 @@ int posix_openpt(int);
uint32_t arc4random(void);
void arc4random_buf(void*, size_t);
uint32_t arc4random_uniform(uint32_t);
int ptsname_r(int, char*, size_t);
int mkostemps(char*, int, int);
#endif
#ifdef __cplusplus

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016 Jonas 'Sortie' Termansen.
* Copyright (c) 2016, 2024 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -45,30 +45,30 @@ char* nl_langinfo_l(nl_item item, locale_t locale)
case ABDAY_5: return "Thu";
case ABDAY_6: return "Fri";
case ABDAY_7: return "Sat";
case MON_1: return "January";
case MON_2: return "February";
case MON_3: return "March";
case MON_4: return "April";
case MON_5: return "May";
case MON_6: return "June";
case MON_7: return "July";
case MON_8: return "August";
case MON_9: return "September";
case MON_10: return "October";
case MON_11: return "November";
case MON_12: return "December";
case ABMON_1: return "Jan";
case ABMON_2: return "Feb";
case ABMON_3: return "Mar";
case ABMON_4: return "Apr";
case ABMON_5: return "May";
case ABMON_6: return "Jun";
case ABMON_7: return "Jul";
case ABMON_8: return "Aug";
case ABMON_9: return "Sep";
case ABMON_10: return "Oct";
case ABMON_11: return "Nov";
case ABMON_12: return "Dec";
case MON_1: case ALTMON_1: return "January";
case MON_2: case ALTMON_2: return "February";
case MON_3: case ALTMON_3: return "March";
case MON_4: case ALTMON_4: return "April";
case MON_5: case ALTMON_5: return "May";
case MON_6: case ALTMON_6: return "June";
case MON_7: case ALTMON_7: return "July";
case MON_8: case ALTMON_8: return "August";
case MON_9: case ALTMON_9: return "September";
case MON_10: case ALTMON_10: return "October";
case MON_11: case ALTMON_11: return "November";
case MON_12: case ALTMON_12: return "December";
case ABMON_1: case ABALTMON_1: return "Jan";
case ABMON_2: case ABALTMON_2: return "Feb";
case ABMON_3: case ABALTMON_3: return "Mar";
case ABMON_4: case ABALTMON_4: return "Apr";
case ABMON_5: case ABALTMON_5: return "May";
case ABMON_6: case ABALTMON_6: return "Jun";
case ABMON_7: case ABALTMON_7: return "Jul";
case ABMON_8: case ABALTMON_8: return "Aug";
case ABMON_9: case ABALTMON_9: return "Sep";
case ABMON_10: case ABALTMON_10: return "Oct";
case ABMON_11: case ABALTMON_11: return "Nov";
case ABMON_12: case ABALTMON_12: return "Dec";
case ERA: return "";
case ERA_D_FMT: return "";
case ERA_D_T_FMT: return "";

View file

@ -0,0 +1,26 @@
/*
* Copyright (c) 2024 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* stdlib/secure_getenv.c
* Get an environment variable securely.
*/
#include <stdlib.h>
char* secure_getenv(const char* name)
{
// Sortix does not have setuid / setgid executables.
return getenv(name);
}