Skip to content

Changes required for Windows support

wez edited this page Nov 3, 2014 · 6 revisions

If you're interested in working on Windows support, here's a partial list of things you'll need to do:

  • Use Windows file-watching APIs: ReadDirectoryChangesW
  • Translation layer to convert internal UTF-8 to UTF-16 and back, for Win32 syscalls
  • Just use posix_spawn to start service instead of daemonize()
  • Will need to provide a posix_spawn implementation that covers starting the service and running trigger processes. May want to consider disabling triggers in the early stages of the port.
  • Using the Win32 threading API instead of pthreads (Consider using http://locklessinc.com/downloads/winpthreads.h for this)
  • Translation layer switching forward slashes to backslashes and back, for Win32 syscalls (maybe?)
  • Watchman currently exclusively uses unix sockets to create a well-known endpoint on a per-user basis. Windows doesn't support unix domain sockets. The closest equivalent is the named pipe which doesn't really behave the same way at all, but has similar characteristics. Another option is use TCP sockets and bind to the loopback. This is more appealing because more portable tools know how to talk to TCP sockets than NT named pipes. The drawback is that having a well-known port works great only for single-user scenarios.

We're using https://github.com/facebook/watchman/issues/19 to track this issue