[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Semaphore



On Thu, Jan 02, 2003 at 12:42:12PM -0800, S P wrote:
> 
> Hi,
> 
> I am trying to use semaphore for locking. Following is the piece of code I am using :
> 
> struct semaphore mr_sem;
> 
> sema_init(&mr_sem, 1); /* usage count is 1 */
> 
> if (down_interruptible(&mr_sem))
>   /* semaphore not acquired; received a signal ... */
> 
> /* critical region (semaphore acquired) ... */
> 
> up(&mr_sem);
> 
>  
> 
> The compilation is done using gcc with options _D__KERNEL__. It compiles properly, but the linking gives some errors regards to __down_failed_interruptible and __up_wakeup.
> 
> Do I need to specify some other options for the compilation.
> 

Did you include include/asm-[my_arch]/semaphore.h?
This is the header file in which those 2 files are defined as a function
prototypes. Not includint it might be the reason of error.

[That's only my guess.]

-- 
tadeusz a. kadlubowski
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/