@@ -1179,17 +1179,18 @@ static void usage(void)
1179
1179
lxcfs_info ("Usage: lxcfs <directory>\n" );
1180
1180
lxcfs_info ("lxcfs is a FUSE-based proc, sys and cgroup virtualizing filesystem\n" );
1181
1181
lxcfs_info ("Options :" );
1182
- lxcfs_info (" -d, --debug Run lxcfs with debugging enabled" );
1183
- lxcfs_info (" -f, --foreground Run lxcfs in the foreground" );
1184
- lxcfs_info (" -h, --help Print help" );
1185
- lxcfs_info (" -l, --enable-loadavg Enable loadavg virtualization" );
1186
- lxcfs_info (" -o Options to pass directly through fuse" );
1187
- lxcfs_info (" -p, --pidfile=FILE Path to use for storing lxcfs pid" );
1188
- lxcfs_info (" Default pidfile is %s/lxcfs.pid" , RUNTIME_PATH );
1189
- lxcfs_info (" -u, --disable-swap Disable swap virtualization" );
1190
- lxcfs_info (" -v, --version Print lxcfs version" );
1191
- lxcfs_info (" --enable-cfs Enable CPU virtualization via CPU shares" );
1192
- lxcfs_info (" --enable-pidfd Use pidfd for process tracking" );
1182
+ lxcfs_info (" -d, --debug Run lxcfs with debugging enabled" );
1183
+ lxcfs_info (" -f, --foreground Run lxcfs in the foreground" );
1184
+ lxcfs_info (" -h, --help Print help" );
1185
+ lxcfs_info (" -l, --enable-loadavg Enable loadavg virtualization" );
1186
+ lxcfs_info (" -o Options to pass directly through fuse" );
1187
+ lxcfs_info (" -p, --pidfile=FILE Path to use for storing lxcfs pid" );
1188
+ lxcfs_info (" Default pidfile is %s/lxcfs.pid" , RUNTIME_PATH );
1189
+ lxcfs_info (" -u, --disable-swap Disable swap virtualization" );
1190
+ lxcfs_info (" -v, --version Print lxcfs version" );
1191
+ lxcfs_info (" --enable-cfs Enable CPU virtualization via CPU shares" );
1192
+ lxcfs_info (" --enable-pidfd Use pidfd for process tracking" );
1193
+ lxcfs_info (" --allow-write-on-cgroup Allow write() syscall on cgroup lxcfs subtree" );
1193
1194
exit (EXIT_FAILURE );
1194
1195
}
1195
1196
@@ -1229,17 +1230,18 @@ static int set_pidfile(char *pidfile)
1229
1230
}
1230
1231
1231
1232
static const struct option long_options [] = {
1232
- {"debug" , no_argument , 0 , 'd' },
1233
- {"disable-swap" , no_argument , 0 , 'u' },
1234
- {"enable-loadavg" , no_argument , 0 , 'l' },
1235
- {"foreground" , no_argument , 0 , 'f' },
1236
- {"help" , no_argument , 0 , 'h' },
1237
- {"version" , no_argument , 0 , 'v' },
1238
-
1239
- {"enable-cfs" , no_argument , 0 , 0 },
1240
- {"enable-pidfd" , no_argument , 0 , 0 },
1241
-
1242
- {"pidfile" , required_argument , 0 , 'p' },
1233
+ {"debug" , no_argument , 0 , 'd' },
1234
+ {"disable-swap" , no_argument , 0 , 'u' },
1235
+ {"enable-loadavg" , no_argument , 0 , 'l' },
1236
+ {"foreground" , no_argument , 0 , 'f' },
1237
+ {"help" , no_argument , 0 , 'h' },
1238
+ {"version" , no_argument , 0 , 'v' },
1239
+
1240
+ {"enable-cfs" , no_argument , 0 , 0 },
1241
+ {"enable-pidfd" , no_argument , 0 , 0 },
1242
+ {"allow-write-on-cgroup" , no_argument , 0 , 0 },
1243
+
1244
+ {"pidfile" , required_argument , 0 , 'p' },
1243
1245
{ },
1244
1246
};
1245
1247
@@ -1309,7 +1311,8 @@ int main(int argc, char *argv[])
1309
1311
opts -> swap_off = false;
1310
1312
opts -> use_pidfd = false;
1311
1313
opts -> use_cfs = false;
1312
- opts -> version = 1 ;
1314
+ opts -> version = 2 ;
1315
+ opts -> allow_write_on_cgroup = false;
1313
1316
1314
1317
while ((c = getopt_long (argc , argv , "dulfhvso:p:" , long_options , & idx )) != -1 ) {
1315
1318
switch (c ) {
@@ -1318,6 +1321,8 @@ int main(int argc, char *argv[])
1318
1321
opts -> use_pidfd = true;
1319
1322
else if (strcmp (long_options [idx ].name , "enable-cfs" ) == 0 )
1320
1323
opts -> use_cfs = true;
1324
+ else if (strcmp (long_options [idx ].name , "allow-write-on-cgroup" ) == 0 )
1325
+ opts -> allow_write_on_cgroup = true;
1321
1326
else
1322
1327
usage ();
1323
1328
break ;
0 commit comments