bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to write a proper fork hook code?


From: Samuel Thibault
Subject: Re: How to write a proper fork hook code?
Date: Mon, 2 Mar 2015 00:34:52 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Svante Signell, le Mon 02 Mar 2015 00:15:14 +0100, a écrit :
> On Sun, 2015-03-01 at 23:08 +0100, Svante Signell wrote:
> > On Sun, 2015-03-01 at 22:06 +0100, Samuel Thibault wrote:
> 
> Much simpler code: It only opens a file and calls fork!
> FCNTL_CALLS version triggers the hook
> RPC_CALLS version does not

> #ifdef RPC_CALLS
>   fd2 = file_name_lookup (argv[1], O_READ | O_WRITE | O_CREAT, 0666);
>   if (fd2 == MACH_PORT_NULL)
>     error (1, errno, "file_name_lookup");
> #endif

I hadn't realized in your previous code: contrary to what the variable
name suggests, this code is not actually creating an fd, so your fork
hook won't find an fd to unlock.  I however don't know what makes you
say that the hook is not triggered, so I can't really deduct anything.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]