[libc-commits] [libc] 09f2f81 - [libc][NFC] Move the POSIX write function to the default build on linux.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Thu Jan 27 09:36:37 PST 2022


Author: Siva Chandra Reddy
Date: 2022-01-27T17:29:13Z
New Revision: 09f2f81ce8b455b01c30e095788d53b383c43534

URL: https://github.com/llvm/llvm-project/commit/09f2f81ce8b455b01c30e095788d53b383c43534
DIFF: https://github.com/llvm/llvm-project/commit/09f2f81ce8b455b01c30e095788d53b383c43534.diff

LOG: [libc][NFC] Move the POSIX write function to the default build on linux.

Added: 
    

Modified: 
    libc/config/linux/x86_64/entrypoints.txt
    libc/src/CMakeLists.txt
    libc/src/unistd/linux/write.cpp
    libc/src/unistd/write.h
    libc/test/src/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/config/linux/x86_64/entrypoints.txt b/libc/config/linux/x86_64/entrypoints.txt
index 1e63ed0390092..47066d598da76 100644
--- a/libc/config/linux/x86_64/entrypoints.txt
+++ b/libc/config/linux/x86_64/entrypoints.txt
@@ -79,6 +79,9 @@ set(TARGET_LIBC_ENTRYPOINTS
     # sys/mman.h entrypoints
     libc.src.sys.mman.mmap
     libc.src.sys.mman.munmap
+
+    # unistd.h entrypoints
+    libc.src.unistd.write
 )
 
 set(TARGET_LIBM_ENTRYPOINTS
@@ -229,9 +232,6 @@ if(LLVM_LIBC_FULL_BUILD)
     libc.src.time.gmtime
     libc.src.time.gmtime_r
     libc.src.time.mktime
-
-    # unistd.h entrypoints
-    libc.src.unistd.write
   )
 endif()
 

diff  --git a/libc/src/CMakeLists.txt b/libc/src/CMakeLists.txt
index 99faf794c1356..7dfaac78b6c6e 100644
--- a/libc/src/CMakeLists.txt
+++ b/libc/src/CMakeLists.txt
@@ -10,6 +10,7 @@ add_subdirectory(stdlib)
 
 if(${LIBC_TARGET_OS} STREQUAL "linux")
   add_subdirectory(sys)
+  add_subdirectory(unistd)
 endif()
 
 if(NOT LLVM_LIBC_FULL_BUILD)
@@ -23,4 +24,3 @@ endif()
 add_subdirectory(stdio)
 add_subdirectory(threads)
 add_subdirectory(time)
-add_subdirectory(unistd)

diff  --git a/libc/src/unistd/linux/write.cpp b/libc/src/unistd/linux/write.cpp
index 0eaa632e57673..2de84c330fc5e 100644
--- a/libc/src/unistd/linux/write.cpp
+++ b/libc/src/unistd/linux/write.cpp
@@ -8,11 +8,11 @@
 
 #include "src/unistd/write.h"
 
-#include "include/sys/syscall.h"          // For syscall numbers.
 #include "src/__support/OSUtil/syscall.h" // For internal syscall function.
 #include "src/__support/common.h"
 
 #include <errno.h>
+#include <sys/syscall.h>          // For syscall numbers.
 
 namespace __llvm_libc {
 

diff  --git a/libc/src/unistd/write.h b/libc/src/unistd/write.h
index d69c10a66f0f1..821dc49050ec5 100644
--- a/libc/src/unistd/write.h
+++ b/libc/src/unistd/write.h
@@ -9,8 +9,7 @@
 #ifndef LLVM_LIBC_SRC_UNISTD_WRITE_H
 #define LLVM_LIBC_SRC_UNISTD_WRITE_H
 
-#include "include/unistd.h"
-#include <stddef.h>
+#include <unistd.h>
 
 namespace __llvm_libc {
 

diff  --git a/libc/test/src/CMakeLists.txt b/libc/test/src/CMakeLists.txt
index 96bc7e6c2bc77..469f5a56e7139 100644
--- a/libc/test/src/CMakeLists.txt
+++ b/libc/test/src/CMakeLists.txt
@@ -36,6 +36,7 @@ add_subdirectory(stdlib)
 
 if(${LIBC_TARGET_OS} STREQUAL "linux")
   add_subdirectory(sys)
+  add_subdirectory(unistd)
 endif()
 
 if(NOT LLVM_LIBC_FULL_BUILD)
@@ -49,7 +50,6 @@ endif()
 add_subdirectory(stdio)
 add_subdirectory(threads)
 add_subdirectory(time)
-add_subdirectory(unistd)
 
 set(public_test ${CMAKE_CURRENT_BINARY_DIR}/public_integration_test.cpp)
 


        


More information about the libc-commits mailing list