It has been several months since I published the blog post on the QNX 7 desktop. While I haven’t been able to dedicate much time to this project, there have been some notable updates that I would like to share. The desktop code itself has been enhanced and now supports window resizing and window switching with ALT+TAB. On the application-support front, the desktop sports a modern browser, based on Google’s Blink engine.
Most importantly, though, is that I got Emacs to work (though only in terminal mode). My initial attempt at porting Emacs failed when the build generated a binary that filled the entire hard drive. This turned out to be due to Emacs’s use of sbrk(), which QNX has not supported for many years, but which is still implemented by the system as a stub that returns -1. The Emacs code took -1 to mean the 64-bit address 0xffffffffffffffff, and tried to write a binary of a size approaching 2^64 bytes. With help from the Emacs maintainers (who have been very supportive) I switched to using the “hybrid-malloc” option, used by the Cygwin port, that doesn’t rely on sbrk().
The Emacs port also requires an implementation of openat(), fstatat() and fdopendir(). These have been on our to-do list for a long time. The implementation of these functions in a micro-kernel architecture is not trivial, as there is no one service that owns a directory, and in fact the same directory can contain nodes from multiple services (unioned file systems, pipe). I realized, however, that the at() functions can be treated as a generalization of chdir(), and proceeded to write an implementation along these lines. Emacs is now fully functional.