-
-
Save Happy-Ferret/1368c6acc55d3878b11da8e5d85f8abf to your computer and use it in GitHub Desktop.
_ff-addon-snippet-fuser_fread - trying to get fuser and fread from libc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Cu.import('resource://gre/modules/ctypes.jsm'); | |
function doit() { | |
var _libc = ctypes.open('libc.so.6'); | |
var _x11 = ctypes.open('libX11.so.6'); | |
var popen = _x11.declare('popen', ctypes.default_abi, ctypes.voidptr_t, // Return int | |
ctypes.char.ptr, // Param1 const char *command | |
ctypes.char.ptr // Param1 const char *command | |
); | |
var fread = _libc.declare('fread', ctypes.default_abi, ctypes.size_t, // Return int | |
ctypes.voidptr_t, | |
ctypes.size_t, | |
ctypes.size_t, | |
ctypes.voidptr_t | |
); | |
var fuser = _libc.declare('fuser', ctypes.default_abi, ctypes.size_t, // Return int | |
ctypes.voidptr_t, | |
ctypes.size_t, | |
ctypes.size_t, | |
ctypes.voidptr_t | |
); | |
var pclose = _x11.declare('pclose', ctypes.default_abi, ctypes.int, // Return int | |
ctypes.voidptr_t | |
); | |
//////////////////////// | |
////END DECLARATIONS | |
//////////////////////// | |
} | |
doit(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment