I need to use toilet to modify hook_function,when I use hook than result can produce colorful output.
And I try to write toilet but the compilation always fails. My key problem is that I don't know how to use the toilet instruction.
{ char command[100]; sprintf(command, "toilet -f term -F border --gay
'syscall number %ld'", a1);
system(command);
return next_sys_call(a1, a2, a3, a4, a5, a6, a7); }
#include <stdio.h>
typedef long (*syscall_fn_t)(long, long, long, long, long, long, long);
static syscall_fn_t next_sys_call = NULL;
static long hook_function(long a1, long a2, long a3, long a4, long a5, long a6, long a7) {
printf("output from hook_function: syscall number %ld\n", a1);
return next_sys_call(a1, a2, a3, a4, a5, a6, a7);
}
int __hook_init(long placeholder attribute((unused)), void *sys_call_hook_ptr) {
printf("output from __hook_init: we can do some init work here\n");
next_sys_call = *((syscall_fn_t *) sys_call_hook_ptr);
*((syscall_fn_t *) sys_call_hook_ptr) = hook_function;
return 0;
}
help me to use toilet modify hook_functioon