[libc-commits] [libc] 9ec0ad7 - [libc][Obvious] Fix incomplete spec definition of sys/random.h.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Wed Oct 19 23:59:05 PDT 2022


Author: Siva Chandra Reddy
Date: 2022-10-20T06:57:00Z
New Revision: 9ec0ad75f511b630ebbc12025b0b2e9b02575466

URL: https://github.com/llvm/llvm-project/commit/9ec0ad75f511b630ebbc12025b0b2e9b02575466
DIFF: https://github.com/llvm/llvm-project/commit/9ec0ad75f511b630ebbc12025b0b2e9b02575466.diff

LOG: [libc][Obvious] Fix incomplete spec definition of sys/random.h.

Added: 
    

Modified: 
    libc/config/linux/api.td
    libc/spec/linux.td
    libc/src/sys/random/getrandom.h

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index 8067d1ec17ab..2b5b03359333 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -270,6 +270,10 @@ def UniStdAPI : PublicAPI<"unistd.h"> {
   let Types = ["__exec_argv_t", "__exec_envp_t", "off_t", "pid_t", "size_t", "ssize_t", "uid_t"];
 }
 
+def SysRandomAPI : PublicAPI<"sys/random.h"> {
+  let Types = ["size_t", "ssize_t"];
+}
+
 def SysResourceAPI : PublicAPI<"sys/resource.h"> {
   let Types = ["rlim_t", "struct rlimit"];
 }

diff  --git a/libc/spec/linux.td b/libc/spec/linux.td
index c6835c217602..d43bc88bbb55 100644
--- a/libc/spec/linux.td
+++ b/libc/spec/linux.td
@@ -81,7 +81,7 @@ def Linux : StandardSpec<"Linux"> {
         Macro<"GRND_NONBLOCK">,
         Macro<"GRND_INSECURE">,
       ],
-      [], // Types
+      [SizeTType, SSizeTType], // Types
       [], // Enumerations
       [
         FunctionSpec<

diff  --git a/libc/src/sys/random/getrandom.h b/libc/src/sys/random/getrandom.h
index dab508d363ff..32a2a64d6e51 100644
--- a/libc/src/sys/random/getrandom.h
+++ b/libc/src/sys/random/getrandom.h
@@ -9,7 +9,7 @@
 #ifndef LLVM_LIBC_SRC_SYS_RANDOM_GETRANDOM_H
 #define LLVM_LIBC_SRC_SYS_RANDOM_GETRANDOM_H
 
-#include <sys/types.h>
+#include <sys/random.h>
 
 namespace __llvm_libc {
 


        


More information about the libc-commits mailing list