home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mips / 905 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.4 KB  |  82 lines

  1. Newsgroups: comp.sys.mips
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!sgiblab!unpc!rogerk
  3. From: rogerk@queernet.org (Roger B.A. Klorese)
  4. Subject: Re: where is settimeofday()
  5. Organization: QueerNet
  6. Date: Fri, 28 Aug 92 04:05:03 GMT
  7. Message-ID: <1992Aug28.040503.3999@queernet.org>
  8. References: <6022@taurus.cs.nps.navy.mil>
  9. Lines: 71
  10.  
  11. In article <6022@taurus.cs.nps.navy.mil> skip@taygeta.oc.nps.navy.mil (Skip Carter) writes:
  12. >
  13. >    I have a program that must be compiled under the sysv systype
  14. >    on a MIPS 3230 running RiscOS 4.52.  But the linker can't
  15. >    seem to find two BSD functions.
  16. >
  17. >    When compiling under systype sysv,  settimeofday() and
  18. >    usleep() are not resolved, even when the compiler is told
  19. >    to look in the bsd libraries.   Where are these functions ?
  20.  
  21. Well, you aren't *really* telling it to look in the "systype bsd43"
  22. libraries...
  23.  
  24. >    My compilation line:
  25. >
  26. >    cc -I/usr/include/bsd -systype sysv  stime.c -lbsd
  27. >
  28. >    gives,
  29. >
  30. >    ld:
  31. >    Undefined:
  32. >    settimeofday
  33. >    usleep
  34.  
  35. ...because they're not in the libraries you're asking for.
  36.  
  37. You're telling it to look in the "systype sysv" BSD extension libraries.
  38. These libraries include only the subset of BSD facilities supported in
  39. the original UMIPS-V (Mips System V) version, before a BSD environment
  40. was added and the name was changed to RISC/os.  These extension libraries
  41. basically only provided networking and socket extensions.
  42.  
  43. >    but,
  44. >
  45. >    cc -systype bsd43 stime.c
  46. >
  47. >    compiles OK.
  48.  
  49. ...because this is the "full BSD" environment.
  50.  
  51. However, all is not lost; you can get to all system calls from either
  52. environment, indirectly...
  53.  
  54. >/* test settimeofday call with different environments */
  55. >
  56. >#include <stdio.h>
  57. >#include <sys/time.h>
  58.  
  59. #ifdef SYSTYPE_SYSV
  60. #include <bsd43/sys/syscall.h>
  61. #define settimeofday(a,b) syscall(BSD43_SYS_settimeofday,a,b)
  62. #endif
  63. >
  64. >void main()
  65. >{
  66. >    struct timeval tv;
  67. >
  68. >       settimeofday(&tv, NULL);
  69. >
  70. >       usleep( 40000 );
  71. >
  72. >}
  73.  
  74. Unfortunately, usleep is not emulated; see the man page for suggestions on
  75. use of setitimer (or actually, syscall(BSD43_SYS_setitimer)) for how to
  76. do it yourself.
  77. -- 
  78. ROGER B.A. KLORESE                                              +1 415 ALL-ARFF
  79. rogerk@unpc.QueerNet.ORG                 {ames,decwrl,pyramid}!mips!unpc!rogerk
  80. "Normal is not something to aspire to, it's something to get away from."
  81.                                                                    -- J. Foster
  82.