Im implementing a User Mode Scheduler in a kernel_module, when I call the "ums_dev_release" in the device I have to kill all the UMS_scheduler_threads associated, I'm trying to use the kill_pid() function, but I got this error:
error: implicit declaration of function ‘kill_pid’; did you mean ‘si_pid’? [-Werror=implicit-function-declaration] .
im also importing:
#include <linux/sched.h>
#include <linux/pid.h>
from the module:
int ums_dev_release(struct inode *inodep, struct file *filep){
int ret = release_scheduler(&sched_data,filep);
if(ret<0){
ERR_PRINTK(MODULE_NAME_LOG "ERROR UMS_DEV_RELEASE\n");
return -EINVAL;
}
return 0;}
the helper function called from the module:
int release_scheduler(struct list_head *sched_data, unsigned long int filep){
int ret;
struct list_head *current_item_list;
UMS_sched_data *current_UMS, *UMS_temp;
list_for_each_entry_safe(current_UMS,UMS_temp,sched_data, next)
{
if (current_UMS->id_counter == filep)
{
struct list_head *current_thread_list;
scheduler_thread *cursor, *temp;
list_for_each_entry_safe(cursor, temp, ¤t_UMS->scheduler_thread, next)
{
kill_pid(cursor->pid, SIGTERM);
list_del(&cursor->next);
kfree(cursor);
}
ret=list_empty(¤t_UMS->scheduler_thread);
if(!ret){
ERR_PPRINTK(MODULE_NAME_LOG"list is not empty ret=%d\n",ret);
return -1;
}
list_del(¤t_UMS->next);
kfree(current_UMS);
return 0;
}
}
return -1;}
these are the 2 structs:
typedef struct scheduler_thread{
pid_t pid;
struct list_head next;
}scheduler_thread;
typedef struct UMS_sched_data{
struct list_head scheduler_thread;
struct list_head next;
unsigned long int id_counter;
}UMS_sched_data;