#include #include ffi_type *uwsgi_libffi_get_type(char *what, size_t *skip) { if (!uwsgi_startswith(what, "int:", 4)) { *skip = 4; return &ffi_type_sint32;} if (!uwsgi_startswith(what, "sint:", 5)) { *skip = 5; return &ffi_type_sint32;} if (!uwsgi_startswith(what, "uint:", 5)) { *skip = 5;return &ffi_type_uint32;} return &ffi_type_pointer; } void *uwsgi_libffi_get_value(char *what, ffi_type *t) { if (t == &ffi_type_sint32) { int32_t *num = uwsgi_malloc(sizeof(int32_t)); *num = atoi(what); return num; } return NULL; } static int uwsgi_libffi_hook(char *arg) { size_t argc = 0; size_t i; char **argv = uwsgi_split_quoted(arg, strlen(arg), " \t", &argc); if (!argc) goto end; void *func = dlsym(RTLD_DEFAULT, argv[0]); if (!func) goto destroy; ffi_cif cif; ffi_type **args_type = (ffi_type **) uwsgi_malloc(sizeof(ffi_type) * (argc-1)); void **values = uwsgi_malloc(sizeof(void*) * (argc-1)); for(i=1;i