From: Henrik.Bakman@csd.uu.SE (Henrik B}kman  CSD)
Subject: time 1.4
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 16 Nov 1992 18:47:27 GMT

Program: gnu time 1.4
Machine: HP 9000/730
OS: HPUX 8.07
Compiler: gcc (2.?.?)
======================================================================
Here is a fix to make time 1.4 compile on hpux 8.07. Unfortunately
hpux doesn't support getrusage() but atleast you get something.

The system call wait3() in hpux is, for the moment, incompatible
with the one used here so I am using the one in wait3.c. Bevare
of the ugly patch to get rid of the conflicting-prototypes-error
for wait3() !

*** /local/share/src/gnu/time-1.4/time.c	Wed Oct 28 20:21:05 1992
--- time.c	Mon Nov 16 17:09:58 1992
***************
*** 89,99 ****
--- 89,114 ----
  void error P_((int status, int errnum, char *message, ...));
  
  int gettimeofday P_((struct timeval *tp, struct timezone *tz));
+ 
+ /* 
+  * HB 921116: HPUX 8.07 does have wait3() BUT it is incompatible
+  * with the one used here :-( Therefor this ugly fix. You can't
+  * just make an macro for wait3() because the prototype in sys/wait.h
+  * is incompatible with the one below.
+  */
+ #if defined HAVE_WAIT3
  #ifdef HAVE_SYS_RESOURCE_H
  int wait3 P_((union wait *status, int options, struct rusage *rusage));
  #else
  int wait3 P_((int *status, int options, struct rusage *rusage));
  #endif
+ #define wait_3(status, options, rusage) \
+   wait3((status), (options), (rusage))
+ #else /* HAVE_WAIT3 */
+ int emul_wait3 P_((int *status, int options, struct rusage *rusage));
+ #define wait_3(status, options, rusage) \
+   emul_wait3((status), (options), (rusage))
+ #endif /* HAVE_WAIT3 */
  
  #include "getpagesize.h"
  #ifndef getpagesize
***************
*** 644,650 ****
  
    /* Ignore signals, but don't ignore the children.  When wait3
       returns the child process, set the time the command finished. */
!   while ((caught = wait3 (&status, 0, ruse)) != pid)
      {
        if (caught == -1)
  	error (1, errno, "error waiting for child process");
--- 659,665 ----
  
    /* Ignore signals, but don't ignore the children.  When wait3
       returns the child process, set the time the command finished. */
!   while ((caught = wait_3 (&status, 0, ruse)) != pid)
      {
        if (caught == -1)
  	error (1, errno, "error waiting for child process");
*** /local/share/src/gnu/time-1.4/wait3.c	Fri Jul  3 21:20:02 1992
--- wait3.c	Mon Nov 16 17:05:06 1992
***************
*** 1,6 ****
--- 1,7 ----
  /* Partial wait3 emulation for non-BSD systems.
     Written by Franc,ois Pinard.  */
  
+ #if ! defined HAVE_WAIT3
  #include <sys/types.h>
  #include <sys/times.h>
  #include <sys/param.h>
***************
*** 20,26 ****
  /* Must be used with the below gettimeofday emulation.  */
  
  int
! wait3 (status, options, rusage)
       int *status;
       int options;
       struct rusage *rusage;
--- 21,27 ----
  /* Must be used with the below gettimeofday emulation.  */
  
  int
! emul_wait3 (status, options, rusage)
       int *status;
       int options;
       struct rusage *rusage;
***************
*** 54,56 ****
--- 55,58 ----
    tp->tv_sec = value / HZ;
    tp->tv_usec = value % HZ * (1000000 / HZ);
  }
+ #endif /* ! HAVE_WAIT3 */

----------------------------------------------------------------------
Henrik Bakman           Adress: Box 520          Tel: +46 18 181044
System Manager                  751 20 UPPSALA   Fax: +46 18 521270
Computing Science Dep.          SWEDEN           Email: hb@csd.uu.se
Uppsala University

Newsgroups: gnu.utils.bug