/** Number of bits to shift to get the page number (1<<<pageShift == pageSize) */
protected final int pageShift;
/** Bottom of region of memory allocated to the stack */
/** Number of bits to shift to get the page number (1<<<pageShift == pageSize) */
protected final int pageShift;
/** Bottom of region of memory allocated to the stack */
FD hostFSOpen(final File f, int flags, int mode, final Object data) throws ErrnoException {
if((flags & ~(3|O_CREAT|O_EXCL|O_APPEND|O_TRUNC)) != 0) {
FD hostFSOpen(final File f, int flags, int mode, final Object data) throws ErrnoException {
if((flags & ~(3|O_CREAT|O_EXCL|O_APPEND|O_TRUNC)) != 0) {
private int sys_write(int fdn, int addr, int count) throws FaultException, ErrnoException {
count = Math.min(count,MAX_CHUNK);
if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
if(fds[fdn] == null) return -EBADFD;
byte[] buf = byteBuf(count);
copyin(addr,buf,count);
private int sys_write(int fdn, int addr, int count) throws FaultException, ErrnoException {
count = Math.min(count,MAX_CHUNK);
if(fdn < 0 || fdn >= OPEN_MAX) return -EBADFD;
if(fds[fdn] == null) return -EBADFD;
byte[] buf = byteBuf(count);
copyin(addr,buf,count);
- return fds[fdn].write(buf,0,count);
+ try {
+ return fds[fdn].write(buf,0,count);
+ } catch(ErrnoException e) {
+ if(e.errno == EPIPE) sys_exit(128+13);
+ throw e;
+ }
try {
for(int i=start;i<end;i++) readPages[i] = writePages[i] = new int[pageWords];
} catch(OutOfMemoryError e) {
try {
for(int i=start;i<end;i++) readPages[i] = writePages[i] = new int[pageWords];
} catch(OutOfMemoryError e) {
try {
return _syscall(syscall,a,b,c,d);
} catch(ErrnoException e) {
try {
return _syscall(syscall,a,b,c,d);
} catch(ErrnoException e) {