Moved the #ifdefs for the getnetby* etc. functions directly into the

winsock implementation to avoid having to redefine the data structures
in port.h.
This commit is contained in:
Alexandre Julliard 2002-07-31 23:20:47 +00:00
parent 6f268f13dd
commit cd6b50e732
5 changed files with 18 additions and 98 deletions

View File

@ -423,6 +423,7 @@ static DWORD WINAPI _async_queryfun(LPVOID arg) {
}
break;
case AQ_GETPROTO: {
#if defined(HAVE_GETPROTOBYNAME) && defined(HAVE_GETPROTOBYNUMBER)
struct protoent *pe;
char *copy_protoent = targetptr;
EnterCriticalSection( &csWSgetXXXbyYYY );
@ -445,6 +446,9 @@ static DWORD WINAPI _async_queryfun(LPVOID arg) {
fail = WSANO_DATA;
}
LeaveCriticalSection( &csWSgetXXXbyYYY );
#else
fail = WSANO_DATA;
#endif
}
break;
case AQ_GETSERV: {
@ -453,7 +457,11 @@ static DWORD WINAPI _async_queryfun(LPVOID arg) {
EnterCriticalSection( &csWSgetXXXbyYYY );
se = (aq->flags & AQ_NAME)?
getservbyname(aq->serv_name,aq->serv_proto) :
#ifdef HAVE_GETSERVBYPORT
getservbyport(aq->serv_port,aq->serv_proto);
#else
NULL;
#endif
if (se) {
size = WS_copy_se(copy_servent,(char*)aq->sbuf,aq->sbuflen,se,aq->flags);
if (size < 0) {

View File

@ -2996,7 +2996,7 @@ struct WS_hostent* WINAPI WS_gethostbyname(const char* name)
static WIN_protoent* __ws_getprotobyname(const char *name, int dup_flag)
{
WIN_protoent* retval = NULL;
#ifdef HAVE_GETPROTOBYNAME
struct protoent* proto;
EnterCriticalSection( &csWSgetXXXbyYYY );
if( (proto = getprotobyname(name)) != NULL )
@ -3011,6 +3011,7 @@ static WIN_protoent* __ws_getprotobyname(const char *name, int dup_flag)
SetLastError(WSANO_DATA);
}
LeaveCriticalSection( &csWSgetXXXbyYYY );
#endif
return retval;
}
@ -3040,6 +3041,7 @@ struct WS_protoent* WINAPI WS_getprotobyname(const char* name)
static WIN_protoent* __ws_getprotobynumber(int number, int dup_flag)
{
WIN_protoent* retval = NULL;
#ifdef HAVE_GETPROTOBYNUMBER
struct protoent* proto;
EnterCriticalSection( &csWSgetXXXbyYYY );
if( (proto = getprotobynumber(number)) != NULL )
@ -3054,6 +3056,7 @@ static WIN_protoent* __ws_getprotobynumber(int number, int dup_flag)
SetLastError(WSANO_DATA);
}
LeaveCriticalSection( &csWSgetXXXbyYYY );
#endif
return retval;
}
@ -3134,6 +3137,7 @@ struct WS_servent* WINAPI WS_getservbyname(const char *name, const char *proto)
static WIN_servent* __ws_getservbyport(int port, const char* proto, int dup_flag)
{
WIN_servent* retval = NULL;
#ifdef HAVE_GETSERVBYPORT
struct servent* serv;
if (!proto || wsi_strtolo( proto, NULL )) {
EnterCriticalSection( &csWSgetXXXbyYYY );
@ -3151,6 +3155,7 @@ static WIN_servent* __ws_getservbyport(int port, const char* proto, int dup_flag
LeaveCriticalSection( &csWSgetXXXbyYYY );
}
else SetLastError(WSAENOBUFS);
#endif
return retval;
}

View File

@ -303,5 +303,9 @@ UINT WINAPI WSOCK32_inet_network(const char *cp)
*/
struct netent * WINAPI WSOCK32_getnetbyname(const char *name)
{
#ifdef HAVE_GETNETBYNAME
return getnetbyname(name);
#else
return NULL;
#endif
}

View File

@ -61,23 +61,6 @@ typedef unsigned int size_t;
typedef int ssize_t;
#endif
#if !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME)
struct netent {
char *n_name;
char **n_aliases;
int n_addrtype;
unsigned long n_net;
};
#endif /* !defined(HAVE_GETNETBYADDR) && !defined(HAVE_GETNETBYNAME) */
#if !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER)
struct protoent {
char *p_name;
char **p_aliases;
int p_proto;
};
#endif /* !defined(HAVE_GETPROTOBYNAME) && !defined(HAVE_GETPROTOBYNUMBER) */
#ifndef HAVE_STATFS
# ifdef __BEOS__
# define STATFS_HAS_BFREE
@ -186,30 +169,10 @@ struct statfs;
int clone(int (*fn)(void *arg), void *stack, int flags, void *arg);
#endif /* !defined(HAVE_CLONE) && defined(linux) */
#ifndef HAVE_GETNETBYADDR
struct netent *getnetbyaddr(unsigned long net, int type);
#endif /* defined(HAVE_GETNETBYNAME) */
#ifndef HAVE_GETNETBYNAME
struct netent *getnetbyname(const char *name);
#endif /* defined(HAVE_GETNETBYNAME) */
#ifndef HAVE_GETPAGESIZE
size_t getpagesize(void);
#endif /* HAVE_GETPAGESIZE */
#ifndef HAVE_GETPROTOBYNAME
struct protoent *getprotobyname(const char *name);
#endif /* !defined(HAVE_GETPROTOBYNAME) */
#ifndef HAVE_GETPROTOBYNUMBER
struct protoent *getprotobynumber(int proto);
#endif /* !defined(HAVE_GETPROTOBYNUMBER) */
#ifndef HAVE_GETSERVBYPORT
struct servent *getservbyport(int port, const char *proto);
#endif /* !defined(HAVE_GETSERVBYPORT) */
#ifndef HAVE_GETSOCKOPT
int getsockopt(int socket, int level, int option_name, void *option_value, size_t *option_len);
#endif /* !defined(HAVE_GETSOCKOPT) */
@ -325,12 +288,7 @@ extern long interlocked_xchg_add( long *dest, long incr );
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
#define clone __WINE_NOT_PORTABLE(clone)
#define getnetbyaddr __WINE_NOT_PORTABLE(getnetbyaddr)
#define getnetbyname __WINE_NOT_PORTABLE(getnetbyname)
#define getpagesize __WINE_NOT_PORTABLE(getpagesize)
#define getprotobyname __WINE_NOT_PORTABLE(getprotobyname)
#define getprotobynumber __WINE_NOT_PORTABLE(getprotobynumber)
#define getservbyport __WINE_NOT_PORTABLE(getservbyport)
#define getsockopt __WINE_NOT_PORTABLE(getsockopt)
#define inet_network __WINE_NOT_PORTABLE(inet_network)
#define lstat __WINE_NOT_PORTABLE(lstat)

View File

@ -215,61 +215,6 @@ int strncasecmp( const char *str1, const char *str2, size_t n )
}
#endif /* HAVE_STRNCASECMP */
/***********************************************************************
* getnetbyaddr
*/
#ifndef HAVE_GETNETBYADDR
struct netent *getnetbyaddr(unsigned long net, int type)
{
errno = ENOSYS;
return NULL;
}
#endif /* defined(HAVE_GETNETBYNAME) */
/***********************************************************************
* getnetbyname
*/
#ifndef HAVE_GETNETBYNAME
struct netent *getnetbyname(const char *name)
{
errno = ENOSYS;
return NULL;
}
#endif /* defined(HAVE_GETNETBYNAME) */
/***********************************************************************
* getprotobyname
*/
#ifndef HAVE_GETPROTOBYNAME
struct protoent *getprotobyname(const char *name)
{
errno = ENOSYS;
return NULL;
}
#endif /* !defined(HAVE_GETPROTOBYNAME) */
/***********************************************************************
* getprotobynumber
*/
#ifndef HAVE_GETPROTOBYNUMBER
struct protoent *getprotobynumber(int proto)
{
errno = ENOSYS;
return NULL;
}
#endif /* !defined(HAVE_GETPROTOBYNUMBER) */
/***********************************************************************
* getservbyport
*/
#ifndef HAVE_GETSERVBYPORT
struct servent *getservbyport(int port, const char *proto)
{
errno = ENOSYS;
return NULL;
}
#endif /* !defined(HAVE_GETSERVBYPORT) */
/***********************************************************************
* getsockopt
*/