* conform/conformtest.pl: Implement optional-type.

	* resolv/netdb.h: Include <netinet/in.h> not <sys/socket.h>.  Include
	<rpc/netdb.h> only if __USE_MISC.  Include <stdint.h> instead of
	defining uint32_t here.  Define IPPORT_RESERVED.
	(struct hostent): Type of h_length element is int.
	(getnameinfo): Type of flags parameter is unsigned int.
	* inet/getnameinfo.c (getnameinfo): flags argument is unsigned.
	* conform/data/netdb.h-data: Add many missing definitions.
This commit is contained in:
Ulrich Drepper 2001-01-27 02:27:46 +00:00
parent 12b64309cf
commit ccd4b479dc
5 changed files with 100 additions and 18 deletions

View File

@ -1,5 +1,15 @@
2001-01-26 Ulrich Drepper <drepper@redhat.com> 2001-01-26 Ulrich Drepper <drepper@redhat.com>
* conform/conformtest.pl: Implement optional-type.
* resolv/netdb.h: Include <netinet/in.h> not <sys/socket.h>. Include
<rpc/netdb.h> only if __USE_MISC. Include <stdint.h> instead of
defining uint32_t here. Define IPPORT_RESERVED.
(struct hostent): Type of h_length element is int.
(getnameinfo): Type of flags parameter is unsigned int.
* inet/getnameinfo.c (getnameinfo): flags argument is unsigned.
* conform/data/netdb.h-data: Add many missing definitions.
* conform/conformtest.pl: Implement optional-macro. * conform/conformtest.pl: Implement optional-macro.
* conform/data/math.h-data: Update for XPG6. * conform/data/math.h-data: Update for XPG6.

View File

@ -546,6 +546,30 @@ while ($#headers >= 0) {
$res = runtest ($fnamebase, "Testing for value of constant $const", $res = runtest ($fnamebase, "Testing for value of constant $const",
"Constant \"$const\" has not the right value.", $res); "Constant \"$const\" has not the right value.", $res);
} }
} elsif (/^optional-type *({([^}]*)|([a-zA-Z0-9_]*))/) {
my($type) = "$2$3";
# Remember that this name is allowed.
if ($type =~ /^struct *(.*)/) {
push @allow, $1;
} elsif ($type =~ /^union *(.*)/) {
push @allow, $1;
} else {
push @allow, $type;
}
# Remember that this name is allowed.
push @allow, $type;
# Generate a program to test for the availability of this constant.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
print TESTFILE "#include <$h>\n";
print TESTFILE "$type *a;\n";
close (TESTFILE);
compiletest ($fnamebase, "Testing for type $type",
"Type \"$type\" not available.", $missing, 1);
} elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) { } elsif (/^type *({([^}]*)|([a-zA-Z0-9_]*))/) {
my($type) = "$2$3"; my($type) = "$2$3";

View File

@ -1,6 +1,6 @@
#ifndef ISO #ifndef ISO
type in_port_t optional-type in_port_t
type in_addr_t optional-type in_addr_t
type {struct hostent} type {struct hostent}
@ -42,17 +42,63 @@ macro NO_DATA
macro NO_RECOVERY macro NO_RECOVERY
macro TRY_AGAIN macro TRY_AGAIN
macro AI_V4MAPPED type {struct addrinfo}
macro AI_ALL element {struct addrinfo} int ai_flags
macro AI_ADDRCONFIG element {struct addrinfo} int ai_family
macro AI_DEFAULT element {struct addrinfo} int ai_socktype
element {struct addrinfo} int ai_protocol
element {struct addrinfo} socklen_t ai_addrlen
element {struct addrinfo} {struct sockaddr*} ai_addr
element {struct addrinfo} {char*} ai_canonname
element {struct addrinfo} {struct addrinfo*} ai_next
macro AI_PASSIVE
macro AI_CANONNAME
macro AI_NUMERICHOST
macro NI_NOFQDN
macro NI_NUMERICHOST
macro NI_NAMEREQD
macro NI_NUMERICSERV
macro NI_DGRAM
macro EAI_AGAIN
macro EAI_BADFLAGS
macro EAI_FAIL
macro EAI_FAMILY
macro EAI_MEMORY
macro EAI_NONAME
macro EAI_SERVICE
macro EAI_SOCKTYPE
macro EAI_SYSTEM
function void endhostent (void) function void endhostent (void)
function void endnetent (void) function void endnetent (void)
function void endprotoent (void) function void endprotoent (void)
function void endservent (void) function void endservent (void)
function void freeaddrinfo (struct addrinfo*)
function {char*} gai_strerror (int)
function int getaddrinfo (const char*, const char*, const struct addrinfo*, struct addrinfo**)
function {struct hostent*} gethostbyaddr (const void*, socklen_t, int) function {struct hostent*} gethostbyaddr (const void*, socklen_t, int)
function {struct hostent*} gethostbyname (const char*) function {struct hostent*} gethostbyname (const char*)
function {struct hostent*} gethostent (void) function {struct hostent*} gethostent (void)
function int getnameinfo (const struct sockaddr*, socklen_t, char*, socklen_t, char*, socklen_t, unsigned)
function {struct netent*} getnetbyaddr (uint32_t, int)
function {struct netent*} getnetbyname (const char*)
function {struct netent*} getnetent (void)
function {struct protoent*} getprotobyname (const char *)
function {struct protoent*} getprotobynumber (int)
function {struct protoent*} getprotoent (void)
function {struct servent*} getservbyname (const char*, const char*)
function {struct servent*} getservbyport (int, const char*)
function {struct servent*} getservent (void)
function void sethostent (int)
function void setnetent (int)
function void setprotoent (int)
function void setservent (int)
type socklen_t
allow-header netinet/in.h
allow-header inttypes.h
#endif #endif

View File

@ -166,7 +166,8 @@ nrl_domainname (void)
int int
getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
socklen_t hostlen, char *serv, socklen_t servlen, int flags) socklen_t hostlen, char *serv, socklen_t servlen,
unsigned int flags)
{ {
int serrno = errno; int serrno = errno;
int tmpbuflen = 1024; int tmpbuflen = 1024;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc. /* Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
This file is part of the GNU C Library. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it The GNU C Library is free software; you can redistribute it
@ -25,16 +25,12 @@
#include <features.h> #include <features.h>
#include <netinet/in.h>
#include <stdint.h>
#ifdef __USE_MISC
/* This is necessary to make this include file properly replace the /* This is necessary to make this include file properly replace the
Sun version. */ Sun version. */
#include <rpc/netdb.h> # include <rpc/netdb.h>
#include <sys/socket.h> /* need socklen_t */
#define __need_size_t
#include <stddef.h>
#ifndef __uint32_t_defined
typedef unsigned int uint32_t;
# define __uint32_t_defined
#endif #endif
#include <bits/netdb.h> #include <bits/netdb.h>
@ -87,6 +83,11 @@ __set_h_errno (int __err)
type. */ type. */
#define NO_ADDRESS NO_DATA /* No address, look for MX record. */ #define NO_ADDRESS NO_DATA /* No address, look for MX record. */
#ifdef __USE_XOPEN2K
/* Highest reserved Internet port number. */
# define IPPORT_RESERVED 1024
#endif
#ifdef __USE_GNU #ifdef __USE_GNU
/* Scope delimiter for getaddrinfo(), getnameinfo(). */ /* Scope delimiter for getaddrinfo(), getnameinfo(). */
# define SCOPE_DELIMITER '%' # define SCOPE_DELIMITER '%'
@ -107,7 +108,7 @@ struct hostent
char *h_name; /* Official name of host. */ char *h_name; /* Official name of host. */
char **h_aliases; /* Alias list. */ char **h_aliases; /* Alias list. */
int h_addrtype; /* Host address type. */ int h_addrtype; /* Host address type. */
socklen_t h_length; /* Length of address. */ int h_length; /* Length of address. */
char **h_addr_list; /* List of addresses from name server. */ char **h_addr_list; /* List of addresses from name server. */
#define h_addr h_addr_list[0] /* Address, for backward compatibility. */ #define h_addr h_addr_list[0] /* Address, for backward compatibility. */
}; };
@ -455,7 +456,7 @@ extern char *gai_strerror (int __ecode) __THROW;
extern int getnameinfo (__const struct sockaddr *__restrict __sa, extern int getnameinfo (__const struct sockaddr *__restrict __sa,
socklen_t __salen, char *__restrict __host, socklen_t __salen, char *__restrict __host,
socklen_t __hostlen, char *__restrict __serv, socklen_t __hostlen, char *__restrict __serv,
socklen_t __servlen, int __flags) __THROW; socklen_t __servlen, unsigned int __flags) __THROW;
#endif /* POSIX */ #endif /* POSIX */