[comp.unix.aux] Fixes to include files

coolidge@cs.uiuc.edu (John Coolidge) (03/31/91)

After about a week of having 2.0.1, here are a few problems that I've
found with include files:

1) rpc/types.h disagrees with sys/types.h over malloc. Fix:
*** types.h.orig        Thu Nov 29 14:32:30 1990
--- types.h     Wed Mar 27 13:23:40 1991
***************
*** 30,36
  #endif

  #ifndef KERNEL
! extern char *malloc();
  #define mem_alloc(bsize)      malloc(bsize)
  #define mem_free(ptr, bsize)  free(ptr)
  #ifndef major /* This is a kind of trick, but... */

--- 30,36 -----
  #endif

  #ifndef KERNEL
! extern void *malloc(size_t);
  #define mem_alloc(bsize)      malloc(bsize)
  #ifndef major /* This is a kind of trick, but... */
  #define mem_free(ptr, bsize)  free(ptr)

2) sys/dir.h uses a type (DIR) before it is defined. Fix:
*** dir.h.orig  Thu Nov 29 14:30:53 1990
--- dir.h       Thu Mar 28 23:07:01 1991
***************
*** 56,61
        char    d_name[MAXNAMLEN + 1];  /* name (up to MAXNAMLEN + 1) */
  };

  #if !defined(KERNEL)
  /*
   * The DIRSIZ macro gives the minimum record length which will hold

--- 56,74 -----
        char    d_name[MAXNAMLEN + 1];  /* name (up to MAXNAMLEN + 1) */
  };

+ /*
+  * Definitions for library routines operating on directories.
+  */
+ typedef struct __dirdesc {
+       int     dd_fd;
+       long    dd_loc;
+       long    dd_size;
+       long    dd_bbase;
+       long    dd_entno;
+       long    dd_bsize;
+       char    *dd_buf;
+ } DIR;
+
  #if !defined(KERNEL)
  /*
   * The DIRSIZ macro gives the minimum record length which will hold
***************
*** 97,115
        char    d_name[_SYS_NAME_MAX + 1];      /* name with terminating
NULL */
  };
  #endif /* _SYSV_SOURCE || _POSIX_SOURCE */
-
- /*
-  * Definitions for library routines operating on directories.
-  */
- typedef struct __dirdesc {
-       int     dd_fd;
-       long    dd_loc;
-       long    dd_size;
-       long    dd_bbase;
-       long    dd_entno;
-       long    dd_bsize;
-       char    *dd_buf;
- } DIR;

  #if defined(__STDC__)
  DIR *opendir(const char *dirname);

--- 110,115 -----
        char    d_name[_SYS_NAME_MAX + 1];      /* name with terminating
NULL */
  };
  #endif /* _SYSV_SOURCE || _POSIX_SOURCE */

  #if defined(__STDC__)
  DIR *opendir(const char *dirname);

3) gcc's stddef.h file conflicts with sys/types.h. Fix:
*** stddef.h.orig    Sat Mar 30 21:36:27 1991
--- stddef.h     Wed Mar 27 13:22:04 1991
***************
*** 8,13
  #ifndef __PTRDIFF_T
  #ifndef _PTRDIFF_T_
  #ifndef ___int_ptrdiff_t_h
  #define _PTRDIFF_T
  #define _T_PTRDIFF
  #define __PTRDIFF_T

--- 8,14 -----
  #ifndef __PTRDIFF_T
  #ifndef _PTRDIFF_T_
  #ifndef ___int_ptrdiff_t_h
+ #ifndef __ptrdiff_t
  #define _PTRDIFF_T
  #define _T_PTRDIFF
  #define __PTRDIFF_T
***************
*** 13,18
  #define __PTRDIFF_T
  #define _PTRDIFF_T_
  #define ___int_ptrdiff_t_h
  typedef long ptrdiff_t;
  #endif /* ___int_ptrdiff_t_h */
  #endif /* _PTRDIFF_T_ */

--- 14,20 -----
  #define __PTRDIFF_T
  #define _PTRDIFF_T_
  #define ___int_ptrdiff_t_h
+ #define __ptrdiff_t
  typedef long ptrdiff_t;
  #endif /* __ptrdiff_t */
  #endif /* ___int_ptrdiff_t_h */
***************
*** 14,19
  #define _PTRDIFF_T_
  #define ___int_ptrdiff_t_h
  typedef long ptrdiff_t;
  #endif /* ___int_ptrdiff_t_h */
  #endif /* _PTRDIFF_T_ */
  #endif /* __PTRDIFF_T */

--- 16,22 -----
  #define ___int_ptrdiff_t_h
  #define __ptrdiff_t
  typedef long ptrdiff_t;
+ #endif /* __ptrdiff_t */
  #endif /* ___int_ptrdiff_t_h */
  #endif /* _PTRDIFF_T_ */
  #endif /* __PTRDIFF_T */
***************
*** 27,32
  #ifndef __SIZE_T
  #ifndef _SIZE_T_
  #ifndef ___int_size_t_h
  #define _SIZE_T
  #define _T_SIZE
  #define __SIZE_T

--- 30,36 -----
  #ifndef __SIZE_T
  #ifndef _SIZE_T_
  #ifndef ___int_size_t_h
+ #ifndef __size_t
  #define _SIZE_T
  #define _T_SIZE
  #define __SIZE_T
***************
*** 32,37
  #define __SIZE_T
  #define _SIZE_T_
  #define ___int_size_t_h
  typedef unsigned long size_t;
  #endif /* ___int_size_t_h */
  #endif /* _SIZE_T_ */

--- 36,42 -----
  #define __SIZE_T
  #define _SIZE_T_
  #define ___int_size_t_h
+ #define __size_t
  typedef unsigned long size_t;
  #endif /* __size_t */
  #endif /* ___int_size_t_h */
***************
*** 33,38
  #define _SIZE_T_
  #define ___int_size_t_h
  typedef unsigned long size_t;
  #endif /* ___int_size_t_h */
  #endif /* _SIZE_T_ */
  #endif /* __SIZE_T */

--- 38,44 -----
  #define ___int_size_t_h
  #define __size_t
  typedef unsigned long size_t;
+ #endif /* __size_t */
  #endif /* ___int_size_t_h */
  #endif /* _SIZE_T_ */
  #endif /* __SIZE_T */

I suspect that I'll find more things as time goes on; I haven't actually
run fixincludes with 2.0.1's header files yet, so I'm still using 2.0's
in places...

--John

--------------------------------------------------------------------------
John L. Coolidge     Internet:coolidge@cs.uiuc.edu   UUCP:uiucdcs!coolidge
Of course I don't speak for the U of I (or anyone else except myself)
Copyright 1991 John L. Coolidge. Copying allowed if (and only if) attributed.
You may redistribute this article if and only if your recipients may as well.