Kea 3.1.5
interprocess_util.cc
Go to the documentation of this file.
1// Copyright (C) 2013-2025 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#include <config.h>
8
9#include <util/ready_check.h>
10
11#include <gtest/gtest.h>
12
13#include <cstddef>
14
15namespace isc {
16namespace util {
17namespace unittests {
18
19unsigned char
21 unsigned char result = 0xff;
22
23 const int nfds = util::selectCheck(fd, 5);
24 EXPECT_EQ(1, nfds);
25
26 if (nfds == 1) {
27 // Read status
28 const ssize_t bytes_read = read(fd, &result, sizeof(result));
29 EXPECT_EQ(static_cast<ssize_t>(sizeof(result)), bytes_read);
30 }
31
32 return (result);
33}
34
35}
36}
37}
unsigned char parentReadState(int fd)
A helper utility for a simple synchronization with another process.
int selectCheck(const int fd_to_check, const unsigned int timeout_sec)
Defines the logger used by the top-level component of kea-lfc.