Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build errors: undefined: unix.FanotifyInit, etc #7

Open
yurivict opened this issue May 25, 2019 · 4 comments
Open

Build errors: undefined: unix.FanotifyInit, etc #7

yurivict opened this issue May 25, 2019 · 4 comments

Comments

@yurivict
Copy link

On FreeBSD 12 I am getting this failure:

# github.com/ozeidan/gosearch/internal/fanotify
internal/fanotify/fanotify.go:75:14: undefined: unix.FanotifyInit
internal/fanotify/fanotify.go:81:8: undefined: unix.FanotifyMark
internal/fanotify/fanotify.go:105:15: undefined: unix.FanotifyEventMetadata
internal/fanotify/fanotify.go:126:21: undefined: unix.NewFileHandle
internal/fanotify/fanotify.go:128:14: undefined: unix.OpenByHandleAt
internal/fanotify/fanotify.go:150:16: undefined: unix.IN_CREATE
internal/fanotify/fanotify.go:151:14: undefined: unix.IN_MOVED_TO
internal/fanotify/fanotify.go:154:16: undefined: unix.IN_DELETE
internal/fanotify/fanotify.go:155:14: undefined: unix.IN_MOVED_FROM
internal/fanotify/fanotify.go:169:10: undefined: unix.IN_ACCESS
internal/fanotify/fanotify.go:169:10: too many errors
@ozeidan
Copy link
Owner

ozeidan commented May 25, 2019

I didn't think about FreeBSD at all when creating this program. Does FreeBSD have some mechanism that send file creation/deletion events?

@yurivict
Copy link
Author

Does FreeBSD have some mechanism that send file creation/deletion events?

What do you mean by this? Where are events sent?

(most of the linux functionality works on FreeBSD)

@ozeidan
Copy link
Owner

ozeidan commented May 26, 2019

gosearch uses the fanotify system of the Linux kernel to listen to file change events. Whenever a file is either created or deleted, it is add/removed from the index that gosearch maintains to provide fast search results.

The required capabilities of the fanoitfy system were only mainlined in kernel version 5.1 and it seems to me that fanotify/inotify are exclusive to linux. If there is some similar mechanism in FreeBSD, it would be possible to implement FreeBSD support by providing an implementation of the fanotify package for FreeBSD systems. But until then, building for FreeBSD will fail.

@yurivict
Copy link
Author

Linux's fanotify interface is based on their inotify kernel API. There is a FreeBSD equivalent:

$ pkg search inotify
inotify-tools-3.20.1           Command-line utilities to watch for file events
libinotify-20180201_1          Kevent based inotify compatible library

libinotify does about the same that inotify does through the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants