summaryrefslogtreecommitdiff
path: root/libc/spec
Commit message (Collapse)AuthorAgeFilesLines
* [libc] add socket functionMichael Jones2023-05-032-14/+33
| | | | | | | | | | This patch adds the function "socket" from the header "sys/socket". It's a simple syscall wrapper, and I plan on adding the related functions in a followup patch. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D149622
* [LIBC] Implement remainder of posix 'sched.h' minus `SCHED_SPORADIC`Noah Goldstein2023-04-202-2/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | Includes macros: linux/SCHED_OTHER // posix req linux/SCHED_FIFO // posix req linux/SCHED_RR // posix req linux/SCHED_BATCH linux/SCHED_ISO linux/SCHED_IDLE linux/SCHED_DEADLINE Includes types: struct sched_param { int sched_priority; } Includes functions: sched_setparam sched_getparam sched_setscheduler sched_getscheduler sched_get_priority_max sched_get_priority_min sched_rr_get_interval Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D148069
* [libc] Add implementation of getcharMichael Jones2023-04-142-0/+10
| | | | | | | | added getchar and getchar_unlocked which are just wrappers getc and getc_unlocked respectively. Reviewed By: sivachandra, lntue, michaelrj Differential Revision: https://reviews.llvm.org/D147919
* [LIBC] Implement `sched_yield()`Noah Goldstein2023-04-122-2/+17
| | | | | | | | | | | 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
* [libc] Fix typo in gnu_ext.tdCaslyn Tonelli2023-04-111-1/+1
| | | | Differential Revision: https://reviews.llvm.org/D148052
* [libc] Add memmem implementationCaslyn Tonelli2023-04-111-1/+6
| | | | | | | | | | Introduce the `memmem` libc string function. `memmem_implementation` performs shared logic for `strstr`, `strcasestr`, and `memmem`; essentially reconfiguring what was the `strstr_implementation` to support length parameters. Differential Revision: https://reviews.llvm.org/D147822
* Reland "[libc] Add {,r}index"Alex Brachet2023-04-111-0/+10
| | | | Differential Revision: https://reviews.llvm.org/D147464
* Revert "[libc] Add {,r}index"Alex Brachet2023-04-111-10/+0
| | | | This reverts commit a0a141fcbe1dfd35032fa5c052e6906180a37fb1.
* [libc] Add {,r}indexAlex Brachet2023-04-111-0/+10
| | | | Differential Revision: https://reviews.llvm.org/D147464
* [libc] Add swab implementationCaslyn Tonelli2023-04-101-0/+5
| | | | | | Swab implementation is added to libc/src/unistd. Differential Revision: https://reviews.llvm.org/D147970
* [libc] Implement strsepAlex Brachet2023-04-061-0/+5
| | | | Differential Revision: https://reviews.llvm.org/D147503
* [libc] Add strchrnul implementationCaslyn Tonelli2023-04-031-0/+5
| | | | | | | | Introduce strchrnul implementation and unit tests. Submitting on behalf of Caslyn@ Differential Revision: https://reviews.llvm.org/D147346
* [libc][obvious] remove currently unused typesMichael Jones2023-03-202-3/+0
| | | | | | | Somehow having MBState and StructTmType in the definition for wchar was causing test failures. This should fix those. Differential Revision: https://reviews.llvm.org/D146476
* [libc] add basic wide char functionsMichael Jones2023-03-202-0/+28
| | | | | | | | | | This patch adds the wchar header, as well as the functions to convert to and from wide chars. The header also sets up the definitions for wint and wchar. Reviewed By: lntue Differential Revision: https://reviews.llvm.org/D145995
* [libc] Introduce sys/socket.hJeff Bailey2023-02-231-0/+14
| | | | | | | | This adds sys/socket.h and some definitions on Linux. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D144415
* [libc] Implement ntohl and ntohsRaman Tenneti2023-02-221-0/+10
| | | | | | | | | | | | | Per spec: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html Co-authored-by: Jeff Bailey <jbailey@google.com> Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D144506
* [libc] Implement htonl and htonsRaman Tenneti2023-02-162-0/+23
| | | | | | | | | | | | | | Per spec: * https://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html * https://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html Also adds UInt16Type and UInt32Type to spec.td Co-authored-by: Jeff Bailey <jbailey@google.com> Reviewed By: sivachandra, jeffbailey, rtenneti Differential Revision: https://reviews.llvm.org/D143795
* [libc][math] Implement scalbn, scalbnf, scalbnl.Renyi Chen2023-02-091-0/+4
| | | | | | | | | Implement scalbn via `fptuil::ldexp` for `FLT_RADIX==2` case. "unimplemented" otherwise. Reviewed By: lntue, sivachandra Differential Revision: https://reviews.llvm.org/D143116
* [libc][math] Implement acoshf function correctly rounded to all rounding modes.Tue Ly2023-02-011-0/+1
| | | | | | | | Implement acoshf function correctly rounded to all rounding modes. Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D142781
* [libc][math] Implement asinhf function correctly rounded for all rounding modes.Tue Ly2023-01-271-0/+1
| | | | | | | | Implement asinhf function correctly rounded for all rounding modes. Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D142681
* [libc] Implement strcasestrAlex Brachet2023-01-251-0/+5
| | | | Differential Revision: https://reviews.llvm.org/D142518
* [libc] Implement str{,n}casecmpAlex Brachet2023-01-111-0/+20
| | | | Differential Revision: https://reviews.llvm.org/D141236
* [libc] Move b* string functions to strings.hAlex Brachet2023-01-091-3/+3
| | | | | | Traditionally these functions are exposed in string*s*.h not string.h Differential Revision: https://reviews.llvm.org/D141237
* [libc][math] Implement log10 function correctly rounded for all rounding modesTue Ly2023-01-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Implement double precision log10 function correctly rounded for all rounding modes. This implementation currently needs FMA instructions for correctness. Use 2 passes: Fast pass: - 1 step range reduction with a lookup table of `2^7 = 128` elements to reduce the ranges to `[-2^-7, 2^-7]`. - Use a degree-7 minimax polynomial generated by Sollya, evaluated using a mixed of double-double and double precisions. - Apply Ziv's test for accuracy. Accurate pass: - Apply 5 more range reduction steps to reduce the ranges further to [-2^-27, 2^-27]. - Use a degree-4 minimax polynomial generated by Sollya, evaluated using 192-bit precisions. - By the result of Lefevre (add quote), this is more than enough for correct rounding to all rounding modes. In progress: Adding detail documentations about the algorithm. Depend on: https://reviews.llvm.org/D136799 Reviewed By: zimmermann6 Differential Revision: https://reviews.llvm.org/D139846
* [reland][libc] Add bcopyGuillaume Chatelet2022-12-011-0/+5
| | | | Differential Revision: https://reviews.llvm.org/D138994
* Revert D138994 "[libc] Add bcopy"Guillaume Chatelet2022-12-011-5/+0
| | | | | | Broke build bot This reverts commit 186a15f7a9311a75f3c5e90243ea5d6d20878de1.
* [libc] Add bcopyGuillaume Chatelet2022-12-011-0/+5
| | | | Differential Revision: https://reviews.llvm.org/D138994
* [libc] add scanf entrypointsMichael Jones2022-11-171-0/+20
| | | | | | | | | | | This patch adds scanf, sscanf, and fscanf entrypoints. It also adds unit tests for sscanf and a basic test to fscanf. The scanf function is basically impossible to test in an automated fashion due to it recieving user input. Reviewed By: sivachandra, lntue Differential Revision: https://reviews.llvm.org/D138076
* [libc] cleanup changes to gettimeofday.Raman Tenneti2022-11-151-6/+3
| | | | | | | | | | | + Deleted duplicate definitions of StructTimeVal and StructTimeValPtr. + Caled syscall clock_gettime to get timespec data. + Added tests to test for sleeping 200 and 1000 microseconds. + Fixed comments from https://reviews.llvm.org/D137881 Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D138064
* [libc] re-enable assertMichael Jones2022-11-151-1/+0
| | | | | | | | | The assert functions were disabled while the signal functions were being fixed. This patch re-enables them. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D138056
* Removed tabs.Raman Tenneti2022-11-111-15/+12
|
* [libc] Implement gettimeofdayRaman Tenneti2022-11-111-9/+30
| | | | | | | | | | | | | | | | Implement gettimeofday per .../onlinepubs/9699919799/functions/gettimeofday.html. This call clock_gettime to implement gettimeofday function. Tested: Limited unit test: This makes a call and checks that no error was returned. Used nanosleep for 100 microseconds and verfified it returns a value that elapses more than 100 microseconds and less than 300 microseconds. Co-authored-by: Jeff Bailey <jeffbailey@google.com> Differential Revision: https://reviews.llvm.org/D137881
* [libc] Add implementation of getc, getc_unlocked and fgetc_unlocked.Siva Chandra Reddy2022-11-073-0/+15
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137507
* [libc] Add implementations of ftell.Siva Chandra Reddy2022-11-071-0/+5
| | | | | | Reviewed By: michaelrj, lntue Differential Revision: https://reviews.llvm.org/D137395
* [libc] Add implementation of setbuf and setvbuf.Siva Chandra Reddy2022-11-041-0/+10
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137356
* [libc] Add implementation of ungetc.Siva Chandra Reddy2022-11-021-0/+5
| | | | | | | | | A bug in the file read logic has also been fixed along the way. Parts of the ungetc tests will fail without that bug fixed. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137286
* [libc] Add definitions of a few missing macros and types.Siva Chandra Reddy2022-11-021-0/+3
|
* [libc] Add x86_64 implementation of setjmp and longjmp.Siva Chandra Reddy2022-11-011-0/+27
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137147
* [libc][math] Add place-holder implementation for pow function.Tue Ly2022-10-311-0/+2
| | | | | | | | | Add place-holder implementation for pow function to unblock libc demo examples. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137109
* [libc][math] Add place-holder implementation for asin to unblock demo examples.Tue Ly2022-10-311-0/+1
| | | | | | | | | Add a place-holder implementation for asin to unblock libc demo examples. Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D137105
* [libc] Implement getoptAlex Brachet2022-10-311-0/+24
| | | | Differential Revision: https://reviews.llvm.org/D133487
* [libc] add fgetsMichael Jones2022-10-271-0/+9
| | | | | | | | This adds the fgets function and its unit tests. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D136785
* Revert "[libc] Implement getopt"Alex Brachet2022-10-271-24/+0
| | | | This reverts commit a678f86351c30a7d57197ffefab4e6e44e61a857.
* [libc] Implement getoptAlex Brachet2022-10-271-0/+24
| | | | Differential Revision: https://reviews.llvm.org/D133487
* [libc] Add Linux implementations of time and clock functions.Siva Chandra Reddy2022-10-251-2/+14
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136666
* [libc] Add the header sys/types.h.Siva Chandra Reddy2022-10-251-0/+11
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136642
* [libc] Build fix.Raman Tenneti2022-10-241-0/+8
| | | | | | | | Build fix. Reviewed By: rtenneti Differential Revision: https://reviews.llvm.org/D136647
* [libc] Add implementation of fgetc.Siva Chandra Reddy2022-10-221-0/+5
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136421
* [libc] Add stdin definition.Siva Chandra Reddy2022-10-221-0/+5
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136398
* [libc] Add select.h and the implementation of the select function for Linux.Siva Chandra Reddy2022-10-223-2/+28
| | | | | | Reviewed By: michaelrj Differential Revision: https://reviews.llvm.org/D136375