implicit declaration of function ‘interruptible_sleep_on’

mr_23

New Member
Joined
Mar 27, 2020
Messages
2
Reaction score
0
Credits
0
Hi everyone!
I'm trying to make a kernel device driver. while compiling my code I got an error
error: implicit declaration of function ‘interruptible_sleep_on’ [-Werror=implicit-function-declaration]
line: interruptible_sleep_on(&wait);
and here i have attached the headers for your reference which i used
Code:
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <linux/uaccess.h>
#include <linux/cdev.h>
#include <linux/semaphore.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/types.h>
#include <linux/poll.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/semaphore.h>
#include <linux/fcntl.h>
#include <linux/sched/signal.h>
.
Thanks!!
 


That error usually means you’ve forgotten an #include somewhere.
But from a quick grep of the kernel sources, it’s declared and defined in kernel/sched/core.c
core.c exports the function....
And it’s declared as an extern prototype in include/linux/wait.h

I see you have already included wait.h.....
Hmmmm.... so what’s missing?! It looks to me as if you’ve included everything.....

The only thing I can think of offhand is perhaps the order of the #includes is causing the problem?!

For example - from looking at a few random modules - I can see that module.h is typically included before kernel.h.
So perhaps some of your #includes need to be re-ordered?

In complex projects like the Linux kernel - Putting the includes in a specific order is sometimes necessary to allow the pre-processor and/or the compiler to correctly resolve more complex dependency chains.
That’s about all I can come up with offhand!
 
yes, i rearranged the order but still, it's there.
 


Latest posts

Top