From 5fde8e13ed4c7225ca2629e9bc081695f545a1e0 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Sun, 22 Jan 2012 18:49:04 +0100 Subject: [PATCH] Blocking systemcalls now return EBLOCKING instead of EWOULDBLOCK. EWOULDBLOCK is now used when it wanted to block, but didn't. --- libmaxsi/decl/errno_values.h | 1 + libmaxsi/error.cpp | 1 + sortix/io.cpp | 4 ++-- sortix/pipe.cpp | 4 ++-- sortix/process.cpp | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/libmaxsi/decl/errno_values.h b/libmaxsi/decl/errno_values.h index 2ed85153..d725d694 100644 --- a/libmaxsi/decl/errno_values.h +++ b/libmaxsi/decl/errno_values.h @@ -24,5 +24,6 @@ #define ECHILD 32 #define ENOSYS 33 #define ENOTSUP 34 +#define EBLOCKING 35 #endif diff --git a/libmaxsi/error.cpp b/libmaxsi/error.cpp index d74d2b0d..61391b23 100644 --- a/libmaxsi/error.cpp +++ b/libmaxsi/error.cpp @@ -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"; } } diff --git a/sortix/io.cpp b/sortix/io.cpp index 96396f0d..661f5ee0 100644 --- a/sortix/io.cpp +++ b/sortix/io.cpp @@ -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. diff --git a/sortix/pipe.cpp b/sortix/pipe.cpp index 1f48efc0..47de660a 100644 --- a/sortix/pipe.cpp +++ b/sortix/pipe.cpp @@ -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; } diff --git a/sortix/process.cpp b/sortix/process.cpp index 2b1ea27f..979b0070 100644 --- a/sortix/process.cpp +++ b/sortix/process.cpp @@ -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.