Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions libc/hdr/types/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
add_proxy_header_library(
char8_t
char8_t
HDRS
char8_t.h
DEPENDS
Expand All @@ -10,7 +10,7 @@ add_proxy_header_library(
)

add_proxy_header_library(
char32_t
char32_t
HDRS
char32_t.h
DEPENDS
Expand Down Expand Up @@ -470,3 +470,12 @@ add_proxy_header_library(
libc.include.llvm-libc-types.dl_info
libc.include.dlfcn
)

add_proxy_header_library(
struct_rlimit
HDRS
struct_rlimit.h
FULL_BUILD_DEPENDS
libc.include.llvm-libc-types.struct_rlimit
libc.include.sys_resource
)
22 changes: 22 additions & 0 deletions libc/hdr/types/struct_rlimit.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//===-- Proxy for 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.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_LIBC_HDR_TYPES_STRUCT_RLIMIT_H
#define LLVM_LIBC_HDR_TYPES_STRUCT_RLIMIT_H

#ifdef LIBC_FULL_BUILD

#include "include/llvm-libc-types/struct_rlimit.h"

#else // Overlay mode

#include <sys/resource.h>

#endif // LLVM_LIBC_FULL_BUILD

#endif // LLVM_LIBC_HDR_TYPES_STRUCT_RLIMIT_H
2 changes: 2 additions & 0 deletions libc/src/sys/resource/linux/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ add_entrypoint_object(
HDRS
../getrlimit.h
DEPENDS
libc.hdr.types.struct_rlimit
libc.include.sys_resource
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
Expand All @@ -18,6 +19,7 @@ add_entrypoint_object(
HDRS
../setrlimit.h
DEPENDS
libc.hdr.types.struct_rlimit
libc.include.sys_resource
libc.include.sys_syscall
libc.src.__support.OSUtil.osutil
Expand Down
5 changes: 2 additions & 3 deletions libc/src/sys/resource/linux/getrlimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@

#include "src/sys/resource/getrlimit.h"

#include "hdr/types/struct_rlimit.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"

#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
#include <sys/syscall.h> // For syscall numbers.

namespace LIBC_NAMESPACE_DECL {

Expand Down
5 changes: 2 additions & 3 deletions libc/src/sys/resource/linux/setrlimit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@

#include "src/sys/resource/setrlimit.h"

#include "hdr/types/struct_rlimit.h"
#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
#include "src/__support/common.h"

#include "src/__support/libc_errno.h"
#include "src/__support/macros/config.h"
#include <sys/resource.h> // For struct rlimit
#include <sys/syscall.h> // For syscall numbers.
#include <sys/syscall.h> // For syscall numbers.

namespace LIBC_NAMESPACE_DECL {

Expand Down
2 changes: 0 additions & 2 deletions libc/test/src/sys/resource/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
add_custom_target(libc_sys_resource_unittests)

add_subdirectory(testdata)

add_libc_unittest(
getrlimit_setrlimit_test
SUITE
Expand Down
7 changes: 5 additions & 2 deletions libc/test/src/sys/resource/getrlimit_setrlimit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ TEST_F(LlvmLibcResourceLimitsTest, SetNoFileLimit) {
// successfully. Next, close the files and set the file descriptor limit
// to 4. This will allow us to open one of those file but not the other.

constexpr const char *TEST_FILE1 = "testdata/resource_limits1.test";
constexpr const char *TEST_FILE2 = "testdata/resource_limits2.test";
constexpr const char *TEST_FILE1_NAME = "resource_limits1.test";
constexpr const char *TEST_FILE2_NAME = "resource_limits2.test";

auto TEST_FILE1 = libc_make_test_file_path(TEST_FILE1_NAME);
auto TEST_FILE2 = libc_make_test_file_path(TEST_FILE2_NAME);

int fd1 = LIBC_NAMESPACE::open(TEST_FILE1, O_CREAT | O_WRONLY, S_IRWXU);
ASSERT_GT(fd1, 0);
Expand Down
Empty file.
Loading