update structs in unix.utmpx

Joe Groff 2009-09-18 18:30:48 -05:00
parent e09d14a69a
commit 316aecd1dd
3 changed files with 37 additions and 35 deletions

View File

@ -1,4 +1,5 @@
USING: alien.syntax unix.time classes.struct ; USING: alien.c-types alien.syntax unix.time unix.types
unix.types.macosx classes.struct ;
IN: unix IN: unix
CONSTANT: FD_SETSIZE 1024 CONSTANT: FD_SETSIZE 1024
@ -18,15 +19,15 @@ CONSTANT: _UTX_LINESIZE 32
CONSTANT: _UTX_IDSIZE 4 CONSTANT: _UTX_IDSIZE 4
CONSTANT: _UTX_HOSTSIZE 256 CONSTANT: _UTX_HOSTSIZE 256
C-STRUCT: utmpx STRUCT: utmpx
{ { "char" _UTX_USERSIZE } "ut_user" } { ut_user { char _UTX_USERSIZE } }
{ { "char" _UTX_IDSIZE } "ut_id" } { ut_id { char _UTX_IDSIZE } }
{ { "char" _UTX_LINESIZE } "ut_line" } { ut_line { char _UTX_LINESIZE } }
{ "pid_t" "ut_pid" } { ut_pid pid_t }
{ "short" "ut_type" } { ut_type short }
{ "timeval" "ut_tv" } { ut_tv timeval }
{ { "char" _UTX_HOSTSIZE } "ut_host" } { ut_host { char _UTX_HOSTSIZE } }
{ { "uint" 16 } "ut_pad" } ; { ut_pad { uint 16 } } ;
CONSTANT: __DARWIN_MAXPATHLEN 1024 CONSTANT: __DARWIN_MAXPATHLEN 1024
CONSTANT: __DARWIN_MAXNAMELEN 255 CONSTANT: __DARWIN_MAXNAMELEN 255
@ -37,7 +38,7 @@ STRUCT: dirent
{ d_reclen __uint16_t } { d_reclen __uint16_t }
{ d_type __uint8_t } { d_type __uint8_t }
{ d_namlen __uint8_t } { d_namlen __uint8_t }
{ d_name { "char" __DARWIN_MAXNAMELEN+1 } } ; { d_name { char __DARWIN_MAXNAMELEN+1 } } ;
CONSTANT: EPERM 1 CONSTANT: EPERM 1
CONSTANT: ENOENT 2 CONSTANT: ENOENT 2

View File

@ -1,29 +1,30 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax unix.time classes.struct ; USING: alien.c-types alien.syntax unix.time unix.types
unix.types.netbsd classes.struct ;
IN: unix IN: unix
STRUCT: sockaddr_storage STRUCT: sockaddr_storage
{ ss_len __uint8_t } { ss_len __uint8_t }
{ ss_family sa_family_t } { ss_family sa_family_t }
{ __ss_pad1 { "char" _SS_PAD1SIZE } } { __ss_pad1 { char _SS_PAD1SIZE } }
{ __ss_align __int64_t } { __ss_align __int64_t }
{ __ss_pad2 { "char" _SS_PAD2SIZE } } ; { __ss_pad2 { char _SS_PAD2SIZE } } ;
STRUCT: exit_struct STRUCT: exit_struct
{ e_termination uint16_t } { e_termination uint16_t }
{ e_exit uint16_t } ; { e_exit uint16_t } ;
C-STRUCT: utmpx STRUCT: utmpx
{ { "char" _UTX_USERSIZE } "ut_user" } { ut_user { char _UTX_USERSIZE } }
{ { "char" _UTX_IDSIZE } "ut_id" } { ut_id { char _UTX_IDSIZE } }
{ { "char" _UTX_LINESIZE } "ut_line" } { ut_line { char _UTX_LINESIZE } }
{ { "char" _UTX_HOSTSIZE } "ut_host" } { ut_host { char _UTX_HOSTSIZE } }
{ "uint16_t" "ut_session" } { ut_session uint16_t }
{ "uint16_t" "ut_type" } { ut_type uint16_t }
{ "pid_t" "ut_pid" } { ut_pid pid_t }
{ "exit_struct" "ut_exit" } { ut_exit exit_struct }
{ "sockaddr_storage" "ut_ss" } { ut_ss sockaddr_storage }
{ "timeval" "ut_tv" } { ut_tv timeval }
{ { "uint32_t" 10 } "ut_pad" } ; { ut_pad { uint32_t 10 } } ;

View File

@ -3,7 +3,7 @@
USING: alien.c-types alien.data alien.syntax combinators USING: alien.c-types alien.data alien.syntax combinators
continuations io.encodings.string io.encodings.utf8 kernel continuations io.encodings.string io.encodings.utf8 kernel
sequences strings unix calendar system accessors unix.time sequences strings unix calendar system accessors unix.time
calendar.unix vocabs.loader ; calendar.unix vocabs.loader classes.struct ;
IN: unix.utmpx IN: unix.utmpx
CONSTANT: EMPTY 0 CONSTANT: EMPTY 0
@ -39,15 +39,15 @@ M: unix new-utmpx-record
utmpx-record new ; utmpx-record new ;
M: unix utmpx>utmpx-record ( utmpx -- utmpx-record ) M: unix utmpx>utmpx-record ( utmpx -- utmpx-record )
[ new-utmpx-record ] dip [ new-utmpx-record ] dip \ utmpx memory>struct
{ {
[ utmpx-ut_user _UTX_USERSIZE memory>string >>user ] [ ut_user>> _UTX_USERSIZE memory>string >>user ]
[ utmpx-ut_id _UTX_IDSIZE memory>string >>id ] [ ut_id>> _UTX_IDSIZE memory>string >>id ]
[ utmpx-ut_line _UTX_LINESIZE memory>string >>line ] [ ut_line>> _UTX_LINESIZE memory>string >>line ]
[ utmpx-ut_pid >>pid ] [ ut_pid>> >>pid ]
[ utmpx-ut_type >>type ] [ ut_type>> >>type ]
[ utmpx-ut_tv timeval>unix-time >>timestamp ] [ ut_tv>> timeval>unix-time >>timestamp ]
[ utmpx-ut_host _UTX_HOSTSIZE memory>string >>host ] [ ut_host>> _UTX_HOSTSIZE memory>string >>host ]
} cleave ; } cleave ;
: with-utmpx ( quot -- ) : with-utmpx ( quot -- )