Python Forum
calling os functions not in module os
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
calling os functions not in module os
#1
i recall seeing a way to make calls to libc functions and/or kernel syscalls but now that i need it it can't find it. i did find module dl but it was depricated in version 2.6 so that is not what i would use, even if i could. i'd rather not name the calls i want to make so that any answers can stay focused on what is a general way to do Linux syscalls. at least one of the syscalls i want to do is not even in gnu libc. i also recall seeing a way to call a C library. but that might not help for the one syscall that is not in libc unless i can find a way to build my own C library to do it.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
see Calling functions here: https://docs.python.org/3/library/ctypes.html
simple example:
>>> print(libc.time(None))  
1150640792
>>> print(hex(windll.kernel32.GetModuleHandleA(None)))  
0x1d000000
>>>
Reply
#3
that was the thing i saw a while back. thanks!!

i think i might have overlooked it in my google searches because of the name.

now i can say what it is for. i will be calling some or all of these kernel syscalls: chroot(), clone(), kcmp(), pivot_root(), setns(), syscall(), and unshare(). the project is to use the Linux container facility to run 2 or more Linux distros is parallel without a parent (which means i have to do it directly, not with LXC). and i want Python to be the system programming language of choice. another project is to run a distro entirely in RAM, unmounting the system volumes (and detaching them where possible in container and cloud environments).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Calling functions by making part of their name with variable crouzilles 4 749 Nov-02-2023, 12:25 PM
Last Post: noisefloor
  Calling functions from within a class: PYQT6 Anon_Brown 4 3,644 Dec-09-2021, 12:40 PM
Last Post: deanhystad
Question trouble with functions "def", calling/defining them Duck_Boom 13 4,234 Oct-21-2020, 03:50 AM
Last Post: Duck_Boom
  module to store functions/variables and how to call them? mstichler 3 2,345 Jun-03-2020, 06:49 PM
Last Post: mstichler
  Calling C functions with PyObjects jibarra 6 2,657 Jul-17-2019, 02:52 PM
Last Post: jibarra
  How to find functions or methods in a module? deepakdeshp 8 4,174 May-23-2019, 09:36 AM
Last Post: DeaD_EyE
  when calling module comes up with syntax error DAS 5 3,752 Nov-27-2017, 01:50 PM
Last Post: sparkz_alot
  Trouble calling functions in main function RedSkeleton007 6 4,992 Nov-11-2017, 01:22 PM
Last Post: sparkz_alot
  Calling functions from another file jp2017 11 30,404 Oct-11-2017, 10:58 PM
Last Post: snippsat
  module functions and data references Skaperen 6 4,203 Jul-30-2017, 04:09 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020