summaryrefslogtreecommitdiff
path: root/libc/inet/getservice.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/inet/getservice.c')
-rw-r--r--libc/inet/getservice.c85
1 files changed, 45 insertions, 40 deletions
diff --git a/libc/inet/getservice.c b/libc/inet/getservice.c
index d5402ba3e..e4422246b 100644
--- a/libc/inet/getservice.c
+++ b/libc/inet/getservice.c
@@ -98,7 +98,7 @@ static void __initbuf(void)
}
}
-void setservent(int f)
+extern void attribute_hidden __setservent(int f)
{
LOCK;
if (servf == NULL)
@@ -108,8 +108,9 @@ void setservent(int f)
serv_stayopen |= f;
UNLOCK;
}
+strong_alias(__setservent,setservent)
-void endservent(void)
+extern void attribute_hidden __endservent(void)
{
LOCK;
if (servf) {
@@ -119,37 +120,9 @@ void endservent(void)
serv_stayopen = 0;
UNLOCK;
}
+strong_alias(__endservent,endservent)
-struct servent * getservent(void)
-{
- struct servent *result;
-
- __initbuf();
- getservent_r(&serv, servbuf, SBUFSIZE, &result);
- return result;
-}
-
-
-struct servent *getservbyname(const char *name, const char *proto)
-{
- struct servent *result;
-
- __initbuf();
- getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result);
- return result;
-}
-
-
-struct servent * getservbyport(int port, const char *proto)
-{
- struct servent *result;
-
- __initbuf();
- getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result);
- return result;
-}
-
-int getservent_r(struct servent * result_buf,
+extern int attribute_hidden __getservent_r(struct servent * result_buf,
char * buf, size_t buflen,
struct servent ** result)
{
@@ -228,8 +201,18 @@ again:
UNLOCK;
return 0;
}
+strong_alias(__getservent_r,getservent_r)
-int getservbyname_r(const char *name, const char *proto,
+struct servent * getservent(void)
+{
+ struct servent *result;
+
+ __initbuf();
+ __getservent_r(&serv, servbuf, SBUFSIZE, &result);
+ return result;
+}
+
+extern int attribute_hidden __getservbyname_r(const char *name, const char *proto,
struct servent * result_buf, char * buf, size_t buflen,
struct servent ** result)
{
@@ -237,8 +220,8 @@ int getservbyname_r(const char *name, const char *proto,
int ret;
LOCK;
- setservent(serv_stayopen);
- while (!(ret=getservent_r(result_buf, buf, buflen, result))) {
+ __setservent(serv_stayopen);
+ while (!(ret=__getservent_r(result_buf, buf, buflen, result))) {
if (__strcmp(name, result_buf->s_name) == 0)
goto gotname;
for (cp = result_buf->s_aliases; *cp; cp++)
@@ -250,27 +233,49 @@ gotname:
break;
}
if (!serv_stayopen)
- endservent();
+ __endservent();
UNLOCK;
return *result?0:ret;
}
+strong_alias(__getservbyname_r,getservbyname_r)
+
+struct servent *getservbyname(const char *name, const char *proto)
+{
+ struct servent *result;
+
+ __initbuf();
+ __getservbyname_r(name, proto, &serv, servbuf, SBUFSIZE, &result);
+ return result;
+}
+
-int getservbyport_r(int port, const char *proto,
+extern int attribute_hidden __getservbyport_r(int port, const char *proto,
struct servent * result_buf, char * buf,
size_t buflen, struct servent ** result)
{
int ret;
LOCK;
- setservent(serv_stayopen);
- while (!(ret=getservent_r(result_buf, buf, buflen, result))) {
+ __setservent(serv_stayopen);
+ while (!(ret=__getservent_r(result_buf, buf, buflen, result))) {
if (result_buf->s_port != port)
continue;
if (proto == 0 || __strcmp(result_buf->s_proto, proto) == 0)
break;
}
if (!serv_stayopen)
- endservent();
+ __endservent();
UNLOCK;
return *result?0:ret;
}
+strong_alias(__getservbyport_r,getservbyport_r)
+
+struct servent attribute_hidden * __getservbyport(int port, const char *proto)
+{
+ struct servent *result;
+
+ __initbuf();
+ __getservbyport_r(port, proto, &serv, servbuf, SBUFSIZE, &result);
+ return result;
+}
+strong_alias(__getservbyport,getservbyport)