Re: Attaching PID 0 to a cgroup

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Matt Helsley
Date: Thursday, July 3, 2008 - 2:59 pm

On Wed, 2008-07-02 at 03:24 +0530, Dhaval Giani wrote:

	IMHO you need to include this point in the docs verbosely rather than
just switching the docs to bash's builin-in echo. Otherwise it doesn't
fully resolve the fundamental confusion you correctly identified.

Or perhaps a snippet of simplified C code will make it clear:
------------
	char buffer[16];
	int fd;

	fd = open("/some/cgroup/tasks", O_WRONLY);

	/* 
	 * These two writes produce the same effect: adding this process
	 * to /some/cgroup.
	 */
	if (the_slightly_shorter_way)
		write(fd, "0", 2);
	else {
		/* The slightly-less-short way */
		snprintf(buffer, 16, "%u", getpid());
		write(fd, buffer, strlen(buffer));
	}
------------

Cheers,
	-Matt Helsley

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Attaching PID 0 to a cgroup, Dhaval Giani, (Tue Jul 1, 2:45 am)
Re: Attaching PID 0 to a cgroup, Dhaval Giani, (Tue Jul 1, 2:47 am)
Re: Attaching PID 0 to a cgroup, Li Zefan, (Tue Jul 1, 3:28 am)
Re: Attaching PID 0 to a cgroup, Dhaval Giani, (Tue Jul 1, 3:51 am)
Re: Attaching PID 0 to a cgroup, Paul Jackson, (Tue Jul 1, 11:54 am)
Re: Attaching PID 0 to a cgroup, Paul Menage, (Tue Jul 1, 12:01 pm)
Re: Attaching PID 0 to a cgroup, Andrea Righi, (Tue Jul 1, 2:48 pm)
Re: Attaching PID 0 to a cgroup, Dhaval Giani, (Tue Jul 1, 2: