1 | =head1 NAME |
1 | =head1 NAME |
2 | |
2 | |
3 | Linux::Clone - an interface to the linux clone(2) and unshare(2) syscalls |
3 | Linux::Clone - an interface to the linux clone, unshare, setns, pivot_root and kcmp syscalls |
4 | |
4 | |
5 | =head1 SYNOPSIS |
5 | =head1 SYNOPSIS |
6 | |
6 | |
7 | use Linux::Clone; |
7 | use Linux::Clone; |
8 | |
8 | |
… | |
… | |
143 | =item Linux::Clone::setns $fh_or_fd[, $nstype] |
143 | =item Linux::Clone::setns $fh_or_fd[, $nstype] |
144 | |
144 | |
145 | Calls setns(2) on the file descriptor (or file handle) C<$fh_or_fd>. If |
145 | Calls setns(2) on the file descriptor (or file handle) C<$fh_or_fd>. If |
146 | C<$nstype> is missing, then C<0> is used. |
146 | C<$nstype> is missing, then C<0> is used. |
147 | |
147 | |
148 | At the time of this writing, C<$nstype> can be C<0>, C<Linux::Clone::NEWIPC>, |
148 | The argument C<$nstype> can be C<0>, C<Linux::Clone::NEWIPC>, |
149 | C<Linux::Clone::NEWNET>, C<Linux::Clone::NEUTS>, C<Linux::Clone::NEWCGROUP>, |
149 | C<Linux::Clone::NEWNET>, C<Linux::Clone::NEUTS>, C<Linux::Clone::NEWCGROUP>, |
150 | C<Linux::Clone::NEWNS>, C<Linux::Clone::NEWPID> or C<Linux::Clone::NEWUSER>. |
150 | C<Linux::Clone::NEWNS>, C<Linux::Clone::NEWPID> or C<Linux::Clone::NEWUSER>. |
|
|
151 | |
|
|
152 | =item Linux::Clone::pivot_root $new_root, $old_root |
|
|
153 | |
|
|
154 | Calls pivot_root(2) - refer to its manpage for details. |
|
|
155 | |
|
|
156 | =item Linux::Clone::kcmp $pid1, $pid2, $type[, $idx1, $idx2] |
|
|
157 | |
|
|
158 | Calls kcmp(2) - refer to its manpage for details on operations. |
|
|
159 | |
|
|
160 | The following C<$type> constants are available if the kcmp syscall number |
|
|
161 | was available during compilation: |
|
|
162 | |
|
|
163 | C<Linux::Clone::KCMP_FILE>, C<Linux::Clone::KCMP_VM>, C<Linux::Clone::KCMP_FILES>, |
|
|
164 | C<Linux::Clone::KCMP_FS>, C<Linux::Clone::KCMP_SIGHAND>, C<Linux::Clone::KCMP_IO> and |
|
|
165 | C<Linux::Clone::KCMP_SYSVSEM>. |
|
|
166 | |
151 | |
167 | |
152 | =back |
168 | =back |
153 | |
169 | |
154 | =cut |
170 | =cut |
155 | |
171 | |
156 | package Linux::Clone; |
172 | package Linux::Clone; |
157 | |
173 | |
158 | # use common::sense; |
174 | # use common::sense; |
159 | |
175 | |
160 | BEGIN { |
176 | BEGIN { |
161 | our $VERSION = '1.0'; |
177 | our $VERSION = '1.1'; |
162 | |
178 | |
163 | require XSLoader; |
179 | require XSLoader; |
164 | XSLoader::load (__PACKAGE__, $VERSION); |
180 | XSLoader::load (__PACKAGE__, $VERSION); |
165 | } |
181 | } |
166 | |
182 | |