diff options
author | Noah Goldstein <goldstein.w.n@gmail.com> | 2023-04-12 18:41:33 -0500 |
---|---|---|
committer | Noah Goldstein <goldstein.w.n@gmail.com> | 2023-04-12 19:04:37 -0500 |
commit | 203aff2df368f63532c0db4c5ab2879438654814 (patch) | |
tree | 15c429374e2aad02a515ffed54ba73e43d101e70 /libc/spec | |
parent | 2c12e9b7b2dfaafad5ef51ea38a581adfecc90b4 (diff) | |
download | llvm-203aff2df368f63532c0db4c5ab2879438654814.tar.gz |
[LIBC] Implement `sched_yield()`
Implements: https://linux.die.net/man/2/sched_yield
Possibly we don't need the return value check / errno as according to
both the manpage (and current linux source) `sched_yield` cannot fail.
Reviewed By: sivachandra, michaelrj
Differential Revision: https://reviews.llvm.org/D147985
Diffstat (limited to 'libc/spec')
-rw-r--r-- | libc/spec/gnu_ext.td | 4 | ||||
-rw-r--r-- | libc/spec/posix.td | 15 |
2 files changed, 17 insertions, 2 deletions
diff --git a/libc/spec/gnu_ext.td b/libc/spec/gnu_ext.td index 0c45d5cafbbf..d02733511464 100644 --- a/libc/spec/gnu_ext.td +++ b/libc/spec/gnu_ext.td @@ -32,7 +32,7 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> { FunctionSpec<"exp10f", RetValSpec<FloatType>, [ArgSpec<FloatType>]>, ] >; - + HeaderSpec Sched = HeaderSpec< "sched.h", [], // Macros @@ -51,7 +51,7 @@ def GnuExtensions : StandardSpec<"GNUExtensions"> { >, ] >; - + HeaderSpec String = HeaderSpec< "string.h", [], // Macros diff --git a/libc/spec/posix.td b/libc/spec/posix.td index ccbba46cc214..de160960ab6a 100644 --- a/libc/spec/posix.td +++ b/libc/spec/posix.td @@ -630,6 +630,20 @@ def POSIX : StandardSpec<"POSIX"> { ] >; + HeaderSpec Sched = HeaderSpec< + "sched.h", + [], // Macros + [PidT, SizeTType, CpuSetT], // Types + [], // Enumerations + [ + FunctionSpec< + "sched_yield", + RetValSpec<IntType>, + [] + >, + ] + >; + HeaderSpec String = HeaderSpec< "string.h", [ @@ -1300,6 +1314,7 @@ def POSIX : StandardSpec<"POSIX"> { Errno, FCntl, PThread, + Sched, Signal, Spawn, StdIO, |