[autotex] Use inotify
[autotex] Replace some low-level code with more stable methods