Make minor improvements

This commit is contained in:
Justine Tunney 2020-12-23 23:42:56 -08:00
parent 04caf6f9ad
commit 95b142e4e5
95 changed files with 3818 additions and 2760 deletions

View file

@ -227,9 +227,9 @@ uint32_t gettid(void) nosideeffect;
uint32_t getuid(void) nosideeffect;
uint32_t umask(int32_t);
#define getcwd(BUF, SIZE) \
(isconstant(BUF) && (&(BUF)[0] == NULL) ? get_current_dir_name() \
: getcwd(BUF, SIZE))
#define getcwd(BUF, SIZE) \
(__builtin_constant_p(BUF) && (&(BUF)[0] == NULL) ? get_current_dir_name() \
: getcwd(BUF, SIZE))
/*───────────────────────────────────────────────────────────────────────────│─╗
cosmopolitan § system calls » formatting
@ -249,7 +249,7 @@ void _init_wincrash(void);
#define __SIGACTION(FN, SIG, ...) \
({ \
if (SupportsWindows()) { \
if (isconstant(SIG)) { \
if (__builtin_constant_p(SIG)) { \
switch (SIG) { \
case SIGINT: \
case SIGQUIT: \

View file

@ -63,7 +63,7 @@ int clock_gettime(int clockid, struct timespec *out_ts) {
return clock_gettime$sysv(clockid, out_ts);
} else {
int rc;
static_assert(sizeof(struct timeval) == sizeof(struct timespec));
_Static_assert(sizeof(struct timeval) == sizeof(struct timespec));
if (out_ts) {
out_ts->tv_sec = 0;
out_ts->tv_nsec = 0;

View file

@ -33,7 +33,7 @@
#define kBufSize 1024
#define kProcStatus "/proc/self/status"
alignas(16) static const char kGdbPid[] = "TracerPid:\t";
_Alignas(16) static const char kGdbPid[] = "TracerPid:\t";
/**
* Determines if gdb, strace, windbg, etc. is controlling process.

View file

@ -121,11 +121,11 @@ static void sigaction$native2cosmo(union metasigaction *sa) {
* @asyncsignalsafe
*/
int(sigaction)(int sig, const struct sigaction *act, struct sigaction *oldact) {
static_assert(sizeof(struct sigaction) > sizeof(struct sigaction$linux) &&
sizeof(struct sigaction) > sizeof(struct sigaction$xnu_in) &&
sizeof(struct sigaction) > sizeof(struct sigaction$xnu_out) &&
sizeof(struct sigaction) > sizeof(struct sigaction$freebsd) &&
sizeof(struct sigaction) > sizeof(struct sigaction$openbsd));
_Static_assert(sizeof(struct sigaction) > sizeof(struct sigaction$linux) &&
sizeof(struct sigaction) > sizeof(struct sigaction$xnu_in) &&
sizeof(struct sigaction) > sizeof(struct sigaction$xnu_out) &&
sizeof(struct sigaction) > sizeof(struct sigaction$freebsd) &&
sizeof(struct sigaction) > sizeof(struct sigaction$openbsd));
int rc, rva, oldrva;
struct sigaction *ap, copy;
if (!(0 < sig && sig < NSIG) || sig == SIGKILL || sig == SIGSTOP) {

View file

@ -21,7 +21,7 @@
#include "libc/calls/calls.h"
/**
* Deletes file, the Cosmopolitan way.
* Deletes file.
*
* The caller's variable is made NULL. Note that we define unlink(NULL)
* as a no-op.