mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-08 04:08:32 +00:00
Make improvements
- This change fixes a bug that allowed unbuffered printf() output (to streams like stderr) to be truncated. This regression was introduced some time between now and the last release. - POSIX specifies all functions as thread safe by default. This change works towards cleaning up our use of the @threadsafe / @threadunsafe documentation annotations to reflect that. The goal is (1) to use @threadunsafe to document functions which POSIX say needn't be thread safe, and (2) use @threadsafe to document functions that we chose to implement as thread safe even though POSIX didn't mandate it. - Tidy up the clock_gettime() implementation. We're now trying out a cleaner approach to system call support that aims to maintain the Linux errno convention as long as possible. This also fixes bugs that existed previously, where the vDSO errno wasn't being translated properly. The gettimeofday() system call is now a wrapper for clock_gettime(), which reduces bloat in apps that use both. - The recently-introduced improvements to the execute bit on Windows has had bugs fixed. access(X_OK) on a directory on Windows now succeeds. fstat() will now perform the MZ/#! ReadFile() operation correctly. - Windows.h is no longer included in libc/isystem/, because it confused PCRE's build system into thinking Cosmopolitan is a WIN32 platform. Cosmo's Windows.h polyfill was never even really that good, since it only defines a subset of the subset of WIN32 APIs that Cosmo defines. - The setlongerjmp() / longerjmp() APIs are removed. While they're nice APIs that are superior to the standardized setjmp / longjmp functions, they weren't superior enough to not be dead code in the monorepo. If you use these APIs, please file an issue and they'll be restored. - The .com appending magic has now been removed from APE Loader.
This commit is contained in:
parent
b99512ac58
commit
ff77f2a6af
226 changed files with 708 additions and 2657 deletions
|
@ -26,7 +26,7 @@
|
|||
* @note type signature supports dates greater than 2100
|
||||
* @see PKZIP, FAT
|
||||
*/
|
||||
int64_t DosDateTimeToUnix(unsigned date, unsigned time) {
|
||||
int64_t DosDateTimeToUnix(uint32_t date, uint32_t time) {
|
||||
unsigned year, month, day, hour, minute, second, yday, leap;
|
||||
year = ((date & 0xfffffe00) >> 9) + 1980 - 1900;
|
||||
month = MAX(1, MIN(12, (date & 0x01e0) >> 5));
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
#include "libc/zip.internal.h"
|
||||
|
||||
static inline int pop(int x) {
|
||||
|
|
|
@ -75,6 +75,7 @@ o/$(MODE)/libc/str/iswseparator.o: private \
|
|||
CFLAGS += \
|
||||
-fno-jump-tables
|
||||
|
||||
# ensure that division is optimized
|
||||
o/$(MODE)/libc/str/bcmp.o \
|
||||
o/$(MODE)/libc/str/strcmp.o \
|
||||
o/$(MODE)/libc/str/windowsdurationtotimeval.o \
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
* @param sep is a NUL-terminated set of bytes to consider separators
|
||||
* @return pointer to next token or NULL for end
|
||||
* @see strtok_r() and strsep() for superior functions
|
||||
* @notasyncsignalsafe
|
||||
* @threadunsafe
|
||||
*/
|
||||
char *strtok(char *s, const char *sep) {
|
||||
static char *state;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
int64_t TimeSpecToWindowsTime(struct timespec t) {
|
||||
return t.tv_nsec / 100 + (t.tv_sec + MODERNITYSECONDS) * HECTONANOSECONDS;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
int64_t TimeValToWindowsTime(struct timeval t) {
|
||||
return t.tv_usec * 10 + (t.tv_sec + MODERNITYSECONDS) * HECTONANOSECONDS;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
struct timespec WindowsDurationToTimeSpec(int64_t x) {
|
||||
return (struct timespec){x / HECTONANOSECONDS, x % HECTONANOSECONDS * 100};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
struct timeval WindowsDurationToTimeVal(int64_t x) {
|
||||
return (struct timeval){x / HECTONANOSECONDS, x % HECTONANOSECONDS / 10};
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
/**
|
||||
* Converts Windows COBOL timestamp to UNIX epoch in nanoseconds.
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/wintime.internal.h"
|
||||
|
||||
/**
|
||||
* Converts Windows COBOL timestamp to UNIX epoch in microseconds.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue