Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Last active May 31, 2016 08:06
Show Gist options
  • Save Noitidart/aebffd8babacf1a3f298 to your computer and use it in GitHub Desktop.
Save Noitidart/aebffd8babacf1a3f298 to your computer and use it in GitHub Desktop.
_ff-addon-snippet-fuser_fread - trying to get fuser and fread from libc
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