[erlang-questions] Two questions about open files and file descriptors

Lukas Larsson <>
Tue May 1 20:15:42 CEST 2012


When the process controlling a port dies the port will get what is
equivalent to an exit signal and be stopped. For the specific case of
the file driver, the driver will try to flush all written data before
shutting down the driver, but eventually it should end with a closed
filedescriptor.

Note that if you are not opening the file with raw as arguments, it
will be the file server which is the controlling process.

Lukas

On Tue, May 1, 2012 at 7:40 PM, Daniel Dormont <> wrote:
> Thanks. Will that include ports open from processes that have died? That's
> the specific case I'm trying to understand - what happens if a process
> crashes with a file open, and how do I recover from it?
>
> -Dan
>
>
> On Tue, May 1, 2012 at 12:46 PM, Max Lapshin <> wrote:
>>
>> lsof -p
>> ulimit
>>
>> [{Pid, Ports} || {Pid,Ports} <- [{Pid, [L || L <-
>> element(2,process_info(Pid, links)), is_port(L)]} || Pid <-
>> processes()], length(Ports) > 0]
>
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>



More information about the erlang-questions mailing list