mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 23:08:31 +00:00
Add *NSYNC unit test suite
This change also fixes the clock_nanosleep() api and polyfills futexes on Windows, Mac, and NetBSD using exponential backoff.
This commit is contained in:
parent
3421b9a580
commit
9849b4c7ba
51 changed files with 5505 additions and 1060 deletions
|
@ -17,7 +17,21 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
|
||||
int posix_madvise(void *addr, uint64_t len, int advice) {
|
||||
return madvise(addr, len, advice);
|
||||
/**
|
||||
* Advises kernel about memory intentions, the POSIX way.
|
||||
*
|
||||
* @return 0 on success, or errno on error
|
||||
* @returnserrno
|
||||
* @threadsafe
|
||||
*/
|
||||
errno_t posix_madvise(void *addr, uint64_t len, int advice) {
|
||||
int rc, e = errno;
|
||||
rc = madvise(addr, len, advice);
|
||||
if (rc == -1) {
|
||||
rc = errno;
|
||||
errno = e;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue