aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-common/source/posix/process.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/restricted/aws/aws-c-common/source/posix/process.c
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/aws/aws-c-common/source/posix/process.c')
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/process.c106
1 files changed, 53 insertions, 53 deletions
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/process.c b/contrib/restricted/aws/aws-c-common/source/posix/process.c
index fb808faeb6..217ccb7d32 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/process.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/process.c
@@ -1,53 +1,53 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/common/process.h>
-
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-int aws_get_pid(void) {
- return (int)getpid();
-}
-
-size_t aws_get_soft_limit_io_handles(void) {
- struct rlimit rlimit;
- AWS_ZERO_STRUCT(rlimit);
-
- AWS_FATAL_ASSERT(
- !getrlimit(RLIMIT_NOFILE, &rlimit) &&
- "getrlimit() should never fail for RLIMIT_NOFILE regardless of user permissions");
- return rlimit.rlim_cur;
-}
-
-size_t aws_get_hard_limit_io_handles(void) {
- struct rlimit rlimit;
- AWS_ZERO_STRUCT(rlimit);
-
- AWS_FATAL_ASSERT(
- !getrlimit(RLIMIT_NOFILE, &rlimit) &&
- "getrlimit() should never fail for RLIMIT_NOFILE regardless of user permissions");
- return rlimit.rlim_max;
-}
-
-int aws_set_soft_limit_io_handles(size_t max_handles) {
- size_t hard_limit = aws_get_hard_limit_io_handles();
-
- if (max_handles > hard_limit) {
- return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
- }
-
- struct rlimit rlimit = {
- .rlim_cur = max_handles,
- .rlim_max = hard_limit,
- };
-
- if (setrlimit(RLIMIT_NOFILE, &rlimit)) {
- return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
- }
-
- return AWS_OP_SUCCESS;
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/common/process.h>
+
+#include <sys/resource.h>
+#include <sys/time.h>
+#include <unistd.h>
+
+int aws_get_pid(void) {
+ return (int)getpid();
+}
+
+size_t aws_get_soft_limit_io_handles(void) {
+ struct rlimit rlimit;
+ AWS_ZERO_STRUCT(rlimit);
+
+ AWS_FATAL_ASSERT(
+ !getrlimit(RLIMIT_NOFILE, &rlimit) &&
+ "getrlimit() should never fail for RLIMIT_NOFILE regardless of user permissions");
+ return rlimit.rlim_cur;
+}
+
+size_t aws_get_hard_limit_io_handles(void) {
+ struct rlimit rlimit;
+ AWS_ZERO_STRUCT(rlimit);
+
+ AWS_FATAL_ASSERT(
+ !getrlimit(RLIMIT_NOFILE, &rlimit) &&
+ "getrlimit() should never fail for RLIMIT_NOFILE regardless of user permissions");
+ return rlimit.rlim_max;
+}
+
+int aws_set_soft_limit_io_handles(size_t max_handles) {
+ size_t hard_limit = aws_get_hard_limit_io_handles();
+
+ if (max_handles > hard_limit) {
+ return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
+ }
+
+ struct rlimit rlimit = {
+ .rlim_cur = max_handles,
+ .rlim_max = hard_limit,
+ };
+
+ if (setrlimit(RLIMIT_NOFILE, &rlimit)) {
+ return aws_raise_error(AWS_ERROR_INVALID_ARGUMENT);
+ }
+
+ return AWS_OP_SUCCESS;
+}