mirror of
https://github.com/gaschz/qubes-pass.git
synced 2025-06-07 01:38:31 +02:00
Mlock.
This commit is contained in:
parent
93d9f150cd
commit
48613008a5
12
bin/qvm-pass
12
bin/qvm-pass
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/python3 -u
|
#!/usr/bin/python3 -u
|
||||||
|
|
||||||
|
import ctypes
|
||||||
import argparse
|
import argparse
|
||||||
import base64
|
import base64
|
||||||
import getpass
|
import getpass
|
||||||
@ -368,9 +369,20 @@ def pass_manage(*args, **kwargs):
|
|||||||
return send_args(PASS_MANAGE, *args, **kwargs)
|
return send_args(PASS_MANAGE, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
def mlockall():
|
||||||
|
MCL_CURRENT = 1
|
||||||
|
MCL_FUTURE = 2
|
||||||
|
libc = ctypes.CDLL("libc.so.6", use_errno=True)
|
||||||
|
result = libc.mlockall(MCL_CURRENT | MCL_FUTURE)
|
||||||
|
if result != 0:
|
||||||
|
raise Exception("cannot lock memmory, errno=%s" % ctypes.get_errno())
|
||||||
|
|
||||||
|
|
||||||
# -------------------- Begin ----------------------
|
# -------------------- Begin ----------------------
|
||||||
|
|
||||||
|
|
||||||
|
mlockall()
|
||||||
|
|
||||||
arguments = sys.argv[1:]
|
arguments = sys.argv[1:]
|
||||||
if "--help" in arguments or "-h" in arguments or "-?" in arguments:
|
if "--help" in arguments or "-h" in arguments or "-?" in arguments:
|
||||||
parser_for_subcommands.parse_known_args(arguments)
|
parser_for_subcommands.parse_known_args(arguments)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user