File tree Expand file tree Collapse file tree 7 files changed +44
-8
lines changed 
libc/test/src/sys/mman/linux 
utils/bazel/llvm-project-overlay/libc Expand file tree Collapse file tree 7 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,7 @@ add_libc_unittest(
9999    libc.src.sys.mman.mincore
100100    libc.src.sys.mman.mlock
101101    libc.src.sys.mman.munlock
102+     libc.src.unistd.sysconf
102103    libc.test .UnitTest.ErrnoCheckingTest
103104    libc.test .UnitTest.ErrnoSetterMatcher
104105)
@@ -123,6 +124,7 @@ add_libc_unittest(
123124    libc.src.sys.mman.mlockall
124125    libc.src.sys.mman.munlockall
125126    libc.src.sys.resource .getrlimit
127+     libc.src.unistd.sysconf
126128    libc.src.__support.OSUtil.osutil
127129    libc.test .UnitTest.ErrnoCheckingTest
128130    libc.test .UnitTest.ErrnoSetterMatcher
@@ -144,6 +146,7 @@ add_libc_unittest(
144146    libc.src.sys.mman.mincore
145147    libc.src.sys.mman.mlock
146148    libc.src.sys.mman.munlock
149+     libc.src.unistd.sysconf
147150    libc.test .UnitTest.ErrnoCheckingTest
148151    libc.test .UnitTest.ErrnoSetterMatcher
149152)
@@ -165,6 +168,7 @@ add_libc_unittest(
165168    libc.src.sys.mman.munmap
166169    libc.src.fcntl.open
167170    libc.src.unistd.close
171+     libc.src.unistd.sysconf
168172)
169173
170174add_libc_unittest(
Original file line number Diff line number Diff line change 1212#include  " src/sys/mman/mmap.h" 
1313#include  " src/sys/mman/munlock.h" 
1414#include  " src/sys/mman/munmap.h" 
15+ #include  " src/unistd/sysconf.h" 
1516#include  " test/UnitTest/ErrnoCheckingTest.h" 
1617#include  " test/UnitTest/ErrnoSetterMatcher.h" 
1718#include  " test/UnitTest/Test.h" 
@@ -20,8 +21,7 @@ using LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
2021using  LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
2122using  LlvmLibcMincoreTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
2223
23- //  TODO: Replace with sysconf call once the function is properly implemented.
24- constexpr  size_t  PAGE_SIZE = 4096 ;
24+ const  size_t  PAGE_SIZE = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);
2525
2626TEST_F (LlvmLibcMincoreTest, UnMappedMemory) {
2727  unsigned  char  vec;
Original file line number Diff line number Diff line change 2222#include  " src/sys/mman/munlockall.h" 
2323#include  " src/sys/mman/munmap.h" 
2424#include  " src/sys/resource/getrlimit.h" 
25+ #include  " src/unistd/sysconf.h" 
2526#include  " test/UnitTest/ErrnoCheckingTest.h" 
2627#include  " test/UnitTest/ErrnoSetterMatcher.h" 
2728#include  " test/UnitTest/Test.h" 
2829
2930#include  < sys/syscall.h> 
3031
31- //  TODO: Replace with sysconf call once the function is properly implemented.
32- constexpr  size_t  PAGE_SIZE = 4096 ;
32+ const  size_t  PAGE_SIZE = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);
3333
3434using  namespace  LIBC_NAMESPACE ::testing::ErrnoSetterMatcher; 
3535using  LlvmLibcMlockTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
Original file line number Diff line number Diff line change 1111#include  " src/sys/mman/msync.h" 
1212#include  " src/sys/mman/munlock.h" 
1313#include  " src/sys/mman/munmap.h" 
14+ #include  " src/unistd/sysconf.h" 
1415#include  " test/UnitTest/ErrnoCheckingTest.h" 
1516#include  " test/UnitTest/ErrnoSetterMatcher.h" 
1617#include  " test/UnitTest/Test.h" 
1718
18- //  TODO: Replace with sysconf call once the function is properly implemented.
19- constexpr  size_t  PAGE_SIZE = 4096 ;
19+ const  size_t  PAGE_SIZE = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);
2020
2121using  namespace  LIBC_NAMESPACE ::testing::ErrnoSetterMatcher; 
2222using  LlvmLibcMsyncTest = LIBC_NAMESPACE::testing::ErrnoCheckingTest;
Original file line number Diff line number Diff line change 1111#include  " src/sys/mman/munmap.h" 
1212#include  " src/sys/mman/remap_file_pages.h" 
1313#include  " src/unistd/close.h" 
14+ #include  " src/unistd/sysconf.h" 
1415#include  " test/UnitTest/ErrnoCheckingTest.h" 
1516#include  " test/UnitTest/ErrnoSetterMatcher.h" 
1617#include  " test/UnitTest/Test.h" 
1718
1819#include  < sys/mman.h> 
1920#include  < sys/stat.h>   //  For S_IRWXU
2021
21- //  TODO: Replace with sysconf call once the function is properly implemented.
22- constexpr  size_t  PAGE_SIZE = 4096 ;
22+ const  size_t  PAGE_SIZE = LIBC_NAMESPACE::sysconf(_SC_PAGESIZE);
2323
2424using  LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Fails;
2525using  LIBC_NAMESPACE::testing::ErrnoSetterMatcher::Succeeds;
Original file line number Diff line number Diff line change @@ -1501,6 +1501,21 @@ libc_support_library(
15011501    ],
15021502)
15031503
1504+ libc_support_library (
1505+     name  =  "__support_osutil_linux_auxv" ,
1506+     hdrs  =  ["src/__support/OSUtil/linux/auxv.h" ],
1507+     target_compatible_with  =  select ({
1508+         "@platforms//os:linux" : [],
1509+         "//conditions:default" : ["@platforms//:incompatible" ],
1510+     }),
1511+     deps  =  [
1512+         ":__support_common" ,
1513+         ":__support_osutil_syscall" ,
1514+         ":__support_threads_callonce" ,
1515+         ":hdr_fcntl_macros" ,
1516+     ],
1517+ )
1518+ 
15041519libc_support_library (
15051520    name  =  "__support_osutil_vdso" ,
15061521    hdrs  =  [
@@ -6336,6 +6351,19 @@ libc_function(
63366351    ],
63376352)
63386353
6354+ # WARNING: NOT FULLY IMPLEMENTED, FOR TESTING USE ONLY 
6355+ libc_function (
6356+     name  =  "sysconf" ,
6357+     srcs  =  ["src/unistd/linux/sysconf.cpp" ],
6358+     hdrs  =  ["src/unistd/sysconf.h" ],
6359+     deps  =  [
6360+         ":__support_common" ,
6361+         ":__support_osutil_linux_auxv" ,
6362+         ":errno" ,
6363+         ":hdr_unistd_macros" ,
6364+     ],
6365+ )
6366+ 
63396367libc_function (
63406368    name  =  "write" ,
63416369    srcs  =  ["src/unistd/linux/write.cpp" ],
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ libc_test(
3030        "//libc:mmap" ,
3131        "//libc:munlock" ,
3232        "//libc:munmap" ,
33+         "//libc:sysconf" ,
3334    ],
3435)
3536
@@ -48,6 +49,7 @@ libc_test(
4849        "//libc:munlock" ,
4950        "//libc:munlockall" ,
5051        "//libc:munmap" ,
52+         "//libc:sysconf" ,
5153    ],
5254)
5355
@@ -89,6 +91,7 @@ libc_test(
8991        "//libc:msync" ,
9092        "//libc:munlock" ,
9193        "//libc:munmap" ,
94+         "//libc:sysconf" ,
9295    ],
9396)
9497
@@ -111,6 +114,7 @@ libc_test(
111114        "//libc:munmap" ,
112115        "//libc:open" ,
113116        "//libc:remap_file_pages" ,
117+         "//libc:sysconf" ,
114118    ],
115119)
116120
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments