home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / gnu / utils / bug / 2330 < prev    next >
Encoding:
Text File  |  1993-01-06  |  3.9 KB  |  141 lines

  1. Path: sparky!uunet!olivea!charnel!rat!usc!howland.reston.ans.net!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!ma2s2.mathematik.uni-karlsruhe.de!haible
  2. From: haible@ma2s2.mathematik.uni-karlsruhe.de (Bruno Haible)
  3. Newsgroups: gnu.utils.bug
  4. Subject: time-1.4
  5. Message-ID: <9301052044.AA28629@ma2s2.mathematik.uni-karlsruhe.de>
  6. Date: 5 Jan 93 22:44:00 GMT
  7. Sender: gnulists@ai.mit.edu
  8. Distribution: gnu
  9. Organization: GNUs Not Usenet
  10. Lines: 128
  11. Approved: bug-gnu-utils@prep.ai.mit.edu
  12.  
  13. Compiling time-1.4 on linux, using GCC 2.3.3.
  14.  
  15. time.c:93: conflicting types for `wait3'
  16. /usr/include/sys/wait.h:39: previous declaration of `wait3'
  17. time.c:100: conflicting types for `getpagesize'
  18. /usr/include/unistd.h:331: previous declaration of `getpagesize'
  19. time.c: In function `run_command':
  20. time.c:618: storage size of `status' isn't known
  21. time.c:636: warning: passing arg 2 of `execvp' from incompatible pointer type
  22. make: *** [time.o] Error 1
  23.  
  24. This is fixed by the following diff:
  25.  
  26. diff -r -c3 time-1.4/time.c time-1.41/time.c
  27. *** time-1.4/time.c    Wed Oct 28 19:21:05 1992
  28. --- time-1.41/time.c    Tue Jan  5 19:52:47 1993
  29. ***************
  30. *** 89,95 ****
  31.   void error P_((int status, int errnum, char *message, ...));
  32.   
  33.   int gettimeofday P_((struct timeval *tp, struct timezone *tz));
  34. ! #ifdef HAVE_SYS_RESOURCE_H
  35.   int wait3 P_((union wait *status, int options, struct rusage *rusage));
  36.   #else
  37.   int wait3 P_((int *status, int options, struct rusage *rusage));
  38. --- 89,95 ----
  39.   void error P_((int status, int errnum, char *message, ...));
  40.   
  41.   int gettimeofday P_((struct timeval *tp, struct timezone *tz));
  42. ! #if defined(HAVE_SYS_RESOURCE_H) && !defined(linux)
  43.   int wait3 P_((union wait *status, int options, struct rusage *rusage));
  44.   #else
  45.   int wait3 P_((int *status, int options, struct rusage *rusage));
  46. ***************
  47. *** 97,104 ****
  48. --- 97,108 ----
  49.   
  50.   #include "getpagesize.h"
  51.   #ifndef getpagesize
  52. + #ifdef linux
  53. + size_t getpagesize P_((void));
  54. + #else
  55.   int getpagesize P_((void));
  56.   #endif
  57. + #endif
  58.   
  59.   void usage P_((void));
  60.   
  61. ***************
  62. *** 614,620 ****
  63.        int *exitcode;
  64.        char const *const cmd[];
  65.   {
  66. ! #ifdef HAVE_SYS_RESOURCE_H
  67.     union wait status;        /* Exit status of child. */
  68.   #else
  69.     int status;
  70. --- 618,624 ----
  71.        int *exitcode;
  72.        char const *const cmd[];
  73.   {
  74. ! #if defined(HAVE_SYS_RESOURCE_H) && !defined(linux)
  75.     union wait status;        /* Exit status of child. */
  76.   #else
  77.     int status;
  78. ***************
  79. *** 667,673 ****
  80.       }
  81.     finish->tv_usec -= start.tv_usec;
  82.   
  83. ! #ifdef HAVE_SYS_RESOURCE_H
  84.     *exitcode = (int) status.w_T.w_Retcode;
  85.   #else
  86.     *exitcode = status >> 8;
  87. --- 671,677 ----
  88.       }
  89.     finish->tv_usec -= start.tv_usec;
  90.   
  91. ! #if defined(HAVE_SYS_RESOURCE_H) && !defined(linux)
  92.     *exitcode = (int) status.w_T.w_Retcode;
  93.   #else
  94.     *exitcode = status >> 8;
  95.  
  96.  
  97. The first problem is that Linux has sys/resource.h, but declares wait3()
  98. as follows in <sys/wait.h> :
  99.  
  100. extern pid_t    wait3 _ARGS ((int *__wait_stat, int __options,
  101.                         struct rusage *__rup));
  102.  
  103. Instead of testing for the presence of <sys/resource.h>, you should perhaps
  104. test if including <sys/wait.h> defines the "union wait" type.
  105.  
  106.  
  107. The second problem is that Linux declares getpagesize() as follows in
  108. <unistd.h> :
  109.  
  110. extern size_t   getpagesize  _ARGS((void));
  111.  
  112. and size_t is an unsigned type.
  113.  
  114. Usually, I use the following autoconf macro to check for the getpagesize()
  115. return type:
  116.  
  117. define(AC_GETPAGESIZE,
  118. [AC_COMPILE_CHECK([getpagesize], , [getpagesize();],
  119. AC_DEFINE(HAVE_GETPAGESIZE) [have_getpagesize=1])dnl
  120. if test -n "$have_getpagesize"; then
  121. echo checking for getpagesize declaration
  122. AC_TEST_PROGRAM([
  123. #if STDC_HEADERS
  124. #include <stdlib.h>
  125. #endif
  126. #if HAVE_UNISTD_H
  127. #include <unistd.h>
  128. #endif
  129. extern int getpagesize();
  130. main() { exit(0); }],
  131. AC_DEFINE(RETGETPAGESIZETYPE,[int]),
  132. AC_DEFINE(RETGETPAGESIZETYPE,[size_t]))
  133. fi
  134. ])dnl
  135. dnl
  136.  
  137.  
  138. Regards,
  139.                   Bruno Haible
  140.                   haible@ma2s2.mathematik.uni-karlsruhe.de
  141.