--- a/Unix.st Tue Aug 05 20:40:19 1997 +0200
+++ b/Unix.st Tue Aug 05 21:47:29 1997 +0200
@@ -2124,7 +2124,7 @@
* standard across unixes
*/
char *msg = "unknown error";
- char buffer[50];
+ char buffer[64];
OBJ eno = errNr;
if (__isSmallInteger(eno)) {
@@ -7250,27 +7250,14 @@
%{ /* NOCONTEXT */
-#if defined(linux)
-# if defined(SIGIO) || defined(SIGPOLL)
-# if defined(F_GETFL) && defined(F_SETFL)
-# if defined(F_SETOWN) || defined(FIOSETOWN)
+#if defined(SIGIO) || defined(SIGPOLL)
+# if defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)
+# if defined(F_SETOWN) || defined(FIOSETOWN)
+
+# ifdef linux
RETURN (true);
# endif
-# endif
-# endif
-#else
-# if defined(SYSV4) && defined(USE_SIGIO) && 0
-
-# if defined(SIGPOLL) || defined(SIGIO)
-# if (defined(F_GETFL) && defined(F_SETFL) && defined(FASYNC)) || defined(SYSV4)
- /*
- * currently the only system where they work is unixware SYSV4
- * (not even on SGI ...)
- */
-# if !defined(NEXT)
- RETURN (true);
-# endif
-# endif
+
# endif
# endif
#endif
@@ -7708,7 +7695,10 @@
ftime(&timebuffer);
t = (timebuffer.time * 1000) + timebuffer.millitm;
-# else
+# define HAVE_TIME
+# endif
+
+# ifndef HAVE_TIME
# if defined(SYSV) && defined(HZ)
/*
* sys5 time
@@ -7718,18 +7708,34 @@
ticks = times(&tb);
t = (ticks * 1000) / HZ;
+# define HAVE_TIME
# endif /* old SYSV stuff */
# endif
-#else
-# ifdef WIN32
+
+# ifndef HAVE_TIME
+# ifdef WIN32
t = GetTickCount();
-# else
+# define HAVE_TIME
+# endif
+# endif
+
+# ifndef HAVE_TIME
# ifdef MSDOS_LIKE
struct _timeb timebuffer;
_ftime(&timebuffer);
t = (timebuffer.time * 1000) + timebuffer.millitm;
-# else /* assume HAS_GETTIMEOFDAY */
+# define HAVE_TIME
+# endif
+# endif
+#endif
+
+#ifndef HAVE_TIME
+ /* assume HAS_GETTIMEOFDAY
+ * - will result in a linkage error
+ * if not fixed.
+ */
+
/*
* bsd time
*/
@@ -7738,9 +7744,10 @@
gettimeofday(&tb, &tzb);
t = tb.tv_sec*1000 + tb.tv_usec/1000;
-# endif
-# endif
-#endif
+#endif
+
+#undef HAVE_TIME
+
RETURN ( __MKSMALLINT(t & 0x1FFFFFFF) );
%}
!
@@ -7762,7 +7769,18 @@
%{
long t;
-#if !defined(HAS_GETTIMEOFDAY) && defined(SYSV) && defined(HZ)
+
+#if !defined(HAS_GETTIMEOFDAY)
+# if defined(HAS_FTIME)
+ struct timeb timebuffer;
+
+ seconds = __MKUINT(timebuffer.time);
+ millis = __MKUINT(timebuffer.millitm);
+# define HAVE_TIME
+# endif
+
+# ifndef HAVE_TIME
+# if defined(SYSV) && defined(HZ)
/*
* sys5 time; we have to fake the information
* the returned value is inexact.
@@ -7778,16 +7796,26 @@
t = (ticks * 1000) / HZ;
t = t % 1000;
millis = __MKSMALLINT(t);
-
-#else
-# ifdef MSDOS_LIKE
+# endif /* OLD SYSV stuff */
+# endif
+
+# ifndef HAVE_TIME
+# ifdef MSDOS_LIKE
struct _timeb timebuffer;
_ftime(&timebuffer);
seconds = __MKUINT(timebuffer.time);
millis = __MKUINT(timebuffer.millitm);
-
-# else /* assume HAS_GETTIMEOFDAY */
+# define HAVE_TIME
+# endif
+# endif
+#endif
+
+#ifndef HAVE_TIME
+ /* assume HAS_GETTIMEOFDAY
+ * - will result in a linkage error
+ * if not fixed.
+ */
/*
* bsd time
*/
@@ -7802,11 +7830,11 @@
* being conservative here ...
*/
-# if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX)
+# if defined(__GNUC__) && (__GNUC__ >= 2) && defined(i386) && defined(LINUX)
# define HAS_LONGLONG
-# endif
-
-# ifdef HAS_LONGLONG
+# endif
+
+# ifdef HAS_LONGLONG
{
unsigned long long _secs, _millis, rslt;
unsigned low, hi;
@@ -7819,9 +7847,9 @@
hi = rslt >> 32;
RETURN (__MKLARGEINT64(1, low, hi));
}
-# endif
-
-# ifdef alpha64
+# endif /* long long */
+
+# ifdef alpha64
{
unsigned INT _secs, _millis, rslt;
@@ -7830,13 +7858,15 @@
rslt = _secs * 1000 + _millis;
RETURN (__MKUINT(rslt));
}
-# endif
+# endif /* alpha */
seconds = __MKUINT(tb.tv_sec);
millis = __MKUINT(tb.tv_usec / 1000);
-# endif
-#endif
+#endif
+
+#undef HAVE_TIME
+
%}.
^ (seconds * 1000) + millis
@@ -9077,6 +9107,6 @@
!OperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.239 1997-08-05 14:28:31 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/Unix.st,v 1.240 1997-08-05 19:47:29 cg Exp $'
! !
OperatingSystem initialize!