OOM-killer prevention for master kdeinit process

Kuba Ober kuba at mareimbrium.org
Fri Aug 4 14:33:24 BST 2006


>  The only things done as root are sprintf() with a number,
> open()/write()/close() of the /proc file, pipe(), reading from the pipe
> char by char, atol() and kill(). No C++ involved, nobody else can write to
> the pipe than kdeinit, which only writes getpid() there.  Should be
> perfectly safe (fingers crossed ;) ).

Er, while I wouldn't particularly mind having pipe messages go via beautiful, 
female, 1900's vintage switchboard operators wearing heavy makeup, I'm sure 
it would bring down things to a halt everywhere :)

What's wrong with passing the binary value? It's not like pid_t is suddenly 
gonna change size or endianness on you machine, isn't it? Those pids are 
local. What's the point of having it human-readable?

Wouldn't something like this work?

// writing end
pid_t mepid = getpid();
write(fd, &mepid, sizeof(mepid));

// reading end
pid_t yepid;
read(fd, &yepid, sizeof(yepid));

Cheers, Kuba




More information about the kde-core-devel mailing list