mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
Fix comments for os_* functions return value
In windows libuv does not return -errno, instead it uses negative error codes e.g. UV_ENOENT. This commit changes the comments in os_* functions to reflect this.
This commit is contained in:
parent
4f24b9e06f
commit
8dea8a036f
@ -97,7 +97,7 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb)
|
|||||||
result = uv_listen(watcher->stream, backlog, connection_cb);
|
result = uv_listen(watcher->stream, backlog, connection_cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(result <= 0); // libuv should have returned -errno or zero.
|
assert(result <= 0); // libuv should return negative error code or zero.
|
||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
if (result == -EACCES) {
|
if (result == -EACCES) {
|
||||||
// Libuv converts ENOENT to EACCES for Windows compatibility, but if
|
// Libuv converts ENOENT to EACCES for Windows compatibility, but if
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
/// Sets the stream associated with `fd` to "blocking" mode.
|
/// Sets the stream associated with `fd` to "blocking" mode.
|
||||||
///
|
///
|
||||||
/// @return `0` on success, or `-errno` on failure.
|
/// @return `0` on success, or libuv error code on failure.
|
||||||
int stream_set_blocking(int fd, bool blocking)
|
int stream_set_blocking(int fd, bool blocking)
|
||||||
{
|
{
|
||||||
// Private loop to avoid conflict with existing watcher(s):
|
// Private loop to avoid conflict with existing watcher(s):
|
||||||
|
@ -185,13 +185,13 @@ static bool is_executable_in_path(const char_u *name, char_u **abspath)
|
|||||||
|
|
||||||
/// Opens or creates a file and returns a non-negative integer representing
|
/// Opens or creates a file and returns a non-negative integer representing
|
||||||
/// the lowest-numbered unused file descriptor, for use in subsequent system
|
/// the lowest-numbered unused file descriptor, for use in subsequent system
|
||||||
/// calls (read, write, lseek, fcntl, etc.). If the operation fails, `-errno`
|
/// calls (read, write, lseek, fcntl, etc.). If the operation fails, a libuv
|
||||||
/// is returned, and no file is created or modified.
|
/// error code is returned, and no file is created or modified.
|
||||||
///
|
///
|
||||||
/// @param flags Bitwise OR of flags defined in <fcntl.h>
|
/// @param flags Bitwise OR of flags defined in <fcntl.h>
|
||||||
/// @param mode Permissions for the newly-created file (IGNORED if 'flags' is
|
/// @param mode Permissions for the newly-created file (IGNORED if 'flags' is
|
||||||
/// not `O_CREAT` or `O_TMPFILE`), subject to the current umask
|
/// not `O_CREAT` or `O_TMPFILE`), subject to the current umask
|
||||||
/// @return file descriptor, or negative `errno` on failure
|
/// @return file descriptor, or libuv error code on failure
|
||||||
int os_open(const char* path, int flags, int mode)
|
int os_open(const char* path, int flags, int mode)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
@ -322,7 +322,7 @@ int os_rename(const char_u *path, const char_u *new_path)
|
|||||||
|
|
||||||
/// Make a directory.
|
/// Make a directory.
|
||||||
///
|
///
|
||||||
/// @return `0` for success, -errno for failure.
|
/// @return `0` for success, libuv error code for failure.
|
||||||
int os_mkdir(const char *path, int32_t mode)
|
int os_mkdir(const char *path, int32_t mode)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
@ -342,7 +342,7 @@ int os_mkdir(const char *path, int32_t mode)
|
|||||||
/// failed to create. I.e. it will contain dir or any
|
/// failed to create. I.e. it will contain dir or any
|
||||||
/// of the higher level directories.
|
/// of the higher level directories.
|
||||||
///
|
///
|
||||||
/// @return `0` for success, -errno for failure.
|
/// @return `0` for success, libuv error code for failure.
|
||||||
int os_mkdir_recurse(const char *const dir, int32_t mode,
|
int os_mkdir_recurse(const char *const dir, int32_t mode,
|
||||||
char **const failed_dir)
|
char **const failed_dir)
|
||||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
|
@ -21,9 +21,9 @@ typedef struct {
|
|||||||
uv_dirent_t ent; ///< @private The entry information.
|
uv_dirent_t ent; ///< @private The entry information.
|
||||||
} Directory;
|
} Directory;
|
||||||
|
|
||||||
/// Function to convert -errno error to char * error description
|
/// Function to convert libuv error to char * error description
|
||||||
///
|
///
|
||||||
/// -errno errors are returned by a number of os functions.
|
/// negative libuv error codes are returned by a number of os functions.
|
||||||
#define os_strerror uv_strerror
|
#define os_strerror uv_strerror
|
||||||
|
|
||||||
#endif // NVIM_OS_FS_DEFS_H
|
#endif // NVIM_OS_FS_DEFS_H
|
||||||
|
@ -103,9 +103,9 @@
|
|||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// Function to convert -errno error to char * error description
|
/// Function to convert libuv error to char * error description
|
||||||
///
|
///
|
||||||
/// -errno errors are returned by a number of os functions.
|
/// negative libuv error codes are returned by a number of os functions.
|
||||||
#define os_strerror uv_strerror
|
#define os_strerror uv_strerror
|
||||||
|
|
||||||
#endif // NVIM_OS_OS_DEFS_H
|
#endif // NVIM_OS_OS_DEFS_H
|
||||||
|
Loading…
Reference in New Issue
Block a user