Hi,
I am working on some semaphore stuff. Just to check that I am doing the right thing I wrote a normal c code using semaphores :
Sema_Try.c
--------------------------------------------------
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/semaphore.h>
#include <linux/slab.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <asm/semaphore.h>
#include <linux/slab.h>
int main(void)
{
struct semaphore hold_sem;
sema_init(&hold_sem, 1);
down_trylock(&hold_sem);
return 1;
}
---------------------------------------------------------
On compilation I get the following output:
> gcc -Wall -D__KERNEL__ -I /usr/src/linux-2.4.7-10/include Sema_Try.c
/tmp/ccSdPsrY.o(.text/lock+x): undefined reference to '__down_failed_trylock'
collect2: ld returned 1 exit status
__down_failed_trylock is the function invoked by _down_trylock in semaphore.c. Could you suggest me something to get over this problem ?
Thanks,
SP
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now