Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2001 11:01:58 -0600
From:      Lucas Bergman <lucas@slb.to>
To:        Suyog.Vaidya@Vashimail.ltitl.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Regarding tsleep()
Message-ID:  <20010130110158.A31190@billygoat.slb.to>
In-Reply-To: <652569E4.00330805.00@Vashimail.ltitl.com>; from Suyog.Vaidya@Vashimail.ltitl.com on Tue, Jan 30, 2001 at 02:47:23PM %2B0530
References:  <652569E4.00330805.00@Vashimail.ltitl.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> On FreeBSD4.2 I am using tsleep() system call but it gives error
> while compiling, the error is reported in systm.h file.
> 
> /usr/include/sys/systm.h:332: syntax error before `int'
> /usr/include/sys/systm.h:333: syntax error before `int'
> /usr/include/sys/systm.h:334: syntax error before `('

Some crucial parts of the include files are surrounded by
`#ifdef _KERNEL'.  So, if you compile with `-D_KERNEL' or add
`#define _KERNEL 1' to your source, it compiles fine.  This should, of
course, make you nervous.

> If I am compiling it on FreeBSD3.0 then it gives "undefined
> reference to 'tsleep' "

There is not a single piece of non-kernel code that uses this call:

  % cd /usr/src
  % find . -name '*.c' | grep -v '^\./sys/' | xargs grep -l tsleep
  %

Clearly, this was not meant to be used in applications.

I'd advise getting the functionality you're looking for with signals.
That's way more portable, anyway.  Unless you're writing kernel
modules, that is...

> Can you help me please?

Only partially.  Sorry.  :)

Lucas


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010130110158.A31190>