[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: OOM-killer prevention for master kdeinit process
From:       Kuba Ober <kuba () mareimbrium ! org>
Date:       2006-08-04 13:33:24
Message-ID: 200608040933.24071.kuba () mareimbrium ! org
[Download RAW message or body]

>  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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic