Blocking systemcalls now return EBLOCKING instead of EWOULDBLOCK.

EWOULDBLOCK is now used when it wanted to block, but didn't.
This commit is contained in:
Jonas 'Sortie' Termansen 2012-01-22 18:49:04 +01:00
parent 9bcfdad174
commit 5fde8e13ed
5 changed files with 7 additions and 5 deletions

View File

@ -24,5 +24,6 @@
#define ECHILD 32
#define ENOSYS 33
#define ENOTSUP 34
#define EBLOCKING 35
#endif

View File

@ -72,6 +72,7 @@ namespace Maxsi
case ECHILD: return (char*) "No child processes";
case ENOSYS: return (char*) "Function not implemented";
case ENOTSUP: return (char*) "Operation not supported";
case EBLOCKING: return (char*) "Operation is blocking";
default: return (char*) "Unknown error condition";
}
}

View File

@ -58,7 +58,7 @@ namespace Sortix
if ( !stream->IsWritable() ) { Error::Set(EBADF); return -1; }
ssize_t written = stream->Write(buffer, count);
if ( 0 <= written ) { return written; }
if ( Error::Last() != EWOULDBLOCK ) { return -1; }
if ( Error::Last() != EBLOCKING ) { return -1; }
// The stream will resume our system call once progress has been
// made. Our request is certainly not forgotten.
@ -98,7 +98,7 @@ namespace Sortix
if ( !stream->IsReadable() ) { Error::Set(EBADF); return -1;}
ssize_t bytesread = stream->Read(buffer, count);
if ( 0 <= bytesread ) { return bytesread; }
if ( Error::Last() != EWOULDBLOCK ) { return -1; }
if ( Error::Last() != EBLOCKING ) { return -1; }
// The stream will resume our system call once progress has been
// made. Our request is certainly not forgotten.

View File

@ -93,7 +93,7 @@ namespace Sortix
return amount + Read(dest + amount, count - amount);
}
Error::Set(EWOULDBLOCK);
Error::Set(EBLOCKING);
readevent.Register();
return -1;
}
@ -115,7 +115,7 @@ namespace Sortix
return amount + Write(src + amount, count - amount);
}
Error::Set(EWOULDBLOCK);
Error::Set(EBLOCKING);
writeevent.Register();
return -1;
}

View File

@ -356,7 +356,7 @@ namespace Sortix
return SysExevVEStage2(state);
}
if ( Error::Last() != EWOULDBLOCK ) { delete state; return -1; }
if ( Error::Last() != EBLOCKING ) { delete state; return -1; }
// The stream will resume our system call once progress has been
// made. Our request is certainly not forgotten.