Subject: Re: Problem with libc.so.12.2
To: Bernd Ernesti <netbsd@arresum.inka.de>
From: Dennis Ferguson <dennis@mci.net>
List: current-users
Date: 04/01/1995 12:54:15
> Clone from sleep(), with the logic for returning a value removed.
[...]
>   489 Xcl      CALL  sigprocmask(0x1,0x2000)
>   489 Xcl      RET   sigprocmask -65793/0xfffefeff
>   489 Xcl      CALL  sigaction(0xe,0xdffdb18,0xdffdb0c)
>   489 Xcl      RET   sigaction 0
>   489 Xcl      CALL  setitimer(0,0xdffdb34,0xdffdb24)
>   489 Xcl      RET   setitimer 0
>   489 Xcl      CALL  sigsuspend(0xfffefeff)

This is slightly off topic, but I'm curious about the reasoning behind
doing usleep() this way.  I know sleep() goes through all those
gyrations (40 lines of code, 7 system calls) to try to get the
silly return value right, but it doesn't seem necessary for
usleep() to do this.  Is there some defect with the simple way
of doing short sleeps, e.g.

void
usleep(useconds)
	unsigned int useconds;
{
	struct timeval tv;

	if (!useconds)
		return;

	tv.tv_sec = (long) (useconds / 1000000);
	tv.tv_usec = (long) (useconds % 1000000);
	(void) select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, &tv);
}

?

Dennis Ferguson