You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experimenting with using Swift for some low(ish)-level Linux system programming, and I'd like to invoke the unshare(2) system call to create a new namespace.
unshare is normally exposed in C by sched.h (ultimately bits/sched.h). CSystem on Linux includes sched.h; however, as it doesn't define _GNU_SOURCE, most of bits/sched.h is not exposed, including the namespace (containerisation) functions clone, unshare, and setns (and their associated CLONE_* flags).
I understand the primary purpose of CSystem is to expose functionality that is then wrapped by System; and maybe one day System on Linux will include a wrapper for Linux namespaces: they're a compelling feature for the platform. Unfortunately, I'm not yet experienced enough with Swift to volunteer to write one.
In any case, would it be possible to #define _GNU_SOURCE in CSystem on Linux? What problems (if any) could this cause?
Other desirable system interfaces, often including safer alternatives to standard interfaces, are also gated behind it, e.g. get_current_dir_name, which was suggested for use in System in #71 (comment).
The text was updated successfully, but these errors were encountered:
I'm experimenting with using Swift for some low(ish)-level Linux system programming, and I'd like to invoke the unshare(2) system call to create a new namespace.
unshare
is normally exposed in C bysched.h
(ultimatelybits/sched.h
). CSystem on Linux includessched.h
; however, as it doesn't define_GNU_SOURCE
, most ofbits/sched.h
is not exposed, including the namespace (containerisation) functionsclone
,unshare
, andsetns
(and their associatedCLONE_*
flags).I understand the primary purpose of CSystem is to expose functionality that is then wrapped by System; and maybe one day System on Linux will include a wrapper for Linux namespaces: they're a compelling feature for the platform. Unfortunately, I'm not yet experienced enough with Swift to volunteer to write one.
In any case, would it be possible to
#define _GNU_SOURCE
in CSystem on Linux? What problems (if any) could this cause?Other desirable system interfaces, often including safer alternatives to standard interfaces, are also gated behind it, e.g.
get_current_dir_name
, which was suggested for use in System in #71 (comment).The text was updated successfully, but these errors were encountered: