Skip to content

Commit

Permalink
Support libuv 1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Qard committed Jun 15, 2016
1 parent f6870dc commit 220cda8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
4 changes: 2 additions & 2 deletions libuv-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ fn libuv_dir() -> PathBuf {
fn libuv_repo() -> String {
"https://github.com/libuv/libuv.git".to_owned()
}
fn libuv_revision() -> String {
"v1.7.5".to_owned()
fn libuv_revision() -> String {
"v1.9.1".to_owned()
}
fn libuv_lib() -> PathBuf {
if cfg!(windows) {
Expand Down
36 changes: 35 additions & 1 deletion libuv-sys/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![allow(non_camel_case_types)]
#![allow(raw_pointer_derive)]
extern crate libc;
use libc::{c_int, c_char, c_uint, c_void, uint64_t, size_t, sockaddr, sockaddr_in6, int64_t,
ssize_t, addrinfo, c_long, sockaddr_in, sockaddr_storage};
Expand Down Expand Up @@ -88,6 +87,7 @@ pub use uv_handle_type::*;
// Not binding the individual UV_E* constants for now because they're a huge
// mess. Use uv_err_name.


extern {
pub fn uv_strerror(err: c_int) -> *const c_char;
pub fn uv_err_name(err: c_int) -> *const c_char;
Expand Down Expand Up @@ -216,6 +216,8 @@ pub enum uv_req_type {
UV_WORK = 7,
UV_GETADDRINFO = 8,
UV_GETNAMEINFO = 9, // plus zero or more private types
UV_REQ_TYPE_PRIVATE = 10,
UV_REQ_TYPE_MAX = 11,
}
pub use uv_req_type::*;

Expand Down Expand Up @@ -297,6 +299,7 @@ pub type uv_poll_cb = extern "C" fn(*mut uv_poll_t, c_int, c_int);
pub enum uv_poll_event {
UV_READABLE = 1,
UV_WRITABLE = 2,
UV_DISCONNECT = 4,
}
pub use uv_poll_event::*;

Expand Down Expand Up @@ -547,6 +550,13 @@ extern {

// tcp.rst

#[repr(C)]
#[derive(Debug,Clone,Copy,PartialEq,Eq)]
pub enum uv_tcp_flags {
UV_TCP_IPV6ONLY = 1,
}
pub use uv_tcp_flags::*;

#[repr(C)]
pub struct uv_tcp_t {
pub data: *mut c_void,
Expand Down Expand Up @@ -841,6 +851,7 @@ pub enum uv_fs_type {
UV_FS_READLINK = 25,
UV_FS_CHOWN = 26,
UV_FS_FCHOWN = 27,
UV_FS_REALPATH = 28,
}
pub use uv_fs_type::*;

Expand Down Expand Up @@ -1037,8 +1048,30 @@ extern {
gid: uv_gid_t,
cb: uv_fs_cb)
-> c_int;
pub fn uv_fs_realpath(loop_: *mut uv_loop_t,
req: *mut uv_fs_t,
path: *const c_char,
cb: uv_fs_cb)
-> c_int;
}

// passwd.rst

#[repr(C)]
pub struct uv_passwd_t {
pub username: *mut c_char,
pub uid: c_long,
pub gid: c_long,
pub shell: *mut c_char,
pub homedir: *mut c_char,
}

extern {
pub fn uv_os_get_passwd(passwd: *mut uv_passwd_t) -> c_int;
pub fn uv_os_free_passwd(passwd: *mut uv_passwd_t);
}


// threadpool.rst

#[repr(C)]
Expand Down Expand Up @@ -1243,6 +1276,7 @@ extern {
pub fn uv_cwd(buffer: *mut c_char, size: *mut size_t) -> c_int;
pub fn uv_chdir(dir: *const c_char) -> c_int;
pub fn uv_os_homedir(buffer: *mut c_char, size: *mut size_t) -> c_int;
pub fn uv_os_tmpdir(buffer: *mut c_char, size: *mut size_t) -> c_int;
pub fn uv_get_free_memory() -> uint64_t;
pub fn uv_get_total_memory() -> uint64_t;
pub fn uv_hrtime() -> uint64_t;
Expand Down
4 changes: 2 additions & 2 deletions libuv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ mod tests {
use super::*;
#[test]
fn test_version_hex() {
assert_eq!(version_hex(), 0x10705);
assert_eq!(version_hex(), 0x10901);
}

#[test]
fn test_version_string() {
assert_eq!(version_string(), "1.7.5");
assert_eq!(version_string(), "1.9.1");
}
}

0 comments on commit 220cda8

Please sign in to comment.