Skip to content

Commit 5478578

Browse files
committed
Merge pull request rust-lang#32 from alexcrichton/getaddrinfo
Add getaddrinfo functions
2 parents 10dff9a + b9096d3 commit 5478578

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

src/unix/bsd/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,13 @@ extern {
135135
pub fn setgroups(ngroups: ::c_int,
136136
ptr: *const ::gid_t) -> ::c_int;
137137
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
138+
pub fn getnameinfo(sa: *const ::sockaddr,
139+
salen: ::socklen_t,
140+
host: *mut ::c_char,
141+
hostlen: ::socklen_t,
142+
serv: *mut ::c_char,
143+
sevlen: ::socklen_t,
144+
flags: ::c_int) -> ::c_int;
138145
}
139146

140147
cfg_if! {

src/unix/mod.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,14 +432,20 @@ extern {
432432

433433
pub fn utimes(filename: *const ::c_char,
434434
times: *const ::timeval) -> ::c_int;
435-
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
436435
pub fn dlopen(filename: *const ::c_char,
437436
flag: ::c_int) -> *mut ::c_void;
438437
pub fn dlerror() -> *mut ::c_char;
439438
pub fn dlsym(handle: *mut ::c_void,
440439
symbol: *const ::c_char) -> *mut ::c_void;
441440
pub fn dlclose(handle: *mut ::c_void) -> ::c_int;
442441
pub fn dladdr(addr: *const ::c_void, info: *mut Dl_info) -> ::c_int;
442+
443+
pub fn getaddrinfo(node: *const c_char,
444+
service: *const c_char,
445+
hints: *const addrinfo,
446+
res: *mut *mut addrinfo) -> ::c_int;
447+
pub fn freeaddrinfo(res: *mut addrinfo);
448+
pub fn gai_strerror(errcode: ::c_int) -> *const ::c_char;
443449
}
444450

445451
// TODO: get rid of this #[cfg(not(...))]

src/unix/notbsd/android/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ extern {
218218
flags: ::c_uint) -> ::ssize_t;
219219
pub fn recv(socket: ::c_int, buf: *mut ::c_void, len: ::size_t,
220220
flags: ::c_uint) -> ::ssize_t;
221+
pub fn getnameinfo(sa: *const ::sockaddr,
222+
salen: ::socklen_t,
223+
host: *mut ::c_char,
224+
hostlen: ::size_t,
225+
serv: *mut ::c_char,
226+
sevlen: ::size_t,
227+
flags: ::c_int) -> ::c_int;
221228
}
222229

223230
cfg_if! {

src/unix/notbsd/linux/mips.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,13 @@ pub const SIGCHLD: ::c_int = 18;
235235
pub const SIGBUS: ::c_int = 10;
236236

237237
pub const SIG_SETMASK: ::c_int = 3;
238+
239+
extern {
240+
pub fn getnameinfo(sa: *const ::sockaddr,
241+
salen: ::socklen_t,
242+
host: *mut ::c_char,
243+
hostlen: ::socklen_t,
244+
serv: *mut ::c_char,
245+
sevlen: ::socklen_t,
246+
flags: ::c_uint) -> ::c_int;
247+
}

src/unix/notbsd/linux/notmips/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,16 @@ pub const SIGCHLD: ::c_int = 17;
179179
pub const SIGBUS: ::c_int = 7;
180180
pub const SIG_SETMASK: ::c_int = 2;
181181

182+
extern {
183+
pub fn getnameinfo(sa: *const ::sockaddr,
184+
salen: ::socklen_t,
185+
host: *mut ::c_char,
186+
hostlen: ::socklen_t,
187+
serv: *mut ::c_char,
188+
sevlen: ::socklen_t,
189+
flags: ::c_int) -> ::c_int;
190+
}
191+
182192
cfg_if! {
183193
if #[cfg(any(target_arch = "x86", target_arch = "arm"))] {
184194
mod b32;

0 commit comments

Comments
 (0)