Side effects of open system call
Rahul Bedarkar
rpal143 at gmail.com
Thu Feb 20 23:22:32 EST 2014
On Thu, Feb 20, 2014 at 9:06 PM, <Valdis.Kletnieks at vt.edu> wrote:
> On Thu, 20 Feb 2014 20:36:44 +0530, Rahul Bedarkar said:
>
>> "Often the open(2) call has unwanted side effects, that can be avoided
>> under Linux by giving it the O_NONBLOCK flag."
>>
>> I have seen open man page but can't find what are side effects of open.
>
> Well, for starters, the open() call can block while trying to open a hardware
> device that isnt ready, thus hanging the entire process. For added joy,
> remember that signals are delivered when a process inside a syscall finally
> returns to userspace - which means that your hung process may be unkillable
> even by 'kill -9'.
>
Thanks, Does this mean that if I open a device file with O_NONBLOCK flag
and if device is not ready by that time open system call will return
immediately and fail?
> Most people would call that an unwanted side effect. :)
More information about the Kernelnewbies
mailing list