Balbir Singh <balbir@...> writes:

> 
> On Tue, Jan 25, 2011 at 2:26 AM, adansilva05@...
> <adansilva05@...> wrote:
> > Hi All,
> >
> > I want to develop an application in C/C++ that allows to make 
> > calls directly to
> > cgroups, do you can make Cgroups operations from a program in C/C++?
> >
> > if possible, there is an API to do this, wich packages i should 
> > install? or how i do this?
> >
> > or someone who can help me on this issue?
> >
> 
> The library is written to be called from C/C++ code. Please see
> src/tools for examples of API usage. Please see tests as well. There
> is generated documentation at
> http://libcg.sourceforge.net/html/index.html.
> 
> For pacakges to be installed, please see your distro, it should be
> libcgroup-devel or libcgroup-dev.
> 
> Balbir
> 
> 


Hi Balbir,

I have ubuntu 10.10, the package i need is libcgroup-dev.
I installed the package successfully (apt-get install libcgroup-dev).

i try to compile a simple example that I did using this library, but 
when compiling I have the following error: 

my little program to test:

cgcreate.c
#include <libcgroup.h>

int main(int argc, char *argv[])
{
  int ret = 0;
  
  /* initialize libcg */
  ret = cgroup_init();

  return ret;
}

to get compiling:

root@comun-Inspiron-530s:~# gcc cgcreate.c -o create
/tmp/ccxO3B0V.o: In function `main':
cgcreate.c:(.text+0x12): undefined reference to `cgroup_init'
collect2: ld returned 1 exit status

what is the problem I have?

I check the installed library libcgroup.h which is in /usr/include 
which refers to init.h to use cgroup_init() function, and see that 
init.h only has:

ifndef _LIBCGROUP_INIT_H
#define _LIBCGROUP_INIT_H

#ifndef _LIBCGROUP_H_INSIDE
#error "Only <libcgroup.h> should be included directly."
#endif

#include <features.h>

__BEGIN_DECLS

/**
 * @defgroup group_init 1. Initialization
 * @{
 *
 * @name Initialization
 * @{
 * Application must initialize @c libcgroup using cgroup_init() before 
 *any other @c libcgroup function can be called. 
 */

/**
 * Initialize libcgroup. Information about mounted hierarchies are 
 * examined and cached internally (just what's mounted where, not 
 * the groups themselves).
 */
int cgroup_init(void);

/**
 * Returns path where is mounted given controller. Applications 
 * should rely on @c libcgroup API and not call this function directly.
 * @param controller Name of the controller
 * @param mount_point The string where the mount point location is 
 * stored.
 *      Please note, the caller must free the mount_point.
 */
int cgroup_get_subsys_mount_point(const char *controller, 
         char **mount_point);

/**
 * @}
 * @}
 */
__END_DECLS

#endif /* _LIBCGROUP_INIT_H */

in which I see that the function cgroup_init() is only declared and 
not defined, I do not understand.

also i try to compile the example cgcreate.c that is on the folder 
src/tools. and I get this error:

root@comun-Inspiron-530s:~/libcgroup-0.37/src/tools# gcc cgcreate.c -o create
cgcreate.c:17: fatal error: libcgroup-internal.h: No such file or directory
compilation terminated.

So, what is the problem I have, or what I have to do to use these functions?

I appreciate your help has been of great importance, I am a computer 
science student and I'm a fresh man on this part of linux.

thanks

Regards,
adansilv...@hotmail.com




------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to