Move the (at this time private) get{proto,serv}ent_r() prototypes and

data structures into the libc sources until the interface gets redone.
Approved by christos.
This commit is contained in:
kleink 2005-04-18 19:39:45 +00:00
parent 1e5f8afdd2
commit 4e3cae58ff
15 changed files with 163 additions and 65 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: netdb.h,v 1.50 2005/03/21 13:30:50 kleink Exp $ */
/* $NetBSD: netdb.h,v 1.51 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1980, 1983, 1988, 1993
@ -335,46 +335,6 @@ void freeaddrinfo(struct addrinfo *);
const char *gai_strerror(int);
#endif
void setservent(int);
#if defined(_NETBSD_SOURCE) && defined(_LIBC)
struct protoent_data {
FILE *fp;
struct protoent proto;
char **aliases;
size_t maxaliases;
int stayopen;
char *line;
void *dummy;
};
struct protoent *getprotoent_r(struct protoent *, struct protoent_data *);
struct protoent *getprotobyname_r(const char *,
struct protoent *, struct protoent_data *);
struct protoent *getprotobynumber_r(int,
struct protoent *, struct protoent_data *);
void setprotoent_r(int, struct protoent_data *);
void endprotoent_r(struct protoent_data *);
struct servent_data {
FILE *fp;
struct servent serv;
char **aliases;
size_t maxaliases;
int stayopen;
char *line;
void *dummy;
};
struct servent *getservent_r(struct servent *, struct servent_data *);
struct servent *getservbyname_r(const char *, const char *,
struct servent *, struct servent_data *);
struct servent *getservbyport_r(int, const char *,
struct servent *, struct servent_data *);
void setservent_r(int, struct servent_data *);
void endservent_r(struct servent_data *);
#endif /* _NETBSD_SOURCE && _LIBC */
__END_DECLS
#endif /* !_NETDB_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotobyname.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getprotobyname.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getprotobyname.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getprotobyname.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -45,6 +45,8 @@ __RCSID("$NetBSD: getprotobyname.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(getprotobyname,_getprotobyname)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotobyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $ */
/* $NetBSD: getprotobyname_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getprotoname.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getprotobyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
__RCSID("$NetBSD: getprotobyname_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -44,6 +44,8 @@ __RCSID("$NetBSD: getprotobyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
#include <netdb.h>
#include <string.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(getprotobyname_r,_getprotobyname_r)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotobynumber.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getprotobynumber.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getprotobynumber.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getprotobynumber.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -46,6 +46,8 @@ __RCSID("$NetBSD: getprotobynumber.c,v 1.2 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(getprotobynumber,_getprotobynumber)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotobynumber_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $ */
/* $NetBSD: getprotobynumber_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getproto.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getprotobynumber_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
__RCSID("$NetBSD: getprotobynumber_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -42,6 +42,8 @@ __RCSID("$NetBSD: getprotobynumber_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
#include <netdb.h>
#include <stddef.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(getprotobynumber_r,_getprotobynumber_r)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotoent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getprotoent.c,v 1.11 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getprotoent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getprotoent.c,v 1.11 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -46,6 +46,8 @@ __RCSID("$NetBSD: getprotoent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(endprotoent,_endprotoent)
__weak_alias(getprotoent,_getprotoent)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getprotoent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $ */
/* $NetBSD: getprotoent_r.c,v 1.5 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getprotoent.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getprotoent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $");
__RCSID("$NetBSD: getprotoent_r.c,v 1.5 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -45,6 +45,8 @@ __RCSID("$NetBSD: getprotoent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $");
#include <stdlib.h>
#include <string.h>
#include "protoent.h"
#ifdef __weak_alias
__weak_alias(endprotoent_r,_endprotoent_r)
__weak_alias(getprotoent_r,_getprotoent_r)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservbyname.c,v 1.12 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getservbyname.c,v 1.13 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getservbyname.c,v 1.12 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getservbyname.c,v 1.13 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -45,6 +45,8 @@ __RCSID("$NetBSD: getservbyname.c,v 1.12 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(getservbyname,_getservbyname)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservbyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $ */
/* $NetBSD: getservbyname_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getservbyname.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getservbyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
__RCSID("$NetBSD: getservbyname_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -43,6 +43,8 @@ __RCSID("$NetBSD: getservbyname_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
#include <netdb.h>
#include <string.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(getservbyname_r,_getservbyname_r)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservbyport.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getservbyport.c,v 1.11 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getservbyport.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getservbyport.c,v 1.11 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -46,6 +46,8 @@ __RCSID("$NetBSD: getservbyport.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(getservbyport,_getservbyport)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservbyport_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $ */
/* $NetBSD: getservbyport_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getservbyport.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getservbyport_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
__RCSID("$NetBSD: getservbyport_r.c,v 1.3 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -42,6 +42,8 @@ __RCSID("$NetBSD: getservbyport_r.c,v 1.2 2004/03/04 02:30:41 enami Exp $");
#include <netdb.h>
#include <string.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(getservbyport_r,_getservbyport_r)
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $ */
/* $NetBSD: getservent.c,v 1.11 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: getservent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
__RCSID("$NetBSD: getservent.c,v 1.11 2005/04/18 19:39:45 kleink Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@ -46,6 +46,8 @@ __RCSID("$NetBSD: getservent.c,v 1.10 2005/01/07 22:22:49 mycroft Exp $");
#include <netdb.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(endservent,_endservent)
__weak_alias(getservent,_getservent)

View File

@ -1,4 +1,4 @@
/* $NetBSD: getservent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $ */
/* $NetBSD: getservent_r.c,v 1.5 2005/04/18 19:39:45 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)getservent.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: getservent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $");
__RCSID("$NetBSD: getservent_r.c,v 1.5 2005/04/18 19:39:45 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -45,6 +45,8 @@ __RCSID("$NetBSD: getservent_r.c,v 1.4 2004/02/25 06:28:10 taca Exp $");
#include <string.h>
#include <stdlib.h>
#include "servent.h"
#ifdef __weak_alias
__weak_alias(endservent_r,_endservent_r)
__weak_alias(getservent_r,_getservent_r)

57
lib/libc/net/protoent.h Normal file
View File

@ -0,0 +1,57 @@
/* $NetBSD: protoent.h,v 1.1 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
struct protoent_data {
FILE *fp;
struct protoent proto;
char **aliases;
size_t maxaliases;
int stayopen;
char *line;
void *dummy;
};
struct protoent *getprotoent_r(struct protoent *, struct protoent_data *);
struct protoent *getprotobyname_r(const char *,
struct protoent *, struct protoent_data *);
struct protoent *getprotobynumber_r(int,
struct protoent *, struct protoent_data *);
void setprotoent_r(int, struct protoent_data *);
void endprotoent_r(struct protoent_data *);

57
lib/libc/net/servent.h Normal file
View File

@ -0,0 +1,57 @@
/* $NetBSD: servent.h,v 1.1 2005/04/18 19:39:45 kleink Exp $ */
/*-
* Copyright (c) 2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
struct servent_data {
FILE *fp;
struct servent serv;
char **aliases;
size_t maxaliases;
int stayopen;
char *line;
void *dummy;
};
struct servent *getservent_r(struct servent *, struct servent_data *);
struct servent *getservbyname_r(const char *, const char *,
struct servent *, struct servent_data *);
struct servent *getservbyport_r(int, const char *,
struct servent *, struct servent_data *);
void setservent_r(int, struct servent_data *);
void endservent_r(struct servent_data *);