sbuild  1.7.2
unshare.h
1 /* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org>
2  *
3  * schroot is free software: you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * schroot is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see
15  * <http://www.gnu.org/licenses/>.
16  *
17  *********************************************************************/
18 
19 #ifndef SBUILD_CHROOT_FACET_UNSHARE_H
20 #define SBUILD_CHROOT_FACET_UNSHARE_H
21 
22 #include <sbuild/chroot/facet/facet.h>
23 
24 namespace sbuild
25 {
26  namespace chroot
27  {
28  namespace facet
29  {
30 
34  class unshare : public facet
35  {
36  public:
38  typedef std::shared_ptr<unshare> ptr;
39 
41  typedef std::shared_ptr<const unshare> const_ptr;
42 
45  {
47  };
48 
51 
52  private:
54  unshare ();
55 
56  public:
58  virtual ~unshare ();
59 
65  static ptr
66  create ();
67 
68  virtual facet::ptr
69  clone () const;
70 
71  virtual std::string const&
72  get_name () const;
73 
79  bool
80  get_unshare_net () const;
81 
87  void
88  set_unshare_net (bool unshare);
89 
95  bool
96  get_unshare_sysvipc () const;
97 
103  void
105 
111  bool
112  get_unshare_sysvsem () const;
113 
119  void
121 
127  bool
128  get_unshare_uts () const;
129 
135  void
136  set_unshare_uts (bool unshare);
137 
141  void
142  do_unshare () const;
143 
144  virtual void
145  setup_env (environment& env) const;
146 
147  virtual void
148  get_details (format_detail& detail) const;
149 
150  virtual void
151  get_used_keys (string_list& used_keys) const;
152 
153  virtual void
154  get_keyfile (keyfile& keyfile) const;
155 
156  virtual void
157  set_keyfile (const keyfile& keyfile);
158 
159  private:
168  };
169 
170  }
171  }
172 }
173 
174 #endif /* SBUILD_CHROOT_FACET_UNSHARE_H */
175 
176 /*
177  * Local Variables:
178  * mode:C++
179  * End:
180  */
static ptr create()
Create a chroot facet.
Definition: unshare.cc:83
unshare()
The constructor.
Definition: unshare.cc:69
Debian source builder components.
Definition: ctty.cc:31
Chroot support for unsharing process execution context.
Definition: unshare.h:34
bool unshare_sysvsem
Unshare System V SEM.
Definition: unshare.h:165
void set_unshare_net(bool unshare)
Set network unsharing.
Definition: unshare.cc:107
virtual std::string const & get_name() const
Get the name of the chroot facet.
Definition: unshare.cc:95
error_code
Error codes.
Definition: unshare.h:44
std::shared_ptr< unshare > ptr
A shared_ptr to a chroot facet object.
Definition: unshare.h:38
void set_unshare_sysvipc(bool unshare)
Set System V IPC unsharing.
Definition: unshare.cc:119
Container of environment variables.
Definition: environment.h:38
virtual ~unshare()
The destructor.
Definition: unshare.cc:78
custom_error< error_code > error
Exception type.
Definition: unshare.h:50
bool get_unshare_sysvsem() const
Is System V SEM unshared?
Definition: unshare.cc:125
bool unshare_net
Unshare networking.
Definition: unshare.h:161
std::shared_ptr< const unshare > const_ptr
A shared_ptr to a const chroot facet object.
Definition: unshare.h:41
bool get_unshare_uts() const
Is UTS namespace unshared?
Definition: unshare.cc:137
virtual void set_keyfile(const keyfile &keyfile)
Set the chroot properties from a keyfile.
Definition: unshare.cc:226
Base class for all facets.
Definition: facet.h:50
void set_unshare_uts(bool unshare)
Set System UTS namespace unsharing.
Definition: unshare.cc:143
Could not unshare process execution context.
Definition: unshare.h:46
std::vector< std::string > string_list
A string vector.
Definition: types.h:38
Custom error.
Definition: custom-error.h:31
virtual void get_keyfile(keyfile &keyfile) const
Copy the chroot properties into a keyfile.
Definition: unshare.cc:213
bool unshare_uts
Unshare System V SEM.
Definition: unshare.h:167
Format names and values for output.
Definition: format-detail.h:38
virtual facet::ptr clone() const
Copy the chroot facet.
Definition: unshare.cc:89
bool unshare_sysvipc
Unshare System V IPC.
Definition: unshare.h:163
void do_unshare() const
Unshare process execution context.
Definition: unshare.cc:149
Configuration file parser.
Definition: keyfile.h:46
virtual void setup_env(environment &env) const
Set environment.
Definition: unshare.cc:186
virtual void get_details(format_detail &detail) const
Get detailed information about the chroot for output.
Definition: unshare.cc:195
void set_unshare_sysvsem(bool unshare)
Set System V SEM unsharing.
Definition: unshare.cc:131
std::shared_ptr< facet > ptr
A shared_ptr to a chroot facet object.
Definition: facet.h:63
bool get_unshare_net() const
Is networking unshared?
Definition: unshare.cc:101
bool get_unshare_sysvipc() const
Is System V IPC unshared?
Definition: unshare.cc:113
virtual void get_used_keys(string_list &used_keys) const
Get a list of the keys used during keyfile parsing.
Definition: unshare.cc:204