Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

1493 lines
64 KiB
XML

<Type Name="UnixMarshal" FullName="Mono.Unix.UnixMarshal">
<TypeSignature Language="C#" Value="public sealed class UnixMarshal" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit UnixMarshal extends System.Object" />
<AssemblyInfo>
<AssemblyName>Mono.Posix</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ThreadingSafetyStatement>This type is safe for multithreaded operations.</ThreadingSafetyStatement>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>
Provides a collection of miscellaneous methods for marshaling strings,
allocating memory, and interoperating with the operating system.
</summary>
<remarks>
<para>
The <b>UnixMarshal</b> class consists of many members to facilitate
the <see cref="T:System.Runtime.InteropServices.Marshal" /> class,
specifically for use with Unix.
</para>
<para>
The following table assigns each method to a category that describes
its usage:
</para>
<list type="table">
<listheader>
<term>Category</term>
<description>Members</description>
</listheader>
<item>
<term>Data Transformation</term>
<description>
<para>
Managed to unmanaged:
<see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />,
</para>
<para>
Unmanaged to managed:
<see cref="M:Mono.Unix.UnixMarshal.PtrToString" />,
<see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" />,
<see cref="M:Mono.Unix.UnixMarshal.PtrToStringUnix" /></para>
</description>
</item>
<item>
<term>Error Handling</term>
<description>
<see cref="M:Mono.Unix.UnixMarshal.GetErrorDescription" />,
<see cref="M:Mono.Unix.UnixMarshal.ShouldRetrySyscall" />,
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" />,
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForErrorIf" />,
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForLastError" />,
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf" /></description>
</item>
<item>
<term>Memory Management</term>
<description>
<see cref="M:Mono.Unix.UnixMarshal.AllocHeap" />,
<see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />,
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /></description>
</item>
</list>
</remarks>
</Docs>
<Members>
<Member MemberName="AllocHeap">
<MemberSignature Language="C#" Value="public static IntPtr AllocHeap (long size);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int AllocHeap(int64 size) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="size" Type="System.Int64" />
</Parameters>
<Docs>
<param name="size">
A <see cref="T:System.Int64" /> containing the number of bytes to
allocate on the system heap.
</param>
<summary>Allocates <paramref name="size" /> bytes from the system heap.</summary>
<returns>
A <see cref="T:System.IntPtr" /> containing the address of
<paramref name="size" /> bytes on the system heap, or
<see cref="F:System.IntPtr.Zero" /> if the memory could not be
allocated.
</returns>
<remarks>
<para>
The "system heap" is where dynamic memory is allocated by the
runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
Unix platforms.
</para>
<para>
The memory allocated by this function must be freed via
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="size" /> is a negative value.
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
<altmember cref="M:Mono.Unix.Native.Stdlib.malloc" />
</Docs>
</Member>
<Member MemberName="FreeHeap">
<MemberSignature Language="C#" Value="public static void FreeHeap (IntPtr ptr);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void FreeHeap(native int ptr) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="ptr" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="ptr">
A <see cref="T:System.IntPtr" /> containing the address of a block
of memory previously returned by
<see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or
<see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />.
</param>
<summary>Frees the memory referenced by <paramref name="ptr" />.</summary>
<remarks>
<para>
If <paramref name="ptr" /> is <see cref="F:System.IntPtr.Zero" />,
no action occurs.
</para>
<para>
The "system heap" is where dynamic memory is allocated by the
runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
Unix platforms.
</para>
</remarks>
<altmember cref="M:Mono.Unix.UnixMarshal.AllocHeap" />
<altmember cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />
<altmember cref="M:Mono.Unix.Native.Stdlib.free" />
</Docs>
</Member>
<Member MemberName="GetErrorDescription">
<MemberSignature Language="C#" Value="public static string GetErrorDescription (Mono.Unix.Native.Errno errno);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetErrorDescription(valuetype Mono.Unix.Native.Errno errno) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
</Parameters>
<Docs>
<param name="errno">
A <see cref="T:Mono.Unix.Native.Errno" /> containing the error code
to get the description for.
</param>
<summary>Gets a description for the error code <paramref name="errno" />.</summary>
<returns>
A <see cref="T:System.String" /> containing a description of the
specified error code <paramref name="errno" />.
</returns>
<remarks>
<para>
If <paramref name="errno" /> isn't a valid error number or isn't
supported by the operating system, then the string
"<c>** Unknown error code: <paramref name="errno" />**</c>" is
returned.
</para>
</remarks>
<altmember cref="M:Mono.Unix.Native.Stdlib.strerror" />
<altmember cref="M:Mono.Unix.Native.Syscall.strerror_r" />
</Docs>
</Member>
<Member MemberName="PtrToString">
<MemberSignature Language="C#" Value="public static string PtrToString (IntPtr p);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToString(native int p) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="p" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="p">
A <see cref="T:System.IntPtr" /> containing the address of an
unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
encoding.
</param>
<summary>
Allocates a managed <see cref="T:System.String" /> and marshals the
unmanaged string into the managed string.
</summary>
<returns>
A <see cref="T:System.String" /> containing a copy of the unmanaged
string <paramref name="p" />, or <see langword="null" /> if
<paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
</returns>
<remarks>
<para>
The input string <paramref name="p" /> must have a terminating
null <c>0x00</c> byte.
</para>
<para>
This method is identical to
<see cref="M:Mono.Unix.UnixMarshal.PtrToString" />(<paramref name="p" />,
<see cref="F:Mono.Unix.UnixEncoding.Instance" />).
</para>
</remarks>
<altmember cref="M:Mono.Unix.UnixMarshal.PtrToStringUnix" />
</Docs>
</Member>
<Member MemberName="PtrToString">
<MemberSignature Language="C#" Value="public static string PtrToString (IntPtr p, System.Text.Encoding encoding);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToString(native int p, class System.Text.Encoding encoding) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="p" Type="System.IntPtr" />
<Parameter Name="encoding" Type="System.Text.Encoding" />
</Parameters>
<Docs>
<param name="p">
A <see cref="T:System.IntPtr" /> containing the address of an
unmanaged string in the <paramref name="encoding" />
encoding.
</param>
<param name="encoding">
A <see cref="T:System.Text.Encoding" /> specifying which encoding
<paramref name="p" /> is in.
</param>
<summary>
Allocates a managed <see cref="T:System.String" /> and marshals the
unmanaged string into the managed string using the specified
encoding.
</summary>
<returns>
A <see cref="T:System.String" /> containing a copy of the unmanaged
string <paramref name="p" />, or <see langword="null" /> if
<paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
</returns>
<remarks>
<para>
The input string <paramref name="p" /> must have a terminating
null. The definition of "terminating null" is fluid in this
context, since the size of a terminating null depends upon the
encoding specified.
</para>
<para>
A terminating null is a single byte containing the value
<c>0x00</c> if <paramref name="encoding" /> is one of the
following encodings:
<see cref="T:System.Text.ASCIIEncoding" />,
<see cref="T:System.Text.UTF8Encoding" />,
<see cref="T:System.Text.UTF7Encoding" />, or
<see cref="T:Mono.Unix.UnixEncoding" />.
</para>
<para>
A terminating null is the <see cref="T:System.Int16" /> value
<c>0x0000</c> if <paramref name="encoding" /> is
<see cref="T:System.Text.UnicodeEncoding" />.
</para>
<para>
Otherwise, the terminating null must consist of a sequence of
<see cref="M:System.Text.Encoding.GetMaxByteCount" />(1) bytes
having the value <c>0x00</c>.
<block subset="none" type="note">
This potentially plays havoc with multi-byte encodings, as many
multi-byte encodings would only use a single byte for the
terminating null, and not the maximum possible number of bytes
used for encoding any character to be used for the terminating
null.
</block></para>
<para>
Any buffer returned by
<see cref="M:Mono.Unix.UnixMarshal.StringToHeap" /> will satisfy
this requirement.
</para>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="encoding" /> is <see langword="null" />.
</exception>
</Docs>
</Member>
<Member MemberName="PtrToStringArray">
<MemberSignature Language="C#" Value="public static string[] PtrToStringArray (IntPtr stringArray);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(native int stringArray) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="stringArray" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="stringArray">
A <see cref="T:System.IntPtr" /> containing a
<c><see cref="T:System.Byte" />**</c> array
which follows the ANSI C rules for the <c>argv</c> argument passed
to <c>main</c>.
</param>
<summary>
Allocates a <see cref="T:System.String" /> array and unmarshals the
unmanaged string array into a managed string array.
</summary>
<returns>
A <see cref="T:System.String" /> array containing all the strings in
the unmanaged string array. If <paramref name="stringArray" /> is
<see cref="F:System.IntPtr.Zero" />, a string array containing zero
elements is returned.
</returns>
<remarks>
<para>
This is identical to calling
<see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" />(<paramref name="stringArray" />,
<see cref="F:Mono.Unix.UnixEncoding.Instance" />).
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="PtrToStringArray">
<MemberSignature Language="C#" Value="public static string[] PtrToStringArray (int count, IntPtr stringArray);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(int32 count, native int stringArray) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="count" Type="System.Int32" />
<Parameter Name="stringArray" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="count">
A <see cref="T:System.Int32" /> containing the number of strings in
<paramref name="stringArray" />.
</param>
<param name="stringArray">
A <see cref="T:System.IntPtr" /> containing a
<c><see cref="T:System.Byte" />**</c> array.
</param>
<summary>
Allocates a <see cref="T:System.String" /> array and unmarshals the
unmanaged string array into a managed string array.
</summary>
<returns>
A <see cref="T:System.String" /> array containing
<paramref name="count" /> strings from the
unmanaged string array <paramref name="stringArray" />.
If <paramref name="stringArray" /> is
<see cref="F:System.IntPtr.Zero" />, a string array containing zero
elements is returned.
</returns>
<remarks>
<para>
This method is identical to
<see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" /> (<paramref name="count" />, <paramref name="stringArray" />,
<see cref="F:Mono.Unix.UnixEncoding.Instance" />).
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="PtrToStringArray">
<MemberSignature Language="C#" Value="public static string[] PtrToStringArray (IntPtr stringArray, System.Text.Encoding encoding);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(native int stringArray, class System.Text.Encoding encoding) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="stringArray" Type="System.IntPtr" />
<Parameter Name="encoding" Type="System.Text.Encoding" />
</Parameters>
<Docs>
<param name="stringArray">
A <see cref="T:System.IntPtr" /> containing a
<c><see cref="T:System.Byte" />**</c> array
which follows the ANSI C rules for the <c>argv</c> argument passed
to <c>main</c>.
</param>
<param name="encoding">
A <see cref="System.Text.Encoding" /> specifying the encoding of the
unmanaged strings within <paramref name="stringArray" />.
</param>
<summary>
Allocates a <see cref="T:System.String" /> array and unmarshals the
unmanaged string array into a managed string array using the
specified encoding.
</summary>
<returns>
A <see cref="T:System.String" /> array containing all the strings in
the unmanaged string array. If <paramref name="stringArray" /> is
<see cref="F:System.IntPtr.Zero" />, a string array containing zero
elements is returned.
</returns>
<remarks>
<para>
<paramref name="stringArray" /> is assumed to be a <c>C</c><c>char**</c> pointer containing a terminating
<see cref="F:System.IntPtr.Zero" /> pointer to designate the end
of the array. This follows the requirements for <c>argv</c> in
the ANSI C <c>main</c> function declaration.
</para>
<code lang="C">static const char*
stringArray[] = {
"string 1",
"string 2",
NULL
};
</code>
<para>
The final null string will not be returned from this method; the
above <b>stringArray</b> declaration would create an array
containing two elements if passed through this method.
</para>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="encoding" /> is <see langword="null" />.
</exception>
</Docs>
</Member>
<Member MemberName="PtrToStringArray">
<MemberSignature Language="C#" Value="public static string[] PtrToStringArray (int count, IntPtr stringArray, System.Text.Encoding encoding);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(int32 count, native int stringArray, class System.Text.Encoding encoding) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="count" Type="System.Int32" />
<Parameter Name="stringArray" Type="System.IntPtr" />
<Parameter Name="encoding" Type="System.Text.Encoding" />
</Parameters>
<Docs>
<param name="count">
A <see cref="T:System.Int32" /> containing the number of strings in
<paramref name="stringArray" />.
</param>
<param name="stringArray">
A <see cref="T:System.IntPtr" /> containing a
<c><see cref="T:System.Byte" />**</c> array.
</param>
<param name="encoding">
A <see cref="System.Text.Encoding" /> specifying the encoding of the
unmanaged strings within <paramref name="stringArray" />.
</param>
<summary>
Allocates a <see cref="T:System.String" /> array and unmarshals the
unmanaged string array into a managed string array using the
specified encoding.
</summary>
<returns>
A <see cref="T:System.String" /> array containing
<paramref name="count" /> strings from the
unmanaged string array <paramref name="stringArray" />.
If <paramref name="stringArray" /> is
<see cref="F:System.IntPtr.Zero" />, a string array containing zero
elements is returned.
</returns>
<remarks>
<para>
No validation is done to ensure that the pointers for embedded
strings are valid. This could result in an access violation or
corrupted strings if you're not careful. Embedded null pointers
will become <see langword="null" /> strings within the returned
array.
</para>
<para>
The difference between this method and
<see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray(System.IntPtr,System.Text.Encoding)" />
is that this method doesn't require a terminating null pointer.
</para>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="encoding" /> is <see langword="null" />.
</exception>
</Docs>
</Member>
<Member MemberName="PtrToStringUnix">
<MemberSignature Language="C#" Value="public static string PtrToStringUnix (IntPtr p);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToStringUnix(native int p) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="p" Type="System.IntPtr" />
</Parameters>
<Docs>
<param name="p">
A <see cref="T:System.IntPtr" /> containing the address of an
unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
encoding.
</param>
<summary>
Allocates a managed <see cref="T:System.String" /> and marshals the
unmanaged string into the managed string using the
<see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</summary>
<returns>
A <see cref="T:System.String" /> containing a copy of the unmanaged
string <paramref name="p" />, or <see langword="null" /> if
<paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
</returns>
<remarks>
<para>
The input string <paramref name="p" /> must have a terminating
null <c>0x00</c> byte.
</para>
<para>
This is an optimized version of
<see cref="M:Mono.Unix.UnixMarshal.PtrToString(System.IntPtr)" />
for the <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="ReAllocHeap">
<MemberSignature Language="C#" Value="public static IntPtr ReAllocHeap (IntPtr ptr, long size);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int ReAllocHeap(native int ptr, int64 size) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="ptr" Type="System.IntPtr" />
<Parameter Name="size" Type="System.Int64" />
</Parameters>
<Docs>
<param name="ptr">
A <see cref="T:System.IntPtr" /> containing the address of the
memory block to resize. This value must either be
<see cref="F:System.IntPtr.Zero" /> or a value previously returned
by <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or
<see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />.
</param>
<param name="size">
A <see cref="T:System.Int64" /> containing the number of bytes to
allocate on the system heap.
</param>
<summary>
Changes the size of the memory block <paramref name="ptr" /> to
refer to <paramref name="size" /> bytes of memory on the system
heap.
</summary>
<returns>
<para>
A <see cref="T:System.IntPtr" /> containing the address of
<paramref name="size" /> bytes on the system heap, or
<see cref="F:System.IntPtr.Zero" /> if the memory could not be
allocated.
</para>
<block subset="none" type="note">
If <see cref="F:System.IntPtr.Zero" /> is returned,
<paramref name="ptr" /> is still a valid memory address, and must
still be freed.
</block>
</returns>
<remarks>
<para>
This function changes the size of the previously allocated memory
referenced by <paramref name="ptr" /> to <paramref name="size" />
bytes. <paramref name="ptr" />
must have been previously allocated via
<see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or
<see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />, or
<paramref name="ptr" /> must be the
value <see cref="F:System.IntPtr.Zero" /> (in which case this
method is identical to
<see cref="M:Mono.Unix.UnixMarshal.AllocHeap" />).
The contents of the memory are unchanged up to the lesser
of the new and old sizes. If the new size is larger, the value of
the newly allocated portion of the memory is undefined.
</para>
<para>
The memory allocated by this function must be freed via
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
<block subset="none" type="note">
<para>
If the requested memory cannot be allocated,
<see cref="F:System.IntPtr.Zero" /> is returned and
the memory referenced by <paramref name="ptr" /> is valid and
unchanged.
</para>
<para>
If memory can be allocated, the memory referenced by
<paramref name="ptr" /> is freed and a pointer to the
newly allocated memory is returned. Note that this may be
different from the value passed as <paramref name="ptr" />.
</para>
</block>
<para>
The "system heap" is where dynamic memory is allocated by the
runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
Unix platforms.
</para>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="size" /> is a negative value.
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
<altmember cref="M:Mono.Unix.Native.Stdlib.realloc" />
</Docs>
</Member>
<Member MemberName="ShouldRetrySyscall">
<MemberSignature Language="C#" Value="public static bool ShouldRetrySyscall (int r);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ShouldRetrySyscall(int32 r) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="r" Type="System.Int32" />
</Parameters>
<Docs>
<param name="r">
A <see cref="T:System.Int32" /> containing the return value of a
method from <see cref="T:Mono.Unix.Native.Syscall" />.
</param>
<summary>
Returns a <see cref="T:System.Boolean" /> indicating whether a
system call should be retried.
</summary>
<returns>
Returns <see langword="true" /> if <paramref name="r" /> is
<c>-1</c> and <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
returns <see cref="F:Mono.Unix.Native.Errno.EINTR" />.
Otherwise, <see langword="false" /> is returned.
</returns>
<remarks>
<para>
System calls may need to be restarted for a variety of reasons,
generally explained within the system call documentation. The
most typical reason is that the system call was interrupted, and
the caller is expected to re-invoke the system call to complete
the operation.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="ShouldRetrySyscall">
<MemberSignature Language="C#" Value="public static bool ShouldRetrySyscall (int r, out Mono.Unix.Native.Errno errno);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ShouldRetrySyscall(int32 r, valuetype Mono.Unix.Native.Errno errno) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="r" Type="System.Int32" />
<Parameter Name="errno" Type="Mono.Unix.Native.Errno&amp;" RefType="out" />
</Parameters>
<Docs>
<param name="r">
A <see cref="T:System.Int32" /> containing the return value of a
method from <see cref="T:Mono.Unix.Native.Syscall" />.
</param>
<param name="errno">
A reference to a <see cref="T:Mono.Unix.Native.Errno" /> variable
which will capture the last error value.
</param>
<summary>
Returns a <see cref="T:System.Boolean" /> indicating whether a
system call should be retried, saving the last error value for later
processing.
</summary>
<returns>
Returns <see langword="true" /> if <paramref name="r" /> is
<c>-1</c> and <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
returns <see cref="F:Mono.Unix.Native.Errno.EINTR" />, in which case
<paramref name="errno" /> will have the value
<see cref="F:Mono.Unix.Native.Errno.EINTR" />.
Otherwise, <see langword="false" /> is returned, and
<paramref name="errno" /> will store the value from the call to
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />.
</returns>
<remarks>
<para>
System calls may need to be restarted for a variety of reasons,
generally explained within the system call documentation. The
most typical reason is that the system call was interrupted, and
the caller is expected to re-invoke the system call to complete
the operation.
</para>
<para>
This method saves the last error value returned from
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> into the
<paramref name="errno" /> parameter.
</para>
</remarks>
</Docs>
</Member>
<Member MemberName="StringToHeap">
<MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
</Parameters>
<Docs>
<param name="s">
A <see cref="T:System.String" /> to copy into the system heap.
</param>
<summary>
Allocates a copy of <paramref name="s" /> on the system heap in the
<see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</summary>
<returns>
A <see cref="T:System.IntPtr" /> containing a pointer on the system
heap containing the marshaled string. If <paramref name="s" /> is
<see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
returned.
</returns>
<remarks>
<para>
The pointer returned should be freed with
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
<para>
This is identical to
<see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />,
<see cref="F:Mono.Unix.UnixMarshal.Instance" />).
</para>
</remarks>
<exception cref="T:System.NotSupportedException">
There was an error marshaling <paramref name="s" /> into the
<see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
Unable to allocate enough memory for the marshaled string.
[<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
</Docs>
</Member>
<Member MemberName="StringToHeap">
<MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, System.Text.Encoding encoding);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, class System.Text.Encoding encoding) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
<Parameter Name="encoding" Type="System.Text.Encoding" />
</Parameters>
<Docs>
<param name="s">
A <see cref="T:System.String" /> to copy into the system heap.
</param>
<param name="encoding">
A <see cref="T:System.Text.Encoding" /> specifying which encoding to
marshal the string into.
</param>
<summary>
Allocates a copy of <paramref name="s" /> on the system heap in the
<paramref name="encoding" /> encoding.
</summary>
<returns>
A <see cref="T:System.IntPtr" /> containing a pointer on the system
heap containing the marshaled string. If <paramref name="s" /> is
<see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
returned.
</returns>
<remarks>
<para>
The pointer returned should be freed with
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
<para>
This is identical to
<see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, 0, <i>s.Length</i>,
<see cref="F:Mono.Unix.UnixMarshal.Instance" />).
</para>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="encoding" /> is <see langword="null" />.
</exception>
<exception cref="T:System.NotSupportedException">
There was an error marshaling <paramref name="s" /> into the
specified encoding <paramref name="encoding" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
Unable to allocate enough memory for the marshaled string.
[<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
</Docs>
</Member>
<Member MemberName="StringToHeap">
<MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, int index, int count);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, int32 index, int32 count) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
</Parameters>
<Docs>
<param name="s">
A <see cref="T:System.String" /> to copy into the system heap.
</param>
<param name="index">
A <see cref="T:System.Int32" /> containing the start index into
<paramref name="s" /> to start marshaling.
</param>
<param name="count">
A <see cref="T:System.Int32" /> containing the number of characters
to marshal from <paramref name="s" /> starting at index
<paramref name="index" />.
</param>
<summary>
Allocates a copy of <paramref name="s" /> on the system heap in the
<see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</summary>
<returns>
A <see cref="T:System.IntPtr" /> containing a pointer on the system
heap containing the marshaled string. If <paramref name="s" /> is
<see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
returned.
</returns>
<remarks>
<para>
The pointer returned should be freed with
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
<para>
This is identical to
<see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, <paramref name="count" />,
<paramref name="index" />,
<see cref="F:Mono.Unix.UnixMarshal.Instance" />).
</para>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">
<para>
<paramref name="count" /> or <paramref name="index" /> is less
than zero.
</para>
<para>-or-</para>
<para>
<paramref name="index" /> plus <paramref name="count" /> is
greater than the length of <paramref name="s" />.
</para>
</exception>
<exception cref="T:System.NotSupportedException">
There was an error marshaling <paramref name="s" /> into the
<see cref="T:Mono.Unix.UnixEncoding" /> encoding.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
Unable to allocate enough memory for the marshaled string.
[<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
</Docs>
</Member>
<Member MemberName="StringToHeap">
<MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, int index, int count, System.Text.Encoding encoding);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, int32 index, int32 count, class System.Text.Encoding encoding) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="s" Type="System.String" />
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="count" Type="System.Int32" />
<Parameter Name="encoding" Type="System.Text.Encoding" />
</Parameters>
<Docs>
<param name="s">
A <see cref="T:System.String" /> to copy into the system heap.
</param>
<param name="index">
A <see cref="T:System.Int32" /> containing the start index into
<paramref name="s" /> to start marshaling.
</param>
<param name="count">
A <see cref="T:System.Int32" /> containing the number of characters
to marshal from <paramref name="s" /> starting at index
<paramref name="index" />.
</param>
<param name="encoding">
A <see cref="T:System.Text.Encoding" /> specifying which encoding to
marshal the string into.
</param>
<summary>
Allocates a copy of <paramref name="s" /> on the system heap in the
<paramref name="encoding" /> encoding.
</summary>
<returns>
A <see cref="T:System.IntPtr" /> containing a pointer on the system
heap containing the marshaled string. If <paramref name="s" /> is
<see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
returned.
</returns>
<remarks>
<para>
The pointer returned should be freed with
<see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
leak.
</para>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="encoding" /> is <see langword="null" />.
</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<para>
<paramref name="count" /> or <paramref name="index" /> is less
than zero.
</para>
<para>-or-</para>
<para>
<paramref name="index" /> plus <paramref name="count" /> is
greater than the length of <paramref name="s" />.
</para>
</exception>
<exception cref="T:System.NotSupportedException">
There was an error marshaling <paramref name="s" /> into the
specified encoding <paramref name="encoding" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
Unable to allocate enough memory for the marshaled string.
[<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
</exception>
<altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
</Docs>
</Member>
<Member MemberName="ThrowExceptionForError">
<MemberSignature Language="C#" Value="public static void ThrowExceptionForError (Mono.Unix.Native.Errno errno);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForError(valuetype Mono.Unix.Native.Errno errno) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
</Parameters>
<Docs>
<param name="errno">
A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
to throw.
</param>
<summary>
Throws an exception that best matches <paramref name="errno" />.
</summary>
<remarks>
<para>
This method translates <paramref name="errno" /> into its closest
matching exception type, and throws the exception.
</para>
<para>
If the exception thrown is not a
<see cref="T:Mono.Unix.UnixIOException" />, then the exception's
<see cref="P:System.Exception.InnerException" /> property will
be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
wrapping <paramref name="errno" />, if possible.
<block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
have its
<see cref="P:System.Exception.InnerException" /> property set, as
<see cref="T:System.ArgumentOutOfRangeException" /> does not
provide a constructor that sets this property.
</block></para>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
<see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
</exception>
<exception cref="T:System.InvalidOperationException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
<see cref="F:Mono.Unix.Native.Errno.EPERM" />.
</exception>
<exception cref="T:System.InvalidProgramException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
</exception>
<exception cref="T:System.NullReferenceException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
</exception>
<exception cref="T:System.OverflowException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
</exception>
<exception cref="T:System.UnauthorizedAccessException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
<see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
</exception>
<exception cref="T:System.IO.FileNotFoundException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
</exception>
<exception cref="T:System.IO.IOException">
<paramref name="errno" />
is one of:
<see cref="F:Mono.Unix.Native.Errno.EIO" />,
<see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
<see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
<see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
<see cref="F:Mono.Unix.Native.Errno.EROFS" />,
<see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
</exception>
<exception cref="T:System.IO.PathTooLongException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
<paramref name="errno" /> is not any of the above error values.
</exception>
</Docs>
</Member>
<Member MemberName="ThrowExceptionForErrorIf">
<MemberSignature Language="C#" Value="public static void ThrowExceptionForErrorIf (int retval, Mono.Unix.Native.Errno errno);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForErrorIf(int32 retval, valuetype Mono.Unix.Native.Errno errno) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.CLSCompliant(false)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="retval" Type="System.Int32" />
<Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
</Parameters>
<Docs>
<param name="retval">
A <see cref="T:System.Int32" /> containing the return value of a
method from <see cref="T:Mono.Unix.Native.Syscall" />.
</param>
<param name="errno">
A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
to throw.
</param>
<summary>
Throws an exception that best matches <paramref name="errno" />
if <paramref name="retval" /> is <c>-1</c>.
</summary>
<remarks>
<para>
If <paramref name="retval" /> is <c>-1</c>, then this method is
equivalent to calling
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<paramref name="errno" />).
Otherwise, nothing is done.
</para>
<para>
If the exception thrown is not a
<see cref="T:Mono.Unix.UnixIOException" />, then the exception's
<see cref="P:System.Exception.InnerException" /> property will
be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
wrapping <paramref name="errno" />, if possible.
<block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
have its
<see cref="P:System.Exception.InnerException" /> property set, as
<see cref="T:System.ArgumentOutOfRangeException" /> does not
provide a constructor that sets this property.
</block></para>
</remarks>
<exception cref="T:System.ArgumentException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
<see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
</exception>
<exception cref="T:System.InvalidOperationException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
<see cref="F:Mono.Unix.Native.Errno.EPERM" />.
</exception>
<exception cref="T:System.InvalidProgramException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
</exception>
<exception cref="T:System.NullReferenceException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
</exception>
<exception cref="T:System.OverflowException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
</exception>
<exception cref="T:System.UnauthorizedAccessException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
<see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
</exception>
<exception cref="T:System.IO.FileNotFoundException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
</exception>
<exception cref="T:System.IO.IOException">
<paramref name="errno" />
is one of:
<see cref="F:Mono.Unix.Native.Errno.EIO" />,
<see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
<see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
<see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
<see cref="F:Mono.Unix.Native.Errno.EROFS" />,
<see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
</exception>
<exception cref="T:System.IO.PathTooLongException">
<paramref name="errno" />
is
<see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
<paramref name="errno" /> is not any of the above error values.
</exception>
</Docs>
</Member>
<Member MemberName="ThrowExceptionForLastError">
<MemberSignature Language="C#" Value="public static void ThrowExceptionForLastError ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForLastError() cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>
Throws an exception that best matches the last error returned
from <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />.
</summary>
<remarks>
<para>
This is equivalent to calling
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> ()).
</para>
<para>
If the exception thrown is not a
<see cref="T:Mono.Unix.UnixIOException" />, then the exception's
<see cref="P:System.Exception.InnerException" /> property will
be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
wrapping <paramref name="errno" />, if possible.
<block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
have its
<see cref="P:System.Exception.InnerException" /> property set, as
<see cref="T:System.ArgumentOutOfRangeException" /> does not
provide a constructor that sets this property.
</block></para>
</remarks>
<exception cref="T:System.ArgumentException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
<see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
</exception>
<exception cref="T:System.InvalidOperationException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
<see cref="F:Mono.Unix.Native.Errno.EPERM" />.
</exception>
<exception cref="T:System.InvalidProgramException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
</exception>
<exception cref="T:System.NullReferenceException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
</exception>
<exception cref="T:System.OverflowException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
</exception>
<exception cref="T:System.UnauthorizedAccessException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
<see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
</exception>
<exception cref="T:System.IO.FileNotFoundException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
</exception>
<exception cref="T:System.IO.IOException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is one of:
<see cref="F:Mono.Unix.Native.Errno.EIO" />,
<see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
<see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
<see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
<see cref="F:Mono.Unix.Native.Errno.EROFS" />,
<see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
</exception>
<exception cref="T:System.IO.PathTooLongException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is not any of the above error values.
</exception>
</Docs>
</Member>
<Member MemberName="ThrowExceptionForLastErrorIf">
<MemberSignature Language="C#" Value="public static void ThrowExceptionForLastErrorIf (int retval);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForLastErrorIf(int32 retval) cil managed" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="retval" Type="System.Int32" />
</Parameters>
<Docs>
<param name="retval">
A <see cref="T:System.Int32" /> containing the return value of a
method from <see cref="T:Mono.Unix.Native.Syscall" />.
</param>
<summary>
Throws an exception that best matches the last error returned
from <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> if
<paramref name="retval" /> is <c>-1</c>.
</summary>
<remarks>
<para>
If <paramref name="retval" /> is <c>-1</c>, then this method is
equivalent to calling
<see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> ()).
Otherwise, nothing is done.
</para>
<para>
If the exception thrown is not a
<see cref="T:Mono.Unix.UnixIOException" />, then the exception's
<see cref="P:System.Exception.InnerException" /> property will
be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
wrapping <paramref name="errno" />, if possible.
<block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
have its
<see cref="P:System.Exception.InnerException" /> property set, as
<see cref="T:System.ArgumentOutOfRangeException" /> does not
provide a constructor that sets this property.
</block></para>
</remarks>
<exception cref="T:System.ArgumentException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
<see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
</exception>
<exception cref="T:System.ArgumentOutOfRangeException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
</exception>
<exception cref="T:System.InvalidOperationException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
<see cref="F:Mono.Unix.Native.Errno.EPERM" />.
</exception>
<exception cref="T:System.InvalidProgramException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
</exception>
<exception cref="T:System.NullReferenceException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
</exception>
<exception cref="T:System.OverflowException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
</exception>
<exception cref="T:System.UnauthorizedAccessException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
<see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
</exception>
<exception cref="T:System.IO.DirectoryNotFoundException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
</exception>
<exception cref="T:System.IO.FileNotFoundException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
</exception>
<exception cref="T:System.IO.IOException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is one of:
<see cref="F:Mono.Unix.Native.Errno.EIO" />,
<see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
<see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
<see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
<see cref="F:Mono.Unix.Native.Errno.EROFS" />,
<see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
</exception>
<exception cref="T:System.IO.PathTooLongException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is
<see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
</exception>
<exception cref="T:Mono.Unix.UnixIOException">
<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
is not any of the above error values.
</exception>
</Docs>
</Member>
</Members>
</Type>