]> gitweb.factorcode.org Git - factor.git/commitdiff
unix.utmpx: Support utmpx on linux and fix on macosx. Add a unit test.
authorDoug Coleman <doug.coleman@gmail.com>
Wed, 5 Jun 2013 00:51:36 +0000 (17:51 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Wed, 5 Jun 2013 00:53:15 +0000 (17:53 -0700)
basis/unix/ffi/linux/linux.factor
basis/unix/utmpx/macosx/authors.txt [deleted file]
basis/unix/utmpx/macosx/macosx-tests.factor [deleted file]
basis/unix/utmpx/macosx/macosx.factor [deleted file]
basis/unix/utmpx/macosx/platforms.txt [deleted file]
basis/unix/utmpx/platforms.txt
basis/unix/utmpx/utmpx-tests.factor [new file with mode: 0644]
basis/unix/utmpx/utmpx.factor

index a28935feeff909f02357374d4cdba437945114f7..8d7bec607a10c7622e7ac1225d9be1b9b265bdc3 100644 (file)
@@ -277,3 +277,25 @@ CONSTANT: SIGPWR          30
 CONSTANT: SIGSYS          31
 
 FUNCTION: ssize_t sendfile ( int out_fd, int in_fd, off_t* offset, size_t count ) ;
+
+
+CONSTANT: __UT_LINESIZE 32
+CONSTANT: __UT_NAMESIZE 32
+CONSTANT: __UT_HOSTSIZE 256
+
+STRUCT: exit_status
+    { e_termination short }
+    { e_exit short } ;
+
+STRUCT: utmpx
+    { ut_type short }
+    { ut_pid pid_t }
+    { ut_line short }
+    { ut_id short }
+    { ut_user short }
+    { ut_host short }
+    { ut_exit exit_status }
+    { ut_session long }
+    { ut_tv timeval }
+    { ut_addr_v6 int[4] }
+    { __unused char[20] } ;
diff --git a/basis/unix/utmpx/macosx/authors.txt b/basis/unix/utmpx/macosx/authors.txt
deleted file mode 100644 (file)
index b4bd0e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Doug Coleman
\ No newline at end of file
diff --git a/basis/unix/utmpx/macosx/macosx-tests.factor b/basis/unix/utmpx/macosx/macosx-tests.factor
deleted file mode 100644 (file)
index b0aa97d..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: tools.test unix.utmpx.macosx ;
-IN: unix.utmpx.macosx.tests
diff --git a/basis/unix/utmpx/macosx/macosx.factor b/basis/unix/utmpx/macosx/macosx.factor
deleted file mode 100644 (file)
index b33c448..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-! Copyright (C) 2008 Doug Coleman.
-! See http://factorcode.org/license.txt for BSD license.
-USING: alien.syntax unix.ffi.macosx ;
-IN: unix.utmpx.macosx
-
-! empty
diff --git a/basis/unix/utmpx/macosx/platforms.txt b/basis/unix/utmpx/macosx/platforms.txt
deleted file mode 100644 (file)
index 6e806f4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-macosx
index 6e806f449ecbbcdbf4596d9adcec9f8088abdaf8..509143d86315eda0a858ba863bfc0f4447dbed1f 100644 (file)
@@ -1 +1 @@
-macosx
+unix
diff --git a/basis/unix/utmpx/utmpx-tests.factor b/basis/unix/utmpx/utmpx-tests.factor
new file mode 100644 (file)
index 0000000..d7f6c02
--- /dev/null
@@ -0,0 +1,6 @@
+! Copyright (C) 2013 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: kernel tools.test unix.utmpx ;
+IN: unix.utmpx.tests
+
+{ } [ all-utmpx drop ] unit-test
index 64a38a3c7c88311903c92147c979d6df3733d448..ef3731de2ae22b4045e2a3f6ffa920105a2c3db1 100644 (file)
@@ -19,8 +19,6 @@ CONSTANT: ACCOUNTING 9
 CONSTANT: SIGNATURE 10
 CONSTANT: SHUTDOWN_TIME 11
 
-C-TYPE: utmpx
-
 FUNCTION: void setutxent ( ) ;
 FUNCTION: void endutxent ( ) ;
 FUNCTION: utmpx* getutxent ( ) ;
@@ -41,8 +39,7 @@ M: unix new-utmpx-record
     utmpx-record new ;
     
 M: unix utmpx>utmpx-record ( utmpx -- utmpx-record )
-    [ new-utmpx-record ] dip
-    {
+    [ new-utmpx-record ] dip {
         [ ut_user>> _UTX_USERSIZE memory>string >>user ]
         [ ut_id>>   _UTX_IDSIZE memory>string >>id ]
         [ ut_line>> _UTX_LINESIZE memory>string >>line ]
@@ -61,7 +58,3 @@ M: unix utmpx>utmpx-record ( utmpx -- utmpx-record )
         [ utmpx>utmpx-record ]
         produce nip
     ] with-utmpx ;
-    
-os {
-    { macosx [ "unix.utmpx.macosx" require ] }
-} case