File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 31
31
32
32
#include "mount-api-utils.h"
33
33
34
+ #ifdef HAVE_LINUX_NSFS_H
35
+ # include <linux/nsfs.h>
36
+ # if defined(NS_GET_NSTYPE ) && defined(NS_GET_OWNER_UID )
37
+ # define USE_NS_GET_API 1
38
+ # endif
39
+ #endif
40
+
34
41
typedef struct {
35
42
const char * name ;
36
43
int (* fnc )(void );
@@ -132,6 +139,18 @@ static int hlp_sz_time(void)
132
139
return 0 ;
133
140
}
134
141
142
+ static int hlp_get_nstype_ok (void )
143
+ {
144
+ #ifdef USE_NS_GET_API
145
+ errno = 0 ;
146
+ ioctl (STDOUT_FILENO , NS_GET_NSTYPE );
147
+ #else
148
+ errno = ENOSYS ;
149
+ #endif
150
+ printf ("%d\n" , errno != ENOSYS );
151
+ return 0 ;
152
+ }
153
+
135
154
static const mntHlpfnc hlps [] =
136
155
{
137
156
{ "WORDSIZE" , hlp_wordsize },
@@ -147,6 +166,7 @@ static const mntHlpfnc hlps[] =
147
166
{ "enotty-ok" , hlp_enotty_ok },
148
167
{ "fsopen-ok" , hlp_fsopen_ok },
149
168
{ "sz(time_t)" , hlp_sz_time },
169
+ { "ns-gettype-ok" , hlp_get_nstype_ok },
150
170
{ NULL , NULL }
151
171
};
152
172
@@ -181,4 +201,3 @@ int main(int argc, char **argv)
181
201
182
202
exit (re ? EXIT_FAILURE : EXIT_SUCCESS );
183
203
}
184
-
Original file line number Diff line number Diff line change @@ -25,11 +25,16 @@ ts_init "$*"
25
25
ts_check_test_command " $TS_CMD_LSNS "
26
26
ts_check_test_command " $TS_CMD_LSFD "
27
27
ts_check_test_command " $TS_HELPER_MKFDS "
28
+ ts_check_test_command " $TS_HELPER_SYSINFO "
28
29
29
30
ts_check_prog " ip"
30
31
31
32
ts_skip_nonroot
32
33
34
+ if [ " $( $TS_HELPER_SYSINFO ns-gettyep-ok) " == " 0" ]; then
35
+ ts_skip " NS_GET_NSTYPE ioctl cmd not available"
36
+ fi
37
+
33
38
FD=4
34
39
NS=LSNS-TEST-FILEDESC-NS
35
40
FILE=/run/netns/$NS
You can’t perform that action at this time.
0 commit comments