Remove #getStatusOfProcess: -- it does not work and can hang the system.
authorStefan Vogel <sv@exept.de>
Tue, 10 Aug 2004 17:17:12 +0200
changeset 8469 928145276114
parent 8468 75bd57a46249
child 8470 d79e917d4f36
Remove #getStatusOfProcess: -- it does not work and can hang the system. Use Processor>>#monitor:action: instead.
UnixOperatingSystem.st
--- a/UnixOperatingSystem.st	Tue Aug 10 17:15:02 2004 +0200
+++ b/UnixOperatingSystem.st	Tue Aug 10 17:17:12 2004 +0200
@@ -3308,52 +3308,6 @@
     "Modified: / 5.6.1998 / 17:40:48 / cg"
 !
 
-getStatusOfProcess:aProcessId
-    "wait for a process to terminate and fetch its exit status.
-     This is required to avoid zombie processes."
-
-%{
-    int status;
-
-    if (__isSmallInteger(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);
-# 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;
-	    }
-# endif /* NO_WAITPID */
-	}
-	RETURN ( __MKSMALLINT(status));
-    }
-%}.
-    self primitiveFailed
-
-!
-
 pathOfCommand:aCommand
     "find where aCommand's executable file is;
      return its full pathName if there is such a command, otherwise
@@ -6211,36 +6165,36 @@
 closeLeftOverFiles
     "a bad bad kludge and workaround for a big bug in the linux
      getAddrInfo implementation:
-	if it get interrupted (via a timer, for example), its domain-name
-	socket remains open and is NEVER closed.
-	These open files collect up and lead to no-more-files eventually.
+        if it gets interrupted (via a timer, for example), its domain-name
+        socket remains open and is NEVER closed.
+        These open files collect up and lead to no-more-files eventually.
      Invoking this method helps in this situation."
 
     |p|
 
     p := PipeStream
-	    readingFrom:('lsof -p ' , (OperatingSystem getProcessId printString)).
+            readingFrom:('lsof -p ' , (OperatingSystem getProcessId printString)).
 
     p linesDo:[:line |
-	|words fd|
-
-	words := line asCollectionOfWords.
-	"/ COMMAND PID USER   FD   TYPE     DEVICE    SIZE    NODE NAME
-	words first = 'stx' ifTrue:[
-	    words second = (OperatingSystem getProcessId printString) ifTrue:[
-		(words fourth endsWith:'u') ifTrue:[
-		    (words fifth = 'IPv4') ifTrue:[
-			(words seventh = 'UDP') ifTrue:[
-			    (words last endsWith:'domain') ifTrue:[
-				fd := Number readFrom:(words fourth copyWithoutLast:1).
+        |words fd|
+
+        words := line asCollectionOfWords.
+        "/ COMMAND PID USER   FD   TYPE     DEVICE    SIZE    NODE NAME
+        words first = 'stx' ifTrue:[
+            words second = (OperatingSystem getProcessId printString) ifTrue:[
+                (words fourth endsWith:'u') ifTrue:[
+                    (words fifth = 'IPv4') ifTrue:[
+                        (words seventh = 'UDP') ifTrue:[
+                            (words last endsWith:'domain') ifTrue:[
+                                fd := Number readFrom:(words fourth copyWithoutLast:1).
 Transcript showCR:line.
-				OperatingSystem closeFd:fd.
-			    ]
-			]
-		    ]
-		]
-	    ]
-	]
+                                OperatingSystem closeFd:fd.
+                            ]
+                        ]
+                    ]
+                ]
+            ]
+        ]
     ].
     p close.
 
@@ -12331,7 +12285,7 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.210 2004-05-13 18:50:04 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.211 2004-08-10 15:17:12 stefan Exp $'
 ! !
 
 UnixOperatingSystem initialize!