cosmopolitan/libc/x/x.h
Justine Tunney f531acc8f9
Make improvements
- Invent openatemp() API
- Invent O_UNLINK open flag
- Introduce getenv_secure() API
- Remove `git pull` from cosmocc
- Fix utimes() when path is NULL
- Fix mktemp() to never return NULL
- Fix utimensat() UTIME_OMIT on XNU
- Improve utimensat() code for RHEL5
- Turn `argv[0]` C:/ to /C/ on Windows
- Introduce tmpnam() and tmpnam_r() APIs
- Fix more const issues with internal APIs
- Permit utimes() on WIN32 in O_RDONLY mode
- Fix fdopendir() to check fd is a directory
- Fix recent crash regression in landlock make
- Fix futimens(AT_FDCWD, NULL) to return EBADF
- Use workaround so `make -j` doesn't fork bomb
- Rename dontdiscard to __wur (just like glibc)
- Fix st_size for WIN32 symlinks containing UTF-8
- Introduce stdio ext APIs needed by GNU coreutils
- Fix lstat() on WIN32 for symlinks to directories
- Move some constants from normalize.inc to limits.h
- Fix segv with memchr() and memcmp() overlapping page
- Implement POSIX fflush() behavior for reader streams
- Implement AT_SYMLINK_NOFOLLOW for utimensat() on WIN32
- Don't change read-only status of existing files on WIN32
- Correctly handle `0x[^[:xdigit:]]` case in strtol() functions
2023-09-06 12:34:59 -07:00

101 lines
4.4 KiB
C

#ifndef COSMOPOLITAN_LIBC_X_H_
#define COSMOPOLITAN_LIBC_X_H_
#ifdef _COSMO_SOURCE
#define xwrite __xwrite
#define xdie __xdie
#define xmalloc __xmalloc
#define xrealloc __xrealloc
#define xcalloc __xcalloc
#define xvalloc __xvalloc
#define xmemalign __xmemalign
#define xmemalignzero __xmemalignzero
#define xstrdup __xstrdup
#define xstrndup __xstrndup
#define xstrmul __xstrmul
#define xinet_ntop __xinet_ntop
#define xunbinga __xunbinga
#define xunbing __xunbing
#define utf8to16 __utf8to16
#define utf16to8 __utf16to8
#define utf8to32 __utf8to32
#define utf16to32 __utf16to32
#define utf32to8 __utf32to8
#define xhomedir __xhomedir
#define xstripext __xstripext
#define xstripexts __xstripexts
#define xload __xload
#define rmrf __rmrf
#define xbasename __xbasename
#define xdirname __xdirname
#define xjoinpaths __xjoinpaths
#define xfixpath __xfixpath
#define xslurp __xslurp
#define xbarf __xbarf
#endif /* _COSMO_SOURCE */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
#ifdef _COSMO_SOURCE
COSMOPOLITAN_C_START_
int xwrite(int, const void *, uint64_t);
void xdie(void) wontreturn;
char *xdtoa(double)
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xdtoaf(float)
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xdtoal(long double)
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xmalloc(size_t) attributeallocsize((1))
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xrealloc(void *, size_t)
attributeallocsize((2)) dontthrow nocallback __wur;
void *xcalloc(size_t, size_t) attributeallocsize((1, 2))
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xvalloc(size_t) attributeallocsize((1)) returnsaligned((65536))
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xmemalign(size_t, size_t) attributeallocalign((1)) attributeallocsize((2))
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xmemalignzero(size_t, size_t) attributeallocalign((1)) attributeallocsize(
(2)) returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xstrdup(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xstrndup(const char *, size_t) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xstrcat(const char *, ...) paramsnonnull((1)) nullterminated()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
#define xstrcat(...) (xstrcat)(__VA_ARGS__, NULL)
char *xstrmul(const char *, size_t) paramsnonnull((1))
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xinet_ntop(int, const void *) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void *xunbinga(size_t, const char16_t *)
attributeallocalign((1)) returnspointerwithnoaliases dontthrow
nocallback __wur returnsnonnull dontthrow nocallback __wur returnsnonnull;
void *xunbing(const char16_t *) returnspointerwithnoaliases dontthrow
nocallback __wur returnsnonnull dontthrow nocallback __wur returnsnonnull;
char16_t *utf8to16(const char *, size_t, size_t *) __wur;
char *utf16to8(const char16_t *, size_t, size_t *) __wur;
wchar_t *utf8to32(const char *, size_t, size_t *) __wur;
wchar_t *utf16to32(const char16_t *, size_t, size_t *) __wur;
char *utf32to8(const wchar_t *, size_t, size_t *) __wur;
char *xhomedir(void) __wur;
char *xstripext(const char *) __wur;
char *xstripexts(const char *) __wur;
void *xload(_Atomic(void *) *, const void *, size_t, size_t);
int rmrf(const char *);
char *xbasename(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xdirname(const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
char *xjoinpaths(const char *, const char *) paramsnonnull()
returnspointerwithnoaliases dontthrow nocallback __wur returnsnonnull;
void xfixpath(void);
void *xslurp(const char *, size_t *)
paramsnonnull((1)) returnspointerwithnoaliases returnsaligned((4096)) __wur;
int xbarf(const char *, const void *, size_t);
COSMOPOLITAN_C_END_
#endif /* _COSMO_SOURCE */
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_X_H_ */