summaryrefslogtreecommitdiffstats
path: root/cpukit/libnetworking/rtems/sghostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libnetworking/rtems/sghostname.c')
-rw-r--r--cpukit/libnetworking/rtems/sghostname.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/cpukit/libnetworking/rtems/sghostname.c b/cpukit/libnetworking/rtems/sghostname.c
deleted file mode 100644
index df7513df4f..0000000000
--- a/cpukit/libnetworking/rtems/sghostname.c
+++ /dev/null
@@ -1,54 +0,0 @@
-#include <machine/rtems-bsd-kernel-space.h>
-
-/*
- * RTEMS versions of hostname functions
- * FIXME: Not thread-safe
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <errno.h>
-#include <unistd.h>
-#include <rtems/rtems_bsdnet.h>
-#include <sys/param.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-
-static char *rtems_hostname;
-
-int
-gethostname (char *name, size_t namelen)
-{
- char *cp = rtems_hostname;
-
- if (cp == NULL)
- cp = "";
- strncpy (name, cp, namelen);
- return 0;
-}
-
-int
-sethostname (const char *name, size_t namelen)
-{
- char *old, *new;
-
- if (namelen >= MAXHOSTNAMELEN) {
- errno = EINVAL;
- return -1;
- }
- new = malloc (namelen + 1, M_HTABLE, M_NOWAIT);
- if (new == NULL) {
- errno = ENOMEM;
- return -1;
- }
- strncpy (new, name, namelen);
- new[namelen] = '\0';
- old = rtems_hostname;
- rtems_hostname = new;
- if (old)
- free (old, M_HTABLE);
- return 0;
-}