This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: RFC: NSS prototypes


>>>>> Ulrich Drepper writes:

 > Andreas Jaeger <aj@suse.de> writes:
>> I'd like to fix all these NSS related warnings with a patch like the
>> following.  What do you think?  Shall I finish the patch?  Or what
>> needs changing?

 > Should work this way.  It's an internal header so nobody will look
 > closely at it to see how ugly the code is.

I hope it's not too ugly.  

My patch showed a number of problems - like the following (I moved the
declarations to its proper place in netdb.h instead of in nsswitch.h).

In file included from nss_files/files-hosts.c:50:
nss_files/files-XXX.c:116: warning: no previous prototype for `_nss_files_sethostent'
nss_files/files-XXX.c:153: warning: no previous prototype for `_nss_files_endhostent'
nss_files/files-hosts.c:271: conflicting types for `_nss_files_gethostbyname2_r'
../include/netdb.h:182: previous declaration of `_nss_files_gethostbyname2_r'

Shouldn't the following macro in files-hosts.c have all arguments?

HOST_DB_LOOKUP (hostbyname, ,,
		{
		  LOOKUP_NAME_CASE (h_name, h_aliases)
		}, const char *name)


FYI I'm appending my current patch, I'll enhance and refine it
tomorrow.

Andreas

2000-12-17  Andreas Jaeger  <aj@suse.de>

	* nis/nss_nis/nis-proto.c (_nss_nis_setprotoent): Fix declaration.

	* include/netdb.h (DECLARE_NSS_PROTOTYPES): New.

============================================================
Index: include/netdb.h
--- include/netdb.h	2000/11/26 09:43:11	1.11
+++ include/netdb.h	2000/12/17 20:05:20
@@ -143,10 +143,58 @@
 /* The following declarations and definitions have been removed from
    the public header since we don't want people to use them.  */
 
-#define AI_V4MAPPED	0x0008  /* IPv4-mapped addresses are acceptable.  */
-#define AI_ALL		0x0010  /* Return both IPv4 and IPv6 addresses.  */
-#define AI_ADDRCONFIG	0x0020  /* Use configuration of this host to choose
-                                  returned address type.  */
+#define AI_V4MAPPED	0x0008	/* IPv4-mapped addresses are acceptable.  */
+#define AI_ALL		0x0010	/* Return both IPv4 and IPv6 addresses.	 */
+#define AI_ADDRCONFIG	0x0020	/* Use configuration of this host to choose
+				  returned address type.  */
 #define AI_DEFAULT    (AI_V4MAPPED | AI_ADDRCONFIG)
+
+#define DECLARE_NSS_PROTOTYPES(service)					      \
+extern enum nss_status _nss_ ## service ## _setprotoent (int);		      \
+extern enum nss_status _nss_ ## service ## _endprotoent (void);		      \
+extern enum nss_status _nss_ ## service ## _getprotoent_r		      \
+		       (struct protoent *proto, char *buffer, size_t buflen,  \
+			int *errnop);					      \
+extern enum nss_status _nss_ ## service ## _getprotobyname_r		      \
+		       (const char *name, struct protoent *proto,	      \
+			char *buffer, size_t buflen, int *errnop);	      \
+extern enum nss_status _nss_ ## service ## _getprotobynumber_r		      \
+		       (int number, struct protoent *proto,		      \
+			char *buffer, size_t buflen, int *errnop);	      \
+extern enum nss_status _nss_ ## service ## _gethostent_r		      \
+		       (struct hostent *host, char *buffer, size_t buflen,    \
+			int *errnop, int *h_errnop);			      \
+extern enum nss_status _nss_ ## service ## _gethostbyname2_r		      \
+		       (const char *name, int af, struct hostent *host,	      \
+			char *buffer, size_t buflen, int *errnop,	      \
+			int *h_errnop, int flags);			      \
+extern enum nss_status _nss_ ## service ## _gethostbyname_r		      \
+		       (const char *name, struct hostent *host, char *buffer, \
+			size_t buflen, int *errnop, int *h_errnop);	      \
+extern enum nss_status _nss_ ## service ## _gethostbyaddr_r		      \
+		       (const void *addr, socklen_t addrlen, int af,	      \
+			struct hostent *host, char *buffer, size_t buflen,    \
+			int *errnop, int *h_errnop);
+extern enum nss_status _nss_ ## service ## _setservent (int);
+extern enum nss_status _nss_ ## service ## _endservent (void);
+extern enum nss_status _nss_ ## service ## _getservent_r
+		       (struct servent *serv, char *buffer, size_t buflen,
+			int *errnop);
+extern enum nss_status _nss_ ## service ## _getservbyname_r
+		       (const char *name, char *protocol,
+			struct servent *serv, char *buffer, size_t buflen,
+			int *errnop);
+extern enum nss_status _nss_ ## service ## _getservbyport_r
+		       (int port, char *protocol, struct servent *serv,
+			char *buffer, size_t buflen, int *errnop);
+
+
+
+DECLARE_NSS_PROTOTYPES (nis)
+DECLARE_NSS_PROTOTYPES (nisplus)
+DECLARE_NSS_PROTOTYPES (hesiod)
+DECLARE_NSS_PROTOTYPES (files)
+
+#undef DECLARE_NSS_PROTOTYPES
 
 #endif /* !_NETDB_H */
============================================================
Index: nis/nss_nis/nis-proto.c
--- nis/nss_nis/nis-proto.c	2000/03/17 18:34:12	1.14
+++ nis/nss_nis/nis-proto.c	2000/12/17 20:05:21
@@ -106,7 +106,7 @@
 }
 
 enum nss_status
-_nss_nis_setprotoent (void)
+_nss_nis_setprotoent (int)
 {
   enum nss_status status;
 

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]