syscall_wrappers: move sethostname()

parent 8cb8f970
...@@ -127,6 +127,19 @@ extern int pivot_root(const char *new_root, const char *put_old); ...@@ -127,6 +127,19 @@ extern int pivot_root(const char *new_root, const char *put_old);
#endif #endif
#endif #endif
/* Define sethostname() if missing from the C library */
#ifndef HAVE_SETHOSTNAME
static inline int sethostname(const char *name, size_t len)
{
#ifdef __NR_sethostname
return syscall(__NR_sethostname, name, len);
#else
errno = ENOSYS;
return -1;
#endif
}
#endif
/* Define setns() if missing from the C library */ /* Define setns() if missing from the C library */
#ifndef HAVE_SETNS #ifndef HAVE_SETNS
static inline int setns(int fd, int nstype) static inline int setns(int fd, int nstype)
......
...@@ -56,19 +56,6 @@ extern char *get_rundir(void); ...@@ -56,19 +56,6 @@ extern char *get_rundir(void);
#endif #endif
#endif #endif
/* Define sethostname() if missing from the C library */
#ifndef HAVE_SETHOSTNAME
static inline int sethostname(const char *name, size_t len)
{
#ifdef __NR_sethostname
return syscall(__NR_sethostname, name, len);
#else
errno = ENOSYS;
return -1;
#endif
}
#endif
/* Define unshare() if missing from the C library */ /* Define unshare() if missing from the C library */
#ifndef HAVE_UNSHARE #ifndef HAVE_UNSHARE
static inline int unshare(int flags) static inline int unshare(int flags)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment