So I am writing a system call in Linux. I want to print a message that looks like
printk(KERN_DEBUG "PROC_DEBUG [%s, %s]: %s", executable, current->pid, message);
Where executable is the name of the executable that is created when I link a source file against the library used to call the syscall. So if I run the command "cc -o sourcefile.c -L ./a -lfilename", is what I want to print for the executable. (The pid is the process ID of the process that is running the executable, and message is a parameter I pass to the system call.)
I was trying to use this code to get the executable name
struct task_struct *task = get_current();
char task_com[TASK_COM_LEN];
get_task_com(task_com, task);
But I am getting an error that 'TASK_COM_LEN' is undeclared, so what am I missing?
Is there an easier way to get the executable name? Something like "current->executable"? I'm not finding any great matches on the web.
Asked by TheIncrediblyStupidOne
(1 rep)
Oct 1, 2022, 02:39 PM
Last activity: May 27, 2025, 01:08 AM
Last activity: May 27, 2025, 01:08 AM