2
* Copyright © 2014 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Authored by: Kevin DuBois <kevin.dubois@canonical.com>
25
//TODO: remove once mir::Fd is used more pervasively.
26
// some existing code does not really allow us to transfer or share the ownership
27
// of the fd. Constructing using mir::Fd(IntOwnedFd(int)) will help transition the existing
28
// code to using the mir::Fd type properly.
36
//transfer ownership of the POD-int to the object. The int no longer needs close()ing,
37
//and has the lifetime of the Fd object.
39
explicit Fd(IntOwnedFd);
40
static int const invalid{-1};
41
Fd(); //Initializes fd to the mir::Fd::invalid;
43
Fd(Fd const&) = default;
46
//bit of a convenient kludge. take care not to close or otherwise destroy the FD.
50
std::shared_ptr<int> fd;