[lxc-devel] lxcfs and print_subsystems()

Dietmar Maurer dietmar at proxmox.com
Thu Nov 19 07:57:09 UTC 2015


OK, maybe this is just a bug in systemd logging code.
The following patch fixes the problem:

Index: new/lxcfs.c
===================================================================
--- new.orig/lxcfs.c
+++ new/lxcfs.c
@@ -3183,6 +3183,8 @@ int main(int argc, char *argv[])
 	newargv[cnt++] = argv[1];
 	newargv[cnt++] = NULL;
 
+	setlinebuf(stdout);
+
 	if (!cgfs_setup_controllers())
 		goto out;
 


it also helps if you print to stderr instead of stdout.


> # lxc-attach -n 102 ps
> Nov 19 07:00:26 elsa lxcfs[12165]: hierarchies: 1: name=systemd
> Nov 19 07:00:26 elsa lxcfs[12165]: 2: cpuset
> Nov 19 07:00:26 elsa lxcfs[12165]: 3: cpu,cpuacct
> Nov 19 07:00:26 elsa lxcfs[12165]: 4: blkio
> Nov 19 07:00:26 elsa lxcfs[12165]: 5: memory
> Nov 19 07:00:26 elsa lxcfs[12165]: 6: devices
> Nov 19 07:00:26 elsa lxcfs[12165]: 7: freezer
> Nov 19 07:00:26 elsa lxcfs[12165]: 8: net_cls,net_prio
> Nov 19 07:00:26 elsa lxcfs[12165]: 9: perf_event
> Nov 19 07:00:26 elsa lxcfs[12165]: 10: hugetlb
> 
> But PID is always the same, no crash, no restart. Nethertheless,
> it looks like main() is called several times??



More information about the lxc-devel mailing list