]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/process/detail/posix/child_handle.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / process / detail / posix / child_handle.hpp
CommitLineData
b32b8144
FG
1// Copyright (c) 2006, 2007 Julio M. Merino Vidal
2// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling
3// Copyright (c) 2009 Boris Schaeling
4// Copyright (c) 2010 Felipe Tanus, Boris Schaeling
5// Copyright (c) 2011, 2012 Jeff Flinn, Boris Schaeling
6//
7// Distributed under the Boost Software License, Version 1.0. (See accompanying
8// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9
10#ifndef BOOST_PROCESS_POSIX_CHILD_HPP
11#define BOOST_PROCESS_POSIX_CHILD_HPP
12
13#include <utility>
14#include <system_error>
15
16namespace boost { namespace process { namespace detail { namespace posix {
17
18typedef ::pid_t pid_t;
19
20struct child_handle
21{
22 int pid {-1};
23 explicit child_handle(int pid) : pid(pid)
24 {}
25
26 child_handle() = default;
27 ~child_handle() = default;
28
29 child_handle(const child_handle & c) = delete;
30 child_handle(child_handle && c) : pid(c.pid)
31 {
32 c.pid = -1;
33 }
34 child_handle &operator=(const child_handle & c) = delete;
35 child_handle &operator=(child_handle && c)
36 {
37 pid = c.pid;
38 c.pid = -1;
39 return *this;
40 }
41
42 int id() const
43 {
44 return pid;
45 }
46 bool in_group() const {return true;}
47 bool in_group(std::error_code&) const noexcept {return true;}
48
49 typedef int process_handle_t;
50 process_handle_t process_handle() const { return pid; }
51
52 bool valid() const
53 {
54 return pid != -1;
55 }
56};
57
58}}}}
59
60#endif