fd_conservation_posix_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #include <sys/resource.h>
20 
21 #include <grpc/grpc.h>
22 #include <grpc/support/log.h>
23 
27 
28 int main(int argc, char** argv) {
29  int i;
30  struct rlimit rlim;
32 
34  grpc_init();
35  {
37 
38  /* set max # of file descriptors to a low value, and
39  verify we can create and destroy many more than this number
40  of descriptors */
41  rlim.rlim_cur = rlim.rlim_max = 10;
42  GPR_ASSERT(0 == setrlimit(RLIMIT_NOFILE, &rlim));
43  for (i = 0; i < 100; i++) {
44  p = grpc_iomgr_create_endpoint_pair("test", nullptr);
45  grpc_endpoint_destroy(p.client);
46  grpc_endpoint_destroy(p.server);
48  }
49  }
50 
51  grpc_shutdown();
52  return 0;
53 }
iomgr.h
log.h
generate.env
env
Definition: generate.py:37
xds_manager.p
p
Definition: xds_manager.py:60
endpoint_pair.h
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
main
int main(int argc, char **argv)
Definition: fd_conservation_posix_test.cc:28
grpc_core::ExecCtx::Flush
bool Flush()
Definition: exec_ctx.cc:69
grpc.h
grpc_endpoint_destroy
void grpc_endpoint_destroy(grpc_endpoint *ep)
Definition: endpoint.cc:53
grpc_core::ExecCtx
Definition: exec_ctx.h:97
test_config.h
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_iomgr_create_endpoint_pair
grpc_endpoint_pair grpc_iomgr_create_endpoint_pair(const char *name, grpc_channel_args *args)
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_endpoint_pair
Definition: endpoint_pair.h:26
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
grpc_core::ExecCtx::Get
static ExecCtx * Get()
Definition: exec_ctx.h:205
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:22