From d17d6d4286c18626c357d748df6fa9ab66aa2714 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Tue, 20 Mar 2001 19:27:56 +0000 Subject: [PATCH] * libc/include/sys/types.h (BSD int typedefs): Guard with _BSDTYPES_DEFINED rather than _WINSOCK_H. (fd_set): Add !defined __USE_W32_SOCKETS to guard; define _SYS_TYPES_FD_SET. * libc/include/sys/unistd.h (gethostname): Don't declare if defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS). --- newlib/ChangeLog | 9 +++++++++ newlib/libc/include/sys/types.h | 20 ++++++++++++-------- newlib/libc/include/sys/unistd.h | 5 ++++- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1768d4794..e44836866 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,12 @@ +2001-03-20 Danny Smith + + * libc/include/sys/types.h (BSD int typedefs): Guard with + _BSDTYPES_DEFINED rather than _WINSOCK_H. + (fd_set): Add !defined __USE_W32_SOCKETS to guard; define + _SYS_TYPES_FD_SET. + * libc/include/sys/unistd.h (gethostname): Don't declare if defined + (_WINSOCK_H) || defined (__USE_W32_SOCKETS). + Sat Mar 17 18:30:00 2001 Corinna Vinschen * libc/include/sys/unistd.h: Add _PC_POSIX_PERMISSONS and diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index d37a5f9ae..7ec35ae31 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -49,11 +49,13 @@ # define physadr physadr_t # define quad quad_t -#ifndef _WINSOCK_H +#ifndef _BSDTYPES_DEFINED +/* also defined in mingw/gmon.h and in w32api/winsock[2].h */ typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; +#define _BSDTYPES_DEFINED #endif typedef unsigned short ushort; /* System V compatibility */ @@ -152,12 +154,14 @@ typedef unsigned int mode_t _ST_INT32; typedef unsigned short nlink_t; /* We don't define fd_set and friends if we are compiling POSIX - source, or if we have included the Windows Sockets.h header (which - defines Windows versions of them). Note that a program which - includes the Windows sockets.h header must know what it is doing; - it must not call the cygwin32 select function. */ -# if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) - + source, or if we have included (or may include as indicated + by __USE_W32_SOCKETS) the W32api winsock[2].h header which + defines Windows versions of them. Note that a program which + includes the W32api winsock[2].h header must know what it is doing; + it must not call the cygwin32 select function. +*/ +# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) +# define _SYS_TYPES_FD_SET # define NBBY 8 /* number of bits in a byte */ /* * Select uses bit masks of file descriptors in longs. @@ -193,7 +197,7 @@ typedef struct _types_fd_set { *__tmp++ = 0; \ })) -# endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */ +# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */ #undef __MS_types__ #undef _ST_INT32 diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 2da98790b..0fad0dccf 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -115,7 +115,10 @@ int _EXFUN(setdtablesize, (int)); unsigned _EXFUN(usleep, (unsigned int __useconds)); int _EXFUN(ftruncate, (int __fd, off_t __length)); int _EXFUN(truncate, (const char *, off_t __length)); -int _EXFUN(gethostname, (char *__name, size_t __len)); +#if !(defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) +/* winsock[2].h defines as __stdcall, and with int as 2nd arg */ + int _EXFUN(gethostname, (char *__name, size_t __len)); +#endif char * _EXFUN(mktemp, (char *)); int _EXFUN(sync, (void)); int _EXFUN(readlink, (const char *__path, char *__buf, int __buflen));