More problems with libiberty on 4.3BSD

Michael Sokolov msokolov@ivan.Harhan.ORG
Mon Apr 10 16:20:00 GMT 2000

Hi there,

Having posted a patch for libiberty/, I'm now tackling the libiberty
code, with the same goal of making it build on 4.3BSD. Here are the problems:

* getruntime.c #includes both <time.h> and <sys/time.h>. On 4.3BSD neither is
protected against multiple inclusion and hence neither can be included more
than once. <time.h> defines struct tm and the related libc functions, but
doesn't include anything. <sys/time.h>, OTOH, defines struct timeval and other
time-related kernel structs, operations, and constants, and then at the end
includes <time.h>. This means that it's an error on 4.3BSD to #include both of
them, and if you need the definitions from both, #include <sys/time.h> only.

* mkstemps.c uses size_t. 4.3BSD uses the original K&R C compiler from Bell
Labs (pcc) that doesn't have size_t. However, 4.3BSD does typedef size_t in
<sys/types.h>. mkstemps.c, however, doesn't include <sys/types.h> or any other
headers that include it.

* pexecute.c, strtol.c, and strtoul.c use errno. They #include <errno.h>, but
on 4.3BSD this file only defines the error codes and not the errno global
variable. The latter is not declared in any header file and must be declared

* strtol.c and strtoul.c #include <limits.h>, which doesn't exist on 4.3BSD.
Apparently it is wanted for ULONG_MAX, LONG_MAX, and LONG_MIN. Under 4.3BSD
these are defined in <sys/param.h> and strtol.c and strtoul.c provide their own
definitions anyway when the system doesn't.

I have fixed the above problems manually on my machine and built libiberty, but
I can't figure out how to fix them in a way that's acceptable for a patch,
i.e., how to add 4.3BSD support to libiberty that can coexist with whatever it
supports now (portability isn't my forte). Any suggestions? TIA a lot.

Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

More information about the Gcc-patches mailing list