X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FMono.Posix%2FMono.Unix%2FUnixIOException.cs;h=fb8ca466a059807a0454b50144caa73c3f854a94;hb=ace29afea299c410e495c2b8fd11a28bbe51fec7;hp=0b8e2dd623c6abc4eff1214da149c84e98af13b4;hpb=0abc2e6270020edc4a5b4c66f93b4ae582815f20;p=mono.git diff --git a/mcs/class/Mono.Posix/Mono.Unix/UnixIOException.cs b/mcs/class/Mono.Posix/Mono.Unix/UnixIOException.cs index 0b8e2dd623c..fb8ca466a05 100644 --- a/mcs/class/Mono.Posix/Mono.Unix/UnixIOException.cs +++ b/mcs/class/Mono.Posix/Mono.Unix/UnixIOException.cs @@ -4,7 +4,7 @@ // Authors: // Jonathan Pryor (jonpryor@vt.edu) // -// (C) 2004 Jonathan Pryor +// (C) 2004-2005 Jonathan Pryor // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -37,30 +37,46 @@ namespace Mono.Unix { [Serializable] public class UnixIOException : IOException { + private int errno; + public UnixIOException () : this (Marshal.GetLastWin32Error()) {} - public UnixIOException (int error) + public UnixIOException (int errno) + : base (UnixMarshal.GetErrorDescription (Native.NativeConvert.ToErrno (errno))) { - this.error = error; + this.errno = errno; } - public UnixIOException (int error, Exception inner) - : base ("Unix-generated exception", inner) + public UnixIOException (int errno, Exception inner) + : base (UnixMarshal.GetErrorDescription (Native.NativeConvert.ToErrno (errno)), inner) + { + this.errno = errno; + } + + public UnixIOException (Native.Errno errno) + : base (UnixMarshal.GetErrorDescription (errno)) { - this.error = error; + this.errno = Native.NativeConvert.FromErrno (errno); } - public UnixIOException (Error error) + public UnixIOException (Native.Errno errno, Exception inner) + : base (UnixMarshal.GetErrorDescription (errno), inner) { - this.error = UnixConvert.FromError (error); + this.errno = Native.NativeConvert.FromErrno (errno); } - public UnixIOException (Error error, Exception inner) - : base ("Unix-generated exception", inner) + public UnixIOException (string message) + : base (message) { - this.error = UnixConvert.FromError (error); + this.errno = 0; + } + + public UnixIOException (string message, Exception inner) + : base (message, inner) + { + this.errno = 0; } protected UnixIOException (SerializationInfo info, StreamingContext context) @@ -69,18 +85,11 @@ namespace Mono.Unix { } public int NativeErrorCode { - get {return error;} + get {return errno;} } - public Error ErrorCode { - get {return UnixConvert.ToError (error);} - } - - private int error; - - public override string ToString () - { - return UnixMarshal.GetErrorDescription (ErrorCode); + public Native.Errno ErrorCode { + get {return Native.NativeConvert.ToErrno (errno);} } } }