Subject: Re: /usr/include/zconf.h uses HAVE_UNISTD_H
To: None <>
From: None <>
List: tech-userlevel
Date: 10/15/1999 01:39:39
>>> 	/usr/include/zconf.h always use HAVE_UNISTD_H, and it would affect
>>> 	definition of z_off_t (defined to off_t when HAVE_UNISTD_H is defined,
>>> 	long when not defined).  Is it safe?  I believe not every program
>>> 	defines HAVE_UNISTD_H.
>>Uhm... as far as I understand (and I only had one cup of coffee this morning):
>>Our OS offset type _is_ off_t, and our OS provides a unistd.h that
>>defines or uses it. "long" is wrong (well, it would happen to work on
>>our LP64 machines, for the time being). So, as long as libz and friends
>>use z_off_t where our system calls use offsets, using off_t is
>	Yes, the above was in my mind.
>	Isn't it better to change #ifdef HAVE_UNISTD_H in zconf.h into #if 1,
>	or something similar, so that there will be no mistake?
>	I checked src/lib/libz/Makefile and it has no HAVE_UNISTD_H...

	After doing cc -E, I now believe "long" is mistakingly used for file
	offset, instead of off_t, like return value and argument for gzseek().
	I'd like to propose the following fix.
	Should I increase shlib minor, or major, for this? (I suspect major)


Index: zconf.h
RCS file: /cvsroot/basesrc/lib/libz/zconf.h,v
retrieving revision 1.7
diff -c -r1.7 zconf.h
*** zconf.h	1999/07/03 12:30:57	1.7
--- zconf.h	1999/10/14 16:36:00
*** 242,248 ****
     typedef Byte     *voidp;
! #ifdef HAVE_UNISTD_H
  #  include <sys/types.h> /* for off_t */
  #  include <unistd.h>    /* for SEEK_* and off_t */
  #  define z_off_t  off_t
--- 242,248 ----
     typedef Byte     *voidp;
! #if defined(HAVE_UNISTD_H) || defined(__NetBSD__)
  #  include <sys/types.h> /* for off_t */
  #  include <unistd.h>    /* for SEEK_* and off_t */
  #  define z_off_t  off_t