Re: [Linux] Linux PID algorithm is BRAINDEAD!

From: Theodore Ts'o
Date: Mon Oct 12 2015 - 14:12:50 EST


On Mon, Oct 12, 2015 at 01:49:59PM -0400, Dave Goel wrote:
>
> OTOH, I guess if one has to write cleaner/other meta scripts without
> proper traps, the cleaner can simply check if linux's PID counter
> is too close to the current PID, and if so, refrain from drastic
> actions. For the latter, I wonder if there's a way to
> get "current PID counter."

How about:

current_pid = fork();
if (current_pid == 0)
exit(0);
(void) waitpid(current_pid);

Translating this to perl or python shouldn't be that difficult.

- Ted
--
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/