From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 28 16:06:53 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86BCF16A4CE for ; Mon, 28 Feb 2005 16:06:53 +0000 (GMT) Received: from gandalf.online.bg (gandalf.online.bg [217.75.128.9]) by mx1.FreeBSD.org (Postfix) with SMTP id DF60D43D46 for ; Mon, 28 Feb 2005 16:06:51 +0000 (GMT) (envelope-from roam@ringlet.net) Received: (qmail 31467 invoked from network); 28 Feb 2005 16:06:46 -0000 Received: from unknown (HELO straylight.ringlet.net) (213.16.36.92) by gandalf.online.bg with SMTP; 28 Feb 2005 16:06:46 -0000 Received: (qmail 35304 invoked by uid 1000); 28 Feb 2005 16:06:49 -0000 Date: Mon, 28 Feb 2005 18:06:49 +0200 From: Peter Pentchev To: Kathy Quinlan Message-ID: <20050228160649.GC34617@straylight.m.ringlet.net> Mail-Followup-To: Kathy Quinlan , freebsd-hackers@freebsd.org References: <42233B48.4010108@kaqelectronics.dyndns.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="H8ygTp4AXg6deix2" Content-Disposition: inline In-Reply-To: <42233B48.4010108@kaqelectronics.dyndns.org> User-Agent: Mutt/1.5.8i cc: freebsd-hackers@freebsd.org Subject: Re: clock.h X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Feb 2005 16:06:53 -0000 --H8ygTp4AXg6deix2 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Feb 28, 2005 at 11:39:52PM +0800, Kathy Quinlan wrote: > I have this: >=20 > #include >=20 > In program I use this: >=20 > DELAY(1000); >=20 > I get this: >=20 > undefined referance to 'DELAY' >=20 > when I compile the program with GCC with flags -Wall -g -o com main.c >=20 > ANY ideas ?? >=20 > 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 =66rom 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 kernel only. If you want a high-precision delay/sleep interface in a userland program, take a look at the usleep(2) and nanosleep(2) syscalls. G'luck, Peter --=20 Peter Pentchev roam@ringlet.net roam@cnsys.bg roam@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. --H8ygTp4AXg6deix2 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.0 (FreeBSD) iD8DBQFCI0GZ7Ri2jRYZRVMRAoktAJ9K/UpRs6avaaoTxWkTF9+AA8XUeACeOHRW FNHGOEWopXiAhVRfgQZD0wo= =JWPU -----END PGP SIGNATURE----- --H8ygTp4AXg6deix2--