Skip to content

Commit

Permalink
[Truffle] Use PosixShim for macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisseaton committed Apr 14, 2015
1 parent 6fcb945 commit 8e6d4e4
Showing 1 changed file with 11 additions and 10 deletions.
Expand Up @@ -56,6 +56,7 @@
import org.jruby.truffle.runtime.signal.SignalOperations;

import org.jruby.truffle.runtime.subsystems.ThreadManager;
import org.jruby.util.io.PosixShim;
import sun.misc.Signal;

import com.oracle.truffle.api.CompilerDirectives;
Expand Down Expand Up @@ -578,7 +579,7 @@ public Object waitPID(final int input_pid, boolean no_hang) {
// Transliterated from Rubinius C++ - not tidied up significantly to make merging changes easier

int options = 0;
final int[] status = new int[]{0};
final int[] statusReference = new int[]{0};
int pid;

if(no_hang) {
Expand All @@ -593,7 +594,7 @@ public Object waitPID(final int input_pid, boolean no_hang) {

@Override
public Integer block() throws InterruptedException {
return getContext().getRuntime().getPosix().waitpid(input_pid, status, finalOptions);
return getContext().getRuntime().getPosix().waitpid(input_pid, statusReference, finalOptions);
}

});
Expand All @@ -620,15 +621,15 @@ public Integer block() throws InterruptedException {
Object termsig = nil();
Object stopsig = nil();

/* TODO CS 14-April-15 figure out how to do this using JNR
if(status == WIFEXITED.i) {
output = WEXITSTATUS(status);
} else if(WIFSIGNALED(status)) {
termsig = WTERMSIG(status);
} else if(WIFSTOPPED(status)){
stopsig = WSTOPSIG(status);
final int status = statusReference[0];

if(PosixShim.WAIT_MACROS.WIFEXITED(status)) {
output = PosixShim.WAIT_MACROS.WEXITSTATUS(status);
} else if(PosixShim.WAIT_MACROS.WIFSIGNALED(status)) {
termsig = PosixShim.WAIT_MACROS.WTERMSIG(status);
} else if(PosixShim.WAIT_MACROS.WIFSTOPPED(status)){
stopsig = PosixShim.WAIT_MACROS.WSTOPSIG(status);
}
*/

return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(), output, termsig, stopsig, pid);
}
Expand Down

0 comments on commit 8e6d4e4

Please sign in to comment.