[comp.unix.wizards] usleep under Vax/Ultrix

iain@estevax.UUCP (Hr Iain Lea) (03/22/91)

Just recieved the fuzz and ptyjig test tools from univ. of wisconsin.
Tried compiling them under Ultrix on a vax 8550 but the compiler could
not find the function  usleep().
Checked the man pages but could not find it.
Also did a nm on libc.a and that was negative.
Checked a Vax/BSD machine and that has it.

I thought Ultrix used BSD as its porting base, so what happened ?

Anyway can someone tell me what to use on Ultrix and probably SysV 
in place of  usleep() ?

Thanx

Iain.

jik@athena.mit.edu (Jonathan I. Kamens) (03/25/91)

  Ultrix used BSD 4.2 as its porting base.  The usleep() function was
introduced in BSD 4.3.

  Since usleep() was written by Berkeley and is not based on anything
AT&T'ish, it is freely redistributable under the Berkeley sofware License
Agreement.

  Therefore, all you have to do is find an archive site that has the usleep()
sources on-line (in a file "usleep.c"), get the file, and add it to your
program's source code (Make sure you leave the Berkeley copyright at the top
intact, and obey its other conditions!).

  One such archive site is uunet.uu.net, in the anonymous ftp directory
/bsd-sources/lib/libc/gen.  You can find other anonymous ftp sites by
telnet'ing to quiche.cs.mcgill.ca as "archie" (with no password) and typing
"set search exact" and then "prog usleep.c".  If you don't have telnet access,
you can send mail to "archie@quiche.cs.mcgill.ca" with the contents "prog
usleep\.c" (the backslash is because you're specifying a regular expression
and you want the period to be interpreted literally).

  If you do not have direct access to anonymous ftp, you can use the bitftp
server on pucc.princeton.edu to retrieve the file.  Send a mail message with
subject "help" to "bitftp@pucc.princeton.edu" to get more information about
this.

  Finally, to make things easier for you, I have placed 4.3bsd and 4.3reno
versions of usleep.c in the archive on pit-manager.mit.edu.  You can get them
via anonymous ftp from "/pub/tmp", or from my mail server
("mail-server@pit-manager.mit.edu"), by sending a message to it containing
either "send tmp/usleep.c.4.3" or "send tmp/usleep.c.reno" or both (on
separate lines).  You'll probably have better luck with the 4.3 version.

  Note that the files on my workstation will go away after a week.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710

rbj@uunet.UU.NET (Root Boy Jim) (03/26/91)

In article <2171@estevax.UUCP> iain@estevax.UUCP (Hr Iain Lea) writes:
?I could not find the function  usleep().
?Checked the man pages but could not find it.
?Also did a nm on libc.a and that was negative.
?Checked a Vax/BSD machine and that has it.

Try extracting usleep.o from BSD's libc.a and using it under Ultrix!
Or get the source and recompile.

?I thought Ultrix used BSD as its porting base, so what happened ?

Probably 4.2 vs 4.3.

?Anyway can someone tell me what to use on Ultrix and probably SysV 
?in place of  usleep() ?

Usleep is just a wrapper around setitimer. The key word is "just",
as it must coexist with any previous use of itimers.

You can also use select with a subsecond sleep.

I don't think System V Release 3 has a subsecond sleep. Probably in SVR4.
-- 
		[rbj@uunet 1] stty sane
		unknown mode: sane

guy@auspex.auspex.com (Guy Harris) (03/31/91)

>You can also use select with a subsecond sleep.
>
>I don't think System V Release 3 has a subsecond sleep.

S5R3 has "poll()", which can be used to get a subsecond sleep in the
same fashion "select()" is used.

>Probably in SVR4.

S5R4 has "poll()", has a "select()" implemented atop "poll()", and also
has "usleep()" in the BSD compatibility library, presumably implemented
atop "setitimer()" and SIGALRM just as the 4.3BSD version is.