neovim/neovim — pull request #346 by lslah (2014-03-11 18:45:40+00:00)
Title: [WIP/RFC] Port mch_[gs]etperm to libuv.

Currently I'm trying to port `mch_getperm` and `mch_setperm` to libuv.
So far I've encountered two problems:

1. In order to write unit tests for the functions I need `#define`s like `S_IRUSR`. I'd just define them as hardcoded enums in the tests, if someone can confirm, that they don't differ on different systems. Otherwise I have no other idea than taking the risk and porting the functions without writing proper tests.

2. The current implementations of both functions work with type `long` for the file mode, which is a 32 bit value in C99 according to wikipedia. On the other hand `uv_fs_stat` returns a struct which holds the variable `uint64_t st_mode`. Is it safe to assume that a cast of the latter to `long` will result in the exact same result as what `mch_getperm` returns now? In that case I would just change `mch_getperm` and `mch_setperm` to work with `uint64_t` (and also update the places in which one of them is called).