7 #include <sys/syscall.h>
11 int (*xseg_snprintf)(char *str, size_t size, const char *format, ...) = snprintf;
13 char __xseg_errbuf[4096];
15 void __load_plugin(const char *name)
20 unsigned int namesize = strlen(name);
22 strncpy(_name, "xseg_", 5);
23 strncpy(_name + 5, name, 80);
24 strncpy(_name + 5 + namesize, ".so", 3);
25 _name[5 + namesize + 3 ] = 0;
26 dl = dlopen(_name, RTLD_NOW);
28 LOGMSG("Cannot load plugin '%s': %s\n", _name, dlerror());
32 strncpy(_name + 5 + namesize, "_init", 5);
34 init = (void (*)(void))(long)dlsym(dl, _name);
36 LOGMSG("Init function '%s' not found!\n", _name);
41 //LOGMSG("Plugin '%s' loaded.\n", name);
44 uint32_t __get_id(void)
46 return syscall(SYS_gettid);
49 void __xseg_log(const char *msg)
54 void *xq_malloc(unsigned long size)
59 void xq_mfree(void *ptr)