Home
last modified time | relevance | path

Searched refs:fds (Results 1 - 25 of 37) sorted by relevance

12

/base/startup/init/services/init/standard/
H A Dfd_holder_service.c28 static void FreeFds(int *fds) in FreeFds() argument
30 if (fds != NULL) { in FreeFds()
31 free(fds); in FreeFds()
35 static int HandlerHoldFds(Service *service, int *fds, size_t fdCount, const char *pollStr) in HandlerHoldFds() argument
37 if (fds == NULL || fdCount == 0 || fdCount > MAX_HOLD_FDS) { in HandlerHoldFds()
38 INIT_LOGE("Service %s request hold fds with invalid fds", service->name); in HandlerHoldFds()
42 INIT_LOGI("Hold service \' %s \' fds:", service->name); in HandlerHoldFds()
44 INIT_LOGI("fd = %d", fds[i]); in HandlerHoldFds()
46 if (UpdaterServiceFds(service, fds, fdCoun in HandlerHoldFds()
108 CloseFds(int *fds, size_t fdCount) CloseFds() argument
127 int *fds = ReceiveFds(sock, iovec, &fdCount, true, &requestPid); HandlerFdHolder() local
[all...]
/base/startup/init/test/exec_test/
H A Dfd_holder_test.c31 int fds[10]; in SaveFds() local
35 fds[i] = open(argv[i], O_APPEND | O_RDWR | O_CREAT | O_TRUNC | O_CLOEXEC, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); in SaveFds()
36 if (fds[i] < 0) { in SaveFds()
40 (void)write(fds[i], "hello", BUFFER_LENGTH); in SaveFds()
45 BEGET_LOGE("Invalid fds for hold, abort\n"); in SaveFds()
48 int ret = ServiceSaveFd(serviceName, fds, (size_t)fdCount); in SaveFds()
50 BEGET_LOGE("Request init save fds failed\n"); in SaveFds()
52 BEGET_LOGI("Request init save fds done\n"); in SaveFds()
60 int *fds = ServiceGetFd("fd_holder_test", &outfdCount); in main() local
61 if (fds in main()
[all...]
/base/notification/eventhandler/frameworks/test/moduletest/
H A Devent_handler_fd_listener_module_test.cpp152 int32_t fds[] = {-1, -1}; in HWTEST_F() local
153 int32_t pipe = pipe2(fds, O_NONBLOCK); in HWTEST_F()
159 auto inResult = handler->AddFileDescriptorListener(fds[0], FILE_DESCRIPTOR_INPUT_EVENT, listener, "AddListener001"); in HWTEST_F()
161 auto outResult = handler->AddFileDescriptorListener(fds[1], FILE_DESCRIPTOR_OUTPUT_EVENT, listener, in HWTEST_F()
206 int32_t fds[] = {-1, -1}; in HWTEST_F() local
207 int32_t pipe = pipe2(fds, O_NONBLOCK); in HWTEST_F()
215 auto inResult = handler->AddFileDescriptorListener(fds[0], event, listener, "AddListener003"); in HWTEST_F()
231 int32_t fds[] = {-1, -1}; in HWTEST_F() local
232 int32_t pipe = pipe2(fds, O_NONBLOCK); in HWTEST_F()
238 auto inResult = handler->AddFileDescriptorListener(fds[ in HWTEST_F()
255 int32_t fds[] = {-1, -1}; HWTEST_F() local
279 int32_t fds[] = {-1, -1}; HWTEST_F() local
313 int32_t fds[] = {-1, -1}; HWTEST_F() local
347 int32_t fds[] = {-1, -1}; HWTEST_F() local
384 int32_t fds[] = {-1, -1}; HWTEST_F() local
414 int32_t fds[] = {-1, -1}; HWTEST_F() local
436 int32_t fds[] = {-1, -1}; AddFileDescriptorHelper() local
[all...]
H A Devent_handler_press_module_test.cpp206 int32_t fds[] = {-1, -1}; in HWTEST_F() local
207 int32_t pipe = pipe2(fds, O_NONBLOCK); in HWTEST_F()
213 auto inResult = handler->AddFileDescriptorListener(fds[0], FILE_DESCRIPTOR_INPUT_EVENT, listener, in HWTEST_F()
216 auto outResult = handler->AddFileDescriptorListener(fds[1], FILE_DESCRIPTOR_OUTPUT_EVENT, listener, in HWTEST_F()
/base/startup/init/interfaces/innerkits/fd_holder/
H A Dfd_holder.c74 static int ServiceSendFds(const char *serviceName, int *fds, int fdCount, bool doPoll) in ServiceSendFds() argument
94 if (BuildControlMessage(&msghdr, fds, fdCount, true) < 0) { in ServiceSendFds()
106 BEGET_LOGE("Failed to send fds to init, err = %d", errno); in ServiceSendFds()
120 BEGET_LOGI("Send fds done"); in ServiceSendFds()
125 int ServiceSaveFd(const char *serviceName, int *fds, int fdCount) in ServiceSaveFd() argument
128 if (serviceName == NULL || fds == NULL || in ServiceSaveFd()
133 return ServiceSendFds(serviceName, fds, fdCount, false); in ServiceSaveFd()
136 int ServiceSaveFdWithPoll(const char *serviceName, int *fds, int fdCount) in ServiceSaveFdWithPoll() argument
139 if (serviceName == NULL || fds == NULL || in ServiceSaveFdWithPoll()
144 return ServiceSendFds(serviceName, fds, fdCoun in ServiceSaveFdWithPoll()
171 int *fds = calloc((size_t)fdCount, sizeof(int)); ServiceGetFd() local
[all...]
H A Dfd_holder_internal.c26 int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool sendUcred) in BuildControlMessage() argument
28 if (msghdr == NULL || (fdCount > 0 && fds == NULL)) { in BuildControlMessage()
54 int ret = memcpy_s(CMSG_DATA(cmsg), cmsg->cmsg_len, fds, sizeof(int) * fdCount); in BuildControlMessage()
82 BEGET_LOGE("Message was truncated when receiving fds"); in GetFdsFromMsg()
87 int *fds = NULL; in GetFdsFromMsg() local
91 fds = (int*)CMSG_DATA(cmsg); in GetFdsFromMsg()
93 BEGET_ERROR_CHECK(fdCount <= MAX_HOLD_FDS, return NULL, "Too many fds returned."); in GetFdsFromMsg()
106 if (fds != NULL && fdCount > 0) { in GetFdsFromMsg()
108 BEGET_ERROR_CHECK(outFds != NULL, return NULL, "Failed to allocate memory for fds"); in GetFdsFromMsg()
109 BEGET_ERROR_CHECK(memcpy_s(outFds, sizeof(int) * (fdCount + 1), fds, sizeo in GetFdsFromMsg()
[all...]
H A Dfd_holder_internal.h43 int BuildControlMessage(struct msghdr *msghdr, int *fds, int fdCount, bool sendUcred);
/base/time/time_service/services/timer/src/
H A Dtimer_handler.cpp43 TimerFds fds; in Create() local
45 epollfd = epoll_create(fds.size()); in Create()
48 static_cast<int>(fds.size()), strerror(errno)); in Create()
52 for (size_t i = 0; i < fds.size(); i++) { in Create()
53 fds[i] = timerfd_create(alarm_to_clock_id[i], 0); in Create()
54 if (fds[i] < 0) { in Create()
59 close(fds[j]); in Create()
65 std::shared_ptr<TimerHandler> handler = std::shared_ptr<TimerHandler>(new TimerHandler(fds, epollfd)); in Create()
66 for (size_t i = 0; i < fds.size(); i++) { in Create()
71 int err = epoll_ctl(epollfd, EPOLL_CTL_ADD, fds[ in Create()
88 TimerHandler(const TimerFds &fds, int epollfd) TimerHandler() argument
[all...]
/base/hiviewdfx/hiview/framework/native/unified_collection/collector/
H A Dhilog_collector_impl.cpp66 int fds[2] = {-1, -1}; // 2: one read pipe, one write pipe in CollectLastLog() local
67 if (pipe(fds) != 0) { in CollectLastLog()
79 close(fds[0]); in CollectLastLog()
81 ExecuteHilog(pid, lineNum > MAX_LINE_NUM ? MAX_LINE_NUM : lineNum, fds[1]); in CollectLastLog()
83 close(fds[1]); in CollectLastLog()
84 ReadHilog(fds[0], result.data); in CollectLastLog()
/base/startup/init/interfaces/innerkits/include/
H A Dfd_holder.h23 // fds stored in allocated memory, do not forget to release the memory when not use anymore
27 // This function will not take responsibility to close these fds
29 int ServiceSaveFdWithPoll(const char *serviceName, int *fds, int fdCount);
32 // This function will not take responsibility to close these fds
34 int ServiceSaveFd(const char *serviceName, int *fds, int fdCount);
/base/tee/tee_client/services/teecd/src/
H A Dtee_ca_auth.c87 fd_set fds; in RecvCaMsg() local
112 FD_ZERO(&fds); in RecvCaMsg()
113 FD_SET(socket, &fds); in RecvCaMsg()
114 ret = select(socket + 1, &fds, NULL, NULL, &timeout); in RecvCaMsg()
/base/msdp/device_status/rust/modules/scheduler/test/src/
H A Dlib.rs37 fds: [RawFd; 2],
46 libc::write(self.fds[1], std::ptr::addr_of!(data) as *const c_void, std::mem::size_of_val(&data)) in signal()
55 self.fds[0] in fd()
65 libc::read(self.fds[0], std::ptr::addr_of!(data) as *mut c_void, std::mem::size_of_val(&data)) in dispatch()
70 info!(LOG_LABEL, "EpollHandlerImpl::dispatch({}), data:{}", @public(self.fds[0]), @public(data)); in dispatch()
84 for fd in &mut self.fds { in drop()
101 let mut fds: [c_int; 2] = [-1; 2]; in new() variables
103 let ret = unsafe { libc::pipe2(fds.as_mut_ptr(), libc::O_CLOEXEC | libc::O_NONBLOCK) }; in new()
107 debug!(LOG_LABEL, "In EpollHandler::new, fds:({},{})", @public(fds[ in new()
[all...]
/base/startup/init/test/fuzztest/servicesavefdwithpoll_fuzzer/
H A Dservicesavefdwithpoll_fuzzer.cpp25 int fds[64] = {0}; in FuzzServiceSaveFdWithPoll() local
27 if (!ServiceSaveFdWithPoll(str.c_str(), fds, fdCount)) { in FuzzServiceSaveFdWithPoll()
/base/startup/init/services/init/
H A Dinit_common_service.c321 INIT_LOGI("Closing service \' %s \' fds", service->name); in CloseServiceFds()
322 // fdCount > 0, There is no reason fds is NULL in CloseServiceFds()
325 int *fds = service->fds; in CloseServiceFds() local
327 INIT_LOGV("Closing fd: %d", fds[i]); in CloseServiceFds()
328 if (fds[i] != -1) { in CloseServiceFds()
329 close(fds[i]); in CloseServiceFds()
330 fds[i] = -1; in CloseServiceFds()
335 if (needFree && service->fds != NULL) { in CloseServiceFds()
336 free(service->fds); in CloseServiceFds()
859 UpdaterServiceFds(Service *service, int *fds, size_t fdCount) UpdaterServiceFds() argument
[all...]
/base/startup/init/test/unittest/innerkits/
H A Dinnerkits_unittest.cpp422 int *fds = nullptr; in HWTEST_F() local
434 fds = ServiceGetFd("testServiceName", &fdCount); in HWTEST_F()
435 EXPECT_NE(fds, nullptr); in HWTEST_F()
443 BuildControlMessage(&msghdr, fds, -1, 0); in HWTEST_F()
448 BuildControlMessage(&msghdr, fds, -1, 1); in HWTEST_F()
453 if (fds != nullptr) in HWTEST_F()
455 free(fds); in HWTEST_F()
456 fds = nullptr; in HWTEST_F()
463 int *fds = nullptr; in HWTEST_F() local
475 fds in HWTEST_F()
[all...]
/base/startup/appspawn/modules/native_adapter/
H A Dnative_adapter.cpp45 APPSPAWN_LOGI("no need to build fd info %{public}d, %{public}d", recvCtx.fds != NULL, recvCtx.fdCount); in BuildFdInfoMap()
70 APPSPAWN_CHECK(findFdIndex < recvCtx.fdCount && recvCtx.fds[findFdIndex] > 0, in BuildFdInfoMap()
71 return -1, "invalid fd info %{public}d %{public}d", findFdIndex, recvCtx.fds[findFdIndex]); in BuildFdInfoMap()
72 fdMap[key] = recvCtx.fds[findFdIndex++]; in BuildFdInfoMap()
/base/notification/eventhandler/frameworks/eventhandler/test/unittest/
H A Dlib_event_handler_event_queue_test.cpp86 * @param fds[] pipe need.
89 static int32_t InitFileDescriptor(int32_t fds[]) in InitFileDescriptor() argument
91 auto result = pipe(fds); in InitFileDescriptor()
94 int32_t fileDescriptor = fds[0]; in InitFileDescriptor()
985 int32_t fds[] = {-1, -1}; in HWTEST_F() local
986 int32_t fileDescriptor = InitFileDescriptor(fds); in HWTEST_F()
1020 close(fds[0]); in HWTEST_F()
1021 close(fds[1]); in HWTEST_F()
1048 int32_t fds[] = {-1, -1}; in HWTEST_F() local
1049 int32_t fileDescriptor = InitFileDescriptor(fds); in HWTEST_F()
1137 int32_t fds[] = {-1, -1}; HWTEST_F() local
1177 int32_t fds[] = {-1, -1}; HWTEST_F() local
1207 int32_t fds[] = {-1, -1}; HWTEST_F() local
1249 int32_t fds[] = {-1, -1}; HWTEST_F() local
1283 int32_t fds[] = {-1, -1}; HWTEST_F() local
1316 int32_t fds[] = {-1, -1}; HWTEST_F() local
1340 int32_t fds[] = {-1, -1}; HWTEST_F() local
[all...]
/base/startup/appspawn/modules/common/
H A Dappspawn_common.c483 int *fds = property->message->connection->receiverCtx.fds; in CloseFdArgs() local
484 if (fds != NULL && fdCount > 0) { in CloseFdArgs()
486 if (fds[i] > 0) { in CloseFdArgs()
487 close(fds[i]); in CloseFdArgs()
504 APPSPAWN_CHECK(recvCtx.fds != NULL && recvCtx.fdCount > 0, return 0, in SetFdEnv()
505 "no need set fd info %{public}d, %{public}d", recvCtx.fds != NULL, recvCtx.fdCount); in SetFdEnv()
521 APPSPAWN_CHECK(findFdIndex < recvCtx.fdCount && recvCtx.fds[findFdIndex] > 0, return -1, in SetFdEnv()
523 findFdIndex, recvCtx.fdCount, recvCtx.fds[findFdIndex]); in SetFdEnv()
527 "%d", recvCtx.fds[findFdInde in SetFdEnv()
[all...]
/base/startup/init/test/unittest/init/
H A Dinit_unittest.cpp105 int *fds = ServiceGetFd("param_watcher", &fdCount); in TestProcessTimer() local
106 EXPECT_TRUE(fds != nullptr); in TestProcessTimer()
107 free(fds); in TestProcessTimer()
/base/security/security_guard/test/fuzztest/risk_collect/riskcollect_fuzzer/
H A Drisk_collect_fuzzer.cpp73 struct pollfd fds = {}; in KernelInterfaceAdapterFuzzTest() local
74 adapter.Poll(&fds, 0, 0); in KernelInterfaceAdapterFuzzTest()
/base/startup/appspawn/test/moduletest/
H A Dappspawn_test_cmder.cpp495 fd_set fds; in InputThread() local
498 FD_ZERO(&fds); in InputThread()
499 FD_SET(STDIN_FILENO, &fds); in InputThread()
500 int ret = select(STDIN_FILENO + 1, &fds, nullptr, nullptr, nullptr); in InputThread()
530 fd_set fds; in DumpThread() local
533 FD_ZERO(&fds); in DumpThread()
534 FD_SET(testCmder->ptyFd_, &fds); in DumpThread()
535 int ret = select(testCmder->ptyFd_ + 1, &fds, nullptr, nullptr, nullptr); in DumpThread()
542 if (!FD_ISSET(testCmder->ptyFd_, &fds)) { in DumpThread()
/base/security/security_guard/test/unittest/data_collect/sa/
H A Dkernel_interface_adapter.h35 virtual int Poll(struct pollfd* const fds, nfds_t fdCount, int timeout) { return 0; }; in Poll() argument
/base/time/time_service/services/timer/include/
H A Dtimer_handler.h40 TimerHandler(const TimerFds &fds, int epollfd);
/base/startup/appspawn/interfaces/innerkits/client/
H A Dappspawn_client.h77 int fds[APP_MAX_FD_COUNT]; member
/base/startup/appspawn/standard/
H A Dappspawn_service.h51 int fds[APP_MAX_FD_COUNT]; member

Completed in 13 milliseconds

12