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
CONSTANT: FD_SETSIZE 1024
@ -18,15 +19,15 @@ CONSTANT: _UTX_LINESIZE 32
CONSTANT: _UTX_IDSIZE 4
CONSTANT: _UTX_HOSTSIZE 256
C-STRUCT: utmpx
{ { "char" _UTX_USERSIZE } "ut_user" }
{ { "char" _UTX_IDSIZE } "ut_id" }
{ { "char" _UTX_LINESIZE } "ut_line" }
{ "pid_t" "ut_pid" }
{ "short" "ut_type" }
{ "timeval" "ut_tv" }
{ { "char" _UTX_HOSTSIZE } "ut_host" }
{ { "uint" 16 } "ut_pad" } ;
STRUCT: utmpx
{ ut_user { char _UTX_USERSIZE } }
{ ut_id { char _UTX_IDSIZE } }
{ ut_line { char _UTX_LINESIZE } }
{ ut_pid pid_t }
{ ut_type short }
{ ut_tv timeval }
{ ut_host { char _UTX_HOSTSIZE } }
{ ut_pad { uint 16 } } ;
CONSTANT: __DARWIN_MAXPATHLEN 1024
CONSTANT: __DARWIN_MAXNAMELEN 255
@ -37,7 +38,7 @@ STRUCT: dirent
{ d_reclen __uint16_t }
{ d_type __uint8_t }
{ d_namlen __uint8_t }
{ d_name { "char" __DARWIN_MAXNAMELEN+1 } } ;
{ d_name { char __DARWIN_MAXNAMELEN+1 } } ;
CONSTANT: EPERM 1
CONSTANT: ENOENT 2

View File

@ -1,29 +1,30 @@
! Copyright (C) 2008 Doug Coleman.
! 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
STRUCT: sockaddr_storage
{ ss_len __uint8_t }
{ ss_family sa_family_t }
{ __ss_pad1 { "char" _SS_PAD1SIZE } }
{ __ss_pad1 { char _SS_PAD1SIZE } }
{ __ss_align __int64_t }
{ __ss_pad2 { "char" _SS_PAD2SIZE } } ;
{ __ss_pad2 { char _SS_PAD2SIZE } } ;
STRUCT: exit_struct
{ e_termination uint16_t }
{ e_exit uint16_t } ;
C-STRUCT: utmpx
{ { "char" _UTX_USERSIZE } "ut_user" }
{ { "char" _UTX_IDSIZE } "ut_id" }
{ { "char" _UTX_LINESIZE } "ut_line" }
{ { "char" _UTX_HOSTSIZE } "ut_host" }
{ "uint16_t" "ut_session" }
{ "uint16_t" "ut_type" }
{ "pid_t" "ut_pid" }
{ "exit_struct" "ut_exit" }
{ "sockaddr_storage" "ut_ss" }
{ "timeval" "ut_tv" }
{ { "uint32_t" 10 } "ut_pad" } ;
STRUCT: utmpx
{ ut_user { char _UTX_USERSIZE } }
{ ut_id { char _UTX_IDSIZE } }
{ ut_line { char _UTX_LINESIZE } }
{ ut_host { char _UTX_HOSTSIZE } }
{ ut_session uint16_t }
{ ut_type uint16_t }
{ ut_pid pid_t }
{ ut_exit exit_struct }
{ ut_ss sockaddr_storage }
{ ut_tv timeval }
{ ut_pad { uint32_t 10 } } ;

View File

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