Skip to content

Commit fd7c24c

Browse files
authored
Merge pull request rust-lang#796 from andrewtj/atj-yardi-ext
Add getservbyname, getprotobyname, and related structs
2 parents 91cd87c + e0e08d1 commit fd7c24c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/unix/mod.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,19 @@ s! {
138138
pub tms_cutime: ::clock_t,
139139
pub tms_cstime: ::clock_t,
140140
}
141+
142+
pub struct servent {
143+
pub s_name: *mut ::c_char,
144+
pub s_aliases: *mut *mut ::c_char,
145+
pub s_port: ::c_int,
146+
pub s_proto: *mut ::c_char,
147+
}
148+
149+
pub struct protoent {
150+
pub p_name: *mut ::c_char,
151+
pub p_aliases: *mut *mut ::c_char,
152+
pub p_proto: ::c_int,
153+
}
141154
}
142155

143156
pub const SIG_DFL: sighandler_t = 0 as sighandler_t;
@@ -726,6 +739,9 @@ extern {
726739
dev: ::dev_t) -> ::c_int;
727740
pub fn uname(buf: *mut ::utsname) -> ::c_int;
728741
pub fn gethostname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
742+
pub fn getservbyname(name: *const ::c_char,
743+
proto: *const ::c_char) -> *mut servent;
744+
pub fn getprotobyname(name: *const ::c_char) -> *mut protoent;
729745
pub fn chroot(name: *const ::c_char) -> ::c_int;
730746
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),
731747
link_name = "usleep$UNIX2003")]

0 commit comments

Comments
 (0)