[erlang-questions] setuid

Gleb Peregud <>
Thu Jun 5 16:33:35 CEST 2008


Processes in Erlang does not map directly to kernel threads. Erlang
processes are like green threads in Java. Operating system is not
aware of them. They are managed by Erlang VM entierly - they are just,
simplifying, internal data structures inside Erlang VM. Erlang
processes are all run inside Erlang VM, which is run on one (or more
if it is SMP system) kernel thread.

Linked-in drivers are dynamically linked in into Erlang VM [1], hence
setuid, seteuid, setguid, etc. will affect whole Erlang VM (probably
only one of the Erlang VM processes (kernel threads) in case of SMP
system, but i'm not sure). Hence these functions called in linked-in
drivers will affect every Erlang processes inside VM.

I hope this text is not messed too much :)

[1] http://www.erlang.org/doc/tutorial/c_portdriver.html

On Thu, Jun 5, 2008 at 11:53 AM, Ville Silventoinen <> wrote:
> Hi,
>
> I'm new to the world of Erlang and I'm just trying some things out (very
> impressive language!). I got interested in Erlang after seeing Joe
> Armstrong's presentation in this year's ACCU conference in Oxford and
> reading his excellent book.
>
> I'm writing a prototype of a network filesystem using the fuserl package.
> So far so good, I have a little network filesystem that uses fuserl at the
> client-side and communicates with a gateway written with gen_server, which
> does the file system operations.
>
> One of the things I'd like to do is to map the client-side Unix UID and
> GID numbers (#fuse_ctx.uid and #fuse_ctx.gid) to different UID and GID
> numbers at the gateway. I wrote a little linked in C module that allows me
> to call setuid, seteuid, etc. from Erlang, but I'm not sure how this will
> affect other processes doing file operations in the Erlang runtime
> environment. Would setuid change the UID for all Erlang processes or for
> just the process that called it?
>
> I'll find out the answer soon by experimenting, but I thought I should ask
> if anyone has better ideas!
>
> Thanks,
> Ville
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
Gleb Peregud
http://gleber.pl/

Every minute is to be grasped.
Time waits for nobody.
-- Inscription on a Zen Gong



More information about the erlang-questions mailing list