Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

unix: translate fs errno codes to libuv error codes

  • Loading branch information...
bnoordhuis committed Sep 5, 2011
1 parent bb0c6e6 commit efcd273d68c7062fd05242d7311128944f912685
Showing with 7 additions and 2 deletions.
  1. +5 −1 src/unix/error.c
  2. +1 −1 src/unix/fs.c
  3. +1 −0 src/unix/internal.h
@@ -31,6 +31,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>


/* TODO Expose callback to user to handle fatal error like V8 does. */
@@ -65,7 +66,7 @@ char* uv_strerror(uv_err_t err) {
}


static uv_err_code uv_translate_sys_error(int sys_errno) {
uv_err_code uv_translate_sys_error(int sys_errno) {
switch (sys_errno) {
case 0: return UV_OK;
case EACCES: return UV_EACCESS;
@@ -83,6 +84,9 @@ static uv_err_code uv_translate_sys_error(int sys_errno) {
case ENOTCONN: return UV_ENOTCONN;
default: return UV_UNKNOWN;
}

assert(0 && "unreachable");
return -1;
}


@@ -111,7 +111,7 @@ static int uv__fs_after(eio_req* eio) {
assert(req->cb);

req->result = req->eio->result;
req->errorno = req->eio->errorno;
req->errorno = uv_translate_sys_error(req->eio->errorno);

switch (req->fs_type) {
case UV_FS_READDIR:
@@ -74,6 +74,7 @@ int uv__cloexec(int fd, int set) __attribute__((unused));
int uv__socket(int domain, int type, int protocol);

/* error */
uv_err_code uv_translate_sys_error(int sys_errno);
uv_err_t uv_err_new(uv_loop_t* loop, int sys_error);
uv_err_t uv_err_new_artificial(uv_loop_t* loop, int code);
void uv_fatal_error(const int errorno, const char* syscall);

0 comments on commit efcd273

Please sign in to comment.
You can’t perform that action at this time.