submit error to correct loop

This commit is contained in:
Ryan Dahl 2011-08-31 01:43:09 -07:00
parent b47c474cfd
commit ea4271fa90

View File

@ -120,13 +120,13 @@ int uv_fs_close(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_close(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
} else {
/* sync */
if ((req->result = uv__close(file))) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -144,7 +144,7 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_ref(loop);
req->eio = eio_open(path, flags, mode, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -152,7 +152,7 @@ int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
/* sync */
req->result = open(path, flags, mode);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
@ -174,7 +174,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -185,7 +185,7 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file fd, void* buf,
pread(fd, buf, length, offset);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -202,7 +202,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_unlink(path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -211,7 +211,7 @@ int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
req->result = unlink(path);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -230,7 +230,7 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
req->eio = eio_write(file, buf, length, offset, EIO_PRI_DEFAULT,
uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -241,7 +241,7 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
pwrite(file, buf, length, offset);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -259,7 +259,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
uv_ref(loop);
req->eio = eio_mkdir(path, mode, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -268,7 +268,7 @@ int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int mode,
req->result = mkdir(path, mode);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -285,7 +285,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_rmdir(path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -294,7 +294,7 @@ int uv_fs_rmdir(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
req->result = rmdir(path);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -317,7 +317,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
uv_ref(loop);
req->eio = eio_readdir(path, flags, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -325,7 +325,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
/* sync */
DIR* dir = opendir(path);
if (!dir) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
@ -342,7 +342,7 @@ int uv_fs_readdir(uv_loop_t* loop, uv_fs_t* req, const char* path, int flags,
r = closedir(dir);
if (r) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -375,7 +375,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -386,7 +386,7 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
@ -412,7 +412,7 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* ne
uv_ref(loop);
req->eio = eio_rename(path, new_path, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -421,7 +421,7 @@ int uv_fs_rename(uv_loop_t* loop, uv_fs_t* req, const char* path, const char* ne
req->result = rename(path, new_path);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -438,7 +438,7 @@ int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_fsync(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -447,7 +447,7 @@ int uv_fs_fsync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
req->result = fsync(file);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -464,7 +464,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
uv_ref(loop);
req->eio = eio_fdatasync(file, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -473,7 +473,7 @@ int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file, uv_fs_cb cb) {
req->result = fdatasync(file);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -491,7 +491,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, off_t offset,
uv_ref(loop);
req->eio = eio_ftruncate(file, offset, EIO_PRI_DEFAULT, uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -500,7 +500,7 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file, off_t offset,
req->result = ftruncate(file, offset);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -519,7 +519,7 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd,
req->eio = eio_sendfile(out_fd, in_fd, in_offset, length, EIO_PRI_DEFAULT,
uv__fs_after, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -528,7 +528,7 @@ int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd, uv_file in_fd,
req->result = eio_sendfile_sync(out_fd, in_fd, in_offset, length);
if (req->result) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
}
@ -582,7 +582,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}
@ -593,7 +593,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
free(pathdup);
if (req->result < 0) {
uv_err_new(NULL, errno);
uv_err_new(loop, errno);
return -1;
}
@ -680,7 +680,7 @@ int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
req->eio = eio_custom(uv__work, EIO_PRI_DEFAULT, uv__after_work, req);
if (!req->eio) {
uv_err_new(NULL, ENOMEM);
uv_err_new(loop, ENOMEM);
return -1;
}