Permalink
Browse files

Merge branch 'master' of https://github.com/thehobn/nachos

fixed shit
  • Loading branch information...
PatTran committed Apr 1, 2018
2 parents 213f885 + 3336a64 commit 711112cf907e8ba3e393a113bcbaaf7feab73c44
Showing with 12 additions and 4 deletions.
  1. +12 −4 userprog/UserProcess.java
@@ -64,7 +64,13 @@ public boolean execute(String name, String[] args) {
if (!load(name, args))
return false;
<<<<<<< HEAD
userthread=new UThread(this).setName(name).fork();
=======
thread = (UThread) new UThread(this).setName(name);
thread.fork();
>>>>>>> 3336a648cf5ed50a8a15b78c00cc1d7884d49e69
return true;
}
@@ -716,7 +722,8 @@ public int handleJoin(int pid, int status)
// If the UserProcess of the child is null then we return 0
if (child.process == null) return 0;
child.userthread.join();
child.process.userthread.join();
children.remove(pid);
if (writeVirtualMemory(status, Lib.bytesFromInt(Processes.get(pid).currentStatus)) == 4 && Processes.get(pid).NormExit)
@@ -782,11 +789,11 @@ public int handleWrite(int fd, int buffer, int size) {
}
public int handleClose(int fd) {
<<<<<<< HEAD
// Check if the fd is not within valid range or if already null
=======
// check if the fd is out of bounds or if referencing a null file descriptor
>>>>>>> ceebffbd709aa8502fb7babb5e04b51ab050ace1
if(fd < 0 || fd > 15 || filedescriptors[fd] == null) return -1;
filedescriptors[fd].close();
@@ -885,6 +892,7 @@ protected int addFileDescriptor(OpenFile openfile) {
protected UThread userthread;
private int PID;
private UserProcess parent;
protected UThread thread;
private HashMap<Integer, ChildProcess> children = new HashMap<Integer, ChildProcess>();
// A Map of Child ids, this has the mapping of child ID -> Parent process
private static ArrayList<UserProcess> Processes = new ArrayList<UserProcess>();

0 comments on commit 711112c

Please sign in to comment.