Re: [git pull] pull request for writable limits for 2.6.34-rc0

From: Linus Torvalds
Date: Sun Mar 21 2010 - 14:42:30 EST




On Sun, 21 Mar 2010, Alexey Dobriyan wrote:
>
> It's a perfect opportunity to introduce getrlimit64(2), setrlimit64(2)
> _without_ involving /proc, without all bugs in setrlimit(2), without
> compat code, with all resources equal across arches, and, optionally,
> with infinity setting clearly separate from value (useful for C/R).

Yeah, the infinity setting should be cleaned up. I also wonder if we
should clean up the odd file limit rules, and make them all be about
bytes. Correct me if I'm wrong, but don't we do that whole file size thing
in kilobytes right now?

I do also agree that maybe we could/should skip the whole "writable /proc"
thing.

So introducing it as just two system calls:

int getprlimit64(pid, limit, struct rlimit64 *);
int setprlimit64(pid, limit, const struct rlimit64 *);

and having perhaps something like 'pid=0 means current' would look a lot
prettier to me.

Or even just _one_ system call that takes two pointers, and can do an
atomic replace-and-return-the-old-value, like 'sigaction()' does, ie
something like

int prlimit64(pid, limit, const struct rlimit64 *new, struct rlimit64 *old);

wouldn't that be a nice generic interface?

(Somebody should really check me on the whole "limit in kilobytes" thing -
I may be _totally_ off there. I am too lazy to check the actual source
code)

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/