--- Linux-Clone/Clone.xs 2022/07/25 10:59:29 1.5 +++ Linux-Clone/Clone.xs 2022/09/03 23:47:02 1.6 @@ -11,6 +11,11 @@ #include #include +#include + +#include +#include + #ifdef __has_include #if !__has_include("linux/kcmp.h") // use "" as GCC wrongly expands macros #undef SYS_kcmp @@ -78,6 +83,9 @@ } *civ, const_iv[] = { # define const_iv(name) { # name, (IV)name }, # define const_iv_clone(name) { # name, (IV) CLONE_ ## name }, +# ifdef CSIGNAL + const_iv (CSIGNAL) +# endif # ifdef CLONE_FILES const_iv_clone (FILES) # endif @@ -193,8 +201,7 @@ } } } - OUTPUT: - RETVAL + OUTPUT: RETVAL int unshare (int flags) @@ -209,9 +216,23 @@ RETVAL = syscall (SYS_pivot_root, (const char *)SvPVbyte_nolen (new_root), (const char *)SvPVbyte_nolen (old_root)); - OUTPUT: - RETVAL + OUTPUT: RETVAL int kcmp (IV pid1, IV pid2, IV type, UV idx1 = 0, UV idx2 = 0) +int +siocsifflags (char *ifname, U32 flags = IFF_UP) + CODE: +{ + int saved_errno; + struct ifreq ifr; + int fd = socket (AF_INET, SOCK_DGRAM, 0); + strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name)); + RETVAL = ioctl (fd, SIOCSIFFLAGS, &ifr); + saved_errno = errno; + close (fd); + errno = saved_errno; +} + OUTPUT: RETVAL +