First attempt at moving to XS
This commit is contained in:
parent
72e6e79407
commit
d411c54886
5 changed files with 46 additions and 1 deletions
22
.gitignore
vendored
Normal file
22
.gitignore
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/blib/
|
||||
/.build/
|
||||
_build/
|
||||
cover_db/
|
||||
inc/
|
||||
Build
|
||||
!Build/
|
||||
Build.bat
|
||||
.last_cover_stats
|
||||
/Makefile
|
||||
/Makefile.old
|
||||
/MANIFEST.bak
|
||||
/META.yml
|
||||
/META.json
|
||||
/MYMETA.*
|
||||
nytprof.out
|
||||
/pm_to_blib
|
||||
*.o
|
||||
*.bs
|
||||
/_eumm/
|
||||
Sys-Linux-Namespace*
|
||||
test*
|
2
dist.ini
2
dist.ini
|
@ -1,4 +1,4 @@
|
|||
name = Sys-Linux-Unshare
|
||||
name = Sys-Linux-Namespace
|
||||
author = Ryan Voots <simcop2387@simcop2387.info>
|
||||
license = Perl_5
|
||||
copyright_holder = Ryan Voots
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
package Sys::Linux::Namespace;
|
||||
# ABSTRACT: Sets up linux kernel namespaces
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
|
|
@ -6,6 +6,10 @@ use Data::Dumper;
|
|||
require Exporter;
|
||||
our @ISA = qw/Exporter/;
|
||||
|
||||
require XSLoader;
|
||||
|
||||
XSLoader::load();
|
||||
|
||||
BEGIN {
|
||||
# Force reloading of all .ph files
|
||||
delete $INC{$_} for (grep {/\.ph$/} keys %INC);
|
||||
|
|
18
unshare.XS
Normal file
18
unshare.XS
Normal file
|
@ -0,0 +1,18 @@
|
|||
#define PERL_NO_GET_CONTEXT // we'll define thread context if necessary (faster)
|
||||
#include "EXTERN.h" // globals/constant import locations
|
||||
#include "perl.h" // Perl symbols, structures and constants definition
|
||||
#include "XSUB.h" // xsubpp functions and macros
|
||||
#include <stdlib.h> // rand()
|
||||
|
||||
// additional c code goes here
|
||||
|
||||
MODULE = Sys::Linux::Unshare PACKAGE = Sys::Linux::Unshare
|
||||
PROTOTYPES: ENABLE
|
||||
|
||||
# XS code goes here
|
||||
|
||||
# XS comments begin with " #" to avoid them being interpreted as pre-processor
|
||||
# directives
|
||||
|
||||
unsigned int
|
||||
rand()
|
Loading…
Add table
Reference in a new issue