Kea
2.7.6
interprocess_util.cc
Go to the documentation of this file.
1
// Copyright (C) 2013-2015 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 <gtest/gtest.h>
10
11
#include <sys/select.h>
12
#include <cstddef>
13
14
namespace
isc
{
15
namespace
util {
16
namespace
unittests {
17
18
unsigned
char
19
parentReadState
(
int
fd) {
20
unsigned
char
result = 0xff;
21
22
fd_set rfds;
23
FD_ZERO(&rfds);
24
FD_SET(fd, &rfds);
25
26
struct
timeval tv = {5, 0};
27
28
const
int
nfds = select(fd + 1, &rfds, NULL, NULL, &tv);
29
EXPECT_EQ(1, nfds);
30
31
if
(nfds == 1) {
32
// Read status
33
const
ssize_t bytes_read = read(fd, &result,
sizeof
(result));
34
EXPECT_EQ(
sizeof
(result), bytes_read);
35
}
36
37
return
(result);
38
}
39
40
}
41
}
42
}
isc::util::unittests::parentReadState
unsigned char parentReadState(int fd)
A helper utility for a simple synchronization with another process.
Definition
interprocess_util.cc:19
isc
Defines the logger used by the top-level component of kea-lfc.
Definition
agent_parser.cc:148
src
lib
util
unittests
interprocess_util.cc
Generated on Fri Dec 20 2024 08:29:25 for Kea by
1.12.0