mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 02:38:31 +00:00
Fix the build
This commit is contained in:
parent
8111462789
commit
af2ef0d223
6 changed files with 65 additions and 25 deletions
|
@ -11,11 +11,10 @@
|
|||
#define st_mtime_nsec st_mtim.tv_nsec
|
||||
#define st_ctime_nsec st_ctim.tv_nsec
|
||||
|
||||
#define st_atimensec st_atim.tv_nsec
|
||||
#define st_mtimensec st_mtim.tv_nsec
|
||||
#define st_ctimensec st_ctim.tv_nsec
|
||||
#define st_birthtime st_birthtim.tv_sec
|
||||
#define st_birthtimensec st_birthtim.tv_nsec
|
||||
#define st_atimensec st_atim.tv_nsec
|
||||
#define st_mtimensec st_mtim.tv_nsec
|
||||
#define st_ctimensec st_ctim.tv_nsec
|
||||
#define st_birthtime st_birthtim.tv_sec
|
||||
|
||||
#define st_file_attributes st_flags
|
||||
|
||||
|
|
24
libc/stdio/__fseterr.c
Normal file
24
libc/stdio/__fseterr.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or 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. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/errno.h"
|
||||
#include "libc/stdio/stdio_ext.h"
|
||||
|
||||
void __fseterr(FILE *f) {
|
||||
f->state |= EIO;
|
||||
}
|
|
@ -19,6 +19,7 @@ int __fwriting(FILE *);
|
|||
int __fsetlocking(FILE *, int);
|
||||
void _flushlbf(void);
|
||||
void __fpurge(FILE *);
|
||||
void __fseterr(FILE *);
|
||||
|
||||
COSMOPOLITAN_C_END_
|
||||
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/str/path.h"
|
||||
#include "libc/str/str.h"
|
||||
|
@ -23,12 +24,14 @@
|
|||
#include "libc/thread/thread.h"
|
||||
|
||||
const char *__sem_name(const char *name, char path[hasatleast PATH_MAX]) {
|
||||
const char *res;
|
||||
if (_isabspath(name)) {
|
||||
return name;
|
||||
res = name;
|
||||
} else {
|
||||
strlcpy(path, kTmpPath, PATH_MAX);
|
||||
strlcat(path, ".sem-", PATH_MAX);
|
||||
strlcat(path, name, PATH_MAX);
|
||||
return path;
|
||||
res = path;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,12 @@ sem_t *sem_open(const char *name, int oflag, ...) {
|
|||
}
|
||||
|
||||
sem = mmap(0, sizeof(sem_t), PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (sem != MAP_FAILED) sem->sem_pshared = true;
|
||||
if (sem != MAP_FAILED) {
|
||||
sem->sem_pshared = true;
|
||||
} else {
|
||||
sem = SEM_FAILED;
|
||||
}
|
||||
|
||||
_npassert(!close(fd));
|
||||
return sem;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue