@@ -172,15 +172,16 @@ mod ut {
172172 pub use libc:: _UTX_USERSIZE as UT_NAMESIZE ;
173173
174174 pub use libc:: ACCOUNTING ;
175- pub use libc:: DEAD_PROCESS ;
176- pub use libc:: EMPTY ;
177- pub use libc:: INIT_PROCESS ;
178- pub use libc:: LOGIN_PROCESS ;
179- pub use libc:: NEW_TIME ;
180- pub use libc:: OLD_TIME ;
181- pub use libc:: RUN_LVL ;
182- pub use libc:: SIGNATURE ;
183- pub use libc:: USER_PROCESS ;
175+ pub const BOOT_TIME : i16 = libc:: BOOT_TIME as i16 ;
176+ pub const DEAD_PROCESS : i16 = libc:: DEAD_PROCESS as i16 ;
177+ pub const EMPTY : i16 = libc:: EMPTY as i16 ;
178+ pub const INIT_PROCESS : i16 = libc:: INIT_PROCESS as i16 ;
179+ pub const LOGIN_PROCESS : i16 = libc:: LOGIN_PROCESS as i16 ;
180+ pub const NEW_TIME : i16 = libc:: NEW_TIME as i16 ;
181+ pub const OLD_TIME : i16 = libc:: OLD_TIME as i16 ;
182+ pub const RUN_LVL : i16 = libc:: RUN_LVL as i16 ;
183+ pub const SIGNATURE : i16 = libc:: SIGNATURE as i16 ;
184+ pub const USER_PROCESS : i16 = libc:: USER_PROCESS as i16 ;
184185}
185186
186187#[ cfg( target_os = "cygwin" ) ]
@@ -207,10 +208,30 @@ pub struct Utmpx {
207208 inner : utmpx ,
208209}
209210
211+ #[ cfg( target_os = "netbsd" ) ]
212+ impl Utmpx {
213+ fn ut_type ( & self ) -> i16 {
214+ self . inner . ut_type as i16
215+ }
216+ fn ut_user ( & self ) -> String {
217+ chars2string ! ( self . inner. ut_name)
218+ }
219+ }
220+
221+ #[ cfg( not( target_os = "netbsd" ) ) ]
222+ impl Utmpx {
223+ fn ut_type ( & self ) -> i16 {
224+ self . inner . ut_type
225+ }
226+ fn ut_user ( & self ) -> String {
227+ chars2string ! ( self . inner. ut_user)
228+ }
229+ }
230+
210231impl Utmpx {
211232 /// A.K.A. ut.ut_type
212233 pub fn record_type ( & self ) -> i16 {
213- self . inner . ut_type
234+ self . ut_type ( )
214235 }
215236 /// A.K.A. ut.ut_pid
216237 pub fn pid ( & self ) -> i32 {
@@ -220,9 +241,9 @@ impl Utmpx {
220241 pub fn terminal_suffix ( & self ) -> String {
221242 chars2string ! ( self . inner. ut_id)
222243 }
223- /// A.K.A. ut.ut_user
244+ /// A.K.A. ut.ut_user / ut.ut_name (NetBSD)
224245 pub fn user ( & self ) -> String {
225- chars2string ! ( self . inner . ut_user)
246+ self . ut_user ( )
226247 }
227248 /// A.K.A. ut.ut_host
228249 pub fn host ( & self ) -> String {
0 commit comments