Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use a system lib with Perl?

Status
Not open for further replies.

goBoating

Programmer
Feb 8, 2000
1,606
US
I need to get the 'raw' context associated with a given selinuxsecuritycontext for a file or pid. You don't need to know what that means except that the only way I can find to get that info is via the system lib 'context_range_get'.

See "
How do I access that in Perl. I have found examples of doing it in C and C++, but, I cannot use those approaches. Must stay in Perl.

Or, is there another way to get the regular and raw contexts for a given file, user, or PID that more readily available?



'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
rharsh, thanks for the reply. I had surfed the monastery, but, did not find that thread.

And, this seems relevant -
If you want to use C source code (or a C library) from Perl, you need to create a library that can be either dynamically loaded or statically linked into your perl executable. (Dynamic loading is usually preferred, to minimize the number of different perl executables sitting around being different.) You create that library by creating an XS file (ending in .xs) containing a series of wrapper subroutines. The wrapper subroutines are not Perl subroutines, however; they are in the XS language, and we call such a subroutine an XSUB, for "eXternal SUBroutine". An XSUB can wrap a C function from an external library, a C function elsewhere in the XS file, or naked C code in the XSUB itself. You then use the xsubpp utility bundled with Perl to take the XS file and translate it into C code that can be compiled into a library that Perl will understand.

...continues with details....


'hope this helps

If you are new to Tek-Tips, please use descriptive titles, check the FAQs, and beware the evil typo.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top