os_open: impl mch_open with libuv. ref #133

- use return value instead of open_req.result
- libuv uv_fs_open() returns `-errno` instead of always -1
- libuv always sets open_req.result to the return value, _except_ for OOM
  where it only sets the return value. So always use the return value.
- replace calls to mch_open macro.
- update call sites expecting -1 error
This commit is contained in:
Justin M. Keyes
2014-06-14 13:15:07 -04:00
parent bf6b0e3c0a
commit 180c84ed37
8 changed files with 53 additions and 37 deletions

View File

@@ -108,13 +108,12 @@
#endif
# define mch_fopen(n, p) fopen((n), (p))
# define mch_open(n, m, p) open((n), (m), (p))
/* mch_open_rw(): invoke mch_open() with third argument for user R/W. */
/* mch_open_rw(): invoke os_open() with third argument for user R/W. */
#if defined(UNIX) /* open in rw------- mode */
# define mch_open_rw(n, f) mch_open((n), (f), (mode_t)0600)
# define mch_open_rw(n, f) os_open((n), (f), (mode_t)0600)
#else
# define mch_open_rw(n, f) mch_open((n), (f), 0)
# define mch_open_rw(n, f) os_open((n), (f), 0)
#endif
#ifdef STARTUPTIME