Coder Social home page Coder Social logo

imv only works on Linux about imv HOT 5 CLOSED

exec64 avatar exec64 commented on August 16, 2024
imv only works on Linux

from imv.

Comments (5)

jdiez17 avatar jdiez17 commented on August 16, 2024

from imv.

eXeC64 avatar eXeC64 commented on August 16, 2024

My preference would be to avoid adding new libraries when possible, to try and keep the requirements of imv small. Compatibility with other unices and unix-likes is definitely something I'd like to maintain support for.

from imv.

czarkoff avatar czarkoff commented on August 16, 2024

I see three possible ways to provide this functionality on non-Linux platforms:

  • kqueue(2) is available on BSDs (including OS X and probably Minix).
  • libinotify-kqueue adds inotify support to kqueue-enabled systems.
  • stat(2) is available on every Unix-like system.

My initial urge was to do exactly as @eXeC64 says: move reload.c to reload-inotify.c, add reload-kqueue.c and some magic to Makefile to pick right thing. There are dragons here, as kqueue requires keeping descriptors for all watched files around, which has potential to cause descriptor starvation. Also, kqueue won't work on some filesystems. Same issues apply to libinotify-kqueue.

I'd rather go with the following option:

  • Call stat(2) and remember mtime when adding files to navigator.
  • Call stat(2) again before displaying file and compare actual mtime to stored mtime.

This should not have significant overhead. In fact it may turn out to be faster then creating and destroying inotify watches (one stat(2) operation instead of one write(2) and two read(2)s), and it is more reliable in some scenarios. Eg. inotify will not report changes on NFS.

If this plan sounds sane, I'll come up with pull request.

from imv.

czarkoff avatar czarkoff commented on August 16, 2024

P.S.: while testing my approach I've noticed that libinotify-kqueue doesn't seem to work for me at all...

from imv.

eXeC64 avatar eXeC64 commented on August 16, 2024

Fixed by #68

from imv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.