home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mips
- Path: sparky!uunet!haven.umd.edu!darwin.sura.net!sgiblab!unpc!rogerk
- From: rogerk@queernet.org (Roger B.A. Klorese)
- Subject: Re: where is settimeofday()
- Organization: QueerNet
- Date: Fri, 28 Aug 92 04:05:03 GMT
- Message-ID: <1992Aug28.040503.3999@queernet.org>
- References: <6022@taurus.cs.nps.navy.mil>
- Lines: 71
-
- In article <6022@taurus.cs.nps.navy.mil> skip@taygeta.oc.nps.navy.mil (Skip Carter) writes:
- >
- > I have a program that must be compiled under the sysv systype
- > on a MIPS 3230 running RiscOS 4.52. But the linker can't
- > seem to find two BSD functions.
- >
- > When compiling under systype sysv, settimeofday() and
- > usleep() are not resolved, even when the compiler is told
- > to look in the bsd libraries. Where are these functions ?
-
- Well, you aren't *really* telling it to look in the "systype bsd43"
- libraries...
-
- > My compilation line:
- >
- > cc -I/usr/include/bsd -systype sysv stime.c -lbsd
- >
- > gives,
- >
- > ld:
- > Undefined:
- > settimeofday
- > usleep
-
- ...because they're not in the libraries you're asking for.
-
- You're telling it to look in the "systype sysv" BSD extension libraries.
- These libraries include only the subset of BSD facilities supported in
- the original UMIPS-V (Mips System V) version, before a BSD environment
- was added and the name was changed to RISC/os. These extension libraries
- basically only provided networking and socket extensions.
-
- > but,
- >
- > cc -systype bsd43 stime.c
- >
- > compiles OK.
-
- ...because this is the "full BSD" environment.
-
- However, all is not lost; you can get to all system calls from either
- environment, indirectly...
-
- >/* test settimeofday call with different environments */
- >
- >#include <stdio.h>
- >#include <sys/time.h>
-
- #ifdef SYSTYPE_SYSV
- #include <bsd43/sys/syscall.h>
- #define settimeofday(a,b) syscall(BSD43_SYS_settimeofday,a,b)
- #endif
- >
- >void main()
- >{
- > struct timeval tv;
- >
- > settimeofday(&tv, NULL);
- >
- > usleep( 40000 );
- >
- >}
-
- Unfortunately, usleep is not emulated; see the man page for suggestions on
- use of setitimer (or actually, syscall(BSD43_SYS_setitimer)) for how to
- do it yourself.
- --
- ROGER B.A. KLORESE +1 415 ALL-ARFF
- rogerk@unpc.QueerNet.ORG {ames,decwrl,pyramid}!mips!unpc!rogerk
- "Normal is not something to aspire to, it's something to get away from."
- -- J. Foster
-