[libc-commits] [libc] 9050a59 - [libc][Obvious] Fix typo in struct rlimit name - remove the "_t" suffix.

Siva Chandra Reddy via libc-commits libc-commits at lists.llvm.org
Fri Sep 16 14:09:02 PDT 2022


Author: Siva Chandra Reddy
Date: 2022-09-16T21:07:17Z
New Revision: 9050a59c6678789831b7286b8b68d18b966c4694

URL: https://github.com/llvm/llvm-project/commit/9050a59c6678789831b7286b8b68d18b966c4694
DIFF: https://github.com/llvm/llvm-project/commit/9050a59c6678789831b7286b8b68d18b966c4694.diff

LOG: [libc][Obvious] Fix typo in struct rlimit name - remove the "_t" suffix.

Added: 
    libc/include/llvm-libc-types/struct_rlimit.h

Modified: 
    libc/config/linux/api.td
    libc/include/CMakeLists.txt
    libc/include/llvm-libc-types/CMakeLists.txt
    libc/spec/posix.td
    libc/src/sys/resource/getrlimit.h
    libc/src/sys/resource/linux/getrlimit.cpp
    libc/src/sys/resource/linux/setrlimit.cpp
    libc/src/sys/resource/setrlimit.h
    libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp

Removed: 
    libc/include/llvm-libc-types/struct_rlimit_t.h


################################################################################
diff  --git a/libc/config/linux/api.td b/libc/config/linux/api.td
index a77a4b5a9d9b7..32f18945eaa0c 100644
--- a/libc/config/linux/api.td
+++ b/libc/config/linux/api.td
@@ -272,7 +272,7 @@ def UniStdAPI : PublicAPI<"unistd.h"> {
 }
 
 def SysResourceAPI : PublicAPI<"sys/resource.h"> {
-  let Types = ["rlim_t", "struct rlimit_t"];
+  let Types = ["rlim_t", "struct rlimit"];
 }
 
 def SysStatAPI : PublicAPI<"sys/stat.h"> {

diff  --git a/libc/include/CMakeLists.txt b/libc/include/CMakeLists.txt
index 412c130bf58a9..fdaf88b0efb29 100644
--- a/libc/include/CMakeLists.txt
+++ b/libc/include/CMakeLists.txt
@@ -211,7 +211,7 @@ add_gen_header(
     .llvm_libc_common_h
     .llvm-libc-macros.sys_resource_macros
     .llvm-libc-types.rlim_t
-    .llvm-libc-types.struct_rlimit_t
+    .llvm-libc-types.struct_rlimit
 )
 
 add_gen_header(

diff  --git a/libc/include/llvm-libc-types/CMakeLists.txt b/libc/include/llvm-libc-types/CMakeLists.txt
index bf7be2517affa..f1081ddc91acc 100644
--- a/libc/include/llvm-libc-types/CMakeLists.txt
+++ b/libc/include/llvm-libc-types/CMakeLists.txt
@@ -32,7 +32,7 @@ add_header(pthread_mutex_t HDR pthread_mutex_t.h DEPENDS .__futex_word .__mutex_
 add_header(pthread_t HDR pthread_t.h DEPENDS .__thread_type)
 add_header(pthread_mutexattr_t HDR pthread_mutexattr_t.h)
 add_header(rlim_t HDR rlim_t.h)
-add_header(struct_rlimit_t HDR struct_rlimit_t.h DEPENDS .rlim_t)
+add_header(struct_rlimit HDR struct_rlimit.h DEPENDS .rlim_t)
 add_header(ssize_t HDR ssize_t.h)
 add_header(struct_dirent HDR struct_dirent.h DEPENDS .ino_t .off_t)
 add_header(struct_sigaction HDR struct_sigaction.h)

diff  --git a/libc/include/llvm-libc-types/struct_rlimit_t.h b/libc/include/llvm-libc-types/struct_rlimit.h
similarity index 64%
rename from libc/include/llvm-libc-types/struct_rlimit_t.h
rename to libc/include/llvm-libc-types/struct_rlimit.h
index 1b546239b6235..4fe0aa6cdf0b1 100644
--- a/libc/include/llvm-libc-types/struct_rlimit_t.h
+++ b/libc/include/llvm-libc-types/struct_rlimit.h
@@ -1,4 +1,4 @@
-//===-- Definition of type rlimit_t ---------------------------------------===//
+//===-- Definition of type struct rlimit ----------------------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,14 +6,14 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef __LLVM_LIBC_TYPES_RLIMIT_T_H__
-#define __LLVM_LIBC_TYPES_RLIMIT_T_H__
+#ifndef __LLVM_LIBC_TYPES_STRUCT_RLIMIT_H__
+#define __LLVM_LIBC_TYPES_STRUCT_RLIMIT_H__
 
 #include <llvm-libc-types/rlim_t.h>
 
-struct rlimit_t {
+struct rlimit {
   rlim_t rlim_cur;
   rlim_t rlim_max;
 };
 
-#endif // __LLVM_LIBC_TYPES_RLIMIT_T_H__
+#endif // __LLVM_LIBC_TYPES_STRUCT_RLIMIT_H__

diff  --git a/libc/spec/posix.td b/libc/spec/posix.td
index f7d71434069d5..244e88a80d311 100644
--- a/libc/spec/posix.td
+++ b/libc/spec/posix.td
@@ -466,13 +466,13 @@ def POSIX : StandardSpec<"POSIX"> {
   >;
 
   NamedType RLimTType = NamedType<"rlim_t">;
-  NamedType StructRLimitTType = NamedType<"struct rlimit_t">;
-  PtrType StructRLimitPtr = PtrType<StructRLimitTType>;
-  ConstType ConstStructRLimitPtr = ConstType<StructRLimitTType>;
+  NamedType StructRLimitType = NamedType<"struct rlimit">;
+  PtrType StructRLimitPtr = PtrType<StructRLimitType>;
+  ConstType ConstStructRLimitPtr = ConstType<StructRLimitType>;
   HeaderSpec SysResource = HeaderSpec<
     "sys/resource.h",
     [], // Macros
-    [RLimTType, StructRLimitTType], // Types
+    [RLimTType, StructRLimitType], // Types
     [], // Enumerations
     [
         FunctionSpec<

diff  --git a/libc/src/sys/resource/getrlimit.h b/libc/src/sys/resource/getrlimit.h
index e8449684d881e..b0725ac7abfdb 100644
--- a/libc/src/sys/resource/getrlimit.h
+++ b/libc/src/sys/resource/getrlimit.h
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-int getrlimit(int resource, struct rlimit_t *lim);
+int getrlimit(int resource, struct rlimit *lim);
 
 } // namespace __llvm_libc
 

diff  --git a/libc/src/sys/resource/linux/getrlimit.cpp b/libc/src/sys/resource/linux/getrlimit.cpp
index 2b42a13436a18..a9d1d2754a97f 100644
--- a/libc/src/sys/resource/linux/getrlimit.cpp
+++ b/libc/src/sys/resource/linux/getrlimit.cpp
@@ -12,12 +12,12 @@
 #include "src/__support/common.h"
 
 #include <errno.h>
-#include <sys/resource.h> // For struct rlimit_t
+#include <sys/resource.h> // For struct rlimit
 #include <sys/syscall.h>  // For syscall numbers.
 
 namespace __llvm_libc {
 
-LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit_t *limits)) {
+LLVM_LIBC_FUNCTION(int, getrlimit, (int res, struct rlimit *limits)) {
   long ret = __llvm_libc::syscall(SYS_prlimit64, 0, res, nullptr, limits);
   if (ret < 0) {
     errno = -ret;

diff  --git a/libc/src/sys/resource/linux/setrlimit.cpp b/libc/src/sys/resource/linux/setrlimit.cpp
index 43d843f228ed8..efca4c565b91b 100644
--- a/libc/src/sys/resource/linux/setrlimit.cpp
+++ b/libc/src/sys/resource/linux/setrlimit.cpp
@@ -12,12 +12,12 @@
 #include "src/__support/common.h"
 
 #include <errno.h>
-#include <sys/resource.h> // For struct rlimit_t
+#include <sys/resource.h> // For struct rlimit
 #include <sys/syscall.h>  // For syscall numbers.
 
 namespace __llvm_libc {
 
-LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit_t *limits)) {
+LLVM_LIBC_FUNCTION(int, setrlimit, (int res, const struct rlimit *limits)) {
   long ret = __llvm_libc::syscall(SYS_prlimit64, 0, res, limits, nullptr);
   if (ret < 0) {
     errno = -ret;

diff  --git a/libc/src/sys/resource/setrlimit.h b/libc/src/sys/resource/setrlimit.h
index ba48e824edaa5..00a0d4346ce31 100644
--- a/libc/src/sys/resource/setrlimit.h
+++ b/libc/src/sys/resource/setrlimit.h
@@ -13,7 +13,7 @@
 
 namespace __llvm_libc {
 
-int setrlimit(int resource, const struct rlimit_t *lim);
+int setrlimit(int resource, const struct rlimit *lim);
 
 } // namespace __llvm_libc
 

diff  --git a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
index c4265f0be42eb..f87b5f437321a 100644
--- a/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
+++ b/libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
@@ -40,7 +40,7 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
   ASSERT_THAT(__llvm_libc::close(fd1), Succeeds(0));
   ASSERT_THAT(__llvm_libc::close(fd2), Succeeds(0));
 
-  struct rlimit_t limits {
+  struct rlimit limits {
     4, 4
   };
   ASSERT_THAT(__llvm_libc::setrlimit(RLIMIT_NOFILE, &limits), Succeeds(0));
@@ -69,7 +69,7 @@ TEST(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
   ASSERT_THAT(__llvm_libc::unlink(TEST_FILE1), Succeeds(0));
   ASSERT_THAT(__llvm_libc::unlink(TEST_FILE2), Succeeds(0));
 
-  struct rlimit_t current_limits;
+  struct rlimit current_limits;
   ASSERT_THAT(__llvm_libc::getrlimit(RLIMIT_NOFILE, &current_limits),
               Succeeds(0));
   ASSERT_EQ(current_limits.rlim_cur, rlim_t(4));


        


More information about the libc-commits mailing list