mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
src: update to latest libuv api
libuv gyp builds now require you to define the library disposition (static or shared). Also, libuv now supports vectored IO for file system reads and writes, update to those function signatures
This commit is contained in:
3
configure
vendored
3
configure
vendored
@@ -560,6 +560,9 @@ def configure_libuv(o):
|
||||
# assume shared libuv if one of these is set?
|
||||
if options.shared_libuv_libpath:
|
||||
o['libraries'] += ['-L%s' % options.shared_libuv_libpath]
|
||||
else:
|
||||
o['variables']['uv_library'] = 'static_library'
|
||||
|
||||
if options.shared_libuv_libname:
|
||||
o['libraries'] += ['-l%s' % options.shared_libuv_libname]
|
||||
elif options.shared_libuv:
|
||||
|
||||
@@ -769,12 +769,14 @@ static void WriteBuffer(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
buf += off;
|
||||
|
||||
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
|
||||
|
||||
if (cb->IsFunction()) {
|
||||
ASYNC_CALL(write, cb, fd, buf, len, pos)
|
||||
ASYNC_CALL(write, cb, fd, &uvbuf, 1, pos)
|
||||
return;
|
||||
}
|
||||
|
||||
SYNC_CALL(write, NULL, fd, buf, len, pos)
|
||||
SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos)
|
||||
args.GetReturnValue().Set(SYNC_RESULT);
|
||||
}
|
||||
|
||||
@@ -818,8 +820,10 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
|
||||
pos = GET_OFFSET(args[2]);
|
||||
cb = args[4];
|
||||
|
||||
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
|
||||
|
||||
if (!cb->IsFunction()) {
|
||||
SYNC_CALL(write, NULL, fd, buf, len, pos)
|
||||
SYNC_CALL(write, NULL, fd, &uvbuf, 1, pos)
|
||||
if (must_free)
|
||||
delete[] buf;
|
||||
return args.GetReturnValue().Set(SYNC_RESULT);
|
||||
@@ -829,8 +833,8 @@ static void WriteString(const FunctionCallbackInfo<Value>& args) {
|
||||
int err = uv_fs_write(env->event_loop(),
|
||||
&req_wrap->req_,
|
||||
fd,
|
||||
buf,
|
||||
len,
|
||||
&uvbuf,
|
||||
1,
|
||||
pos,
|
||||
After);
|
||||
req_wrap->object()->Set(env->oncomplete_string(), cb);
|
||||
@@ -896,12 +900,14 @@ static void Read(const FunctionCallbackInfo<Value>& args) {
|
||||
|
||||
buf = buffer_data + off;
|
||||
|
||||
uv_buf_t uvbuf = uv_buf_init(const_cast<char*>(buf), len);
|
||||
|
||||
cb = args[5];
|
||||
|
||||
if (cb->IsFunction()) {
|
||||
ASYNC_CALL(read, cb, fd, buf, len, pos);
|
||||
ASYNC_CALL(read, cb, fd, &uvbuf, 1, pos);
|
||||
} else {
|
||||
SYNC_CALL(read, 0, fd, buf, len, pos)
|
||||
SYNC_CALL(read, 0, fd, &uvbuf, 1, pos)
|
||||
args.GetReturnValue().Set(SYNC_RESULT);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user