[PATCH v2] server: support inotify file change notifications on FreeBSD

Damjan Jovanovic damjan.jov at gmail.com
Fri Dec 3 10:14:32 CST 2021


On Fri, Dec 3, 2021 at 9:26 AM Huw Davies <huw at codeweavers.com> wrote:

> On Fri, Dec 03, 2021 at 06:05:50AM +0200, Damjan Jovanovic wrote:
> > The inotify code uses the Linux-specific /proc/self/fd/<FD> symlinks
> > to translate
> > file descriptors to filesystem paths. On FreeBSD, do this translation
> using
> > its own sysctl instead.
> >
> > Signed-off-by: Damjan Jovanovic <damjan.jov at gmail.com>
> > ---
> >  server/change.c | 132 ++++++++++++++++++++++++++++++++++++++++--------
> >  1 file changed, 111 insertions(+), 21 deletions(-)
>
> This is causing a build failure on macOS:
>
> gcc -m32 -c -o server/change.o server/change.c -Iserver -Iinclude
> -D__WINESRC__ -Wall -pipe -fno-stack-protector \
>   -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body
> -Wignored-qualifiers -Winit-self \
>   -Wno-pragma-pack -Wstrict-prototypes -Wtype-limits -Wvla -Wwrite-strings
> -Wpointer-arith -gdwarf-4 \
>   -fno-omit-frame-pointer -O2 -g -Wno-deprecated-declarations
> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
> server/change.c:236:2: error: No fd_path() function for this platform
> #error No fd_path() function for this platform
>
> The fd_path() stuff probably needs to be inside the #ifdef
> HAVE_SYS_INOTIFY_H block.
>
> Huw.
>

No, that sysctl really is FreeBSD-only. MacOS, NetBSD and OpenBSD all
implement fd->path translation in different, incompatible ways. MacOS's
KERN_FILE sysctl doesn't appear to filter by pid (
https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/sysctl.3.html),
I think you are supposed to use the proc_pidinfo() function, see
http://blog.palominolabs.com/2012/06/19/getting-the-files-being-used-by-a-process-on-mac-os-x/index.html

I'll submit a new version with some fixes, but someone with a Mac will have
to develop the Apple implementation.

Damjan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20211203/cf7eca63/attachment.htm>


More information about the wine-devel mailing list