01-23-04 10:20 PM
On Mon, 22 Dec 2003 19:34:13 -0500, Paul Pluzhnikov wrote:
quote:
> Michael B Allen <mba2000@ioplex.com> writes:
>
>
> There isn't one.
>
>
> Nor should you. For one thing, stack on Linux grows in *the other*
> direction.
>
> Now, if you really really want to do the above (WARNING: there is really
> no sane justification for doing this), try:
>
> clone(fn, (char *)malloc(0x10000) + 0xFFFC, CLONE_FILES |
> CLONE_SIGHAND, fn_arg);
That worked. Thanks.
Yes, I know this is not supposed to be used directly but I'm at a point
in my server implementation where I can see everything I've coded so far
work if I can just share the file table. With this little change indeed
it all works. Flawlessly to my surprise! I've taken my measurements (22%
drop in performance over threads). Now I need to implement descriptor
passing ...
I'm curious though; will this support changing security contexts or
locales and so on? I'm creating a "multiple processes accessing all data
in shared memory coordiated with System V semaphores" model. Eventually
I want to be able to service clients with worker procs that can setuid,
setlocale, etc based on handler requirements. Is this do-able with this
CLONE_FILES thing or is it no better than threads in this respect?
Do you know of other operating systems that support sharing the file
descriptor table? If descriptor passing turns out to be a big drop in
performance it might be worth it to be able to take advantage of this
feature if the system supports it. It also introduces some interesting
security possibilities like getting the stacks from non-PROT_EXEC mmap'd
memory.
Mike
[ Post a follow-up to this message ]
|