roam at ringlet.net
Mon Feb 28 16:06:53 GMT 2005
On Mon, Feb 28, 2005 at 11:39:52PM +0800, Kathy Quinlan wrote:
> I have this:
> #include <machine/clock.h>
> In program I use this:
> I get this:
> undefined referance to 'DELAY'
> when I compile the program with GCC with flags -Wall -g -o com main.c
> ANY ideas ??
> I have looked in the relevent header and it seems to be there
Yes, it is in clock.h, but...
* Kernel interface to machine-dependent clock driver.
That's the way that clock.h starts. The 'kernel interface' part means
that this is a header file that declares functions that are used *only*
within the FreeBSD kernel - since they are only implemented in another
part of the kernel code. You cannot use these definitions and functions
from a userland program, as you are trying to do.
The reason that the DELAY() declaration seems to be in the header file,
yet the compiler does not see it, is the #ifdef _KERNEL at the top of
clock.h :) This is just a level of protection that accomplishes exactly
that - no userland program should *ever* define the _KERNEL symbol, so
no userland program will be fooled into believing that there is a
DELAY() function that it could possibly use. It simply cannot, since
the DELAY() function is declared within kernel code for use by the
If you want a high-precision delay/sleep interface in a userland
program, take a look at the usleep(2) and nanosleep(2) syscalls.
Peter Pentchev roam at ringlet.net roam at cnsys.bg roam at FreeBSD.org
PGP key: http://people.FreeBSD.org/~roam/roam.key.asc
Key fingerprint FDBA FD79 C26F 3C51 C95E DF9E ED18 B68D 1619 4553
I am the meaning of this sentence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20050228/5155f597/attachment.bin
More information about the freebsd-hackers