looks to me like you are trying to use kernel code inside of a userland program. Don't. Use the userland semaphore for userland programs, #include<semaphore.h> the sema_* functions are for the kernel code only. Also you are defining __KERNEL__ this shouldn't be done in userland either. If, however, you are trying to do a module then dump main and use the modules entery/exit point macros. On Friday 03 January 2003 2:19 pm, S P wrote: > 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> 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 -- Tom Bradley Software Engineer Jaycor / Titan Systems -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/