--- a/OpenVMSOS.st Tue Jun 09 19:30:14 1998 +0200
+++ b/OpenVMSOS.st Wed Jun 10 11:53:06 1998 +0200
@@ -5716,7 +5716,6 @@
OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId."
^ UnsupportedOperationSignal raise.
-
! !
!OpenVMSOperatingSystem class methodsFor:'ipc support - UNIX'!
@@ -8691,6 +8690,6 @@
!OpenVMSOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/OpenVMSOS.st,v 1.3 1998-06-05 16:52:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/OpenVMSOS.st,v 1.4 1998-06-10 09:52:39 cg Exp $'
! !
OpenVMSOperatingSystem initialize!
--- a/OpenVMSOperatingSystem.st Tue Jun 09 19:30:14 1998 +0200
+++ b/OpenVMSOperatingSystem.st Wed Jun 10 11:53:06 1998 +0200
@@ -5716,7 +5716,6 @@
OpenVMSOperatingSystem>>getStatusOfProcess:aProcessId."
^ UnsupportedOperationSignal raise.
-
! !
!OpenVMSOperatingSystem class methodsFor:'ipc support - UNIX'!
@@ -8691,6 +8690,6 @@
!OpenVMSOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/OpenVMSOperatingSystem.st,v 1.3 1998-06-05 16:52:16 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/OpenVMSOperatingSystem.st,v 1.4 1998-06-10 09:52:39 cg Exp $'
! !
OpenVMSOperatingSystem initialize!
--- a/UnixOS.st Tue Jun 09 19:30:14 1998 +0200
+++ b/UnixOS.st Wed Jun 10 11:53:06 1998 +0200
@@ -1339,7 +1339,7 @@
HostName := nil.
DomainName := nil.
LastErrorNumber := nil.
- PipeFailed := false.
+ PipeFailed := false.
SlowFork := false.
]
@@ -1945,229 +1945,229 @@
*/
#ifdef EPERM
if (sym == @symbol(EPERM)) {
- RETURN ( __MKSMALLINT(EPERM) );
+ RETURN ( __MKSMALLINT(EPERM) );
}
#endif
#ifdef ENOENT
if (sym == @symbol(ENOENT)) {
- RETURN ( __MKSMALLINT(ENOENT) );
+ RETURN ( __MKSMALLINT(ENOENT) );
}
#endif
#ifdef ESRCH
if (sym == @symbol(ESRCH)) {
- RETURN ( __MKSMALLINT(ESRCH) );
+ RETURN ( __MKSMALLINT(ESRCH) );
}
#endif
#ifdef EINTR
if (sym == @symbol(EINTR)) {
- RETURN ( __MKSMALLINT(EINTR) );
+ RETURN ( __MKSMALLINT(EINTR) );
}
#endif
#ifdef EIO
if (sym == @symbol(EIO)) {
- RETURN ( __MKSMALLINT(EIO) );
+ RETURN ( __MKSMALLINT(EIO) );
}
#endif
#ifdef ENXIO
if (sym == @symbol(ENXIO)) {
- RETURN ( __MKSMALLINT(ENXIO) );
+ RETURN ( __MKSMALLINT(ENXIO) );
}
#endif
#ifdef E2BIG
if (sym == @symbol(E2BIG)) {
- RETURN ( __MKSMALLINT(E2BIG) );
+ RETURN ( __MKSMALLINT(E2BIG) );
}
#endif
#ifdef ENOEXEC
if (sym == @symbol(ENOEXEC)) {
- RETURN ( __MKSMALLINT(ENOEXEC) );
+ RETURN ( __MKSMALLINT(ENOEXEC) );
}
#endif
#ifdef EBADF
if (sym == @symbol(EBADF)) {
- RETURN ( __MKSMALLINT(EBADF) );
+ RETURN ( __MKSMALLINT(EBADF) );
}
#endif
#ifdef ECHILD
if (sym == @symbol(ECHILD)) {
- RETURN ( __MKSMALLINT(ECHILD) );
+ RETURN ( __MKSMALLINT(ECHILD) );
}
#endif
#if defined(EAGAIN)
if (sym == @symbol(EAGAIN)) {
- RETURN ( __MKSMALLINT(EAGAIN) );
+ RETURN ( __MKSMALLINT(EAGAIN) );
}
#endif
#ifdef ENOMEM
if (sym == @symbol(ENOMEM)) {
- RETURN ( __MKSMALLINT(ENOMEM) );
+ RETURN ( __MKSMALLINT(ENOMEM) );
}
#endif
#ifdef EACCES
if (sym == @symbol(EACCES)) {
- RETURN ( __MKSMALLINT(EACCES) );
+ RETURN ( __MKSMALLINT(EACCES) );
}
#endif
#ifdef EFAULT
if (sym == @symbol(EFAULT)) {
- RETURN ( __MKSMALLINT(EFAULT) );
+ RETURN ( __MKSMALLINT(EFAULT) );
}
#endif
#ifdef EBUSY
if (sym == @symbol(EBUSY)) {
- RETURN ( __MKSMALLINT(EBUSY) );
+ RETURN ( __MKSMALLINT(EBUSY) );
}
#endif
#ifdef EXDEV
if (sym == @symbol(EXDEV)) {
- RETURN ( __MKSMALLINT(EXDEV) );
+ RETURN ( __MKSMALLINT(EXDEV) );
}
#endif
#ifdef ENODEV
if (sym == @symbol(ENODEV)) {
- RETURN ( __MKSMALLINT(ENODEV) );
+ RETURN ( __MKSMALLINT(ENODEV) );
}
#endif
#ifdef ENOTDIR
if (sym == @symbol(ENOTDIR)) {
- RETURN ( __MKSMALLINT(ENOTDIR) );
+ RETURN ( __MKSMALLINT(ENOTDIR) );
}
#endif
#ifdef EISDIR
if (sym == @symbol(EISDIR)) {
- RETURN ( __MKSMALLINT(EISDIR) );
+ RETURN ( __MKSMALLINT(EISDIR) );
}
#endif
#ifdef EINVAL
if (sym == @symbol(EINVAL)) {
- RETURN ( __MKSMALLINT(EINVAL) );
+ RETURN ( __MKSMALLINT(EINVAL) );
}
#endif
#ifdef ENFILE
if (sym == @symbol(ENFILE)) {
- RETURN ( __MKSMALLINT(ENFILE) );
+ RETURN ( __MKSMALLINT(ENFILE) );
}
#endif
#ifdef EMFILE
if (sym == @symbol(EMFILE)) {
- RETURN ( __MKSMALLINT(EMFILE) );
+ RETURN ( __MKSMALLINT(EMFILE) );
}
#endif
#ifdef ENOTTY
if (sym == @symbol(ENOTTY)) {
- RETURN ( __MKSMALLINT(ENOTTY) );
+ RETURN ( __MKSMALLINT(ENOTTY) );
}
#endif
#ifdef EFBIG
if (sym == @symbol(EFBIG)) {
- RETURN ( __MKSMALLINT(EFBIG) );
+ RETURN ( __MKSMALLINT(EFBIG) );
}
#endif
#ifdef ENOSPC
if (sym == @symbol(ENOSPC)) {
- RETURN ( __MKSMALLINT(ENOSPC) );
+ RETURN ( __MKSMALLINT(ENOSPC) );
}
#endif
#ifdef ESPIPE
if (sym == @symbol(ESPIPE)) {
- RETURN ( __MKSMALLINT(ESPIPE) );
+ RETURN ( __MKSMALLINT(ESPIPE) );
}
#endif
#ifdef EROFS
if (sym == @symbol(EROFS)) {
- RETURN ( __MKSMALLINT(EROFS) );
+ RETURN ( __MKSMALLINT(EROFS) );
}
#endif
#ifdef EMLINK
if (sym == @symbol(EMLINK)) {
- RETURN ( __MKSMALLINT(EMLINK) );
+ RETURN ( __MKSMALLINT(EMLINK) );
}
#endif
#ifdef EPIPE
if (sym == @symbol(EPIPE)) {
- RETURN ( __MKSMALLINT(EPIPE) );
+ RETURN ( __MKSMALLINT(EPIPE) );
}
#endif
#ifdef EDOM
if (sym == @symbol(EDOM)) {
- RETURN ( __MKSMALLINT(EDOM) );
+ RETURN ( __MKSMALLINT(EDOM) );
}
#endif
#ifdef ERANGE
if (sym == @symbol(ERANGE)) {
- RETURN ( __MKSMALLINT(ERANGE) );
+ RETURN ( __MKSMALLINT(ERANGE) );
}
#endif
#ifdef EDEADLK
if (sym == @symbol(EDEADLK)) {
- RETURN ( __MKSMALLINT(EDEADLK) );
+ RETURN ( __MKSMALLINT(EDEADLK) );
}
#endif
#ifdef ENAMETOOLONG
if (sym == @symbol(ENAMETOOLONG)) {
- RETURN ( __MKSMALLINT(ENAMETOOLONG) );
+ RETURN ( __MKSMALLINT(ENAMETOOLONG) );
}
#endif
#ifdef ENOLCK
if (sym == @symbol(ENOLCK)) {
- RETURN ( __MKSMALLINT(ENOLCK) );
+ RETURN ( __MKSMALLINT(ENOLCK) );
}
#endif
#ifdef ENOSYS
if (sym == @symbol(ENOSYS)) {
- RETURN ( __MKSMALLINT(ENOSYS) );
+ RETURN ( __MKSMALLINT(ENOSYS) );
}
#endif
#ifdef ENOTEMPTY
if (sym == @symbol(ENOTEMPTY)) {
- RETURN ( __MKSMALLINT(ENOTEMPTY) );
+ RETURN ( __MKSMALLINT(ENOTEMPTY) );
}
#endif
#ifdef EEXIST
if (sym == @symbol(EEXIST)) {
- RETURN ( __MKSMALLINT(EEXIST) );
+ RETURN ( __MKSMALLINT(EEXIST) );
}
#endif
#ifdef EILSEQ
if (sym == @symbol(EILSEQ)) {
- RETURN ( __MKSMALLINT(EILSEQ) );
+ RETURN ( __MKSMALLINT(EILSEQ) );
}
#endif
@@ -2176,13 +2176,13 @@
*/
#ifdef ENOTBLK
if (sym == @symbol(ENOTBLK)) {
- RETURN ( __MKSMALLINT(ENOTBLK) );
+ RETURN ( __MKSMALLINT(ENOTBLK) );
}
#endif
#ifdef ETXTBSY
if (sym == @symbol(ETXTBSY)) {
- RETURN ( __MKSMALLINT(ETXTBSY) );
+ RETURN ( __MKSMALLINT(ETXTBSY) );
}
#endif
@@ -2191,19 +2191,19 @@
*/
#ifdef EWOULDBLOCK
if (sym == @symbol(EWOULDBLOCK)) {
- RETURN ( __MKSMALLINT(EWOULDBLOCK) );
+ RETURN ( __MKSMALLINT(EWOULDBLOCK) );
}
#endif
#ifdef ENOMSG
if (sym == @symbol(ENOMSG)) {
- RETURN ( __MKSMALLINT(ENOMSG) );
+ RETURN ( __MKSMALLINT(ENOMSG) );
}
#endif
#ifdef ELOOP
if (sym == @symbol(ELOOP)) {
- RETURN ( __MKSMALLINT(ELOOP) );
+ RETURN ( __MKSMALLINT(ELOOP) );
}
#endif
@@ -2212,31 +2212,31 @@
*/
#ifdef ETIME
if (sym == @symbol(ETIME)) {
- RETURN ( __MKSMALLINT(ETIME) );
+ RETURN ( __MKSMALLINT(ETIME) );
}
#endif
#ifdef ENOSR
if (sym == @symbol(ENOSR)) {
- RETURN ( __MKSMALLINT(ENOSR) );
+ RETURN ( __MKSMALLINT(ENOSR) );
}
#endif
#ifdef ENOSTR
if (sym == @symbol(ENOSTR)) {
- RETURN ( __MKSMALLINT(ENOSTR) );
+ RETURN ( __MKSMALLINT(ENOSTR) );
}
#endif
#ifdef ECOMM
if (sym == @symbol(ECOMM)) {
- RETURN ( __MKSMALLINT(ECOMM) );
+ RETURN ( __MKSMALLINT(ECOMM) );
}
#endif
#ifdef EPROTO
if (sym == @symbol(EPROTO)) {
- RETURN ( __MKSMALLINT(EPROTO) );
+ RETURN ( __MKSMALLINT(EPROTO) );
}
#endif
@@ -2245,13 +2245,13 @@
*/
#ifdef ESTALE
if (sym == @symbol(ESTALE)) {
- RETURN ( __MKSMALLINT(ESTALE) );
+ RETURN ( __MKSMALLINT(ESTALE) );
}
#endif
#ifdef EREMOTE
if (sym == @symbol(EREMOTE)) {
- RETURN ( __MKSMALLINT(EREMOTE) );
+ RETURN ( __MKSMALLINT(EREMOTE) );
}
#endif
@@ -2260,157 +2260,157 @@
*/
#ifdef EINPROGRESS
if (sym == @symbol(EINPROGRESS)) {
- RETURN ( __MKSMALLINT(EINPROGRESS) );
+ RETURN ( __MKSMALLINT(EINPROGRESS) );
}
#endif
#ifdef EALREADY
if (sym == @symbol(EALREADY)) {
- RETURN ( __MKSMALLINT(EALREADY) );
+ RETURN ( __MKSMALLINT(EALREADY) );
}
#endif
#ifdef ENOTSOCK
if (sym == @symbol(ENOTSOCK)) {
- RETURN ( __MKSMALLINT(ENOTSOCK) );
+ RETURN ( __MKSMALLINT(ENOTSOCK) );
}
#endif
#ifdef EDESTADDRREQ
if (sym == @symbol(EDESTADDRREQ)) {
- RETURN ( __MKSMALLINT(EDESTADDRREQ) );
+ RETURN ( __MKSMALLINT(EDESTADDRREQ) );
}
#endif
#ifdef EMSGSIZE
if (sym == @symbol(EMSGSIZE)) {
- RETURN ( __MKSMALLINT(EMSGSIZE) );
+ RETURN ( __MKSMALLINT(EMSGSIZE) );
}
#endif
#ifdef EPROTOTYPE
if (sym == @symbol(EPROTOTYPE)) {
- RETURN ( __MKSMALLINT(EPROTOTYPE) );
+ RETURN ( __MKSMALLINT(EPROTOTYPE) );
}
#endif
#ifdef ENOPROTOOPT
if (sym == @symbol(ENOPROTOOPT)) {
- RETURN ( __MKSMALLINT(ENOPROTOOPT) );
+ RETURN ( __MKSMALLINT(ENOPROTOOPT) );
}
#endif
#ifdef EPROTONOSUPPORT
if (sym == @symbol(EPROTONOSUPPORT)) {
- RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
+ RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
}
#endif
#ifdef ESOCKTNOSUPPORT
if (sym == @symbol(ESOCKTNOSUPPORT)) {
- RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
+ RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
}
#endif
#ifdef EOPNOTSUPP
if (sym == @symbol(EOPNOTSUPP)) {
- RETURN ( __MKSMALLINT(EOPNOTSUPP) );
+ RETURN ( __MKSMALLINT(EOPNOTSUPP) );
}
#endif
#ifdef EPFNOSUPPORT
if (sym == @symbol(EPFNOSUPPORT)) {
- RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
+ RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
}
#endif
#ifdef EAFNOSUPPORT
if (sym == @symbol(EAFNOSUPPORT)) {
- RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
+ RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
}
#endif
#ifdef EADDRINUSE
if (sym == @symbol(EADDRINUSE)) {
- RETURN ( __MKSMALLINT(EADDRINUSE) );
+ RETURN ( __MKSMALLINT(EADDRINUSE) );
}
#endif
#ifdef EADDRNOTAVAIL
if (sym == @symbol(EADDRNOTAVAIL)) {
- RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
+ RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
}
#endif
#ifdef ETIMEDOUT
if (sym == @symbol(ETIMEDOUT)) {
- RETURN ( __MKSMALLINT(ETIMEDOUT) );
+ RETURN ( __MKSMALLINT(ETIMEDOUT) );
}
#endif
#ifdef ECONNREFUSED
if (sym == @symbol(ECONNREFUSED)) {
- RETURN ( __MKSMALLINT(ECONNREFUSED) );
+ RETURN ( __MKSMALLINT(ECONNREFUSED) );
}
#endif
#ifdef ENETDOWN
if (sym == @symbol(ENETDOWN)) {
- RETURN ( __MKSMALLINT(ENETDOWN) );
+ RETURN ( __MKSMALLINT(ENETDOWN) );
}
#endif
#ifdef ENETUNREACH
if (sym == @symbol(ENETUNREACH)) {
- RETURN ( __MKSMALLINT(ENETUNREACH) );
+ RETURN ( __MKSMALLINT(ENETUNREACH) );
}
#endif
#ifdef ENETRESET
if (sym == @symbol(ENETRESET)) {
- RETURN ( __MKSMALLINT(ENETRESET) );
+ RETURN ( __MKSMALLINT(ENETRESET) );
}
#endif
#ifdef ECONNABORTED
if (sym == @symbol(ECONNABORTED)) {
- RETURN ( __MKSMALLINT(ECONNABORTED) );
+ RETURN ( __MKSMALLINT(ECONNABORTED) );
}
#endif
#ifdef ECONNRESET
if (sym == @symbol(ECONNRESET)) {
- RETURN ( __MKSMALLINT(ECONNRESET) );
+ RETURN ( __MKSMALLINT(ECONNRESET) );
}
#endif
#ifdef EISCONN
if (sym == @symbol(EISCONN)) {
- RETURN ( __MKSMALLINT(EISCONN) );
+ RETURN ( __MKSMALLINT(EISCONN) );
}
#endif
#ifdef ENOTCONN
if (sym == @symbol(ENOTCONN)) {
- RETURN ( __MKSMALLINT(ENOTCONN) );
+ RETURN ( __MKSMALLINT(ENOTCONN) );
}
#endif
#ifdef ESHUTDOWN
if (sym == @symbol(ESHUTDOWN)) {
- RETURN ( __MKSMALLINT(ESHUTDOWN) );
+ RETURN ( __MKSMALLINT(ESHUTDOWN) );
}
#endif
#ifdef EHOSTDOWN
if (sym == @symbol(EHOSTDOWN)) {
- RETURN ( __MKSMALLINT(EHOSTDOWN) );
+ RETURN ( __MKSMALLINT(EHOSTDOWN) );
}
#endif
#ifdef EHOSTUNREACH
if (sym == @symbol(EHOSTUNREACH)) {
- RETURN ( __MKSMALLINT(EHOSTUNREACH) );
+ RETURN ( __MKSMALLINT(EHOSTUNREACH) );
}
#endif
%}.
@@ -2435,499 +2435,499 @@
OBJ eno = errNr;
if (__isSmallInteger(eno)) {
- switch (__intVal(eno)) {
- /*
- * POSIX errnos - these should be defined
- */
+ switch (__intVal(eno)) {
+ /*
+ * POSIX errnos - these should be defined
+ */
#ifdef EPERM
- case EPERM:
- msg = "Operation not permitted";
- sym = @symbol(EPERM);
- break;
+ case EPERM:
+ msg = "Operation not permitted";
+ sym = @symbol(EPERM);
+ break;
#endif
#ifdef ENOENT
- case ENOENT:
- msg = "No such file or directory";
- sym = @symbol(ENOENT);
- break;
+ case ENOENT:
+ msg = "No such file or directory";
+ sym = @symbol(ENOENT);
+ break;
#endif
#ifdef ESRCH
- case ESRCH:
- msg = "No such process";
- sym = @symbol(ESRCH);
- break;
+ case ESRCH:
+ msg = "No such process";
+ sym = @symbol(ESRCH);
+ break;
#endif
#ifdef EINTR
- case EINTR:
- msg = "Interrupted system call";
- sym = @symbol(EINTR);
- break;
+ case EINTR:
+ msg = "Interrupted system call";
+ sym = @symbol(EINTR);
+ break;
#endif
#ifdef EIO
- case EIO:
- msg = "I/O error";
- sym = @symbol(EIO);
- break;
+ case EIO:
+ msg = "I/O error";
+ sym = @symbol(EIO);
+ break;
#endif
#ifdef ENXIO
- case ENXIO:
- msg = "No such device or address";
- sym = @symbol(ENXIO);
- break;
+ case ENXIO:
+ msg = "No such device or address";
+ sym = @symbol(ENXIO);
+ break;
#endif
#ifdef E2BIG
- case E2BIG:
- msg = "Arg list too long";
- sym = @symbol(E2BIG);
- break;
+ case E2BIG:
+ msg = "Arg list too long";
+ sym = @symbol(E2BIG);
+ break;
#endif
#ifdef ENOEXEC
- case ENOEXEC:
- msg = "Exec format error";
- sym = @symbol(ENOEXEC);
- break;
+ case ENOEXEC:
+ msg = "Exec format error";
+ sym = @symbol(ENOEXEC);
+ break;
#endif
#ifdef EBADF
- case EBADF:
- msg = "Bad file number";
- sym = @symbol(EBADF);
- break;
+ case EBADF:
+ msg = "Bad file number";
+ sym = @symbol(EBADF);
+ break;
#endif
#ifdef ECHILD
- case ECHILD:
- msg = "No child processes";
- sym = @symbol(ECHILD);
- break;
+ case ECHILD:
+ msg = "No child processes";
+ sym = @symbol(ECHILD);
+ break;
#endif
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
- case EAGAIN:
- msg = "Try again";
- sym = @symbol(EAGAIN);
- break;
+ case EAGAIN:
+ msg = "Try again";
+ sym = @symbol(EAGAIN);
+ break;
#endif
#ifdef ENOMEM
- case ENOMEM:
- msg = "Out of memory";
- sym = @symbol(ENOMEM);
- break;
+ case ENOMEM:
+ msg = "Out of memory";
+ sym = @symbol(ENOMEM);
+ break;
#endif
#ifdef EACCES
- case EACCES:
- msg = "Permission denied";
- sym = @symbol(EACCES);
- break;
+ case EACCES:
+ msg = "Permission denied";
+ sym = @symbol(EACCES);
+ break;
#endif
#ifdef EFAULT
- case EFAULT:
- msg = "Bad address";
- sym = @symbol(EFAULT);
- break;
+ case EFAULT:
+ msg = "Bad address";
+ sym = @symbol(EFAULT);
+ break;
#endif
#ifdef EBUSY
- case EBUSY:
- msg = "Device or resource busy";
- sym = @symbol(EBUSY);
- break;
+ case EBUSY:
+ msg = "Device or resource busy";
+ sym = @symbol(EBUSY);
+ break;
#endif
#ifdef EEXIST
- case EEXIST:
- msg = "File exists";
- sym = @symbol(EEXIST);
- break;
+ case EEXIST:
+ msg = "File exists";
+ sym = @symbol(EEXIST);
+ break;
#endif
#ifdef EXDEV
- case EXDEV:
- msg = "Cross-device link";
- sym = @symbol(EXDEV);
- break;
+ case EXDEV:
+ msg = "Cross-device link";
+ sym = @symbol(EXDEV);
+ break;
#endif
#ifdef ENODEV
- case ENODEV:
- msg = "No such device";
- sym = @symbol(ENODEV);
- break;
+ case ENODEV:
+ msg = "No such device";
+ sym = @symbol(ENODEV);
+ break;
#endif
#ifdef ENOTDIR
- case ENOTDIR:
- msg = "Not a directory";
- sym = @symbol(ENOTDIR);
- break;
+ case ENOTDIR:
+ msg = "Not a directory";
+ sym = @symbol(ENOTDIR);
+ break;
#endif
#ifdef EISDIR
- case EISDIR:
- msg = "Is a directory";
- sym = @symbol(EISDIR);
- break;
+ case EISDIR:
+ msg = "Is a directory";
+ sym = @symbol(EISDIR);
+ break;
#endif
#ifdef EINVAL
- case EINVAL:
- msg = "Invalid argument";
- sym = @symbol(EINVAL);
- break;
+ case EINVAL:
+ msg = "Invalid argument";
+ sym = @symbol(EINVAL);
+ break;
#endif
#ifdef ENFILE
- case ENFILE:
- msg = "File table overflow";
- sym = @symbol(ENFILE);
- break;
+ case ENFILE:
+ msg = "File table overflow";
+ sym = @symbol(ENFILE);
+ break;
#endif
#ifdef EMFILE
- case EMFILE:
- msg = "Too many open files";
- sym = @symbol(EMFILE);
- break;
+ case EMFILE:
+ msg = "Too many open files";
+ sym = @symbol(EMFILE);
+ break;
#endif
#ifdef ENOTTY
- case ENOTTY:
- msg = "Not a typewriter";
- sym = @symbol(ENOTTY);
- break;
+ case ENOTTY:
+ msg = "Not a typewriter";
+ sym = @symbol(ENOTTY);
+ break;
#endif
#ifdef EFBIG
- case EFBIG:
- msg = "File too large";
- sym = @symbol(EFBIG);
- break;
+ case EFBIG:
+ msg = "File too large";
+ sym = @symbol(EFBIG);
+ break;
#endif
#ifdef ENOSPC
- case ENOSPC:
- msg = "No space left on device";
- sym = @symbol(ENOSPC);
- break;
+ case ENOSPC:
+ msg = "No space left on device";
+ sym = @symbol(ENOSPC);
+ break;
#endif
#ifdef ESPIPE
- case ESPIPE:
- msg = "Illegal seek";
- sym = @symbol(ESPIPE);
- break;
+ case ESPIPE:
+ msg = "Illegal seek";
+ sym = @symbol(ESPIPE);
+ break;
#endif
#ifdef EROFS
- case EROFS:
- msg = "Read-only file system";
- sym = @symbol(EROFS);
- break;
+ case EROFS:
+ msg = "Read-only file system";
+ sym = @symbol(EROFS);
+ break;
#endif
#ifdef EMLINK
- case EMLINK:
- msg = "Too many links";
- sym = @symbol(EMLINK);
- break;
+ case EMLINK:
+ msg = "Too many links";
+ sym = @symbol(EMLINK);
+ break;
#endif
#ifdef EPIPE
- case EPIPE:
- msg = "Broken pipe";
- sym = @symbol(EPIPE);
- break;
+ case EPIPE:
+ msg = "Broken pipe";
+ sym = @symbol(EPIPE);
+ break;
#endif
#ifdef EDOM
- case EDOM:
- msg = "Math argument out of domain";
- sym = @symbol(EDOM);
- break;
+ case EDOM:
+ msg = "Math argument out of domain";
+ sym = @symbol(EDOM);
+ break;
#endif
#ifdef ERANGE
- case ERANGE:
- msg = "Math result not representable";
- sym = @symbol(ERANGE);
- break;
+ case ERANGE:
+ msg = "Math result not representable";
+ sym = @symbol(ERANGE);
+ break;
#endif
#ifdef EDEADLK
# if EDEADLK != EWOULDBLOCK
- case EDEADLK:
- msg = "Resource deadlock would occur";
- sym = @symbol(EDEADLK);
- break;
+ case EDEADLK:
+ msg = "Resource deadlock would occur";
+ sym = @symbol(EDEADLK);
+ break;
# endif
#endif
#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
- msg = "File name too long";
- sym = @symbol(ENAMETOOLONG);
- break;
+ case ENAMETOOLONG:
+ msg = "File name too long";
+ sym = @symbol(ENAMETOOLONG);
+ break;
#endif
#ifdef ENOLCK
- case ENOLCK:
- msg = "No record locks available";
- sym = @symbol(ENOLCK);
- break;
+ case ENOLCK:
+ msg = "No record locks available";
+ sym = @symbol(ENOLCK);
+ break;
#endif
#ifdef ENOSYS
- case ENOSYS:
- msg = "Function not implemented";
- sym = @symbol(ENOSYS);
- break;
+ case ENOSYS:
+ msg = "Function not implemented";
+ sym = @symbol(ENOSYS);
+ break;
#endif
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
- case ENOTEMPTY:
- msg = "Directory not empty";
- sym = @symbol(ENOTEMPTY);
- break;
+ case ENOTEMPTY:
+ msg = "Directory not empty";
+ sym = @symbol(ENOTEMPTY);
+ break;
#endif
#ifdef EILSEQ
- case EILSEQ:
- msg = "Illegal byte sequence";
- sym = @symbol(EILSEQ);
- break;
-#endif
- /*
- * XPG3 errnos - defined on most systems
- */
+ case EILSEQ:
+ msg = "Illegal byte sequence";
+ sym = @symbol(EILSEQ);
+ break;
+#endif
+ /*
+ * XPG3 errnos - defined on most systems
+ */
#ifdef ENOTBLK
- case ENOTBLK:
- msg = "Block device required";
- sym = @symbol(ENOTBLK);
- break;
+ case ENOTBLK:
+ msg = "Block device required";
+ sym = @symbol(ENOTBLK);
+ break;
#endif
#ifdef ETXTBSY
- case ETXTBSY:
- msg = "Text file busy";
- sym = @symbol(ETXTBSY);
- break;
-#endif
- /*
- * some others
- */
+ case ETXTBSY:
+ msg = "Text file busy";
+ sym = @symbol(ETXTBSY);
+ break;
+#endif
+ /*
+ * some others
+ */
#ifdef EWOULDBLOCK
- case EWOULDBLOCK:
- msg = "Operation would block";
- sym = @symbol(EWOULDBLOCK);
- break;
+ case EWOULDBLOCK:
+ msg = "Operation would block";
+ sym = @symbol(EWOULDBLOCK);
+ break;
#endif
#ifdef ENOMSG
- case ENOMSG:
- msg = "No message of desired type";
- sym = @symbol(ENOMSG);
- break;
+ case ENOMSG:
+ msg = "No message of desired type";
+ sym = @symbol(ENOMSG);
+ break;
#endif
#ifdef ELOOP
- case ELOOP:
- msg = "Too many levels of symbolic links";
- sym = @symbol(ELOOP);
- break;
-#endif
-
- /*
- * some stream errors
- */
+ case ELOOP:
+ msg = "Too many levels of symbolic links";
+ sym = @symbol(ELOOP);
+ break;
+#endif
+
+ /*
+ * some stream errors
+ */
#ifdef ETIME
- case ETIME:
- msg = "Timer expired";
- sym = @symbol(ETIME);
- break;
+ case ETIME:
+ msg = "Timer expired";
+ sym = @symbol(ETIME);
+ break;
#endif
#ifdef ENOSR
- case ENOSR:
- msg = "Out of streams resources";
- sym = @symbol(ENOSR);
- break;
+ case ENOSR:
+ msg = "Out of streams resources";
+ sym = @symbol(ENOSR);
+ break;
#endif
#ifdef ENOSTR
- case ENOSTR:
- msg = "Device not a stream";
- sym = @symbol(ENOSTR);
- break;
+ case ENOSTR:
+ msg = "Device not a stream";
+ sym = @symbol(ENOSTR);
+ break;
#endif
#ifdef ECOMM
- case ECOMM:
- msg = "Communication error on send";
- sym = @symbol(ECOMM);
- break;
+ case ECOMM:
+ msg = "Communication error on send";
+ sym = @symbol(ECOMM);
+ break;
#endif
#ifdef EPROTO
- case EPROTO:
- msg = "Protocol error";
- sym = @symbol(EPROTO);
- break;
-#endif
- /*
- * nfs errors
- */
+ case EPROTO:
+ msg = "Protocol error";
+ sym = @symbol(EPROTO);
+ break;
+#endif
+ /*
+ * nfs errors
+ */
#ifdef ESTALE
- case ESTALE:
- msg = "Stale NFS file handle";
- sym = @symbol(ESTALE);
- break;
+ case ESTALE:
+ msg = "Stale NFS file handle";
+ sym = @symbol(ESTALE);
+ break;
#endif
#ifdef EREMOTE
- case EREMOTE:
- msg = "Too many levels of remote in path";
- sym = @symbol(EREMOTE);
- break;
-#endif
- /*
- * some networking errors
- */
+ case EREMOTE:
+ msg = "Too many levels of remote in path";
+ sym = @symbol(EREMOTE);
+ break;
+#endif
+ /*
+ * some networking errors
+ */
#ifdef EINPROGRESS
- case EINPROGRESS:
- msg = "Operation now in progress";
- sym = @symbol(EINPROGRESS);
- break;
+ case EINPROGRESS:
+ msg = "Operation now in progress";
+ sym = @symbol(EINPROGRESS);
+ break;
#endif
#ifdef EALREADY
- case EALREADY:
- msg = "Operation already in progress";
- sym = @symbol(EALREADY);
- break;
+ case EALREADY:
+ msg = "Operation already in progress";
+ sym = @symbol(EALREADY);
+ break;
#endif
#ifdef ENOTSOCK
- case ENOTSOCK:
- msg = "Socket operation on non-socket";
- sym = @symbol(ENOTSOCK);
- break;
+ case ENOTSOCK:
+ msg = "Socket operation on non-socket";
+ sym = @symbol(ENOTSOCK);
+ break;
#endif
#ifdef EDESTADDRREQ
- case EDESTADDRREQ:
- msg = "Destination address required";
- sym = @symbol(EDESTADDRREQ);
- break;
+ case EDESTADDRREQ:
+ msg = "Destination address required";
+ sym = @symbol(EDESTADDRREQ);
+ break;
#endif
#ifdef EMSGSIZE
- case EMSGSIZE:
- msg = "Message too long";
- sym = @symbol(EMSGSIZE);
- break;
+ case EMSGSIZE:
+ msg = "Message too long";
+ sym = @symbol(EMSGSIZE);
+ break;
#endif
#ifdef EPROTOTYPE
- case EPROTOTYPE:
- msg = "Protocol wrong type for socket";
- sym = @symbol(EPROTOTYPE);
- break;
+ case EPROTOTYPE:
+ msg = "Protocol wrong type for socket";
+ sym = @symbol(EPROTOTYPE);
+ break;
#endif
#ifdef ENOPROTOOPT
- case ENOPROTOOPT:
- msg = "Protocol not available";
- sym = @symbol(ENOPROTOOPT);
- break;
+ case ENOPROTOOPT:
+ msg = "Protocol not available";
+ sym = @symbol(ENOPROTOOPT);
+ break;
#endif
#ifdef EPROTONOSUPPORT
- case EPROTONOSUPPORT:
- msg = "Protocol not supported";
- sym = @symbol(EPROTONOSUPPORT);
- break;
+ case EPROTONOSUPPORT:
+ msg = "Protocol not supported";
+ sym = @symbol(EPROTONOSUPPORT);
+ break;
#endif
#ifdef ESOCKTNOSUPPORT
- case ESOCKTNOSUPPORT:
- msg = "Socket type not supported";
- sym = @symbol(ESOCKTNOSUPPORT);
- break;
+ case ESOCKTNOSUPPORT:
+ msg = "Socket type not supported";
+ sym = @symbol(ESOCKTNOSUPPORT);
+ break;
#endif
#ifdef EOPNOTSUPP
- case EOPNOTSUPP:
- msg = "Operation not supported on socket";
- sym = @symbol(EOPNOTSUPP);
- break;
+ case EOPNOTSUPP:
+ msg = "Operation not supported on socket";
+ sym = @symbol(EOPNOTSUPP);
+ break;
#endif
#ifdef EPFNOSUPPORT
- case EPFNOSUPPORT:
- msg = "Protocol family not supported";
- sym = @symbol(EPFNOSUPPORT);
- break;
+ case EPFNOSUPPORT:
+ msg = "Protocol family not supported";
+ sym = @symbol(EPFNOSUPPORT);
+ break;
#endif
#ifdef EAFNOSUPPORT
- case EAFNOSUPPORT:
- msg = "Address family not supported by protocol family";
- sym = @symbol(EAFNOSUPPORT);
- break;
+ case EAFNOSUPPORT:
+ msg = "Address family not supported by protocol family";
+ sym = @symbol(EAFNOSUPPORT);
+ break;
#endif
#ifdef EADDRINUSE
- case EADDRINUSE:
- msg = "Address already in use";
- sym = @symbol(EADDRINUSE);
- break;
+ case EADDRINUSE:
+ msg = "Address already in use";
+ sym = @symbol(EADDRINUSE);
+ break;
#endif
#ifdef EADDRNOTAVAIL
- case EADDRNOTAVAIL:
- msg = "Can\'t assign requested address";
- sym = @symbol(EADDRNOTAVAIL);
- break;
+ case EADDRNOTAVAIL:
+ msg = "Can\'t assign requested address";
+ sym = @symbol(EADDRNOTAVAIL);
+ break;
#endif
#ifdef ETIMEDOUT
- case ETIMEDOUT:
- msg = "Connection timed out";
- sym = @symbol(ETIMEDOUT);
- break;
+ case ETIMEDOUT:
+ msg = "Connection timed out";
+ sym = @symbol(ETIMEDOUT);
+ break;
#endif
#ifdef ECONNREFUSED
- case ECONNREFUSED:
- msg = "Connection refused";
- sym = @symbol(ECONNREFUSED);
- break;
+ case ECONNREFUSED:
+ msg = "Connection refused";
+ sym = @symbol(ECONNREFUSED);
+ break;
#endif
#ifdef ENETDOWN
- case ENETDOWN:
- msg = "Network is down";
- sym = @symbol(ENETDOWN);
- break;
+ case ENETDOWN:
+ msg = "Network is down";
+ sym = @symbol(ENETDOWN);
+ break;
#endif
#ifdef ENETUNREACH
- case ENETUNREACH:
- msg = "Network is unreachable";
- sym = @symbol(ENETUNREACH);
- break;
+ case ENETUNREACH:
+ msg = "Network is unreachable";
+ sym = @symbol(ENETUNREACH);
+ break;
#endif
#ifdef ENETRESET
- case ENETRESET:
- msg = "Network dropped conn due to reset";
- sym = @symbol(ENETRESET);
- break;
+ case ENETRESET:
+ msg = "Network dropped conn due to reset";
+ sym = @symbol(ENETRESET);
+ break;
#endif
#ifdef ECONNABORTED
- case ECONNABORTED:
- msg = "Software caused connection abort";
- sym = @symbol(ECONNABORTED);
- break;
+ case ECONNABORTED:
+ msg = "Software caused connection abort";
+ sym = @symbol(ECONNABORTED);
+ break;
#endif
#ifdef ECONNRESET
- case ECONNRESET:
- msg = "Connection reset by peer";
- sym = @symbol(ECONNRESET);
- break;
+ case ECONNRESET:
+ msg = "Connection reset by peer";
+ sym = @symbol(ECONNRESET);
+ break;
#endif
#ifdef EISCONN
- case EISCONN:
- msg = "Socket is already connected";
- sym = @symbol(EISCONN);
- break;
+ case EISCONN:
+ msg = "Socket is already connected";
+ sym = @symbol(EISCONN);
+ break;
#endif
#ifdef ENOTCONN
- case ENOTCONN:
- msg = "Socket is not connected";
- sym = @symbol(ENOTCONN);
- break;
+ case ENOTCONN:
+ msg = "Socket is not connected";
+ sym = @symbol(ENOTCONN);
+ break;
#endif
#ifdef ESHUTDOWN
- case ESHUTDOWN:
- msg = "Can't send after socket shutdown";
- sym = @symbol(ESHUTDOWN);
- break;
+ case ESHUTDOWN:
+ msg = "Can't send after socket shutdown";
+ sym = @symbol(ESHUTDOWN);
+ break;
#endif
#ifdef EHOSTDOWN
- case EHOSTDOWN:
- msg = "Host is down";
- sym = @symbol(EHOSTDOWN);
- break;
+ case EHOSTDOWN:
+ msg = "Host is down";
+ sym = @symbol(EHOSTDOWN);
+ break;
#endif
#ifdef EHOSTUNREACH
- case EHOSTUNREACH:
- msg = "No route to host";
- sym = @symbol(EHOSTUNREACH);
- break;
-#endif
-
- default:
- {
- __BEGIN_PROTECT_REGISTERS__
- sprintf(buffer, "ErrorNr: %d", __intVal(eno));
- __END_PROTECT_REGISTERS__
- }
- msg = buffer;
- sym = @symbol(ERROR_OTHER);
- break;
- }
- text = __MKSTRING(msg);
+ case EHOSTUNREACH:
+ msg = "No route to host";
+ sym = @symbol(EHOSTUNREACH);
+ break;
+#endif
+
+ default:
+ {
+ __BEGIN_PROTECT_REGISTERS__
+ sprintf(buffer, "ErrorNr: %d", __intVal(eno));
+ __END_PROTECT_REGISTERS__
+ }
+ msg = buffer;
+ sym = @symbol(ERROR_OTHER);
+ break;
+ }
+ text = __MKSTRING(msg);
} else {
- text = nil;
- sym = nil;
+ text = nil;
+ sym = nil;
}
%}.
^ Array with:sym with:text
@@ -2958,38 +2958,38 @@
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp
"Internal lowLevel entry for combined fork & exec;
If fork is false (chain a command):
- execute the OS command specified by the argument, aCommandPath, with
- arguments in argArray (no arguments, if nil).
- If successful, this method does not return and smalltalk is gone.
- If not successful, it does return.
- Normal use is with forkForCommand.
+ execute the OS command specified by the argument, aCommandPath, with
+ arguments in argArray (no arguments, if nil).
+ If successful, this method does not return and smalltalk is gone.
+ If not successful, it does return.
+ Normal use is with forkForCommand.
If fork is true (subprocess command execution):
- fork a child to do the above.
- The process id of the child process is returned; nil if the fork failed.
+ fork a child to do the above.
+ The process id of the child process is returned; nil if the fork failed.
fdArray contains the filedescriptors, to be used for the child (if fork is true).
- fdArray[1] = 15 -> use fd 15 as stdin.
- If an element of the array is set to nil, the corresponding filedescriptor
- will be closed for the child.
- fdArray[0] == StdIn for child
- fdArray[1] == StdOut for child
- fdArray[2] == StdErr for child
- on VMS, these must be channels as returned by createMailBox.
+ fdArray[1] = 15 -> use fd 15 as stdin.
+ If an element of the array is set to nil, the corresponding filedescriptor
+ will be closed for the child.
+ fdArray[0] == StdIn for child
+ fdArray[1] == StdOut for child
+ fdArray[2] == StdErr for child
+ on VMS, these must be channels as returned by createMailBox.
closeFdArray contains descriptors that will be closed in the subprocess.
- closeDescriptors are ignored in the WIN32 & VMS versions.
+ closeDescriptors are ignored in the WIN32 & VMS versions.
NOTE that in WIN32 the fds are HANDLES!!
If newPgrp is true, the subprocess will be established in a new process group.
- The processgroup will be equal to id.
- newPgrp is not used on WIN32 and VMS systems.
+ The processgroup will be equal to id.
+ newPgrp is not used on WIN32 and VMS systems.
Notice: this used to be two separate ST-methods; however, in order to use
- vfork on some machines, it had to be merged into one, to avoid write
- accesses to ST/X memory from the vforked-child.
- The code below only does read accesses."
+ vfork on some machines, it had to be merged into one, to avoid write
+ accesses to ST/X memory from the vforked-child.
+ The code below only does read accesses."
%{ /* STACK: 16000 */
@@ -3000,101 +3000,101 @@
/* extern char *malloc(); */
if (__isString(aCommandPath) &&
- ((argArray == nil) || __isArray(argArray)) &&
- ((fdArray == nil) || __isArray(fdArray)) &&
- ((closeFdArray == nil) || __isArray(closeFdArray))
+ ((argArray == nil) || __isArray(argArray)) &&
+ ((fdArray == nil) || __isArray(fdArray)) &&
+ ((closeFdArray == nil) || __isArray(closeFdArray))
) {
- nargs = argArray == nil ? 0 : __arraySize(argArray);
- argv = (char **) malloc(sizeof(char *) * (nargs + 1));
- if (argv) {
- for (i=0; i < nargs; i++) {
- arg = __ArrayInstPtr(argArray)->a_element[i];
- if (__isString(arg)) {
- argv[i] = (char *) __stringVal(arg);
- } else {
- argv[i] = "";
- }
- }
- argv[i] = NULL;
-
- if (doFork == true) {
- int nfd, nclose;
-
- nfd = fdArray == nil ? 0 : __arraySize(fdArray);
- nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
+ nargs = argArray == nil ? 0 : __arraySize(argArray);
+ argv = (char **) malloc(sizeof(char *) * (nargs + 1));
+ if (argv) {
+ for (i=0; i < nargs; i++) {
+ arg = __ArrayInstPtr(argArray)->a_element[i];
+ if (__isString(arg)) {
+ argv[i] = (char *) __stringVal(arg);
+ } else {
+ argv[i] = "";
+ }
+ }
+ argv[i] = NULL;
+
+ if (doFork == true) {
+ int nfd, nclose;
+
+ nfd = fdArray == nil ? 0 : __arraySize(fdArray);
+ nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
# ifdef HAS_VFORK
- id = vfork();
+ id = vfork();
# else
- id = fork();
+ id = fork();
# endif
- if (id == 0) {
- /*
- ** In child.
- ** first: dup filedescriptors
- */
- for (i = 0; i < nfd; i++) {
- OBJ fd;
- int rslt;
-
- fd = __ArrayInstPtr(fdArray)->a_element[i];
- if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
- do {
- rslt = dup2(__intVal(fd), i);
- } while ((rslt < 0) && (errno == EINTR));
- }
- }
- /*
- ** second: close unused filedescriptors
- */
- for (i = 0; i < nfd; i++) {
- if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
- close(i);
- }
- }
- /*
- ** third: close filedescriptors
- */
- for (i = 0; i < nclose; i++) {
- OBJ fd;
-
- fd = __ArrayInstPtr(closeFdArray)->a_element[i];
- if (__isSmallInteger(fd)) {
- close(__intVal(fd));
- }
- }
- if (newPgrp == true) {
+ if (id == 0) {
+ /*
+ ** In child.
+ ** first: dup filedescriptors
+ */
+ for (i = 0; i < nfd; i++) {
+ OBJ fd;
+ int rslt;
+
+ fd = __ArrayInstPtr(fdArray)->a_element[i];
+ if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
+ do {
+ rslt = dup2(__intVal(fd), i);
+ } while ((rslt < 0) && (errno == EINTR));
+ }
+ }
+ /*
+ ** second: close unused filedescriptors
+ */
+ for (i = 0; i < nfd; i++) {
+ if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
+ close(i);
+ }
+ }
+ /*
+ ** third: close filedescriptors
+ */
+ for (i = 0; i < nclose; i++) {
+ OBJ fd;
+
+ fd = __ArrayInstPtr(closeFdArray)->a_element[i];
+ if (__isSmallInteger(fd)) {
+ close(__intVal(fd));
+ }
+ }
+ if (newPgrp == true) {
# if defined(_POSIX_JOB_CONTROL)
- (void) setpgid(0, 0);
+ (void) setpgid(0, 0);
# else
# if defined(BSD)
- (void) setpgrp(0);
+ (void) setpgrp(0);
# endif
# endif
- }
-
- execv(__stringVal(aCommandPath), argv);
- /* should not be reached */
- _exit(127); /* POSIX 2 compatible exit value */
- }
- /*
- ** In parent: succes or failure
- */
- free(argv);
- if (id == -1) {
- RETURN (nil);
- } else {
- RETURN (__MKSMALLINT(id));
- }
- } else {
- execv(__stringVal(aCommandPath), argv);
- /*
- * should not be reached
- * (well, it is, if you pass a wrong command-path)
- */
- free(argv);
- RETURN ( nil );
- }
- }
+ }
+
+ execv(__stringVal(aCommandPath), argv);
+ /* should not be reached */
+ _exit(127); /* POSIX 2 compatible exit value */
+ }
+ /*
+ ** In parent: succes or failure
+ */
+ free(argv);
+ if (id == -1) {
+ RETURN (nil);
+ } else {
+ RETURN (__MKSMALLINT(id));
+ }
+ } else {
+ execv(__stringVal(aCommandPath), argv);
+ /*
+ * should not be reached
+ * (well, it is, if you pass a wrong command-path)
+ */
+ free(argv);
+ RETURN ( nil );
+ }
+ }
}
#endif /* UNIX */
%}.
@@ -3111,9 +3111,9 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child'.
- UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
- 'not reached'.
+ 'I am the child'.
+ UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
+ 'not reached'.
]
"
"
@@ -3121,11 +3121,11 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child'.
- UnixOperatingSystem
- exec:'/bin/sh'
- withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
- 'not reached'.
+ 'I am the child'.
+ UnixOperatingSystem
+ exec:'/bin/sh'
+ withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
+ 'not reached'.
].
id printNL.
(Delay forSeconds:3.5) wait.
@@ -3140,11 +3140,11 @@
Not needed with Unix"
^ self
- exec:aCommandPath
- withArguments:argArray
- fileDescriptors:fdArray
- closeDescriptors:closeFdArray
- fork:doFork newPgrp:newPgrp
+ exec:aCommandPath
+ withArguments:argArray
+ fileDescriptors:fdArray
+ closeDescriptors:closeFdArray
+ fork:doFork newPgrp:newPgrp
"Modified: / 5.6.1998 / 19:00:48 / cg"
!
@@ -3193,8 +3193,8 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child process' printCR.
- UnixOperatingSystem exit
+ 'I am the child process' printCR.
+ UnixOperatingSystem exit
]
"
!
@@ -3207,38 +3207,38 @@
int status;
if (__isSmallInteger(aProcessId)) {
- pid_t pid = (pid_t)(__intVal(aProcessId));
- {
+ pid_t pid = (pid_t)(__intVal(aProcessId));
+ {
# ifdef NO_WAITPID
- pid_t child;
-
- do {
- __BEGIN_INTERRUPTABLE__
- child = __wait (&status);
- __END_INTERRUPTABLE__
- if (child < 0 && errno != EINTR) {
- fprintf(stderr, "OS: child-wait errno=%d\n", errno);
- status = -1;
- break;
- }
- } while (child != pid);
+ pid_t child;
+
+ do {
+ __BEGIN_INTERRUPTABLE__
+ child = __wait (&status);
+ __END_INTERRUPTABLE__
+ if (child < 0 && errno != EINTR) {
+ fprintf(stderr, "OS: child-wait errno=%d\n", errno);
+ status = -1;
+ break;
+ }
+ } while (child != pid);
# else
- pid_t child;
-
- /* claus: the original did not care for EINTR here ... */
- do {
- __BEGIN_INTERRUPTABLE__
- child = __waitpid (pid, &status, 0);
- __END_INTERRUPTABLE__
- } while ((child != pid) && (errno == EINTR));
- if (child != pid) {
- fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
- status = -1;
- }
+ pid_t child;
+
+ /* claus: the original did not care for EINTR here ... */
+ do {
+ __BEGIN_INTERRUPTABLE__
+ child = __waitpid (pid, &status, 0);
+ __END_INTERRUPTABLE__
+ } while ((child != pid) && (errno == EINTR));
+ if (child != pid) {
+ fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
+ status = -1;
+ }
# endif /* NO_WAITPID */
- }
- RETURN ( __MKSMALLINT(status));
+ }
+ RETURN ( __MKSMALLINT(status));
}
%}.
self primitiveFailed
@@ -3253,28 +3253,28 @@
|path f fExt|
aCommand asFilename isAbsolute ifTrue:[
- ^ aCommand
+ ^ aCommand
].
path := self getEnvironment:'PATH'.
path notNil ifTrue:[
- (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
- path isEmpty ifTrue:[
- f := aCommand asFilename
- ] ifFalse:[
- f := path asFilename construct:aCommand.
- ].
- self executableFileExtensions do:[:ext |
- ext notEmpty ifTrue:[
- fExt := (f pathName , ext) asFilename.
- ] ifFalse:[
- fExt := f.
- ].
- fExt isExecutable ifTrue:[
- ^ fExt pathName
- ].
- ].
- ].
+ (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
+ path isEmpty ifTrue:[
+ f := aCommand asFilename
+ ] ifFalse:[
+ f := path asFilename construct:aCommand.
+ ].
+ self executableFileExtensions do:[:ext |
+ ext notEmpty ifTrue:[
+ fExt := (f pathName , ext) asFilename.
+ ] ifFalse:[
+ fExt := f.
+ ].
+ fExt isExecutable ifTrue:[
+ ^ fExt pathName
+ ].
+ ].
+ ].
].
^ nil
@@ -3307,25 +3307,25 @@
|in out err shellAndArgs|
anExternalInStream notNil ifTrue:[
- in := anExternalInStream fileDescriptor.
+ in := anExternalInStream fileDescriptor.
] ifFalse:[
- in := '/dev/null' asFilename readStream fileDescriptor
+ in := '/dev/null' asFilename readStream fileDescriptor
].
anExternalOutStream notNil ifTrue:[
- out := anExternalOutStream fileDescriptor.
+ out := anExternalOutStream fileDescriptor.
].
anExternalErrStream notNil ifTrue:[
- err := anExternalErrStream fileDescriptor.
+ err := anExternalErrStream fileDescriptor.
].
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
^ self
- exec:(shellAndArgs at:1)
- withArguments:(shellAndArgs at:2)
- fileDescriptors:(Array with:in with:out with:err)
- closeDescriptors:nil
- fork:true
- newPgrp:false.
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ fileDescriptors:(Array with:in with:out with:err)
+ closeDescriptors:nil
+ fork:true
+ newPgrp:false.
"blocking at current prio (i.e. only higher prio threads execute):
@@ -3346,7 +3346,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3368,8 +3368,8 @@
%{
if (__isSmallInteger(anInteger)) {
- close(__intVal(anInteger));
- RETURN(self);
+ close(__intVal(anInteger));
+ RETURN(self);
}
%}.
^ self primitiveFailed.
@@ -3387,14 +3387,14 @@
%{
if (__isString(aPathName)) {
- int ret;
-
- ret = mkdir(__stringVal(aPathName), 0755);
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (false);
- }
- RETURN (true);
+ int ret;
+
+ ret = mkdir(__stringVal(aPathName), 0755);
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
@@ -3421,23 +3421,23 @@
int ret;
if (__isString(oldPath) && __isString(newPath)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
(oldPath isString not or:[newPath isString not]) ifTrue:[
- "/
- "/ bad argument(s) given
- "/
- ^ self primitiveFailed
+ "/
+ "/ bad argument(s) given
+ "/
+ ^ self primitiveFailed
].
"/
@@ -3483,16 +3483,16 @@
int ret;
if (__isString(fullPathName)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = rmdir((char *) __stringVal(fullPathName));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = rmdir((char *) __stringVal(fullPathName));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
"/
@@ -3516,16 +3516,16 @@
int ret;
if (__isString(fullPathName)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = unlink((char *) __stringVal(fullPathName));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = unlink((char *) __stringVal(fullPathName));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -3544,27 +3544,27 @@
if (__isString(oldPath) && __isString(newPath)) {
#if defined(HAS_RENAME)
- __BEGIN_INTERRUPTABLE__
- do {
- ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
#else
- ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- if (ret >= 0) {
- ret = unlink((char *) __stringVal(oldPath));
- if (ret < 0) {
- eno = errno;
- unlink((char *) __stringVal(newPath));
- errno = eno;
- }
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ if (ret >= 0) {
+ ret = unlink((char *) __stringVal(oldPath));
+ if (ret < 0) {
+ eno = errno;
+ unlink((char *) __stringVal(newPath));
+ errno = eno;
+ }
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -4079,9 +4079,9 @@
"/ root, home and current directories.
"/
^ Array
- with:'/'
- with:(self getHomeDirectory)
- with:(Filename currentDirectory pathName)
+ with:'/'
+ with:(self getHomeDirectory)
+ with:(Filename currentDirectory pathName)
"Modified: / 5.6.1998 / 18:35:35 / cg"
!
@@ -4090,16 +4090,16 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only: the MSDOS name of the file)
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only: the MSDOS name of the file)
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -4127,112 +4127,112 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for info\n", __stringVal(aPathName));
+ printf("stat on '%s' for info\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
-
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- switch (buf.st_mode & S_IFMT) {
- case S_IFDIR:
- type = @symbol(directory);
- break;
-
- case S_IFREG:
- type = @symbol(regular);
- break;
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ switch (buf.st_mode & S_IFMT) {
+ case S_IFDIR:
+ type = @symbol(directory);
+ break;
+
+ case S_IFREG:
+ type = @symbol(regular);
+ break;
# ifdef S_IFCHR
- case S_IFCHR:
- type = @symbol(characterSpecial);
- break;
+ case S_IFCHR:
+ type = @symbol(characterSpecial);
+ break;
# endif
# ifdef S_IFBLK
- case S_IFBLK:
- type = @symbol(blockSpecial);
- break;
+ case S_IFBLK:
+ type = @symbol(blockSpecial);
+ break;
# endif
# ifdef S_IFMPC
- case S_IFMPC:
- type = @symbol(multiplexedCharacterSpecial);
- break;
+ case S_IFMPC:
+ type = @symbol(multiplexedCharacterSpecial);
+ break;
# endif
# ifdef S_IFMPB
- case S_IFMPB:
- type = @symbol(multiplexedBlockSpecial);
- break;
+ case S_IFMPB:
+ type = @symbol(multiplexedBlockSpecial);
+ break;
# endif
# ifdef S_IFLNK
- case S_IFLNK:
- type = @symbol(symbolicLink);
- break;
+ case S_IFLNK:
+ type = @symbol(symbolicLink);
+ break;
# endif
# ifdef S_IFSOCK
- case S_IFSOCK:
- type = @symbol(socket);
- break;
+ case S_IFSOCK:
+ type = @symbol(socket);
+ break;
# endif
# ifdef S_IFIFO
- case S_IFIFO:
- type = @symbol(fifo);
- break;
+ case S_IFIFO:
+ type = @symbol(fifo);
+ break;
# endif
- default:
- type = @symbol(unknown);
- break;
- }
-
- ino = buf.st_ino;
- id = __MKUINT(ino);
-
- mode = __MKSMALLINT(buf.st_mode & 0777);
- uid = __MKSMALLINT(buf.st_uid);
- gid = __MKSMALLINT(buf.st_gid);
- size = __MKUINT(buf.st_size);
- aOStime = __MKUINT(buf.st_atime);
- mOStime = __MKUINT(buf.st_mtime);
- cOStime = __MKUINT(buf.st_ctime);
+ default:
+ type = @symbol(unknown);
+ break;
+ }
+
+ ino = buf.st_ino;
+ id = __MKUINT(ino);
+
+ mode = __MKSMALLINT(buf.st_mode & 0777);
+ uid = __MKSMALLINT(buf.st_uid);
+ gid = __MKSMALLINT(buf.st_gid);
+ size = __MKUINT(buf.st_size);
+ aOStime = __MKUINT(buf.st_atime);
+ mOStime = __MKUINT(buf.st_mtime);
+ cOStime = __MKUINT(buf.st_ctime);
}
%}.
mode notNil ifTrue:[
- aOStime notNil ifTrue:[
- atime := AbsoluteTime fromOSTime:(aOStime * 1000).
- mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
- ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
- ] ifFalse:[
- atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
- mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
- ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
- ].
-
- info := FileStatusInfo
- type:type
- mode:mode
- uid:uid
- gid:gid
- size:size
- id:id
- accessed:atime
- modified:mtime
- statusChanged:ctime
- path:nil
- alternativeName:name2.
-
- recordFormat notNil ifTrue:[
- "/ additional VMS info
- info
- recordFormat:recordFormat
- recordFormatNumeric:recordFormatNumeric
- recordAttributes:recordAttribs
- fixedHeaderSize:fixedHeaderSize
- recordSize:recordSize
- ].
- ^ info
+ aOStime notNil ifTrue:[
+ atime := AbsoluteTime fromOSTime:(aOStime * 1000).
+ mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
+ ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
+ ] ifFalse:[
+ atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
+ mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
+ ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
+ ].
+
+ info := FileStatusInfo
+ type:type
+ mode:mode
+ uid:uid
+ gid:gid
+ size:size
+ id:id
+ accessed:atime
+ modified:mtime
+ statusChanged:ctime
+ path:nil
+ alternativeName:name2.
+
+ recordFormat notNil ifTrue:[
+ "/ additional VMS info
+ info
+ recordFormat:recordFormat
+ recordFormatNumeric:recordFormatNumeric
+ recordAttributes:recordAttribs
+ fixedHeaderSize:fixedHeaderSize
+ recordSize:recordSize
+ ].
+ ^ info
].
^ self primitiveFailed
@@ -4253,27 +4253,27 @@
int ret;
if (__isString(aPathName)) {
- struct stat buf;
+ struct stat buf;
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
+ printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false);
}
%}.
^ self primitiveFailed
"an alternative implementation would be:
- ^ (self infoOf:aPathName) type == #directory
+ ^ (self infoOf:aPathName) type == #directory
"
!
@@ -4348,18 +4348,18 @@
if (__isString(aPathName) || __isSymbol(aPathName) ) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
+ printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (false);
- }
- RETURN ( ret ? false : true );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (false);
+ }
+ RETURN ( ret ? false : true );
}
%}.
^ self primitiveFailed
@@ -4374,17 +4374,17 @@
if (__isString(aPathName)) {
# ifdef TRACE_ACCESS_CALLS
- printf("access on '%s' for writable\n", __stringVal(aPathName));
+ printf("access on '%s' for writable\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = access(__stringVal(aPathName), W_OK);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- }
- RETURN ( ((ret == 0) ? true : false) );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = access(__stringVal(aPathName), W_OK);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ }
+ RETURN ( ((ret == 0) ? true : false) );
}
%}.
^ self primitiveFailed
@@ -4500,43 +4500,43 @@
path := self primPathNameOf:pathName.
path isNil ifTrue:[
- (self isValidPath:pathName) ifFalse:[
- p := pathName.
- [(p size > 1)
- and:[p endsWith:(self fileSeparator)]
- ] whileTrue:[
- p := p copyWithoutLast:1.
- ].
- ^ p
- ].
-
- (SlowFork==true or:[PipeFailed==true]) ifFalse:[
- PipeStream openErrorSignal handle:[:ex |
- PipeFailed := true.
- 'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
- ex return.
- ] do:[
- "have to fall back ..."
- command := 'cd ' , pathName , '; pwd'.
- p := PipeStream readingFrom:command.
- ].
-
- (p isNil or:[p atEnd]) ifTrue:[
- ('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
- ] ifFalse:[
- path := p nextLine.
- p close.
- ]
- ].
- path isNil ifTrue:[
- "/
- "/ return the original - there is nothing else can we do
- "/
- path := pathName
- ].
- (SlowFork==true or:[ForkFailed==true]) ifTrue:[
- path := self compressPath:path
- ]
+ (self isValidPath:pathName) ifFalse:[
+ p := pathName.
+ [(p size > 1)
+ and:[p endsWith:(self fileSeparator)]
+ ] whileTrue:[
+ p := p copyWithoutLast:1.
+ ].
+ ^ p
+ ].
+
+ (SlowFork==true or:[PipeFailed==true]) ifFalse:[
+ PipeStream openErrorSignal handle:[:ex |
+ PipeFailed := true.
+ 'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
+ ex return.
+ ] do:[
+ "have to fall back ..."
+ command := 'cd ' , pathName , '; pwd'.
+ p := PipeStream readingFrom:command.
+ ].
+
+ (p isNil or:[p atEnd]) ifTrue:[
+ ('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
+ ] ifFalse:[
+ path := p nextLine.
+ p close.
+ ]
+ ].
+ path isNil ifTrue:[
+ "/
+ "/ return the original - there is nothing else can we do
+ "/
+ path := pathName
+ ].
+ (SlowFork==true or:[ForkFailed==true]) ifTrue:[
+ path := self compressPath:path
+ ]
].
^ path.
@@ -4566,20 +4566,20 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for id\n", __stringVal(aPathName));
+ printf("stat on '%s' for id\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret >= 0) {
- ino = buf.st_ino;
- retVal = __MKUINT(ino);
- RETURN (retVal);
- }
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (nil);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret >= 0) {
+ ino = buf.st_ino;
+ retVal = __MKUINT(ino);
+ RETURN (retVal);
+ }
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (nil);
}
RETURN (nil);
%}.
@@ -4601,31 +4601,31 @@
#ifdef HAS_GETCWD
# if defined(UNIX_LIKE) ||defined(__VMS__) || defined(MSDOS_LIKE)
- if (strcmp(__stringVal(pathName), ".") == 0)
- {
- char nameBuffer[MAXPATHLEN + 1];
-
- if (@global(CurrentDirectory) == nil) {
- if (getcwd(nameBuffer, MAXPATHLEN)) {
- OBJ d;
-
- @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
- __GSTORE(d);
- }
- }
- RETURN (@global(CurrentDirectory));
- }
+ if (strcmp(__stringVal(pathName), ".") == 0)
+ {
+ char nameBuffer[MAXPATHLEN + 1];
+
+ if (@global(CurrentDirectory) == nil) {
+ if (getcwd(nameBuffer, MAXPATHLEN)) {
+ OBJ d;
+
+ @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
+ __GSTORE(d);
+ }
+ }
+ RETURN (@global(CurrentDirectory));
+ }
# endif /* UNIX_LIKE */
#endif /* HAS_GETCWD */
#ifdef HAS_REALPATH
- {
- char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
-
- if (realpath(__stringVal(pathName), nameBuffer)) {
- RETURN ( __MKSTRING(nameBuffer) );
- }
- }
+ {
+ char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
+
+ if (realpath(__stringVal(pathName), nameBuffer)) {
+ RETURN ( __MKSTRING(nameBuffer) );
+ }
+ }
#endif /* ! HAS_REALPATH */
}
%}.
@@ -4679,7 +4679,7 @@
For nonexistent files, nil is returned."
"could be implemented as:
- (self infoOf:aPathName) modified
+ (self infoOf:aPathName) modified
"
|osSeconds i|
@@ -4690,18 +4690,18 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
+ printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- osSeconds = __MKUINT(buf.st_mtime);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ osSeconds = __MKUINT(buf.st_mtime);
}
%}.
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
@@ -4724,7 +4724,7 @@
"
this could have been implemented as:
- (self infoOf:aPathName) type
+ (self infoOf:aPathName) type
but for huge directory searches the code below is faster
"
@@ -4734,45 +4734,45 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for type\n", __stringVal(aPathName));
+ printf("stat on '%s' for type\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- switch (buf.st_mode & S_IFMT) {
- case S_IFDIR:
- RETURN ( @symbol(directory) );
- case S_IFREG:
- RETURN ( @symbol(regular) );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ switch (buf.st_mode & S_IFMT) {
+ case S_IFDIR:
+ RETURN ( @symbol(directory) );
+ case S_IFREG:
+ RETURN ( @symbol(regular) );
# ifdef S_IFCHR
- case S_IFCHR:
- RETURN ( @symbol(characterSpecial) );
+ case S_IFCHR:
+ RETURN ( @symbol(characterSpecial) );
# endif
# ifdef S_IFBLK
- case S_IFBLK:
- RETURN ( @symbol(blockSpecial) );
+ case S_IFBLK:
+ RETURN ( @symbol(blockSpecial) );
# endif
# ifdef S_IFLNK
- case S_IFLNK:
- RETURN ( @symbol(symbolicLink) );
+ case S_IFLNK:
+ RETURN ( @symbol(symbolicLink) );
# endif
# ifdef S_IFSOCK
- case S_IFSOCK:
- RETURN ( @symbol(socket) );
+ case S_IFSOCK:
+ RETURN ( @symbol(socket) );
# endif
# ifdef S_IFIFO
- case S_IFIFO:
- RETURN ( @symbol(fifo) );
+ case S_IFIFO:
+ RETURN ( @symbol(fifo) );
# endif
- default:
- RETURN ( @symbol(unknown) );
- }
+ default:
+ RETURN ( @symbol(unknown) );
+ }
}
%}.
i := self infoOf:aPathName.
@@ -5541,12 +5541,7 @@
you may have to fetch the processes exitstatus with
UnixOperatingSystem>>getStatusOfProcess:aProcessId."
- self isMSWINDOWSlike ifTrue:[
- self primTerminateProcess:processId
- ].
- self isUNIXlike ifTrue:[
- self sendSignal:(self sigTERM) to:processId.
- ]
+ self sendSignal:(self sigTERM) to:processId.
"Modified: / 28.12.1995 / 15:05:37 / stefan"
"Modified: / 27.1.1998 / 20:05:47 / cg"
@@ -5560,9 +5555,7 @@
you may have to fetch the processes exitstatus with
UnixOperatingSystem>>getStatusOfProcess:aProcessId."
- self isUNIXlike ifTrue:[
- self sendSignal:(self sigTERM) to:(processGroupId negated).
- ]
+ self sendSignal:(self sigTERM) to:(processGroupId negated).
"Modified: / 28.12.1995 / 15:05:37 / stefan"
"Created: / 23.4.1996 / 16:40:34 / stefan"
@@ -5593,17 +5586,17 @@
line = _getpty(&_fdM, O_RDWR|O_NDELAY, 0600, 0);
if ((line != 0) && (_fdM >= 0)) {
- _fdS = open(line, O_RDWR);
- if (_fdS < 0) {
- (void)close(_fdM);
- _fdS = _fdM = -1;
- }
+ _fdS = open(line, O_RDWR);
+ if (_fdS < 0) {
+ (void)close(_fdM);
+ _fdS = _fdM = -1;
+ }
} else {
- _fdM -1;
+ _fdM -1;
}
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __MKSMALLINT(_fdM);
- fdS = __MKSMALLINT(_fdS);
+ fdM = __MKSMALLINT(_fdM);
+ fdS = __MKSMALLINT(_fdS);
}
#endif /* IRIX5 */
@@ -5654,46 +5647,46 @@
struct group *gr;
if ((gr = getgrnam("tty")) != NULL)
- ttygid = gr->gr_gid;
+ ttygid = gr->gr_gid;
else
- ttygid = -1;
+ ttygid = -1;
for (cp1 = PTY_1_CHARS; *cp1; cp1++) {
- line[sizeof(line)-1-2] = * cp1;
-
- for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
- line[5] = 'p';
- line[sizeof(line)-1-1] = *cp2;
-
- if ((_fdM = open(line, O_RDWR, 0)) == -1) {
- if (errno == ENOENT) {
- _fdM = _fdS = -1;
- goto getOutOfHere; /* out of ptys */
- }
- } else {
- line[5] = 't';
- (void) chown( line, getuid(), ttygid );
- (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
-
- if( (_fdS = open(line, O_RDWR, 0)) != -1 ) {
- goto getOutOfHere;
- }
- (void) close( _fdM );
- }
- }
+ line[sizeof(line)-1-2] = * cp1;
+
+ for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
+ line[5] = 'p';
+ line[sizeof(line)-1-1] = *cp2;
+
+ if ((_fdM = open(line, O_RDWR, 0)) == -1) {
+ if (errno == ENOENT) {
+ _fdM = _fdS = -1;
+ goto getOutOfHere; /* out of ptys */
+ }
+ } else {
+ line[5] = 't';
+ (void) chown( line, getuid(), ttygid );
+ (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
+
+ if( (_fdS = open(line, O_RDWR, 0)) != -1 ) {
+ goto getOutOfHere;
+ }
+ (void) close( _fdM );
+ }
+ }
}
getOutOfHere: ;
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __MKSMALLINT(_fdM);
- fdS = __MKSMALLINT(_fdS);
+ fdM = __MKSMALLINT(_fdM);
+ fdS = __MKSMALLINT(_fdS);
}
#endif /* PTY_TEMPL */
%}.
fdM notNil ifTrue:[
- ^ Array with:fdM with:fdS.
+ ^ Array with:fdM with:fdS.
].
^ nil
@@ -5711,15 +5704,15 @@
int fds[2];
if (pipe(fds) < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
}
fd1 = __MKSMALLINT(fds[0]);
fd2 = __MKSMALLINT(fds[1]);
%}.
fd1 notNil ifTrue:[
- ^ Array with:fd1 with:fd2.
+ ^ Array with:fd1 with:fd2.
].
^ nil
! !
@@ -5760,12 +5753,12 @@
getDomainName
"return the domain this host is in.
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx hostName|
DomainName notNil ifTrue:[
- ^ DomainName
+ ^ DomainName
].
%{ /* STACK: 2048 */
@@ -5773,14 +5766,14 @@
char buffer[128];
if (getdomainname(buffer, sizeof(buffer)) == 0) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#else
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- name = __MKSTRING(ubuff.domainname);
+ name = __MKSTRING(ubuff.domainname);
}
# else
# if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
@@ -5788,33 +5781,33 @@
int ret;
if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
# endif
# endif
#endif
%}.
name isNil ifTrue:[
- name := self getEnvironment:'DOMAIN'.
- name isNil ifTrue:[
- UnixOperatingSystem isUNIXlike ifTrue:[
- name := self getCommandOutputFrom:'domainname'
- ]
- ]
+ name := self getEnvironment:'DOMAIN'.
+ name isNil ifTrue:[
+ UnixOperatingSystem isUNIXlike ifTrue:[
+ name := self getCommandOutputFrom:'domainname'
+ ]
+ ]
].
name isNil ifTrue:[
- "/ sometimes, we can extract the domainName from the hostName ...
- hostName := self getHostName.
- hostName notNil ifTrue:[
- idx := hostName indexOf:$..
- idx ~~ 0 ifTrue:[
- name := hostName copyFrom:idx+1.
- ]
- ].
- name isNil ifTrue:[
- 'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
- name := 'unknown'.
- ]
+ "/ sometimes, we can extract the domainName from the hostName ...
+ hostName := self getHostName.
+ hostName notNil ifTrue:[
+ idx := hostName indexOf:$..
+ idx ~~ 0 ifTrue:[
+ name := hostName copyFrom:idx+1.
+ ]
+ ].
+ name isNil ifTrue:[
+ 'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
+ name := 'unknown'.
+ ]
].
DomainName := name.
^ name
@@ -5835,10 +5828,10 @@
extern char *getenv();
if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
- env = getenv(__stringVal(aStringOrSymbol));
- if (env) {
- RETURN ( __MKSTRING(env) );
- }
+ env = getenv(__stringVal(aStringOrSymbol));
+ if (env) {
+ RETURN ( __MKSTRING(env) );
+ }
}
%}
.
@@ -5858,12 +5851,12 @@
"return the hostname we are running on - if there is
a HOST environment variable, we are much faster here ...
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx|
HostName notNil ifTrue:[
- ^ HostName
+ ^ HostName
].
%{ /* STACK: 2048 */
@@ -5871,14 +5864,14 @@
char buffer[256];
if (gethostname(buffer, sizeof(buffer)) == 0) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#else
# if defined(HAS_UNAME)
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- name = __MKSTRING(ubuff.nodename);
+ name = __MKSTRING(ubuff.nodename);
}
# else
# if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
@@ -5886,31 +5879,31 @@
int ret;
if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
# endif
# endif
#endif
%}.
name isNil ifTrue:[
- name := self getEnvironment:'HOST'.
- name isNil ifTrue:[
- UnixOperatingSystem isUNIXlike ifTrue:[
- name := self getCommandOutputFrom:'hostname'
- ]
- ]
+ name := self getEnvironment:'HOST'.
+ name isNil ifTrue:[
+ UnixOperatingSystem isUNIXlike ifTrue:[
+ name := self getCommandOutputFrom:'hostname'
+ ]
+ ]
].
name isNil ifTrue:[
- 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
- name := 'unknown'.
+ 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
+ name := 'unknown'.
] ifFalse:[
- "/ on some systems, the hostname already contains the domain.
- "/ decompose it here.
- idx := name indexOf:$..
- idx ~~ 0 ifTrue:[
- DomainName := name copyFrom:(idx+1).
- name := name copyTo:(idx-1).
- ]
+ "/ on some systems, the hostname already contains the domain.
+ "/ decompose it here.
+ idx := name indexOf:$..
+ idx ~~ 0 ifTrue:[
+ DomainName := name copyFrom:(idx+1).
+ name := name copyTo:(idx-1).
+ ]
].
HostName := name.
^ name
@@ -6191,7 +6184,7 @@
"if supported by the OS, return the systemID;
a unique per machine identification.
WARNING:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
%{ /* NO_CONTEXT */
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
@@ -6200,9 +6193,9 @@
OBJ arr;
if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
- arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
- bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
- RETURN (arr);
+ arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
+ bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
+ RETURN (arr);
}
#endif
#if defined(HAS_GETHOSTID)
@@ -6216,15 +6209,15 @@
#endif
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
{
- char buffer[128];
-
- buffer[0] = 0;
- if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
- buffer[127] = 0;
- if (strlen(buffer) > 0) {
- RETURN(__MKSTRING(buffer));
- }
- }
+ char buffer[128];
+
+ buffer[0] = 0;
+ if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
+ buffer[127] = 0;
+ if (strlen(buffer) > 0) {
+ RETURN(__MKSTRING(buffer));
+ }
+ }
}
#endif
%}.
@@ -6248,16 +6241,16 @@
This method is mainly provided to augment error reports with some system
information.
(in case of system/version specific OS errors, conditional workarounds and patches
- may be based upon this info).
+ may be based upon this info).
Your application should NOT depend upon this in any way.
The returned info may (or may not) contain:
- #system -> some operating system identification (irix, Linux, nt, win32s ...)
- #version -> OS version (some os version identification)
- #release -> OS release (3.5, 1.2.1 ...)
- #node -> some host identification (hostname)
- #domain -> domain name (hosts domain)
- #machine -> type of machine (i586, mips ...)
+ #system -> some operating system identification (irix, Linux, nt, win32s ...)
+ #version -> OS version (some os version identification)
+ #release -> OS release (3.5, 1.2.1 ...)
+ #node -> some host identification (hostname)
+ #domain -> domain name (hosts domain)
+ #machine -> type of machine (i586, mips ...)
"
|sys node rel ver mach dom mtyp brel info arch|
@@ -6268,33 +6261,33 @@
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- sys = __MKSTRING(ubuff.sysname);
- node = __MKSTRING(ubuff.nodename);
- rel = __MKSTRING(ubuff.release);
- ver = __MKSTRING(ubuff.version);
- mach = __MKSTRING(ubuff.machine);
+ sys = __MKSTRING(ubuff.sysname);
+ node = __MKSTRING(ubuff.nodename);
+ rel = __MKSTRING(ubuff.release);
+ ver = __MKSTRING(ubuff.version);
+ mach = __MKSTRING(ubuff.machine);
# ifdef HAS_UTS_DOMAINNAME
- dom = __MKSTRING(ubuff.domainname);
+ dom = __MKSTRING(ubuff.domainname);
# else
# if defined(HAS_GETDOMAINNAME)
- {
- char buffer[128];
-
- if (getdomainname(buffer, sizeof(buffer)) == 0) {
- dom = __MKSTRING(buffer);
- }
- }
+ {
+ char buffer[128];
+
+ if (getdomainname(buffer, sizeof(buffer)) == 0) {
+ dom = __MKSTRING(buffer);
+ }
+ }
# endif
# endif
}
# if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
{
- char buffer[128];
-
- if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
- arch = __MKSTRING(buffer);
- }
+ char buffer[128];
+
+ if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
+ arch = __MKSTRING(buffer);
+ }
}
# endif
@@ -6303,19 +6296,19 @@
#endif /* no uname */
%}.
sys isNil ifTrue:[
- sys := self getSystemType.
+ sys := self getSystemType.
].
node isNil ifTrue:[
- node := self getHostName.
+ node := self getHostName.
].
dom isNil ifTrue:[
- dom := self getDomainName.
+ dom := self getDomainName.
].
mach isNil ifTrue:[
- mach := self getCPUType.
+ mach := self getCPUType.
].
arch isNil ifTrue:[
- arch := 'unknown'.
+ arch := 'unknown'.
].
info := IdentityDictionary new.
@@ -6360,7 +6353,7 @@
%}.
sys isNil ifTrue:[
- ^ self getOSType
+ ^ self getOSType
].
^ sys
@@ -6392,11 +6385,11 @@
maxFileNameLength
"return the max number of characters in a filename.
CAVEAT:
- Actually, the following is somewhat wrong - some systems
- support different sizes, depending on the volume.
- We return a somewhat conservative number here.
- Another entry, to query for volume specific max
- will be added in the future."
+ Actually, the following is somewhat wrong - some systems
+ support different sizes, depending on the volume.
+ We return a somewhat conservative number here.
+ Another entry, to query for volume specific max
+ will be added in the future."
%{ /* NOCONTEXT */
@@ -7135,9 +7128,9 @@
then := UnixOperatingSystem millisecondTimeAdd:now and:millis.
[UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[
- delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
- self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
- now := UnixOperatingSystem getMillisecondTime.
+ delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
+ self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
+ now := UnixOperatingSystem getMillisecondTime.
]
"
@@ -7272,10 +7265,10 @@
struct group *g;
if (__isSmallInteger(aNumber)) {
- g = getgrgid(__intVal(aNumber));
- if (g) {
- RETURN ( __MKSTRING(g->gr_name) );
- }
+ g = getgrgid(__intVal(aNumber));
+ if (g) {
+ RETURN ( __MKSTRING(g->gr_name) );
+ }
}
%}.
^ '???'
@@ -7315,35 +7308,35 @@
char *name = (char *)0;
if (firstCall) {
- name = getlogin();
- if (! name || (name[0] == 0)) {
- name = getenv("LOGNAME");
- }
- if (name && (strlen(name) < sizeof(cachedName))) {
- strcpy(cachedName, name);
- firstCall = 0;
- }
+ name = getlogin();
+ if (! name || (name[0] == 0)) {
+ name = getenv("LOGNAME");
+ }
+ if (name && (strlen(name) < sizeof(cachedName))) {
+ strcpy(cachedName, name);
+ firstCall = 0;
+ }
} else {
- name = cachedName;
+ name = cachedName;
}
/*
* try a few common environment variables ...
*/
if (! name || (name[0] == 0) ) {
- name = getenv("LOGIN");
- if (! name || (name[0] == 0) ) {
- name = getenv("LOGNAME");
- if (! name || (name[0] == 0) ) {
- name = getenv("USER");
- }
- }
+ name = getenv("LOGIN");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("LOGNAME");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("USER");
+ }
+ }
}
/*
* nope - I really font know who you are.
*/
if (! name || (name[0] == 0) ) {
- name = "you";
+ name = "you";
}
RETURN ( __MKSTRING(name) );
@@ -7383,15 +7376,15 @@
struct passwd *p;
if (__isSmallInteger(aNumber)) {
- p = getpwuid(__intVal(aNumber));
- if (p) {
- RETURN ( __MKSTRING(p->pw_name) );
- }
+ p = getpwuid(__intVal(aNumber));
+ if (p) {
+ RETURN ( __MKSTRING(p->pw_name) );
+ }
}
#endif /* unix-like */
%}.
aNumber == self getUserID ifTrue:[
- ^ self getLoginName
+ ^ self getLoginName
].
^ '? (' , aNumber printString , ')'
@@ -7426,42 +7419,42 @@
int ret;
if (__isString(aNameOrID)) {
- buf = getpwnam(__stringVal(aNameOrID));
+ buf = getpwnam(__stringVal(aNameOrID));
} else if (__isSmallInteger(aNameOrID)) {
- buf = getpwuid(__intVal(aNameOrID));
+ buf = getpwuid(__intVal(aNameOrID));
} else {
- buf = (struct passwd *)0;
+ buf = (struct passwd *)0;
}
if (buf) {
- name = __MKSTRING(buf->pw_name);
+ name = __MKSTRING(buf->pw_name);
# ifndef NO_PWD_PASSWD
- passw = __MKSTRING(buf->pw_passwd);
+ passw = __MKSTRING(buf->pw_passwd);
# endif
# ifdef SYSV4
- age = __MKSTRING(buf->pw_age);
- comment = __MKSTRING(buf->pw_comment);
+ age = __MKSTRING(buf->pw_age);
+ comment = __MKSTRING(buf->pw_comment);
# endif
- dir = __MKSTRING(buf->pw_dir);
+ dir = __MKSTRING(buf->pw_dir);
# ifndef NO_PWD_GECOS
- gecos = __MKSTRING(buf->pw_gecos);
+ gecos = __MKSTRING(buf->pw_gecos);
# endif
- shell = __MKSTRING(buf->pw_shell);
-
- uid = __MKSMALLINT(buf->pw_uid);
- gid = __MKSMALLINT(buf->pw_gid);
+ shell = __MKSTRING(buf->pw_shell);
+
+ uid = __MKSMALLINT(buf->pw_uid);
+ gid = __MKSMALLINT(buf->pw_gid);
}
# endif /* has PWD */
%}.
info := IdentityDictionary new.
name isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- name := self getLoginName
- ].
+ aNameOrID == self getUserID ifTrue:[
+ name := self getLoginName
+ ].
].
name notNil ifTrue:[
- info at:#name put:name.
+ info at:#name put:name.
] ifFalse:[
- info at:#name put:'unknown'
+ info at:#name put:'unknown'
].
passw notNil ifTrue:[info at:#passwd put:passw].
age notNil ifTrue:[info at:#age put:age].
@@ -7469,9 +7462,9 @@
gecos notNil ifTrue:[info at:#gecos put:gecos].
shell notNil ifTrue:[info at:#shell put:shell].
dir isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- dir := self getHomeDirectory
- ]
+ aNameOrID == self getUserID ifTrue:[
+ dir := self getHomeDirectory
+ ]
].
dir notNil ifTrue:[info at:#dir put:dir].
uid notNil ifTrue:[info at:#uid put:uid].
@@ -7536,11 +7529,11 @@
# define __BLOCKING_WAIT__ 1
if (blocking != true) {
- /*
- * We do not support nonBlocking waits, so signal an error
- * Sorry about the goto, but with all these ifdefs ...
- */
- goto done;
+ /*
+ * We do not support nonBlocking waits, so signal an error
+ * Sorry about the goto, but with all these ifdefs ...
+ */
+ goto done;
}
# endif /*!HAS_WAIT3*/
# endif /*!HAS_WAITPID*/
@@ -7571,7 +7564,7 @@
# endif
do {
- p = __WAIT;
+ p = __WAIT;
} while (p == -1 && errno == EINTR);
# if __BLOCKING_WAIT__
@@ -7582,28 +7575,28 @@
# undef __WAIT
if (p == 0)
- RETURN(nil)
+ RETURN(nil)
if (p == -1) {
- if (errno == ECHILD)
- RETURN(nil);
+ if (errno == ECHILD)
+ RETURN(nil);
} else {
- pid = __MKSMALLINT(p);
- if (WIFEXITED(s)) {
- status = @symbol(exit);
- code = __MKSMALLINT(WEXITSTATUS(s));
- core = WCOREDUMP(s) ? true : false;
- } else if (WIFSIGNALED(s)) {
- status = @symbol(signal);
- code = __MKSMALLINT(WTERMSIG(s));
- } else if (WIFSTOPPED(s)) {
- status = @symbol(stop);
- code = __MKSMALLINT(WSTOPSIG(s));
- }
+ pid = __MKSMALLINT(p);
+ if (WIFEXITED(s)) {
+ status = @symbol(exit);
+ code = __MKSMALLINT(WEXITSTATUS(s));
+ core = WCOREDUMP(s) ? true : false;
+ } else if (WIFSIGNALED(s)) {
+ status = @symbol(signal);
+ code = __MKSMALLINT(WTERMSIG(s));
+ } else if (WIFSTOPPED(s)) {
+ status = @symbol(stop);
+ code = __MKSMALLINT(WSTOPSIG(s));
+ }
# if defined(WIFCONTINUED)
- else if (WIFCONTINUED(s)) {
- status = @symbol(continue);
- }
+ else if (WIFCONTINUED(s)) {
+ status = @symbol(continue);
+ }
# endif
}
done: ;
@@ -7611,7 +7604,7 @@
%}.
(status isNil or:[pid isNil]) ifTrue:[
- ^ self primitiveFailed
+ ^ self primitiveFailed
].
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
@@ -7636,13 +7629,13 @@
*/
# if defined(FIONREAD) && !defined(WIN32)
{
- int n;
-
- if (__isSmallInteger(fd)) {
- if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
- RETURN (__MKINT(n));
- }
- }
+ int n;
+
+ if (__isSmallInteger(fd)) {
+ if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
+ RETURN (__MKINT(n));
+ }
+ }
}
# endif /* FIONREAD */
#endif
@@ -7730,170 +7723,170 @@
int numFds = 0;
if (__isSmallInteger(millis)) {
- FD_ZERO(&rset);
- FD_ZERO(&wset);
- FD_ZERO(&eset);
-
- maxF = -1;
- if (__isNonNilObject(readFdArray)) {
- if (! __isArray(readFdArray)) {
- goto fail;
- }
- count = __arraySize(readFdArray);
-
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(readFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &rset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- if (__isNonNilObject(writeFdArray)) {
- if (! __isArray(writeFdArray)) {
- goto fail;
- }
- count = __arraySize(writeFdArray);
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(writeFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &wset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- if (__isNonNilObject(exceptFdArray)) {
- if (! __isArray(exceptFdArray)) {
- goto fail;
- }
- count = __arraySize(exceptFdArray);
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &eset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- t = __intVal(millis);
- if (t) {
- wt.tv_sec = t / 1000;
- wt.tv_usec = (t % 1000) * 1000;
- } else {
- wt.tv_sec = wt.tv_usec = 0;
- }
-
- /*
- * make certain, that interrupt gets us out of the select
- * However, we must then care for moved objects.
- */
- __BEGIN_INTERRUPTABLE__
- errno = 0;
-
- if (t == 0) {
- /*
- * if there is no timeout time, we can stay here interruptable.
- */
- do {
+ FD_ZERO(&rset);
+ FD_ZERO(&wset);
+ FD_ZERO(&eset);
+
+ maxF = -1;
+ if (__isNonNilObject(readFdArray)) {
+ if (! __isArray(readFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(readFdArray);
+
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(readFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &rset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ if (__isNonNilObject(writeFdArray)) {
+ if (! __isArray(writeFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(writeFdArray);
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(writeFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &wset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ if (__isNonNilObject(exceptFdArray)) {
+ if (! __isArray(exceptFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(exceptFdArray);
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &eset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ t = __intVal(millis);
+ if (t) {
+ wt.tv_sec = t / 1000;
+ wt.tv_usec = (t % 1000) * 1000;
+ } else {
+ wt.tv_sec = wt.tv_usec = 0;
+ }
+
+ /*
+ * make certain, that interrupt gets us out of the select
+ * However, we must then care for moved objects.
+ */
+ __BEGIN_INTERRUPTABLE__
+ errno = 0;
+
+ if (t == 0) {
+ /*
+ * if there is no timeout time, we can stay here interruptable.
+ */
+ do {
# ifdef WIN32
- intf we;
-
- if (numFds == 0) {
- HANDLE dummyHandle = (HANDLE)0;
+ intf we;
+
+ if (numFds == 0) {
+ HANDLE dummyHandle = (HANDLE)0;
# if 0 /* does not work under WIN95 - sigh */
- if (! GetQueueStatus(QS_ALLINPUT)) {
- MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
- }
+ if (! GetQueueStatus(QS_ALLINPUT)) {
+ MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
+ }
# else
- if (we = __getWaitInputEvent()) {
- we(t);
- }
+ if (we = __getWaitInputEvent()) {
+ we(t);
+ }
# endif
- ret = 0;
- } else {
- ret = select(0, &rset, &wset, &eset, &wt);
- }
+ ret = 0;
+ } else {
+ ret = select(0, &rset, &wset, &eset, &wt);
+ }
# else /* a real OS */
- ret = select(maxF+1, &rset, &wset, &eset, &wt);
+ ret = select(maxF+1, &rset, &wset, &eset, &wt);
# endif /* to WIN or not to WIN */
- } while ((ret < 0) && (errno == EINTR));
- } else {
- do {
+ } while ((ret < 0) && (errno == EINTR));
+ } else {
+ do {
# ifdef WIN32
- intf we;
-
- if (numFds == 0) {
- HANDLE dummyHandle = (HANDLE)0;
+ intf we;
+
+ if (numFds == 0) {
+ HANDLE dummyHandle = (HANDLE)0;
# if 0 /* does not work under WIN95 - sigh */
- if (! GetQueueStatus(QS_ALLINPUT)) {
- MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
- }
+ if (! GetQueueStatus(QS_ALLINPUT)) {
+ MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
+ }
# else
- if (we = __getWaitInputEvent()) {
- we(t);
- }
+ if (we = __getWaitInputEvent()) {
+ we(t);
+ }
# endif
- ret = 0;
- } else {
- ret = select(0, &rset, &wset, &eset, &wt);
- }
+ ret = 0;
+ } else {
+ ret = select(0, &rset, &wset, &eset, &wt);
+ }
# else /* a real OS */
- ret = select(maxF+1, &rset, &wset, &eset, &wt);
+ ret = select(maxF+1, &rset, &wset, &eset, &wt);
# endif * to WIN or not to WIN */
- /*
- * for now: dont loop; if we did, we had to adjust the vt-timeval;
- * could otherwise stay in this loop forever ...
- * Premature return (before the time expired) must be handled by the caller.
- * A good solution is to update the wt-timeval and redo the select.
- */
- } while (0 /* (ret < 0) && (errno == EINTR) */ );
- }
- __END_INTERRUPTABLE__
-
- if (ret > 0) {
- for (i=0; i <= maxF; i++) {
- if (FD_ISSET(i, &rset)
- || FD_ISSET(i, &wset)
- || FD_ISSET(i, &eset)) {
- RETURN ( __MKSMALLINT(i) );
- }
- }
- } else {
- if (ret < 0) {
- if (errno == EINTR) {
- errno = 0;
- @global(LastErrorNumber) = nil;
- } else {
- if (@global(InfoPrinting) == true) {
- fprintf(stderr, "OS [info]: select errno = %d\n", errno);
- }
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- }
- } else {
- @global(LastErrorNumber) = nil;
- }
- }
-
- /*
- * return nil (means time expired or interrupted)
- */
- RETURN ( nil );
+ /*
+ * for now: dont loop; if we did, we had to adjust the vt-timeval;
+ * could otherwise stay in this loop forever ...
+ * Premature return (before the time expired) must be handled by the caller.
+ * A good solution is to update the wt-timeval and redo the select.
+ */
+ } while (0 /* (ret < 0) && (errno == EINTR) */ );
+ }
+ __END_INTERRUPTABLE__
+
+ if (ret > 0) {
+ for (i=0; i <= maxF; i++) {
+ if (FD_ISSET(i, &rset)
+ || FD_ISSET(i, &wset)
+ || FD_ISSET(i, &eset)) {
+ RETURN ( __MKSMALLINT(i) );
+ }
+ }
+ } else {
+ if (ret < 0) {
+ if (errno == EINTR) {
+ errno = 0;
+ @global(LastErrorNumber) = nil;
+ } else {
+ if (@global(InfoPrinting) == true) {
+ fprintf(stderr, "OS [info]: select errno = %d\n", errno);
+ }
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ }
+ } else {
+ @global(LastErrorNumber) = nil;
+ }
+ }
+
+ /*
+ * return nil (means time expired or interrupted)
+ */
+ RETURN ( nil );
}
fail: ;
@@ -8235,6 +8228,6 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Attic/UnixOS.st,v 1.9 1998-06-09 17:30:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Attic/UnixOS.st,v 1.10 1998-06-10 09:53:06 cg Exp $'
! !
UnixOperatingSystem initialize!
--- a/UnixOperatingSystem.st Tue Jun 09 19:30:14 1998 +0200
+++ b/UnixOperatingSystem.st Wed Jun 10 11:53:06 1998 +0200
@@ -1339,7 +1339,7 @@
HostName := nil.
DomainName := nil.
LastErrorNumber := nil.
- PipeFailed := false.
+ PipeFailed := false.
SlowFork := false.
]
@@ -1945,229 +1945,229 @@
*/
#ifdef EPERM
if (sym == @symbol(EPERM)) {
- RETURN ( __MKSMALLINT(EPERM) );
+ RETURN ( __MKSMALLINT(EPERM) );
}
#endif
#ifdef ENOENT
if (sym == @symbol(ENOENT)) {
- RETURN ( __MKSMALLINT(ENOENT) );
+ RETURN ( __MKSMALLINT(ENOENT) );
}
#endif
#ifdef ESRCH
if (sym == @symbol(ESRCH)) {
- RETURN ( __MKSMALLINT(ESRCH) );
+ RETURN ( __MKSMALLINT(ESRCH) );
}
#endif
#ifdef EINTR
if (sym == @symbol(EINTR)) {
- RETURN ( __MKSMALLINT(EINTR) );
+ RETURN ( __MKSMALLINT(EINTR) );
}
#endif
#ifdef EIO
if (sym == @symbol(EIO)) {
- RETURN ( __MKSMALLINT(EIO) );
+ RETURN ( __MKSMALLINT(EIO) );
}
#endif
#ifdef ENXIO
if (sym == @symbol(ENXIO)) {
- RETURN ( __MKSMALLINT(ENXIO) );
+ RETURN ( __MKSMALLINT(ENXIO) );
}
#endif
#ifdef E2BIG
if (sym == @symbol(E2BIG)) {
- RETURN ( __MKSMALLINT(E2BIG) );
+ RETURN ( __MKSMALLINT(E2BIG) );
}
#endif
#ifdef ENOEXEC
if (sym == @symbol(ENOEXEC)) {
- RETURN ( __MKSMALLINT(ENOEXEC) );
+ RETURN ( __MKSMALLINT(ENOEXEC) );
}
#endif
#ifdef EBADF
if (sym == @symbol(EBADF)) {
- RETURN ( __MKSMALLINT(EBADF) );
+ RETURN ( __MKSMALLINT(EBADF) );
}
#endif
#ifdef ECHILD
if (sym == @symbol(ECHILD)) {
- RETURN ( __MKSMALLINT(ECHILD) );
+ RETURN ( __MKSMALLINT(ECHILD) );
}
#endif
#if defined(EAGAIN)
if (sym == @symbol(EAGAIN)) {
- RETURN ( __MKSMALLINT(EAGAIN) );
+ RETURN ( __MKSMALLINT(EAGAIN) );
}
#endif
#ifdef ENOMEM
if (sym == @symbol(ENOMEM)) {
- RETURN ( __MKSMALLINT(ENOMEM) );
+ RETURN ( __MKSMALLINT(ENOMEM) );
}
#endif
#ifdef EACCES
if (sym == @symbol(EACCES)) {
- RETURN ( __MKSMALLINT(EACCES) );
+ RETURN ( __MKSMALLINT(EACCES) );
}
#endif
#ifdef EFAULT
if (sym == @symbol(EFAULT)) {
- RETURN ( __MKSMALLINT(EFAULT) );
+ RETURN ( __MKSMALLINT(EFAULT) );
}
#endif
#ifdef EBUSY
if (sym == @symbol(EBUSY)) {
- RETURN ( __MKSMALLINT(EBUSY) );
+ RETURN ( __MKSMALLINT(EBUSY) );
}
#endif
#ifdef EXDEV
if (sym == @symbol(EXDEV)) {
- RETURN ( __MKSMALLINT(EXDEV) );
+ RETURN ( __MKSMALLINT(EXDEV) );
}
#endif
#ifdef ENODEV
if (sym == @symbol(ENODEV)) {
- RETURN ( __MKSMALLINT(ENODEV) );
+ RETURN ( __MKSMALLINT(ENODEV) );
}
#endif
#ifdef ENOTDIR
if (sym == @symbol(ENOTDIR)) {
- RETURN ( __MKSMALLINT(ENOTDIR) );
+ RETURN ( __MKSMALLINT(ENOTDIR) );
}
#endif
#ifdef EISDIR
if (sym == @symbol(EISDIR)) {
- RETURN ( __MKSMALLINT(EISDIR) );
+ RETURN ( __MKSMALLINT(EISDIR) );
}
#endif
#ifdef EINVAL
if (sym == @symbol(EINVAL)) {
- RETURN ( __MKSMALLINT(EINVAL) );
+ RETURN ( __MKSMALLINT(EINVAL) );
}
#endif
#ifdef ENFILE
if (sym == @symbol(ENFILE)) {
- RETURN ( __MKSMALLINT(ENFILE) );
+ RETURN ( __MKSMALLINT(ENFILE) );
}
#endif
#ifdef EMFILE
if (sym == @symbol(EMFILE)) {
- RETURN ( __MKSMALLINT(EMFILE) );
+ RETURN ( __MKSMALLINT(EMFILE) );
}
#endif
#ifdef ENOTTY
if (sym == @symbol(ENOTTY)) {
- RETURN ( __MKSMALLINT(ENOTTY) );
+ RETURN ( __MKSMALLINT(ENOTTY) );
}
#endif
#ifdef EFBIG
if (sym == @symbol(EFBIG)) {
- RETURN ( __MKSMALLINT(EFBIG) );
+ RETURN ( __MKSMALLINT(EFBIG) );
}
#endif
#ifdef ENOSPC
if (sym == @symbol(ENOSPC)) {
- RETURN ( __MKSMALLINT(ENOSPC) );
+ RETURN ( __MKSMALLINT(ENOSPC) );
}
#endif
#ifdef ESPIPE
if (sym == @symbol(ESPIPE)) {
- RETURN ( __MKSMALLINT(ESPIPE) );
+ RETURN ( __MKSMALLINT(ESPIPE) );
}
#endif
#ifdef EROFS
if (sym == @symbol(EROFS)) {
- RETURN ( __MKSMALLINT(EROFS) );
+ RETURN ( __MKSMALLINT(EROFS) );
}
#endif
#ifdef EMLINK
if (sym == @symbol(EMLINK)) {
- RETURN ( __MKSMALLINT(EMLINK) );
+ RETURN ( __MKSMALLINT(EMLINK) );
}
#endif
#ifdef EPIPE
if (sym == @symbol(EPIPE)) {
- RETURN ( __MKSMALLINT(EPIPE) );
+ RETURN ( __MKSMALLINT(EPIPE) );
}
#endif
#ifdef EDOM
if (sym == @symbol(EDOM)) {
- RETURN ( __MKSMALLINT(EDOM) );
+ RETURN ( __MKSMALLINT(EDOM) );
}
#endif
#ifdef ERANGE
if (sym == @symbol(ERANGE)) {
- RETURN ( __MKSMALLINT(ERANGE) );
+ RETURN ( __MKSMALLINT(ERANGE) );
}
#endif
#ifdef EDEADLK
if (sym == @symbol(EDEADLK)) {
- RETURN ( __MKSMALLINT(EDEADLK) );
+ RETURN ( __MKSMALLINT(EDEADLK) );
}
#endif
#ifdef ENAMETOOLONG
if (sym == @symbol(ENAMETOOLONG)) {
- RETURN ( __MKSMALLINT(ENAMETOOLONG) );
+ RETURN ( __MKSMALLINT(ENAMETOOLONG) );
}
#endif
#ifdef ENOLCK
if (sym == @symbol(ENOLCK)) {
- RETURN ( __MKSMALLINT(ENOLCK) );
+ RETURN ( __MKSMALLINT(ENOLCK) );
}
#endif
#ifdef ENOSYS
if (sym == @symbol(ENOSYS)) {
- RETURN ( __MKSMALLINT(ENOSYS) );
+ RETURN ( __MKSMALLINT(ENOSYS) );
}
#endif
#ifdef ENOTEMPTY
if (sym == @symbol(ENOTEMPTY)) {
- RETURN ( __MKSMALLINT(ENOTEMPTY) );
+ RETURN ( __MKSMALLINT(ENOTEMPTY) );
}
#endif
#ifdef EEXIST
if (sym == @symbol(EEXIST)) {
- RETURN ( __MKSMALLINT(EEXIST) );
+ RETURN ( __MKSMALLINT(EEXIST) );
}
#endif
#ifdef EILSEQ
if (sym == @symbol(EILSEQ)) {
- RETURN ( __MKSMALLINT(EILSEQ) );
+ RETURN ( __MKSMALLINT(EILSEQ) );
}
#endif
@@ -2176,13 +2176,13 @@
*/
#ifdef ENOTBLK
if (sym == @symbol(ENOTBLK)) {
- RETURN ( __MKSMALLINT(ENOTBLK) );
+ RETURN ( __MKSMALLINT(ENOTBLK) );
}
#endif
#ifdef ETXTBSY
if (sym == @symbol(ETXTBSY)) {
- RETURN ( __MKSMALLINT(ETXTBSY) );
+ RETURN ( __MKSMALLINT(ETXTBSY) );
}
#endif
@@ -2191,19 +2191,19 @@
*/
#ifdef EWOULDBLOCK
if (sym == @symbol(EWOULDBLOCK)) {
- RETURN ( __MKSMALLINT(EWOULDBLOCK) );
+ RETURN ( __MKSMALLINT(EWOULDBLOCK) );
}
#endif
#ifdef ENOMSG
if (sym == @symbol(ENOMSG)) {
- RETURN ( __MKSMALLINT(ENOMSG) );
+ RETURN ( __MKSMALLINT(ENOMSG) );
}
#endif
#ifdef ELOOP
if (sym == @symbol(ELOOP)) {
- RETURN ( __MKSMALLINT(ELOOP) );
+ RETURN ( __MKSMALLINT(ELOOP) );
}
#endif
@@ -2212,31 +2212,31 @@
*/
#ifdef ETIME
if (sym == @symbol(ETIME)) {
- RETURN ( __MKSMALLINT(ETIME) );
+ RETURN ( __MKSMALLINT(ETIME) );
}
#endif
#ifdef ENOSR
if (sym == @symbol(ENOSR)) {
- RETURN ( __MKSMALLINT(ENOSR) );
+ RETURN ( __MKSMALLINT(ENOSR) );
}
#endif
#ifdef ENOSTR
if (sym == @symbol(ENOSTR)) {
- RETURN ( __MKSMALLINT(ENOSTR) );
+ RETURN ( __MKSMALLINT(ENOSTR) );
}
#endif
#ifdef ECOMM
if (sym == @symbol(ECOMM)) {
- RETURN ( __MKSMALLINT(ECOMM) );
+ RETURN ( __MKSMALLINT(ECOMM) );
}
#endif
#ifdef EPROTO
if (sym == @symbol(EPROTO)) {
- RETURN ( __MKSMALLINT(EPROTO) );
+ RETURN ( __MKSMALLINT(EPROTO) );
}
#endif
@@ -2245,13 +2245,13 @@
*/
#ifdef ESTALE
if (sym == @symbol(ESTALE)) {
- RETURN ( __MKSMALLINT(ESTALE) );
+ RETURN ( __MKSMALLINT(ESTALE) );
}
#endif
#ifdef EREMOTE
if (sym == @symbol(EREMOTE)) {
- RETURN ( __MKSMALLINT(EREMOTE) );
+ RETURN ( __MKSMALLINT(EREMOTE) );
}
#endif
@@ -2260,157 +2260,157 @@
*/
#ifdef EINPROGRESS
if (sym == @symbol(EINPROGRESS)) {
- RETURN ( __MKSMALLINT(EINPROGRESS) );
+ RETURN ( __MKSMALLINT(EINPROGRESS) );
}
#endif
#ifdef EALREADY
if (sym == @symbol(EALREADY)) {
- RETURN ( __MKSMALLINT(EALREADY) );
+ RETURN ( __MKSMALLINT(EALREADY) );
}
#endif
#ifdef ENOTSOCK
if (sym == @symbol(ENOTSOCK)) {
- RETURN ( __MKSMALLINT(ENOTSOCK) );
+ RETURN ( __MKSMALLINT(ENOTSOCK) );
}
#endif
#ifdef EDESTADDRREQ
if (sym == @symbol(EDESTADDRREQ)) {
- RETURN ( __MKSMALLINT(EDESTADDRREQ) );
+ RETURN ( __MKSMALLINT(EDESTADDRREQ) );
}
#endif
#ifdef EMSGSIZE
if (sym == @symbol(EMSGSIZE)) {
- RETURN ( __MKSMALLINT(EMSGSIZE) );
+ RETURN ( __MKSMALLINT(EMSGSIZE) );
}
#endif
#ifdef EPROTOTYPE
if (sym == @symbol(EPROTOTYPE)) {
- RETURN ( __MKSMALLINT(EPROTOTYPE) );
+ RETURN ( __MKSMALLINT(EPROTOTYPE) );
}
#endif
#ifdef ENOPROTOOPT
if (sym == @symbol(ENOPROTOOPT)) {
- RETURN ( __MKSMALLINT(ENOPROTOOPT) );
+ RETURN ( __MKSMALLINT(ENOPROTOOPT) );
}
#endif
#ifdef EPROTONOSUPPORT
if (sym == @symbol(EPROTONOSUPPORT)) {
- RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
+ RETURN ( __MKSMALLINT(EPROTONOSUPPORT) );
}
#endif
#ifdef ESOCKTNOSUPPORT
if (sym == @symbol(ESOCKTNOSUPPORT)) {
- RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
+ RETURN ( __MKSMALLINT(ESOCKTNOSUPPORT) );
}
#endif
#ifdef EOPNOTSUPP
if (sym == @symbol(EOPNOTSUPP)) {
- RETURN ( __MKSMALLINT(EOPNOTSUPP) );
+ RETURN ( __MKSMALLINT(EOPNOTSUPP) );
}
#endif
#ifdef EPFNOSUPPORT
if (sym == @symbol(EPFNOSUPPORT)) {
- RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
+ RETURN ( __MKSMALLINT(EPFNOSUPPORT) );
}
#endif
#ifdef EAFNOSUPPORT
if (sym == @symbol(EAFNOSUPPORT)) {
- RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
+ RETURN ( __MKSMALLINT(EAFNOSUPPORT) );
}
#endif
#ifdef EADDRINUSE
if (sym == @symbol(EADDRINUSE)) {
- RETURN ( __MKSMALLINT(EADDRINUSE) );
+ RETURN ( __MKSMALLINT(EADDRINUSE) );
}
#endif
#ifdef EADDRNOTAVAIL
if (sym == @symbol(EADDRNOTAVAIL)) {
- RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
+ RETURN ( __MKSMALLINT(EADDRNOTAVAIL) );
}
#endif
#ifdef ETIMEDOUT
if (sym == @symbol(ETIMEDOUT)) {
- RETURN ( __MKSMALLINT(ETIMEDOUT) );
+ RETURN ( __MKSMALLINT(ETIMEDOUT) );
}
#endif
#ifdef ECONNREFUSED
if (sym == @symbol(ECONNREFUSED)) {
- RETURN ( __MKSMALLINT(ECONNREFUSED) );
+ RETURN ( __MKSMALLINT(ECONNREFUSED) );
}
#endif
#ifdef ENETDOWN
if (sym == @symbol(ENETDOWN)) {
- RETURN ( __MKSMALLINT(ENETDOWN) );
+ RETURN ( __MKSMALLINT(ENETDOWN) );
}
#endif
#ifdef ENETUNREACH
if (sym == @symbol(ENETUNREACH)) {
- RETURN ( __MKSMALLINT(ENETUNREACH) );
+ RETURN ( __MKSMALLINT(ENETUNREACH) );
}
#endif
#ifdef ENETRESET
if (sym == @symbol(ENETRESET)) {
- RETURN ( __MKSMALLINT(ENETRESET) );
+ RETURN ( __MKSMALLINT(ENETRESET) );
}
#endif
#ifdef ECONNABORTED
if (sym == @symbol(ECONNABORTED)) {
- RETURN ( __MKSMALLINT(ECONNABORTED) );
+ RETURN ( __MKSMALLINT(ECONNABORTED) );
}
#endif
#ifdef ECONNRESET
if (sym == @symbol(ECONNRESET)) {
- RETURN ( __MKSMALLINT(ECONNRESET) );
+ RETURN ( __MKSMALLINT(ECONNRESET) );
}
#endif
#ifdef EISCONN
if (sym == @symbol(EISCONN)) {
- RETURN ( __MKSMALLINT(EISCONN) );
+ RETURN ( __MKSMALLINT(EISCONN) );
}
#endif
#ifdef ENOTCONN
if (sym == @symbol(ENOTCONN)) {
- RETURN ( __MKSMALLINT(ENOTCONN) );
+ RETURN ( __MKSMALLINT(ENOTCONN) );
}
#endif
#ifdef ESHUTDOWN
if (sym == @symbol(ESHUTDOWN)) {
- RETURN ( __MKSMALLINT(ESHUTDOWN) );
+ RETURN ( __MKSMALLINT(ESHUTDOWN) );
}
#endif
#ifdef EHOSTDOWN
if (sym == @symbol(EHOSTDOWN)) {
- RETURN ( __MKSMALLINT(EHOSTDOWN) );
+ RETURN ( __MKSMALLINT(EHOSTDOWN) );
}
#endif
#ifdef EHOSTUNREACH
if (sym == @symbol(EHOSTUNREACH)) {
- RETURN ( __MKSMALLINT(EHOSTUNREACH) );
+ RETURN ( __MKSMALLINT(EHOSTUNREACH) );
}
#endif
%}.
@@ -2435,499 +2435,499 @@
OBJ eno = errNr;
if (__isSmallInteger(eno)) {
- switch (__intVal(eno)) {
- /*
- * POSIX errnos - these should be defined
- */
+ switch (__intVal(eno)) {
+ /*
+ * POSIX errnos - these should be defined
+ */
#ifdef EPERM
- case EPERM:
- msg = "Operation not permitted";
- sym = @symbol(EPERM);
- break;
+ case EPERM:
+ msg = "Operation not permitted";
+ sym = @symbol(EPERM);
+ break;
#endif
#ifdef ENOENT
- case ENOENT:
- msg = "No such file or directory";
- sym = @symbol(ENOENT);
- break;
+ case ENOENT:
+ msg = "No such file or directory";
+ sym = @symbol(ENOENT);
+ break;
#endif
#ifdef ESRCH
- case ESRCH:
- msg = "No such process";
- sym = @symbol(ESRCH);
- break;
+ case ESRCH:
+ msg = "No such process";
+ sym = @symbol(ESRCH);
+ break;
#endif
#ifdef EINTR
- case EINTR:
- msg = "Interrupted system call";
- sym = @symbol(EINTR);
- break;
+ case EINTR:
+ msg = "Interrupted system call";
+ sym = @symbol(EINTR);
+ break;
#endif
#ifdef EIO
- case EIO:
- msg = "I/O error";
- sym = @symbol(EIO);
- break;
+ case EIO:
+ msg = "I/O error";
+ sym = @symbol(EIO);
+ break;
#endif
#ifdef ENXIO
- case ENXIO:
- msg = "No such device or address";
- sym = @symbol(ENXIO);
- break;
+ case ENXIO:
+ msg = "No such device or address";
+ sym = @symbol(ENXIO);
+ break;
#endif
#ifdef E2BIG
- case E2BIG:
- msg = "Arg list too long";
- sym = @symbol(E2BIG);
- break;
+ case E2BIG:
+ msg = "Arg list too long";
+ sym = @symbol(E2BIG);
+ break;
#endif
#ifdef ENOEXEC
- case ENOEXEC:
- msg = "Exec format error";
- sym = @symbol(ENOEXEC);
- break;
+ case ENOEXEC:
+ msg = "Exec format error";
+ sym = @symbol(ENOEXEC);
+ break;
#endif
#ifdef EBADF
- case EBADF:
- msg = "Bad file number";
- sym = @symbol(EBADF);
- break;
+ case EBADF:
+ msg = "Bad file number";
+ sym = @symbol(EBADF);
+ break;
#endif
#ifdef ECHILD
- case ECHILD:
- msg = "No child processes";
- sym = @symbol(ECHILD);
- break;
+ case ECHILD:
+ msg = "No child processes";
+ sym = @symbol(ECHILD);
+ break;
#endif
#if !defined(EWOULDBLOCK) && defined(EAGAIN) && (EWOULDBLOCK != EAGAIN)
- case EAGAIN:
- msg = "Try again";
- sym = @symbol(EAGAIN);
- break;
+ case EAGAIN:
+ msg = "Try again";
+ sym = @symbol(EAGAIN);
+ break;
#endif
#ifdef ENOMEM
- case ENOMEM:
- msg = "Out of memory";
- sym = @symbol(ENOMEM);
- break;
+ case ENOMEM:
+ msg = "Out of memory";
+ sym = @symbol(ENOMEM);
+ break;
#endif
#ifdef EACCES
- case EACCES:
- msg = "Permission denied";
- sym = @symbol(EACCES);
- break;
+ case EACCES:
+ msg = "Permission denied";
+ sym = @symbol(EACCES);
+ break;
#endif
#ifdef EFAULT
- case EFAULT:
- msg = "Bad address";
- sym = @symbol(EFAULT);
- break;
+ case EFAULT:
+ msg = "Bad address";
+ sym = @symbol(EFAULT);
+ break;
#endif
#ifdef EBUSY
- case EBUSY:
- msg = "Device or resource busy";
- sym = @symbol(EBUSY);
- break;
+ case EBUSY:
+ msg = "Device or resource busy";
+ sym = @symbol(EBUSY);
+ break;
#endif
#ifdef EEXIST
- case EEXIST:
- msg = "File exists";
- sym = @symbol(EEXIST);
- break;
+ case EEXIST:
+ msg = "File exists";
+ sym = @symbol(EEXIST);
+ break;
#endif
#ifdef EXDEV
- case EXDEV:
- msg = "Cross-device link";
- sym = @symbol(EXDEV);
- break;
+ case EXDEV:
+ msg = "Cross-device link";
+ sym = @symbol(EXDEV);
+ break;
#endif
#ifdef ENODEV
- case ENODEV:
- msg = "No such device";
- sym = @symbol(ENODEV);
- break;
+ case ENODEV:
+ msg = "No such device";
+ sym = @symbol(ENODEV);
+ break;
#endif
#ifdef ENOTDIR
- case ENOTDIR:
- msg = "Not a directory";
- sym = @symbol(ENOTDIR);
- break;
+ case ENOTDIR:
+ msg = "Not a directory";
+ sym = @symbol(ENOTDIR);
+ break;
#endif
#ifdef EISDIR
- case EISDIR:
- msg = "Is a directory";
- sym = @symbol(EISDIR);
- break;
+ case EISDIR:
+ msg = "Is a directory";
+ sym = @symbol(EISDIR);
+ break;
#endif
#ifdef EINVAL
- case EINVAL:
- msg = "Invalid argument";
- sym = @symbol(EINVAL);
- break;
+ case EINVAL:
+ msg = "Invalid argument";
+ sym = @symbol(EINVAL);
+ break;
#endif
#ifdef ENFILE
- case ENFILE:
- msg = "File table overflow";
- sym = @symbol(ENFILE);
- break;
+ case ENFILE:
+ msg = "File table overflow";
+ sym = @symbol(ENFILE);
+ break;
#endif
#ifdef EMFILE
- case EMFILE:
- msg = "Too many open files";
- sym = @symbol(EMFILE);
- break;
+ case EMFILE:
+ msg = "Too many open files";
+ sym = @symbol(EMFILE);
+ break;
#endif
#ifdef ENOTTY
- case ENOTTY:
- msg = "Not a typewriter";
- sym = @symbol(ENOTTY);
- break;
+ case ENOTTY:
+ msg = "Not a typewriter";
+ sym = @symbol(ENOTTY);
+ break;
#endif
#ifdef EFBIG
- case EFBIG:
- msg = "File too large";
- sym = @symbol(EFBIG);
- break;
+ case EFBIG:
+ msg = "File too large";
+ sym = @symbol(EFBIG);
+ break;
#endif
#ifdef ENOSPC
- case ENOSPC:
- msg = "No space left on device";
- sym = @symbol(ENOSPC);
- break;
+ case ENOSPC:
+ msg = "No space left on device";
+ sym = @symbol(ENOSPC);
+ break;
#endif
#ifdef ESPIPE
- case ESPIPE:
- msg = "Illegal seek";
- sym = @symbol(ESPIPE);
- break;
+ case ESPIPE:
+ msg = "Illegal seek";
+ sym = @symbol(ESPIPE);
+ break;
#endif
#ifdef EROFS
- case EROFS:
- msg = "Read-only file system";
- sym = @symbol(EROFS);
- break;
+ case EROFS:
+ msg = "Read-only file system";
+ sym = @symbol(EROFS);
+ break;
#endif
#ifdef EMLINK
- case EMLINK:
- msg = "Too many links";
- sym = @symbol(EMLINK);
- break;
+ case EMLINK:
+ msg = "Too many links";
+ sym = @symbol(EMLINK);
+ break;
#endif
#ifdef EPIPE
- case EPIPE:
- msg = "Broken pipe";
- sym = @symbol(EPIPE);
- break;
+ case EPIPE:
+ msg = "Broken pipe";
+ sym = @symbol(EPIPE);
+ break;
#endif
#ifdef EDOM
- case EDOM:
- msg = "Math argument out of domain";
- sym = @symbol(EDOM);
- break;
+ case EDOM:
+ msg = "Math argument out of domain";
+ sym = @symbol(EDOM);
+ break;
#endif
#ifdef ERANGE
- case ERANGE:
- msg = "Math result not representable";
- sym = @symbol(ERANGE);
- break;
+ case ERANGE:
+ msg = "Math result not representable";
+ sym = @symbol(ERANGE);
+ break;
#endif
#ifdef EDEADLK
# if EDEADLK != EWOULDBLOCK
- case EDEADLK:
- msg = "Resource deadlock would occur";
- sym = @symbol(EDEADLK);
- break;
+ case EDEADLK:
+ msg = "Resource deadlock would occur";
+ sym = @symbol(EDEADLK);
+ break;
# endif
#endif
#ifdef ENAMETOOLONG
- case ENAMETOOLONG:
- msg = "File name too long";
- sym = @symbol(ENAMETOOLONG);
- break;
+ case ENAMETOOLONG:
+ msg = "File name too long";
+ sym = @symbol(ENAMETOOLONG);
+ break;
#endif
#ifdef ENOLCK
- case ENOLCK:
- msg = "No record locks available";
- sym = @symbol(ENOLCK);
- break;
+ case ENOLCK:
+ msg = "No record locks available";
+ sym = @symbol(ENOLCK);
+ break;
#endif
#ifdef ENOSYS
- case ENOSYS:
- msg = "Function not implemented";
- sym = @symbol(ENOSYS);
- break;
+ case ENOSYS:
+ msg = "Function not implemented";
+ sym = @symbol(ENOSYS);
+ break;
#endif
#if defined(ENOTEMPTY) && (ENOTEMPTY != EEXIST)
- case ENOTEMPTY:
- msg = "Directory not empty";
- sym = @symbol(ENOTEMPTY);
- break;
+ case ENOTEMPTY:
+ msg = "Directory not empty";
+ sym = @symbol(ENOTEMPTY);
+ break;
#endif
#ifdef EILSEQ
- case EILSEQ:
- msg = "Illegal byte sequence";
- sym = @symbol(EILSEQ);
- break;
-#endif
- /*
- * XPG3 errnos - defined on most systems
- */
+ case EILSEQ:
+ msg = "Illegal byte sequence";
+ sym = @symbol(EILSEQ);
+ break;
+#endif
+ /*
+ * XPG3 errnos - defined on most systems
+ */
#ifdef ENOTBLK
- case ENOTBLK:
- msg = "Block device required";
- sym = @symbol(ENOTBLK);
- break;
+ case ENOTBLK:
+ msg = "Block device required";
+ sym = @symbol(ENOTBLK);
+ break;
#endif
#ifdef ETXTBSY
- case ETXTBSY:
- msg = "Text file busy";
- sym = @symbol(ETXTBSY);
- break;
-#endif
- /*
- * some others
- */
+ case ETXTBSY:
+ msg = "Text file busy";
+ sym = @symbol(ETXTBSY);
+ break;
+#endif
+ /*
+ * some others
+ */
#ifdef EWOULDBLOCK
- case EWOULDBLOCK:
- msg = "Operation would block";
- sym = @symbol(EWOULDBLOCK);
- break;
+ case EWOULDBLOCK:
+ msg = "Operation would block";
+ sym = @symbol(EWOULDBLOCK);
+ break;
#endif
#ifdef ENOMSG
- case ENOMSG:
- msg = "No message of desired type";
- sym = @symbol(ENOMSG);
- break;
+ case ENOMSG:
+ msg = "No message of desired type";
+ sym = @symbol(ENOMSG);
+ break;
#endif
#ifdef ELOOP
- case ELOOP:
- msg = "Too many levels of symbolic links";
- sym = @symbol(ELOOP);
- break;
-#endif
-
- /*
- * some stream errors
- */
+ case ELOOP:
+ msg = "Too many levels of symbolic links";
+ sym = @symbol(ELOOP);
+ break;
+#endif
+
+ /*
+ * some stream errors
+ */
#ifdef ETIME
- case ETIME:
- msg = "Timer expired";
- sym = @symbol(ETIME);
- break;
+ case ETIME:
+ msg = "Timer expired";
+ sym = @symbol(ETIME);
+ break;
#endif
#ifdef ENOSR
- case ENOSR:
- msg = "Out of streams resources";
- sym = @symbol(ENOSR);
- break;
+ case ENOSR:
+ msg = "Out of streams resources";
+ sym = @symbol(ENOSR);
+ break;
#endif
#ifdef ENOSTR
- case ENOSTR:
- msg = "Device not a stream";
- sym = @symbol(ENOSTR);
- break;
+ case ENOSTR:
+ msg = "Device not a stream";
+ sym = @symbol(ENOSTR);
+ break;
#endif
#ifdef ECOMM
- case ECOMM:
- msg = "Communication error on send";
- sym = @symbol(ECOMM);
- break;
+ case ECOMM:
+ msg = "Communication error on send";
+ sym = @symbol(ECOMM);
+ break;
#endif
#ifdef EPROTO
- case EPROTO:
- msg = "Protocol error";
- sym = @symbol(EPROTO);
- break;
-#endif
- /*
- * nfs errors
- */
+ case EPROTO:
+ msg = "Protocol error";
+ sym = @symbol(EPROTO);
+ break;
+#endif
+ /*
+ * nfs errors
+ */
#ifdef ESTALE
- case ESTALE:
- msg = "Stale NFS file handle";
- sym = @symbol(ESTALE);
- break;
+ case ESTALE:
+ msg = "Stale NFS file handle";
+ sym = @symbol(ESTALE);
+ break;
#endif
#ifdef EREMOTE
- case EREMOTE:
- msg = "Too many levels of remote in path";
- sym = @symbol(EREMOTE);
- break;
-#endif
- /*
- * some networking errors
- */
+ case EREMOTE:
+ msg = "Too many levels of remote in path";
+ sym = @symbol(EREMOTE);
+ break;
+#endif
+ /*
+ * some networking errors
+ */
#ifdef EINPROGRESS
- case EINPROGRESS:
- msg = "Operation now in progress";
- sym = @symbol(EINPROGRESS);
- break;
+ case EINPROGRESS:
+ msg = "Operation now in progress";
+ sym = @symbol(EINPROGRESS);
+ break;
#endif
#ifdef EALREADY
- case EALREADY:
- msg = "Operation already in progress";
- sym = @symbol(EALREADY);
- break;
+ case EALREADY:
+ msg = "Operation already in progress";
+ sym = @symbol(EALREADY);
+ break;
#endif
#ifdef ENOTSOCK
- case ENOTSOCK:
- msg = "Socket operation on non-socket";
- sym = @symbol(ENOTSOCK);
- break;
+ case ENOTSOCK:
+ msg = "Socket operation on non-socket";
+ sym = @symbol(ENOTSOCK);
+ break;
#endif
#ifdef EDESTADDRREQ
- case EDESTADDRREQ:
- msg = "Destination address required";
- sym = @symbol(EDESTADDRREQ);
- break;
+ case EDESTADDRREQ:
+ msg = "Destination address required";
+ sym = @symbol(EDESTADDRREQ);
+ break;
#endif
#ifdef EMSGSIZE
- case EMSGSIZE:
- msg = "Message too long";
- sym = @symbol(EMSGSIZE);
- break;
+ case EMSGSIZE:
+ msg = "Message too long";
+ sym = @symbol(EMSGSIZE);
+ break;
#endif
#ifdef EPROTOTYPE
- case EPROTOTYPE:
- msg = "Protocol wrong type for socket";
- sym = @symbol(EPROTOTYPE);
- break;
+ case EPROTOTYPE:
+ msg = "Protocol wrong type for socket";
+ sym = @symbol(EPROTOTYPE);
+ break;
#endif
#ifdef ENOPROTOOPT
- case ENOPROTOOPT:
- msg = "Protocol not available";
- sym = @symbol(ENOPROTOOPT);
- break;
+ case ENOPROTOOPT:
+ msg = "Protocol not available";
+ sym = @symbol(ENOPROTOOPT);
+ break;
#endif
#ifdef EPROTONOSUPPORT
- case EPROTONOSUPPORT:
- msg = "Protocol not supported";
- sym = @symbol(EPROTONOSUPPORT);
- break;
+ case EPROTONOSUPPORT:
+ msg = "Protocol not supported";
+ sym = @symbol(EPROTONOSUPPORT);
+ break;
#endif
#ifdef ESOCKTNOSUPPORT
- case ESOCKTNOSUPPORT:
- msg = "Socket type not supported";
- sym = @symbol(ESOCKTNOSUPPORT);
- break;
+ case ESOCKTNOSUPPORT:
+ msg = "Socket type not supported";
+ sym = @symbol(ESOCKTNOSUPPORT);
+ break;
#endif
#ifdef EOPNOTSUPP
- case EOPNOTSUPP:
- msg = "Operation not supported on socket";
- sym = @symbol(EOPNOTSUPP);
- break;
+ case EOPNOTSUPP:
+ msg = "Operation not supported on socket";
+ sym = @symbol(EOPNOTSUPP);
+ break;
#endif
#ifdef EPFNOSUPPORT
- case EPFNOSUPPORT:
- msg = "Protocol family not supported";
- sym = @symbol(EPFNOSUPPORT);
- break;
+ case EPFNOSUPPORT:
+ msg = "Protocol family not supported";
+ sym = @symbol(EPFNOSUPPORT);
+ break;
#endif
#ifdef EAFNOSUPPORT
- case EAFNOSUPPORT:
- msg = "Address family not supported by protocol family";
- sym = @symbol(EAFNOSUPPORT);
- break;
+ case EAFNOSUPPORT:
+ msg = "Address family not supported by protocol family";
+ sym = @symbol(EAFNOSUPPORT);
+ break;
#endif
#ifdef EADDRINUSE
- case EADDRINUSE:
- msg = "Address already in use";
- sym = @symbol(EADDRINUSE);
- break;
+ case EADDRINUSE:
+ msg = "Address already in use";
+ sym = @symbol(EADDRINUSE);
+ break;
#endif
#ifdef EADDRNOTAVAIL
- case EADDRNOTAVAIL:
- msg = "Can\'t assign requested address";
- sym = @symbol(EADDRNOTAVAIL);
- break;
+ case EADDRNOTAVAIL:
+ msg = "Can\'t assign requested address";
+ sym = @symbol(EADDRNOTAVAIL);
+ break;
#endif
#ifdef ETIMEDOUT
- case ETIMEDOUT:
- msg = "Connection timed out";
- sym = @symbol(ETIMEDOUT);
- break;
+ case ETIMEDOUT:
+ msg = "Connection timed out";
+ sym = @symbol(ETIMEDOUT);
+ break;
#endif
#ifdef ECONNREFUSED
- case ECONNREFUSED:
- msg = "Connection refused";
- sym = @symbol(ECONNREFUSED);
- break;
+ case ECONNREFUSED:
+ msg = "Connection refused";
+ sym = @symbol(ECONNREFUSED);
+ break;
#endif
#ifdef ENETDOWN
- case ENETDOWN:
- msg = "Network is down";
- sym = @symbol(ENETDOWN);
- break;
+ case ENETDOWN:
+ msg = "Network is down";
+ sym = @symbol(ENETDOWN);
+ break;
#endif
#ifdef ENETUNREACH
- case ENETUNREACH:
- msg = "Network is unreachable";
- sym = @symbol(ENETUNREACH);
- break;
+ case ENETUNREACH:
+ msg = "Network is unreachable";
+ sym = @symbol(ENETUNREACH);
+ break;
#endif
#ifdef ENETRESET
- case ENETRESET:
- msg = "Network dropped conn due to reset";
- sym = @symbol(ENETRESET);
- break;
+ case ENETRESET:
+ msg = "Network dropped conn due to reset";
+ sym = @symbol(ENETRESET);
+ break;
#endif
#ifdef ECONNABORTED
- case ECONNABORTED:
- msg = "Software caused connection abort";
- sym = @symbol(ECONNABORTED);
- break;
+ case ECONNABORTED:
+ msg = "Software caused connection abort";
+ sym = @symbol(ECONNABORTED);
+ break;
#endif
#ifdef ECONNRESET
- case ECONNRESET:
- msg = "Connection reset by peer";
- sym = @symbol(ECONNRESET);
- break;
+ case ECONNRESET:
+ msg = "Connection reset by peer";
+ sym = @symbol(ECONNRESET);
+ break;
#endif
#ifdef EISCONN
- case EISCONN:
- msg = "Socket is already connected";
- sym = @symbol(EISCONN);
- break;
+ case EISCONN:
+ msg = "Socket is already connected";
+ sym = @symbol(EISCONN);
+ break;
#endif
#ifdef ENOTCONN
- case ENOTCONN:
- msg = "Socket is not connected";
- sym = @symbol(ENOTCONN);
- break;
+ case ENOTCONN:
+ msg = "Socket is not connected";
+ sym = @symbol(ENOTCONN);
+ break;
#endif
#ifdef ESHUTDOWN
- case ESHUTDOWN:
- msg = "Can't send after socket shutdown";
- sym = @symbol(ESHUTDOWN);
- break;
+ case ESHUTDOWN:
+ msg = "Can't send after socket shutdown";
+ sym = @symbol(ESHUTDOWN);
+ break;
#endif
#ifdef EHOSTDOWN
- case EHOSTDOWN:
- msg = "Host is down";
- sym = @symbol(EHOSTDOWN);
- break;
+ case EHOSTDOWN:
+ msg = "Host is down";
+ sym = @symbol(EHOSTDOWN);
+ break;
#endif
#ifdef EHOSTUNREACH
- case EHOSTUNREACH:
- msg = "No route to host";
- sym = @symbol(EHOSTUNREACH);
- break;
-#endif
-
- default:
- {
- __BEGIN_PROTECT_REGISTERS__
- sprintf(buffer, "ErrorNr: %d", __intVal(eno));
- __END_PROTECT_REGISTERS__
- }
- msg = buffer;
- sym = @symbol(ERROR_OTHER);
- break;
- }
- text = __MKSTRING(msg);
+ case EHOSTUNREACH:
+ msg = "No route to host";
+ sym = @symbol(EHOSTUNREACH);
+ break;
+#endif
+
+ default:
+ {
+ __BEGIN_PROTECT_REGISTERS__
+ sprintf(buffer, "ErrorNr: %d", __intVal(eno));
+ __END_PROTECT_REGISTERS__
+ }
+ msg = buffer;
+ sym = @symbol(ERROR_OTHER);
+ break;
+ }
+ text = __MKSTRING(msg);
} else {
- text = nil;
- sym = nil;
+ text = nil;
+ sym = nil;
}
%}.
^ Array with:sym with:text
@@ -2958,38 +2958,38 @@
exec:aCommandPath withArguments:argArray fileDescriptors:fdArray closeDescriptors:closeFdArray fork:doFork newPgrp:newPgrp
"Internal lowLevel entry for combined fork & exec;
If fork is false (chain a command):
- execute the OS command specified by the argument, aCommandPath, with
- arguments in argArray (no arguments, if nil).
- If successful, this method does not return and smalltalk is gone.
- If not successful, it does return.
- Normal use is with forkForCommand.
+ execute the OS command specified by the argument, aCommandPath, with
+ arguments in argArray (no arguments, if nil).
+ If successful, this method does not return and smalltalk is gone.
+ If not successful, it does return.
+ Normal use is with forkForCommand.
If fork is true (subprocess command execution):
- fork a child to do the above.
- The process id of the child process is returned; nil if the fork failed.
+ fork a child to do the above.
+ The process id of the child process is returned; nil if the fork failed.
fdArray contains the filedescriptors, to be used for the child (if fork is true).
- fdArray[1] = 15 -> use fd 15 as stdin.
- If an element of the array is set to nil, the corresponding filedescriptor
- will be closed for the child.
- fdArray[0] == StdIn for child
- fdArray[1] == StdOut for child
- fdArray[2] == StdErr for child
- on VMS, these must be channels as returned by createMailBox.
+ fdArray[1] = 15 -> use fd 15 as stdin.
+ If an element of the array is set to nil, the corresponding filedescriptor
+ will be closed for the child.
+ fdArray[0] == StdIn for child
+ fdArray[1] == StdOut for child
+ fdArray[2] == StdErr for child
+ on VMS, these must be channels as returned by createMailBox.
closeFdArray contains descriptors that will be closed in the subprocess.
- closeDescriptors are ignored in the WIN32 & VMS versions.
+ closeDescriptors are ignored in the WIN32 & VMS versions.
NOTE that in WIN32 the fds are HANDLES!!
If newPgrp is true, the subprocess will be established in a new process group.
- The processgroup will be equal to id.
- newPgrp is not used on WIN32 and VMS systems.
+ The processgroup will be equal to id.
+ newPgrp is not used on WIN32 and VMS systems.
Notice: this used to be two separate ST-methods; however, in order to use
- vfork on some machines, it had to be merged into one, to avoid write
- accesses to ST/X memory from the vforked-child.
- The code below only does read accesses."
+ vfork on some machines, it had to be merged into one, to avoid write
+ accesses to ST/X memory from the vforked-child.
+ The code below only does read accesses."
%{ /* STACK: 16000 */
@@ -3000,101 +3000,101 @@
/* extern char *malloc(); */
if (__isString(aCommandPath) &&
- ((argArray == nil) || __isArray(argArray)) &&
- ((fdArray == nil) || __isArray(fdArray)) &&
- ((closeFdArray == nil) || __isArray(closeFdArray))
+ ((argArray == nil) || __isArray(argArray)) &&
+ ((fdArray == nil) || __isArray(fdArray)) &&
+ ((closeFdArray == nil) || __isArray(closeFdArray))
) {
- nargs = argArray == nil ? 0 : __arraySize(argArray);
- argv = (char **) malloc(sizeof(char *) * (nargs + 1));
- if (argv) {
- for (i=0; i < nargs; i++) {
- arg = __ArrayInstPtr(argArray)->a_element[i];
- if (__isString(arg)) {
- argv[i] = (char *) __stringVal(arg);
- } else {
- argv[i] = "";
- }
- }
- argv[i] = NULL;
-
- if (doFork == true) {
- int nfd, nclose;
-
- nfd = fdArray == nil ? 0 : __arraySize(fdArray);
- nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
+ nargs = argArray == nil ? 0 : __arraySize(argArray);
+ argv = (char **) malloc(sizeof(char *) * (nargs + 1));
+ if (argv) {
+ for (i=0; i < nargs; i++) {
+ arg = __ArrayInstPtr(argArray)->a_element[i];
+ if (__isString(arg)) {
+ argv[i] = (char *) __stringVal(arg);
+ } else {
+ argv[i] = "";
+ }
+ }
+ argv[i] = NULL;
+
+ if (doFork == true) {
+ int nfd, nclose;
+
+ nfd = fdArray == nil ? 0 : __arraySize(fdArray);
+ nclose = closeFdArray == nil ? 0 : __arraySize(closeFdArray);
# ifdef HAS_VFORK
- id = vfork();
+ id = vfork();
# else
- id = fork();
+ id = fork();
# endif
- if (id == 0) {
- /*
- ** In child.
- ** first: dup filedescriptors
- */
- for (i = 0; i < nfd; i++) {
- OBJ fd;
- int rslt;
-
- fd = __ArrayInstPtr(fdArray)->a_element[i];
- if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
- do {
- rslt = dup2(__intVal(fd), i);
- } while ((rslt < 0) && (errno == EINTR));
- }
- }
- /*
- ** second: close unused filedescriptors
- */
- for (i = 0; i < nfd; i++) {
- if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
- close(i);
- }
- }
- /*
- ** third: close filedescriptors
- */
- for (i = 0; i < nclose; i++) {
- OBJ fd;
-
- fd = __ArrayInstPtr(closeFdArray)->a_element[i];
- if (__isSmallInteger(fd)) {
- close(__intVal(fd));
- }
- }
- if (newPgrp == true) {
+ if (id == 0) {
+ /*
+ ** In child.
+ ** first: dup filedescriptors
+ */
+ for (i = 0; i < nfd; i++) {
+ OBJ fd;
+ int rslt;
+
+ fd = __ArrayInstPtr(fdArray)->a_element[i];
+ if (__isSmallInteger(fd) && (__intVal(fd) != i)) {
+ do {
+ rslt = dup2(__intVal(fd), i);
+ } while ((rslt < 0) && (errno == EINTR));
+ }
+ }
+ /*
+ ** second: close unused filedescriptors
+ */
+ for (i = 0; i < nfd; i++) {
+ if (__ArrayInstPtr(fdArray)->a_element[i] == nil) {
+ close(i);
+ }
+ }
+ /*
+ ** third: close filedescriptors
+ */
+ for (i = 0; i < nclose; i++) {
+ OBJ fd;
+
+ fd = __ArrayInstPtr(closeFdArray)->a_element[i];
+ if (__isSmallInteger(fd)) {
+ close(__intVal(fd));
+ }
+ }
+ if (newPgrp == true) {
# if defined(_POSIX_JOB_CONTROL)
- (void) setpgid(0, 0);
+ (void) setpgid(0, 0);
# else
# if defined(BSD)
- (void) setpgrp(0);
+ (void) setpgrp(0);
# endif
# endif
- }
-
- execv(__stringVal(aCommandPath), argv);
- /* should not be reached */
- _exit(127); /* POSIX 2 compatible exit value */
- }
- /*
- ** In parent: succes or failure
- */
- free(argv);
- if (id == -1) {
- RETURN (nil);
- } else {
- RETURN (__MKSMALLINT(id));
- }
- } else {
- execv(__stringVal(aCommandPath), argv);
- /*
- * should not be reached
- * (well, it is, if you pass a wrong command-path)
- */
- free(argv);
- RETURN ( nil );
- }
- }
+ }
+
+ execv(__stringVal(aCommandPath), argv);
+ /* should not be reached */
+ _exit(127); /* POSIX 2 compatible exit value */
+ }
+ /*
+ ** In parent: succes or failure
+ */
+ free(argv);
+ if (id == -1) {
+ RETURN (nil);
+ } else {
+ RETURN (__MKSMALLINT(id));
+ }
+ } else {
+ execv(__stringVal(aCommandPath), argv);
+ /*
+ * should not be reached
+ * (well, it is, if you pass a wrong command-path)
+ */
+ free(argv);
+ RETURN ( nil );
+ }
+ }
}
#endif /* UNIX */
%}.
@@ -3111,9 +3111,9 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child'.
- UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
- 'not reached'.
+ 'I am the child'.
+ UnixOperatingSystem exec:'/bin/ls' withArguments:#('ls' '/tmp').
+ 'not reached'.
]
"
"
@@ -3121,11 +3121,11 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child'.
- UnixOperatingSystem
- exec:'/bin/sh'
- withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
- 'not reached'.
+ 'I am the child'.
+ UnixOperatingSystem
+ exec:'/bin/sh'
+ withArguments:#('sh' '-c' 'sleep 2;echo 1;sleep 2;echo 2').
+ 'not reached'.
].
id printNL.
(Delay forSeconds:3.5) wait.
@@ -3140,11 +3140,11 @@
Not needed with Unix"
^ self
- exec:aCommandPath
- withArguments:argArray
- fileDescriptors:fdArray
- closeDescriptors:closeFdArray
- fork:doFork newPgrp:newPgrp
+ exec:aCommandPath
+ withArguments:argArray
+ fileDescriptors:fdArray
+ closeDescriptors:closeFdArray
+ fork:doFork newPgrp:newPgrp
"Modified: / 5.6.1998 / 19:00:48 / cg"
!
@@ -3193,8 +3193,8 @@
id := UnixOperatingSystem fork.
id == 0 ifTrue:[
- 'I am the child process' printCR.
- UnixOperatingSystem exit
+ 'I am the child process' printCR.
+ UnixOperatingSystem exit
]
"
!
@@ -3207,38 +3207,38 @@
int status;
if (__isSmallInteger(aProcessId)) {
- pid_t pid = (pid_t)(__intVal(aProcessId));
- {
+ pid_t pid = (pid_t)(__intVal(aProcessId));
+ {
# ifdef NO_WAITPID
- pid_t child;
-
- do {
- __BEGIN_INTERRUPTABLE__
- child = __wait (&status);
- __END_INTERRUPTABLE__
- if (child < 0 && errno != EINTR) {
- fprintf(stderr, "OS: child-wait errno=%d\n", errno);
- status = -1;
- break;
- }
- } while (child != pid);
+ pid_t child;
+
+ do {
+ __BEGIN_INTERRUPTABLE__
+ child = __wait (&status);
+ __END_INTERRUPTABLE__
+ if (child < 0 && errno != EINTR) {
+ fprintf(stderr, "OS: child-wait errno=%d\n", errno);
+ status = -1;
+ break;
+ }
+ } while (child != pid);
# else
- pid_t child;
-
- /* claus: the original did not care for EINTR here ... */
- do {
- __BEGIN_INTERRUPTABLE__
- child = __waitpid (pid, &status, 0);
- __END_INTERRUPTABLE__
- } while ((child != pid) && (errno == EINTR));
- if (child != pid) {
- fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
- status = -1;
- }
+ pid_t child;
+
+ /* claus: the original did not care for EINTR here ... */
+ do {
+ __BEGIN_INTERRUPTABLE__
+ child = __waitpid (pid, &status, 0);
+ __END_INTERRUPTABLE__
+ } while ((child != pid) && (errno == EINTR));
+ if (child != pid) {
+ fprintf(stderr, "OS: child-waitpid errno=%d\n", errno);
+ status = -1;
+ }
# endif /* NO_WAITPID */
- }
- RETURN ( __MKSMALLINT(status));
+ }
+ RETURN ( __MKSMALLINT(status));
}
%}.
self primitiveFailed
@@ -3253,28 +3253,28 @@
|path f fExt|
aCommand asFilename isAbsolute ifTrue:[
- ^ aCommand
+ ^ aCommand
].
path := self getEnvironment:'PATH'.
path notNil ifTrue:[
- (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
- path isEmpty ifTrue:[
- f := aCommand asFilename
- ] ifFalse:[
- f := path asFilename construct:aCommand.
- ].
- self executableFileExtensions do:[:ext |
- ext notEmpty ifTrue:[
- fExt := (f pathName , ext) asFilename.
- ] ifFalse:[
- fExt := f.
- ].
- fExt isExecutable ifTrue:[
- ^ fExt pathName
- ].
- ].
- ].
+ (path asCollectionOfSubstringsSeparatedBy:(self pathSeparator)) do:[:path |
+ path isEmpty ifTrue:[
+ f := aCommand asFilename
+ ] ifFalse:[
+ f := path asFilename construct:aCommand.
+ ].
+ self executableFileExtensions do:[:ext |
+ ext notEmpty ifTrue:[
+ fExt := (f pathName , ext) asFilename.
+ ] ifFalse:[
+ fExt := f.
+ ].
+ fExt isExecutable ifTrue:[
+ ^ fExt pathName
+ ].
+ ].
+ ].
].
^ nil
@@ -3307,25 +3307,25 @@
|in out err shellAndArgs|
anExternalInStream notNil ifTrue:[
- in := anExternalInStream fileDescriptor.
+ in := anExternalInStream fileDescriptor.
] ifFalse:[
- in := '/dev/null' asFilename readStream fileDescriptor
+ in := '/dev/null' asFilename readStream fileDescriptor
].
anExternalOutStream notNil ifTrue:[
- out := anExternalOutStream fileDescriptor.
+ out := anExternalOutStream fileDescriptor.
].
anExternalErrStream notNil ifTrue:[
- err := anExternalErrStream fileDescriptor.
+ err := anExternalErrStream fileDescriptor.
].
shellAndArgs := self commandAndArgsForOSCommand:aCommandString.
^ self
- exec:(shellAndArgs at:1)
- withArguments:(shellAndArgs at:2)
- fileDescriptors:(Array with:in with:out with:err)
- closeDescriptors:nil
- fork:true
- newPgrp:false.
+ exec:(shellAndArgs at:1)
+ withArguments:(shellAndArgs at:2)
+ fileDescriptors:(Array with:in with:out with:err)
+ closeDescriptors:nil
+ fork:true
+ newPgrp:false.
"blocking at current prio (i.e. only higher prio threads execute):
@@ -3346,7 +3346,7 @@
The following will no longer work. monitorPid has disappeared
pid notNil ifTrue:[
- Processor monitorPid:pid action:[:OSstatus | sema signal ].
+ Processor monitorPid:pid action:[:OSstatus | sema signal ].
].
in close.
out close.
@@ -3368,8 +3368,8 @@
%{
if (__isSmallInteger(anInteger)) {
- close(__intVal(anInteger));
- RETURN(self);
+ close(__intVal(anInteger));
+ RETURN(self);
}
%}.
^ self primitiveFailed.
@@ -3387,14 +3387,14 @@
%{
if (__isString(aPathName)) {
- int ret;
-
- ret = mkdir(__stringVal(aPathName), 0755);
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (false);
- }
- RETURN (true);
+ int ret;
+
+ ret = mkdir(__stringVal(aPathName), 0755);
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (false);
+ }
+ RETURN (true);
}
%}.
@@ -3421,23 +3421,23 @@
int ret;
if (__isString(oldPath) && __isString(newPath)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
(oldPath isString not or:[newPath isString not]) ifTrue:[
- "/
- "/ bad argument(s) given
- "/
- ^ self primitiveFailed
+ "/
+ "/ bad argument(s) given
+ "/
+ ^ self primitiveFailed
].
"/
@@ -3483,16 +3483,16 @@
int ret;
if (__isString(fullPathName)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = rmdir((char *) __stringVal(fullPathName));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = rmdir((char *) __stringVal(fullPathName));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
"/
@@ -3516,16 +3516,16 @@
int ret;
if (__isString(fullPathName)) {
- __BEGIN_INTERRUPTABLE__
- do {
- ret = unlink((char *) __stringVal(fullPathName));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = unlink((char *) __stringVal(fullPathName));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -3544,27 +3544,27 @@
if (__isString(oldPath) && __isString(newPath)) {
#if defined(HAS_RENAME)
- __BEGIN_INTERRUPTABLE__
- do {
- ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = rename((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
#else
- ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
- if (ret >= 0) {
- ret = unlink((char *) __stringVal(oldPath));
- if (ret < 0) {
- eno = errno;
- unlink((char *) __stringVal(newPath));
- errno = eno;
- }
- }
-#endif
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN (true);
+ ret = link((char *) __stringVal(oldPath), (char *) __stringVal(newPath));
+ if (ret >= 0) {
+ ret = unlink((char *) __stringVal(oldPath));
+ if (ret < 0) {
+ eno = errno;
+ unlink((char *) __stringVal(newPath));
+ errno = eno;
+ }
+ }
+#endif
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN (true);
}
%}.
^ self primitiveFailed
@@ -4079,9 +4079,9 @@
"/ root, home and current directories.
"/
^ Array
- with:'/'
- with:(self getHomeDirectory)
- with:(Filename currentDirectory pathName)
+ with:'/'
+ with:(self getHomeDirectory)
+ with:(Filename currentDirectory pathName)
"Modified: / 5.6.1998 / 18:35:35 / cg"
!
@@ -4090,16 +4090,16 @@
"return some object filled with info for the file 'aPathName';
the info (for which corresponding access methods are understood by
the returned object) is:
- type - a symbol giving the files type
- mode - numeric access mode
- uid - owners user id
- gid - owners group id
- size - files size
- id - files number (i.e. inode number)
- accessed - last access time (as Timestamp)
- modified - last modification time (as Timestamp)
- statusChanged - last status change time (as Timestamp)
- alternativeName - (windows only: the MSDOS name of the file)
+ type - a symbol giving the files type
+ mode - numeric access mode
+ uid - owners user id
+ gid - owners group id
+ size - files size
+ id - files number (i.e. inode number)
+ accessed - last access time (as Timestamp)
+ modified - last modification time (as Timestamp)
+ statusChanged - last status change time (as Timestamp)
+ alternativeName - (windows only: the MSDOS name of the file)
Some of the fields may be returned as nil on systems which do not provide
all of the information.
@@ -4127,112 +4127,112 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for info\n", __stringVal(aPathName));
+ printf("stat on '%s' for info\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
-
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- switch (buf.st_mode & S_IFMT) {
- case S_IFDIR:
- type = @symbol(directory);
- break;
-
- case S_IFREG:
- type = @symbol(regular);
- break;
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ switch (buf.st_mode & S_IFMT) {
+ case S_IFDIR:
+ type = @symbol(directory);
+ break;
+
+ case S_IFREG:
+ type = @symbol(regular);
+ break;
# ifdef S_IFCHR
- case S_IFCHR:
- type = @symbol(characterSpecial);
- break;
+ case S_IFCHR:
+ type = @symbol(characterSpecial);
+ break;
# endif
# ifdef S_IFBLK
- case S_IFBLK:
- type = @symbol(blockSpecial);
- break;
+ case S_IFBLK:
+ type = @symbol(blockSpecial);
+ break;
# endif
# ifdef S_IFMPC
- case S_IFMPC:
- type = @symbol(multiplexedCharacterSpecial);
- break;
+ case S_IFMPC:
+ type = @symbol(multiplexedCharacterSpecial);
+ break;
# endif
# ifdef S_IFMPB
- case S_IFMPB:
- type = @symbol(multiplexedBlockSpecial);
- break;
+ case S_IFMPB:
+ type = @symbol(multiplexedBlockSpecial);
+ break;
# endif
# ifdef S_IFLNK
- case S_IFLNK:
- type = @symbol(symbolicLink);
- break;
+ case S_IFLNK:
+ type = @symbol(symbolicLink);
+ break;
# endif
# ifdef S_IFSOCK
- case S_IFSOCK:
- type = @symbol(socket);
- break;
+ case S_IFSOCK:
+ type = @symbol(socket);
+ break;
# endif
# ifdef S_IFIFO
- case S_IFIFO:
- type = @symbol(fifo);
- break;
+ case S_IFIFO:
+ type = @symbol(fifo);
+ break;
# endif
- default:
- type = @symbol(unknown);
- break;
- }
-
- ino = buf.st_ino;
- id = __MKUINT(ino);
-
- mode = __MKSMALLINT(buf.st_mode & 0777);
- uid = __MKSMALLINT(buf.st_uid);
- gid = __MKSMALLINT(buf.st_gid);
- size = __MKUINT(buf.st_size);
- aOStime = __MKUINT(buf.st_atime);
- mOStime = __MKUINT(buf.st_mtime);
- cOStime = __MKUINT(buf.st_ctime);
+ default:
+ type = @symbol(unknown);
+ break;
+ }
+
+ ino = buf.st_ino;
+ id = __MKUINT(ino);
+
+ mode = __MKSMALLINT(buf.st_mode & 0777);
+ uid = __MKSMALLINT(buf.st_uid);
+ gid = __MKSMALLINT(buf.st_gid);
+ size = __MKUINT(buf.st_size);
+ aOStime = __MKUINT(buf.st_atime);
+ mOStime = __MKUINT(buf.st_mtime);
+ cOStime = __MKUINT(buf.st_ctime);
}
%}.
mode notNil ifTrue:[
- aOStime notNil ifTrue:[
- atime := AbsoluteTime fromOSTime:(aOStime * 1000).
- mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
- ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
- ] ifFalse:[
- atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
- mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
- ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
- ].
-
- info := FileStatusInfo
- type:type
- mode:mode
- uid:uid
- gid:gid
- size:size
- id:id
- accessed:atime
- modified:mtime
- statusChanged:ctime
- path:nil
- alternativeName:name2.
-
- recordFormat notNil ifTrue:[
- "/ additional VMS info
- info
- recordFormat:recordFormat
- recordFormatNumeric:recordFormatNumeric
- recordAttributes:recordAttribs
- fixedHeaderSize:fixedHeaderSize
- recordSize:recordSize
- ].
- ^ info
+ aOStime notNil ifTrue:[
+ atime := AbsoluteTime fromOSTime:(aOStime * 1000).
+ mtime := AbsoluteTime fromOSTime:(mOStime * 1000).
+ ctime := AbsoluteTime fromOSTime:(cOStime * 1000).
+ ] ifFalse:[
+ atime := AbsoluteTime day:aDay month:aMon year:aYr hour:aHr minutes:aMin seconds:aSec milliseconds:aMS.
+ mtime := AbsoluteTime day:mDay month:mMon year:mYr hour:mHr minutes:mMin seconds:mSec milliseconds:mMS.
+ ctime := AbsoluteTime day:cDay month:cMon year:cYr hour:cHr minutes:cMin seconds:cSec milliseconds:cMS.
+ ].
+
+ info := FileStatusInfo
+ type:type
+ mode:mode
+ uid:uid
+ gid:gid
+ size:size
+ id:id
+ accessed:atime
+ modified:mtime
+ statusChanged:ctime
+ path:nil
+ alternativeName:name2.
+
+ recordFormat notNil ifTrue:[
+ "/ additional VMS info
+ info
+ recordFormat:recordFormat
+ recordFormatNumeric:recordFormatNumeric
+ recordAttributes:recordAttribs
+ fixedHeaderSize:fixedHeaderSize
+ recordSize:recordSize
+ ].
+ ^ info
].
^ self primitiveFailed
@@ -4253,27 +4253,27 @@
int ret;
if (__isString(aPathName)) {
- struct stat buf;
+ struct stat buf;
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
+ printf("stat on '%s' for isDirectory\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( false );
- }
- RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( false );
+ }
+ RETURN ( ((buf.st_mode & S_IFMT) == S_IFDIR) ? true : false);
}
%}.
^ self primitiveFailed
"an alternative implementation would be:
- ^ (self infoOf:aPathName) type == #directory
+ ^ (self infoOf:aPathName) type == #directory
"
!
@@ -4348,18 +4348,18 @@
if (__isString(aPathName) || __isSymbol(aPathName) ) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
+ printf("stat on '%s' for isValidPath\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (false);
- }
- RETURN ( ret ? false : true );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (false);
+ }
+ RETURN ( ret ? false : true );
}
%}.
^ self primitiveFailed
@@ -4374,17 +4374,17 @@
if (__isString(aPathName)) {
# ifdef TRACE_ACCESS_CALLS
- printf("access on '%s' for writable\n", __stringVal(aPathName));
+ printf("access on '%s' for writable\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = access(__stringVal(aPathName), W_OK);
- } while ((ret < 0) && (errno == EINTR));
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- }
- RETURN ( ((ret == 0) ? true : false) );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = access(__stringVal(aPathName), W_OK);
+ } while ((ret < 0) && (errno == EINTR));
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ }
+ RETURN ( ((ret == 0) ? true : false) );
}
%}.
^ self primitiveFailed
@@ -4500,43 +4500,43 @@
path := self primPathNameOf:pathName.
path isNil ifTrue:[
- (self isValidPath:pathName) ifFalse:[
- p := pathName.
- [(p size > 1)
- and:[p endsWith:(self fileSeparator)]
- ] whileTrue:[
- p := p copyWithoutLast:1.
- ].
- ^ p
- ].
-
- (SlowFork==true or:[PipeFailed==true]) ifFalse:[
- PipeStream openErrorSignal handle:[:ex |
- PipeFailed := true.
- 'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
- ex return.
- ] do:[
- "have to fall back ..."
- command := 'cd ' , pathName , '; pwd'.
- p := PipeStream readingFrom:command.
- ].
-
- (p isNil or:[p atEnd]) ifTrue:[
- ('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
- ] ifFalse:[
- path := p nextLine.
- p close.
- ]
- ].
- path isNil ifTrue:[
- "/
- "/ return the original - there is nothing else can we do
- "/
- path := pathName
- ].
- (SlowFork==true or:[ForkFailed==true]) ifTrue:[
- path := self compressPath:path
- ]
+ (self isValidPath:pathName) ifFalse:[
+ p := pathName.
+ [(p size > 1)
+ and:[p endsWith:(self fileSeparator)]
+ ] whileTrue:[
+ p := p copyWithoutLast:1.
+ ].
+ ^ p
+ ].
+
+ (SlowFork==true or:[PipeFailed==true]) ifFalse:[
+ PipeStream openErrorSignal handle:[:ex |
+ PipeFailed := true.
+ 'UnixOperatingSystem [warning]: cannot fork/popen' errorPrintCR.
+ ex return.
+ ] do:[
+ "have to fall back ..."
+ command := 'cd ' , pathName , '; pwd'.
+ p := PipeStream readingFrom:command.
+ ].
+
+ (p isNil or:[p atEnd]) ifTrue:[
+ ('UnixOperatingSystem [warning]: PipeStream for <' , command , '> failed') errorPrintCR.
+ ] ifFalse:[
+ path := p nextLine.
+ p close.
+ ]
+ ].
+ path isNil ifTrue:[
+ "/
+ "/ return the original - there is nothing else can we do
+ "/
+ path := pathName
+ ].
+ (SlowFork==true or:[ForkFailed==true]) ifTrue:[
+ path := self compressPath:path
+ ]
].
^ path.
@@ -4566,20 +4566,20 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for id\n", __stringVal(aPathName));
+ printf("stat on '%s' for id\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret >= 0) {
- ino = buf.st_ino;
- retVal = __MKUINT(ino);
- RETURN (retVal);
- }
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN (nil);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret >= 0) {
+ ino = buf.st_ino;
+ retVal = __MKUINT(ino);
+ RETURN (retVal);
+ }
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN (nil);
}
RETURN (nil);
%}.
@@ -4601,31 +4601,31 @@
#ifdef HAS_GETCWD
# if defined(UNIX_LIKE) ||defined(__VMS__) || defined(MSDOS_LIKE)
- if (strcmp(__stringVal(pathName), ".") == 0)
- {
- char nameBuffer[MAXPATHLEN + 1];
-
- if (@global(CurrentDirectory) == nil) {
- if (getcwd(nameBuffer, MAXPATHLEN)) {
- OBJ d;
-
- @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
- __GSTORE(d);
- }
- }
- RETURN (@global(CurrentDirectory));
- }
+ if (strcmp(__stringVal(pathName), ".") == 0)
+ {
+ char nameBuffer[MAXPATHLEN + 1];
+
+ if (@global(CurrentDirectory) == nil) {
+ if (getcwd(nameBuffer, MAXPATHLEN)) {
+ OBJ d;
+
+ @global(CurrentDirectory) = d = __MKSTRING(nameBuffer);
+ __GSTORE(d);
+ }
+ }
+ RETURN (@global(CurrentDirectory));
+ }
# endif /* UNIX_LIKE */
#endif /* HAS_GETCWD */
#ifdef HAS_REALPATH
- {
- char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
-
- if (realpath(__stringVal(pathName), nameBuffer)) {
- RETURN ( __MKSTRING(nameBuffer) );
- }
- }
+ {
+ char nameBuffer[MAXPATHLEN + 1 + MAXPATHLEN + 1];
+
+ if (realpath(__stringVal(pathName), nameBuffer)) {
+ RETURN ( __MKSTRING(nameBuffer) );
+ }
+ }
#endif /* ! HAS_REALPATH */
}
%}.
@@ -4679,7 +4679,7 @@
For nonexistent files, nil is returned."
"could be implemented as:
- (self infoOf:aPathName) modified
+ (self infoOf:aPathName) modified
"
|osSeconds i|
@@ -4690,18 +4690,18 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
+ printf("stat on '%s' for timeOfLastChange\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- osSeconds = __MKUINT(buf.st_mtime);
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ osSeconds = __MKUINT(buf.st_mtime);
}
%}.
osSeconds notNil ifTrue:[^ AbsoluteTime fromOSTime:(osSeconds * 1000)].
@@ -4724,7 +4724,7 @@
"
this could have been implemented as:
- (self infoOf:aPathName) type
+ (self infoOf:aPathName) type
but for huge directory searches the code below is faster
"
@@ -4734,45 +4734,45 @@
if (__isString(aPathName)) {
# ifdef TRACE_STAT_CALLS
- printf("stat on '%s' for type\n", __stringVal(aPathName));
+ printf("stat on '%s' for type\n", __stringVal(aPathName));
# endif
- __BEGIN_INTERRUPTABLE__
- do {
- ret = stat((char *) __stringVal(aPathName), &buf);
- } while (ret < 0 && errno == EINTR);
- __END_INTERRUPTABLE__
- if (ret < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
- }
- switch (buf.st_mode & S_IFMT) {
- case S_IFDIR:
- RETURN ( @symbol(directory) );
- case S_IFREG:
- RETURN ( @symbol(regular) );
+ __BEGIN_INTERRUPTABLE__
+ do {
+ ret = stat((char *) __stringVal(aPathName), &buf);
+ } while (ret < 0 && errno == EINTR);
+ __END_INTERRUPTABLE__
+ if (ret < 0) {
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
+ }
+ switch (buf.st_mode & S_IFMT) {
+ case S_IFDIR:
+ RETURN ( @symbol(directory) );
+ case S_IFREG:
+ RETURN ( @symbol(regular) );
# ifdef S_IFCHR
- case S_IFCHR:
- RETURN ( @symbol(characterSpecial) );
+ case S_IFCHR:
+ RETURN ( @symbol(characterSpecial) );
# endif
# ifdef S_IFBLK
- case S_IFBLK:
- RETURN ( @symbol(blockSpecial) );
+ case S_IFBLK:
+ RETURN ( @symbol(blockSpecial) );
# endif
# ifdef S_IFLNK
- case S_IFLNK:
- RETURN ( @symbol(symbolicLink) );
+ case S_IFLNK:
+ RETURN ( @symbol(symbolicLink) );
# endif
# ifdef S_IFSOCK
- case S_IFSOCK:
- RETURN ( @symbol(socket) );
+ case S_IFSOCK:
+ RETURN ( @symbol(socket) );
# endif
# ifdef S_IFIFO
- case S_IFIFO:
- RETURN ( @symbol(fifo) );
+ case S_IFIFO:
+ RETURN ( @symbol(fifo) );
# endif
- default:
- RETURN ( @symbol(unknown) );
- }
+ default:
+ RETURN ( @symbol(unknown) );
+ }
}
%}.
i := self infoOf:aPathName.
@@ -5541,12 +5541,7 @@
you may have to fetch the processes exitstatus with
UnixOperatingSystem>>getStatusOfProcess:aProcessId."
- self isMSWINDOWSlike ifTrue:[
- self primTerminateProcess:processId
- ].
- self isUNIXlike ifTrue:[
- self sendSignal:(self sigTERM) to:processId.
- ]
+ self sendSignal:(self sigTERM) to:processId.
"Modified: / 28.12.1995 / 15:05:37 / stefan"
"Modified: / 27.1.1998 / 20:05:47 / cg"
@@ -5560,9 +5555,7 @@
you may have to fetch the processes exitstatus with
UnixOperatingSystem>>getStatusOfProcess:aProcessId."
- self isUNIXlike ifTrue:[
- self sendSignal:(self sigTERM) to:(processGroupId negated).
- ]
+ self sendSignal:(self sigTERM) to:(processGroupId negated).
"Modified: / 28.12.1995 / 15:05:37 / stefan"
"Created: / 23.4.1996 / 16:40:34 / stefan"
@@ -5593,17 +5586,17 @@
line = _getpty(&_fdM, O_RDWR|O_NDELAY, 0600, 0);
if ((line != 0) && (_fdM >= 0)) {
- _fdS = open(line, O_RDWR);
- if (_fdS < 0) {
- (void)close(_fdM);
- _fdS = _fdM = -1;
- }
+ _fdS = open(line, O_RDWR);
+ if (_fdS < 0) {
+ (void)close(_fdM);
+ _fdS = _fdM = -1;
+ }
} else {
- _fdM -1;
+ _fdM -1;
}
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __MKSMALLINT(_fdM);
- fdS = __MKSMALLINT(_fdS);
+ fdM = __MKSMALLINT(_fdM);
+ fdS = __MKSMALLINT(_fdS);
}
#endif /* IRIX5 */
@@ -5654,46 +5647,46 @@
struct group *gr;
if ((gr = getgrnam("tty")) != NULL)
- ttygid = gr->gr_gid;
+ ttygid = gr->gr_gid;
else
- ttygid = -1;
+ ttygid = -1;
for (cp1 = PTY_1_CHARS; *cp1; cp1++) {
- line[sizeof(line)-1-2] = * cp1;
-
- for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
- line[5] = 'p';
- line[sizeof(line)-1-1] = *cp2;
-
- if ((_fdM = open(line, O_RDWR, 0)) == -1) {
- if (errno == ENOENT) {
- _fdM = _fdS = -1;
- goto getOutOfHere; /* out of ptys */
- }
- } else {
- line[5] = 't';
- (void) chown( line, getuid(), ttygid );
- (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
-
- if( (_fdS = open(line, O_RDWR, 0)) != -1 ) {
- goto getOutOfHere;
- }
- (void) close( _fdM );
- }
- }
+ line[sizeof(line)-1-2] = * cp1;
+
+ for( cp2 = PTY_2_CHARS; *cp2; cp2++ ) {
+ line[5] = 'p';
+ line[sizeof(line)-1-1] = *cp2;
+
+ if ((_fdM = open(line, O_RDWR, 0)) == -1) {
+ if (errno == ENOENT) {
+ _fdM = _fdS = -1;
+ goto getOutOfHere; /* out of ptys */
+ }
+ } else {
+ line[5] = 't';
+ (void) chown( line, getuid(), ttygid );
+ (void) chmod( line, S_IRUSR|S_IWUSR|S_IWGRP );
+
+ if( (_fdS = open(line, O_RDWR, 0)) != -1 ) {
+ goto getOutOfHere;
+ }
+ (void) close( _fdM );
+ }
+ }
}
getOutOfHere: ;
if ((_fdM >= 0) && (_fdS >= 0)) {
- fdM = __MKSMALLINT(_fdM);
- fdS = __MKSMALLINT(_fdS);
+ fdM = __MKSMALLINT(_fdM);
+ fdS = __MKSMALLINT(_fdS);
}
#endif /* PTY_TEMPL */
%}.
fdM notNil ifTrue:[
- ^ Array with:fdM with:fdS.
+ ^ Array with:fdM with:fdS.
].
^ nil
@@ -5711,15 +5704,15 @@
int fds[2];
if (pipe(fds) < 0) {
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- RETURN ( nil );
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ RETURN ( nil );
}
fd1 = __MKSMALLINT(fds[0]);
fd2 = __MKSMALLINT(fds[1]);
%}.
fd1 notNil ifTrue:[
- ^ Array with:fd1 with:fd2.
+ ^ Array with:fd1 with:fd2.
].
^ nil
! !
@@ -5760,12 +5753,12 @@
getDomainName
"return the domain this host is in.
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx hostName|
DomainName notNil ifTrue:[
- ^ DomainName
+ ^ DomainName
].
%{ /* STACK: 2048 */
@@ -5773,14 +5766,14 @@
char buffer[128];
if (getdomainname(buffer, sizeof(buffer)) == 0) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#else
# if defined(HAS_UNAME) && defined(HAS_UTS_DOMAINNAME)
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- name = __MKSTRING(ubuff.domainname);
+ name = __MKSTRING(ubuff.domainname);
}
# else
# if defined(HAS_SYSINFO) && defined(SI_SRPC_DOMAIN)
@@ -5788,33 +5781,33 @@
int ret;
if ((ret = sysinfo(SI_SRPC_DOMAIN, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
# endif
# endif
#endif
%}.
name isNil ifTrue:[
- name := self getEnvironment:'DOMAIN'.
- name isNil ifTrue:[
- UnixOperatingSystem isUNIXlike ifTrue:[
- name := self getCommandOutputFrom:'domainname'
- ]
- ]
+ name := self getEnvironment:'DOMAIN'.
+ name isNil ifTrue:[
+ UnixOperatingSystem isUNIXlike ifTrue:[
+ name := self getCommandOutputFrom:'domainname'
+ ]
+ ]
].
name isNil ifTrue:[
- "/ sometimes, we can extract the domainName from the hostName ...
- hostName := self getHostName.
- hostName notNil ifTrue:[
- idx := hostName indexOf:$..
- idx ~~ 0 ifTrue:[
- name := hostName copyFrom:idx+1.
- ]
- ].
- name isNil ifTrue:[
- 'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
- name := 'unknown'.
- ]
+ "/ sometimes, we can extract the domainName from the hostName ...
+ hostName := self getHostName.
+ hostName notNil ifTrue:[
+ idx := hostName indexOf:$..
+ idx ~~ 0 ifTrue:[
+ name := hostName copyFrom:idx+1.
+ ]
+ ].
+ name isNil ifTrue:[
+ 'UnixOperatingSystem [warning]: cannot find out domainname' errorPrintCR.
+ name := 'unknown'.
+ ]
].
DomainName := name.
^ name
@@ -5835,10 +5828,10 @@
extern char *getenv();
if (__isString(aStringOrSymbol) || __isSymbol(aStringOrSymbol)) {
- env = getenv(__stringVal(aStringOrSymbol));
- if (env) {
- RETURN ( __MKSTRING(env) );
- }
+ env = getenv(__stringVal(aStringOrSymbol));
+ if (env) {
+ RETURN ( __MKSTRING(env) );
+ }
}
%}
.
@@ -5858,12 +5851,12 @@
"return the hostname we are running on - if there is
a HOST environment variable, we are much faster here ...
Notice:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
|name idx|
HostName notNil ifTrue:[
- ^ HostName
+ ^ HostName
].
%{ /* STACK: 2048 */
@@ -5871,14 +5864,14 @@
char buffer[256];
if (gethostname(buffer, sizeof(buffer)) == 0) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
#else
# if defined(HAS_UNAME)
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- name = __MKSTRING(ubuff.nodename);
+ name = __MKSTRING(ubuff.nodename);
}
# else
# if defined(HAS_SYSINFO) && defined(SI_HOSTNAME)
@@ -5886,31 +5879,31 @@
int ret;
if ((ret = sysinfo(SI_HOSTNAME, buffer, sizeof(buffer))) >= 0 && ret <= sizeof(buffer)) {
- name = __MKSTRING(buffer);
+ name = __MKSTRING(buffer);
}
# endif
# endif
#endif
%}.
name isNil ifTrue:[
- name := self getEnvironment:'HOST'.
- name isNil ifTrue:[
- UnixOperatingSystem isUNIXlike ifTrue:[
- name := self getCommandOutputFrom:'hostname'
- ]
- ]
+ name := self getEnvironment:'HOST'.
+ name isNil ifTrue:[
+ UnixOperatingSystem isUNIXlike ifTrue:[
+ name := self getCommandOutputFrom:'hostname'
+ ]
+ ]
].
name isNil ifTrue:[
- 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
- name := 'unknown'.
+ 'UnixOperatingSystem [warning]: cannot find out hostname' errorPrintCR.
+ name := 'unknown'.
] ifFalse:[
- "/ on some systems, the hostname already contains the domain.
- "/ decompose it here.
- idx := name indexOf:$..
- idx ~~ 0 ifTrue:[
- DomainName := name copyFrom:(idx+1).
- name := name copyTo:(idx-1).
- ]
+ "/ on some systems, the hostname already contains the domain.
+ "/ decompose it here.
+ idx := name indexOf:$..
+ idx ~~ 0 ifTrue:[
+ DomainName := name copyFrom:(idx+1).
+ name := name copyTo:(idx-1).
+ ]
].
HostName := name.
^ name
@@ -6191,7 +6184,7 @@
"if supported by the OS, return the systemID;
a unique per machine identification.
WARNING:
- not all systems support this; on some, 'unknown' is returned."
+ not all systems support this; on some, 'unknown' is returned."
%{ /* NO_CONTEXT */
#if defined(IRIX5) && !defined(HAS_GETHOSTID)
@@ -6200,9 +6193,9 @@
OBJ arr;
if ((retVal = syssgi(SGI_SYSID, idBuffer)) == 0) {
- arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
- bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
- RETURN (arr);
+ arr = __BYTEARRAY_UNINITIALIZED_NEW_INT(MAXSYSIDSIZE);
+ bcopy(idBuffer, __ByteArrayInstPtr(arr)->ba_element, MAXSYSIDSIZE);
+ RETURN (arr);
}
#endif
#if defined(HAS_GETHOSTID)
@@ -6216,15 +6209,15 @@
#endif
#if defined(HAS_SYSINFO) && defined(SI_HW_SERIAL)
{
- char buffer[128];
-
- buffer[0] = 0;
- if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
- buffer[127] = 0;
- if (strlen(buffer) > 0) {
- RETURN(__MKSTRING(buffer));
- }
- }
+ char buffer[128];
+
+ buffer[0] = 0;
+ if (sysinfo(SI_HW_SERIAL, buffer, sizeof(buffer))) {
+ buffer[127] = 0;
+ if (strlen(buffer) > 0) {
+ RETURN(__MKSTRING(buffer));
+ }
+ }
}
#endif
%}.
@@ -6248,16 +6241,16 @@
This method is mainly provided to augment error reports with some system
information.
(in case of system/version specific OS errors, conditional workarounds and patches
- may be based upon this info).
+ may be based upon this info).
Your application should NOT depend upon this in any way.
The returned info may (or may not) contain:
- #system -> some operating system identification (irix, Linux, nt, win32s ...)
- #version -> OS version (some os version identification)
- #release -> OS release (3.5, 1.2.1 ...)
- #node -> some host identification (hostname)
- #domain -> domain name (hosts domain)
- #machine -> type of machine (i586, mips ...)
+ #system -> some operating system identification (irix, Linux, nt, win32s ...)
+ #version -> OS version (some os version identification)
+ #release -> OS release (3.5, 1.2.1 ...)
+ #node -> some host identification (hostname)
+ #domain -> domain name (hosts domain)
+ #machine -> type of machine (i586, mips ...)
"
|sys node rel ver mach dom mtyp brel info arch|
@@ -6268,33 +6261,33 @@
struct utsname ubuff;
if (uname(&ubuff) >= 0) {
- sys = __MKSTRING(ubuff.sysname);
- node = __MKSTRING(ubuff.nodename);
- rel = __MKSTRING(ubuff.release);
- ver = __MKSTRING(ubuff.version);
- mach = __MKSTRING(ubuff.machine);
+ sys = __MKSTRING(ubuff.sysname);
+ node = __MKSTRING(ubuff.nodename);
+ rel = __MKSTRING(ubuff.release);
+ ver = __MKSTRING(ubuff.version);
+ mach = __MKSTRING(ubuff.machine);
# ifdef HAS_UTS_DOMAINNAME
- dom = __MKSTRING(ubuff.domainname);
+ dom = __MKSTRING(ubuff.domainname);
# else
# if defined(HAS_GETDOMAINNAME)
- {
- char buffer[128];
-
- if (getdomainname(buffer, sizeof(buffer)) == 0) {
- dom = __MKSTRING(buffer);
- }
- }
+ {
+ char buffer[128];
+
+ if (getdomainname(buffer, sizeof(buffer)) == 0) {
+ dom = __MKSTRING(buffer);
+ }
+ }
# endif
# endif
}
# if defined(HAS_SYSINFO) && defined(SI_ARCHITECTURE)
{
- char buffer[128];
-
- if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
- arch = __MKSTRING(buffer);
- }
+ char buffer[128];
+
+ if (sysinfo(SI_ARCHITECTURE, buffer, sizeof(buffer))) {
+ arch = __MKSTRING(buffer);
+ }
}
# endif
@@ -6303,19 +6296,19 @@
#endif /* no uname */
%}.
sys isNil ifTrue:[
- sys := self getSystemType.
+ sys := self getSystemType.
].
node isNil ifTrue:[
- node := self getHostName.
+ node := self getHostName.
].
dom isNil ifTrue:[
- dom := self getDomainName.
+ dom := self getDomainName.
].
mach isNil ifTrue:[
- mach := self getCPUType.
+ mach := self getCPUType.
].
arch isNil ifTrue:[
- arch := 'unknown'.
+ arch := 'unknown'.
].
info := IdentityDictionary new.
@@ -6360,7 +6353,7 @@
%}.
sys isNil ifTrue:[
- ^ self getOSType
+ ^ self getOSType
].
^ sys
@@ -6392,11 +6385,11 @@
maxFileNameLength
"return the max number of characters in a filename.
CAVEAT:
- Actually, the following is somewhat wrong - some systems
- support different sizes, depending on the volume.
- We return a somewhat conservative number here.
- Another entry, to query for volume specific max
- will be added in the future."
+ Actually, the following is somewhat wrong - some systems
+ support different sizes, depending on the volume.
+ We return a somewhat conservative number here.
+ Another entry, to query for volume specific max
+ will be added in the future."
%{ /* NOCONTEXT */
@@ -7135,9 +7128,9 @@
then := UnixOperatingSystem millisecondTimeAdd:now and:millis.
[UnixOperatingSystem millisecondTime:then isAfter:now] whileTrue:[
- delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
- self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
- now := UnixOperatingSystem getMillisecondTime.
+ delta := UnixOperatingSystem millisecondTimeDeltaBetween:then and:now.
+ self selectOnAnyReadable:nil writable:nil exception:nil withTimeOut:delta.
+ now := UnixOperatingSystem getMillisecondTime.
]
"
@@ -7272,10 +7265,10 @@
struct group *g;
if (__isSmallInteger(aNumber)) {
- g = getgrgid(__intVal(aNumber));
- if (g) {
- RETURN ( __MKSTRING(g->gr_name) );
- }
+ g = getgrgid(__intVal(aNumber));
+ if (g) {
+ RETURN ( __MKSTRING(g->gr_name) );
+ }
}
%}.
^ '???'
@@ -7315,35 +7308,35 @@
char *name = (char *)0;
if (firstCall) {
- name = getlogin();
- if (! name || (name[0] == 0)) {
- name = getenv("LOGNAME");
- }
- if (name && (strlen(name) < sizeof(cachedName))) {
- strcpy(cachedName, name);
- firstCall = 0;
- }
+ name = getlogin();
+ if (! name || (name[0] == 0)) {
+ name = getenv("LOGNAME");
+ }
+ if (name && (strlen(name) < sizeof(cachedName))) {
+ strcpy(cachedName, name);
+ firstCall = 0;
+ }
} else {
- name = cachedName;
+ name = cachedName;
}
/*
* try a few common environment variables ...
*/
if (! name || (name[0] == 0) ) {
- name = getenv("LOGIN");
- if (! name || (name[0] == 0) ) {
- name = getenv("LOGNAME");
- if (! name || (name[0] == 0) ) {
- name = getenv("USER");
- }
- }
+ name = getenv("LOGIN");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("LOGNAME");
+ if (! name || (name[0] == 0) ) {
+ name = getenv("USER");
+ }
+ }
}
/*
* nope - I really font know who you are.
*/
if (! name || (name[0] == 0) ) {
- name = "you";
+ name = "you";
}
RETURN ( __MKSTRING(name) );
@@ -7383,15 +7376,15 @@
struct passwd *p;
if (__isSmallInteger(aNumber)) {
- p = getpwuid(__intVal(aNumber));
- if (p) {
- RETURN ( __MKSTRING(p->pw_name) );
- }
+ p = getpwuid(__intVal(aNumber));
+ if (p) {
+ RETURN ( __MKSTRING(p->pw_name) );
+ }
}
#endif /* unix-like */
%}.
aNumber == self getUserID ifTrue:[
- ^ self getLoginName
+ ^ self getLoginName
].
^ '? (' , aNumber printString , ')'
@@ -7426,42 +7419,42 @@
int ret;
if (__isString(aNameOrID)) {
- buf = getpwnam(__stringVal(aNameOrID));
+ buf = getpwnam(__stringVal(aNameOrID));
} else if (__isSmallInteger(aNameOrID)) {
- buf = getpwuid(__intVal(aNameOrID));
+ buf = getpwuid(__intVal(aNameOrID));
} else {
- buf = (struct passwd *)0;
+ buf = (struct passwd *)0;
}
if (buf) {
- name = __MKSTRING(buf->pw_name);
+ name = __MKSTRING(buf->pw_name);
# ifndef NO_PWD_PASSWD
- passw = __MKSTRING(buf->pw_passwd);
+ passw = __MKSTRING(buf->pw_passwd);
# endif
# ifdef SYSV4
- age = __MKSTRING(buf->pw_age);
- comment = __MKSTRING(buf->pw_comment);
+ age = __MKSTRING(buf->pw_age);
+ comment = __MKSTRING(buf->pw_comment);
# endif
- dir = __MKSTRING(buf->pw_dir);
+ dir = __MKSTRING(buf->pw_dir);
# ifndef NO_PWD_GECOS
- gecos = __MKSTRING(buf->pw_gecos);
+ gecos = __MKSTRING(buf->pw_gecos);
# endif
- shell = __MKSTRING(buf->pw_shell);
-
- uid = __MKSMALLINT(buf->pw_uid);
- gid = __MKSMALLINT(buf->pw_gid);
+ shell = __MKSTRING(buf->pw_shell);
+
+ uid = __MKSMALLINT(buf->pw_uid);
+ gid = __MKSMALLINT(buf->pw_gid);
}
# endif /* has PWD */
%}.
info := IdentityDictionary new.
name isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- name := self getLoginName
- ].
+ aNameOrID == self getUserID ifTrue:[
+ name := self getLoginName
+ ].
].
name notNil ifTrue:[
- info at:#name put:name.
+ info at:#name put:name.
] ifFalse:[
- info at:#name put:'unknown'
+ info at:#name put:'unknown'
].
passw notNil ifTrue:[info at:#passwd put:passw].
age notNil ifTrue:[info at:#age put:age].
@@ -7469,9 +7462,9 @@
gecos notNil ifTrue:[info at:#gecos put:gecos].
shell notNil ifTrue:[info at:#shell put:shell].
dir isNil ifTrue:[
- aNameOrID == self getUserID ifTrue:[
- dir := self getHomeDirectory
- ]
+ aNameOrID == self getUserID ifTrue:[
+ dir := self getHomeDirectory
+ ]
].
dir notNil ifTrue:[info at:#dir put:dir].
uid notNil ifTrue:[info at:#uid put:uid].
@@ -7536,11 +7529,11 @@
# define __BLOCKING_WAIT__ 1
if (blocking != true) {
- /*
- * We do not support nonBlocking waits, so signal an error
- * Sorry about the goto, but with all these ifdefs ...
- */
- goto done;
+ /*
+ * We do not support nonBlocking waits, so signal an error
+ * Sorry about the goto, but with all these ifdefs ...
+ */
+ goto done;
}
# endif /*!HAS_WAIT3*/
# endif /*!HAS_WAITPID*/
@@ -7571,7 +7564,7 @@
# endif
do {
- p = __WAIT;
+ p = __WAIT;
} while (p == -1 && errno == EINTR);
# if __BLOCKING_WAIT__
@@ -7582,28 +7575,28 @@
# undef __WAIT
if (p == 0)
- RETURN(nil)
+ RETURN(nil)
if (p == -1) {
- if (errno == ECHILD)
- RETURN(nil);
+ if (errno == ECHILD)
+ RETURN(nil);
} else {
- pid = __MKSMALLINT(p);
- if (WIFEXITED(s)) {
- status = @symbol(exit);
- code = __MKSMALLINT(WEXITSTATUS(s));
- core = WCOREDUMP(s) ? true : false;
- } else if (WIFSIGNALED(s)) {
- status = @symbol(signal);
- code = __MKSMALLINT(WTERMSIG(s));
- } else if (WIFSTOPPED(s)) {
- status = @symbol(stop);
- code = __MKSMALLINT(WSTOPSIG(s));
- }
+ pid = __MKSMALLINT(p);
+ if (WIFEXITED(s)) {
+ status = @symbol(exit);
+ code = __MKSMALLINT(WEXITSTATUS(s));
+ core = WCOREDUMP(s) ? true : false;
+ } else if (WIFSIGNALED(s)) {
+ status = @symbol(signal);
+ code = __MKSMALLINT(WTERMSIG(s));
+ } else if (WIFSTOPPED(s)) {
+ status = @symbol(stop);
+ code = __MKSMALLINT(WSTOPSIG(s));
+ }
# if defined(WIFCONTINUED)
- else if (WIFCONTINUED(s)) {
- status = @symbol(continue);
- }
+ else if (WIFCONTINUED(s)) {
+ status = @symbol(continue);
+ }
# endif
}
done: ;
@@ -7611,7 +7604,7 @@
%}.
(status isNil or:[pid isNil]) ifTrue:[
- ^ self primitiveFailed
+ ^ self primitiveFailed
].
"/ Transcript show:'pid: '; show:pid; show:' status: '; show:status;
@@ -7636,13 +7629,13 @@
*/
# if defined(FIONREAD) && !defined(WIN32)
{
- int n;
-
- if (__isSmallInteger(fd)) {
- if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
- RETURN (__MKINT(n));
- }
- }
+ int n;
+
+ if (__isSmallInteger(fd)) {
+ if (ioctl(__intVal(fd), FIONREAD, &n) >= 0) {
+ RETURN (__MKINT(n));
+ }
+ }
}
# endif /* FIONREAD */
#endif
@@ -7730,170 +7723,170 @@
int numFds = 0;
if (__isSmallInteger(millis)) {
- FD_ZERO(&rset);
- FD_ZERO(&wset);
- FD_ZERO(&eset);
-
- maxF = -1;
- if (__isNonNilObject(readFdArray)) {
- if (! __isArray(readFdArray)) {
- goto fail;
- }
- count = __arraySize(readFdArray);
-
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(readFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &rset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- if (__isNonNilObject(writeFdArray)) {
- if (! __isArray(writeFdArray)) {
- goto fail;
- }
- count = __arraySize(writeFdArray);
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(writeFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &wset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- if (__isNonNilObject(exceptFdArray)) {
- if (! __isArray(exceptFdArray)) {
- goto fail;
- }
- count = __arraySize(exceptFdArray);
- for (i=0; i<count;i++) {
- fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
- if (fd != nil) {
- f = __intVal(fd);
- if ((unsigned)f < FD_SETSIZE) {
- FD_SET(f, &eset);
- if (f > maxF) maxF = f;
- numFds++;
- }
- }
- }
- }
-
- t = __intVal(millis);
- if (t) {
- wt.tv_sec = t / 1000;
- wt.tv_usec = (t % 1000) * 1000;
- } else {
- wt.tv_sec = wt.tv_usec = 0;
- }
-
- /*
- * make certain, that interrupt gets us out of the select
- * However, we must then care for moved objects.
- */
- __BEGIN_INTERRUPTABLE__
- errno = 0;
-
- if (t == 0) {
- /*
- * if there is no timeout time, we can stay here interruptable.
- */
- do {
+ FD_ZERO(&rset);
+ FD_ZERO(&wset);
+ FD_ZERO(&eset);
+
+ maxF = -1;
+ if (__isNonNilObject(readFdArray)) {
+ if (! __isArray(readFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(readFdArray);
+
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(readFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &rset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ if (__isNonNilObject(writeFdArray)) {
+ if (! __isArray(writeFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(writeFdArray);
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(writeFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &wset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ if (__isNonNilObject(exceptFdArray)) {
+ if (! __isArray(exceptFdArray)) {
+ goto fail;
+ }
+ count = __arraySize(exceptFdArray);
+ for (i=0; i<count;i++) {
+ fd = __ArrayInstPtr(exceptFdArray)->a_element[i];
+ if (fd != nil) {
+ f = __intVal(fd);
+ if ((unsigned)f < FD_SETSIZE) {
+ FD_SET(f, &eset);
+ if (f > maxF) maxF = f;
+ numFds++;
+ }
+ }
+ }
+ }
+
+ t = __intVal(millis);
+ if (t) {
+ wt.tv_sec = t / 1000;
+ wt.tv_usec = (t % 1000) * 1000;
+ } else {
+ wt.tv_sec = wt.tv_usec = 0;
+ }
+
+ /*
+ * make certain, that interrupt gets us out of the select
+ * However, we must then care for moved objects.
+ */
+ __BEGIN_INTERRUPTABLE__
+ errno = 0;
+
+ if (t == 0) {
+ /*
+ * if there is no timeout time, we can stay here interruptable.
+ */
+ do {
# ifdef WIN32
- intf we;
-
- if (numFds == 0) {
- HANDLE dummyHandle = (HANDLE)0;
+ intf we;
+
+ if (numFds == 0) {
+ HANDLE dummyHandle = (HANDLE)0;
# if 0 /* does not work under WIN95 - sigh */
- if (! GetQueueStatus(QS_ALLINPUT)) {
- MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
- }
+ if (! GetQueueStatus(QS_ALLINPUT)) {
+ MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
+ }
# else
- if (we = __getWaitInputEvent()) {
- we(t);
- }
+ if (we = __getWaitInputEvent()) {
+ we(t);
+ }
# endif
- ret = 0;
- } else {
- ret = select(0, &rset, &wset, &eset, &wt);
- }
+ ret = 0;
+ } else {
+ ret = select(0, &rset, &wset, &eset, &wt);
+ }
# else /* a real OS */
- ret = select(maxF+1, &rset, &wset, &eset, &wt);
+ ret = select(maxF+1, &rset, &wset, &eset, &wt);
# endif /* to WIN or not to WIN */
- } while ((ret < 0) && (errno == EINTR));
- } else {
- do {
+ } while ((ret < 0) && (errno == EINTR));
+ } else {
+ do {
# ifdef WIN32
- intf we;
-
- if (numFds == 0) {
- HANDLE dummyHandle = (HANDLE)0;
+ intf we;
+
+ if (numFds == 0) {
+ HANDLE dummyHandle = (HANDLE)0;
# if 0 /* does not work under WIN95 - sigh */
- if (! GetQueueStatus(QS_ALLINPUT)) {
- MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
- }
+ if (! GetQueueStatus(QS_ALLINPUT)) {
+ MsgWaitForMultipleObjects(0, &dummyHandle, FALSE, t, QS_ALLINPUT);
+ }
# else
- if (we = __getWaitInputEvent()) {
- we(t);
- }
+ if (we = __getWaitInputEvent()) {
+ we(t);
+ }
# endif
- ret = 0;
- } else {
- ret = select(0, &rset, &wset, &eset, &wt);
- }
+ ret = 0;
+ } else {
+ ret = select(0, &rset, &wset, &eset, &wt);
+ }
# else /* a real OS */
- ret = select(maxF+1, &rset, &wset, &eset, &wt);
+ ret = select(maxF+1, &rset, &wset, &eset, &wt);
# endif * to WIN or not to WIN */
- /*
- * for now: dont loop; if we did, we had to adjust the vt-timeval;
- * could otherwise stay in this loop forever ...
- * Premature return (before the time expired) must be handled by the caller.
- * A good solution is to update the wt-timeval and redo the select.
- */
- } while (0 /* (ret < 0) && (errno == EINTR) */ );
- }
- __END_INTERRUPTABLE__
-
- if (ret > 0) {
- for (i=0; i <= maxF; i++) {
- if (FD_ISSET(i, &rset)
- || FD_ISSET(i, &wset)
- || FD_ISSET(i, &eset)) {
- RETURN ( __MKSMALLINT(i) );
- }
- }
- } else {
- if (ret < 0) {
- if (errno == EINTR) {
- errno = 0;
- @global(LastErrorNumber) = nil;
- } else {
- if (@global(InfoPrinting) == true) {
- fprintf(stderr, "OS [info]: select errno = %d\n", errno);
- }
- @global(LastErrorNumber) = __MKSMALLINT(errno);
- }
- } else {
- @global(LastErrorNumber) = nil;
- }
- }
-
- /*
- * return nil (means time expired or interrupted)
- */
- RETURN ( nil );
+ /*
+ * for now: dont loop; if we did, we had to adjust the vt-timeval;
+ * could otherwise stay in this loop forever ...
+ * Premature return (before the time expired) must be handled by the caller.
+ * A good solution is to update the wt-timeval and redo the select.
+ */
+ } while (0 /* (ret < 0) && (errno == EINTR) */ );
+ }
+ __END_INTERRUPTABLE__
+
+ if (ret > 0) {
+ for (i=0; i <= maxF; i++) {
+ if (FD_ISSET(i, &rset)
+ || FD_ISSET(i, &wset)
+ || FD_ISSET(i, &eset)) {
+ RETURN ( __MKSMALLINT(i) );
+ }
+ }
+ } else {
+ if (ret < 0) {
+ if (errno == EINTR) {
+ errno = 0;
+ @global(LastErrorNumber) = nil;
+ } else {
+ if (@global(InfoPrinting) == true) {
+ fprintf(stderr, "OS [info]: select errno = %d\n", errno);
+ }
+ @global(LastErrorNumber) = __MKSMALLINT(errno);
+ }
+ } else {
+ @global(LastErrorNumber) = nil;
+ }
+ }
+
+ /*
+ * return nil (means time expired or interrupted)
+ */
+ RETURN ( nil );
}
fail: ;
@@ -8235,6 +8228,6 @@
!UnixOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.9 1998-06-09 17:30:14 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.10 1998-06-10 09:53:06 cg Exp $'
! !
UnixOperatingSystem initialize!