amit_at_expertsexchange
asked on
Makefile include for unistd.h
I need to use sleep function and for that I have defined unistd. h.
How do i give include option for this file in makefile.
I tried externing the sleep function but it didn't worked.
How do i give include option for this file in makefile.
I tried externing the sleep function but it didn't worked.
ASKER
Thanks fridon, actually my intent was to know include path only in Makefile as you have sggested, just that its a driver module Makefile. I have another problem now, the unistd.h is a user space file and I need the kernel space equivalent of it which I think is impelemented by the wait function. What is the include file for it.
Also what is the difference between CFLAGS and EXTRA_CFLAGS
Also what is the difference between CFLAGS and EXTRA_CFLAGS
Well it's up to you to give it meaning. Howerver under gnu the CFLAGS are handed automagically to the compiler I still prefer having it written out
like this
gcc $(CFLAGS)....
Now EXTRA_CFLAGS ist just a convenience. You may have some file which needs let's say /whatever/path/you/like
so you write before the rule
EXTRA_CFLAGS=.....
and use it thereafter
gcc $(CFLAGS) $(EXTRA_CFLAGS)....
and later you may re-use the EXTRA_CFLAGS
EXTRA_CFLAGS=/some/other/p ath....
or the like.
So I'd see CFLAGS as more general as EXTRA_CFLAGS but well in the end it's up to you to interpret it.
Regards
Friedrich
like this
gcc $(CFLAGS)....
Now EXTRA_CFLAGS ist just a convenience. You may have some file which needs let's say /whatever/path/you/like
so you write before the rule
EXTRA_CFLAGS=.....
and use it thereafter
gcc $(CFLAGS) $(EXTRA_CFLAGS)....
and later you may re-use the EXTRA_CFLAGS
EXTRA_CFLAGS=/some/other/p
or the like.
So I'd see CFLAGS as more general as EXTRA_CFLAGS but well in the end it's up to you to interpret it.
Regards
Friedrich
You're writing a driver and you're calling sleep()? That seems awfully fishy to me. I haven't done any kernel programming, but I always thought that if you're in the kernel you have to be very careful about doing things that block.
When you're in the kernel, you don't have the full suite of user-mode utilities. Many of those utilities depend on being able to block waiting for resources, but in the kernel you often do not have that luxury, especially in re-entrant code.
When you're in the kernel, you don't have the full suite of user-mode utilities. Many of those utilities depend on being able to block waiting for resources, but in the kernel you often do not have that luxury, especially in re-entrant code.
ASKER
Thanks fridom, I also read that CFLAGS is for top Makefile and EXTRA_CFLAGS otherwise.
ASKER
NovaDenizen: I subsequently decided to use sleep_on_interruptible. kernel/sched.h. It uses wait queue as a param and jiffies as another. Though there are too many variants, I think this shoud suffice.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
e.g paths to the headers if they are in unusual places. Let us assume unistd.h is in /usr/local/include
then you coulc add this to your Makefile
CFLAGS=-I/usr/local/includ
In the C files you simply wrote:
file.c
#include <unitstd.h>
or in
file.h
#include <unistd.h>
You can not add anything like extra includes in a Makefile
Regards
Friedrich