[lxc-users] system libraries under the hood.

Serge Hallyn serge.hallyn at ubuntu.com
Wed Oct 1 22:05:43 UTC 2014


Quoting Vicky Kak (vicky.kak at gmail.com):
> Hi All,
> 
> I have been using linux container for some time as a user and now getting
> interested to know how it is internally working, I started looking for
> internals and could make that it is using cgroups under the hood.
> The docs mention that it is using many other kernel pieces, I see the code
> being implemented in C ( Ah I am not a C guy but am willing to play with
> it).
> I wanted to know which system librarary is being used in c code that
> invokes cgroup call, I looked at the code at
> https://github.com/lxc/lxc/blob/master/src/lxc/lxccontainer.c
> 
> and see #include "cgroup.h" being included.
> cgroup.c does not seem to contain the reference of
> http://libcg.sourceforge.net/ library which I was expecting.
> Can someone provide the high level code flow, I can take it from there.
> 
> Sorry if I am asking stupid question due to my ignorance of C understanding.

src/lxc/cgroup.{c,h} is a frontend to the two cgroup backends we support -
src/lxc/cgfs.c, which uses the cgroup filesystem (which of course requires
that cgroup fs be mounted), and src/lxc/cgmanager.c, which uses dbus calls
to the cgroup manager (cgmanager, see github.com/cgmanager/cgmanager and
cgmanager.linuxcontainers.org).

-serge


More information about the lxc-users mailing list