Merge pull request #409 from Alkarex/patch-1
[mono.git] / mcs / class / Mono.Posix / Documentation / en / Mono.Unix / UnixMarshal.xml
1 <Type Name="UnixMarshal" FullName="Mono.Unix.UnixMarshal">
2   <TypeSignature Language="C#" Value="public sealed class UnixMarshal" />
3   <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit UnixMarshal extends System.Object" />
4   <AssemblyInfo>
5     <AssemblyName>Mono.Posix</AssemblyName>
6     <AssemblyVersion>1.0.5000.0</AssemblyVersion>
7     <AssemblyVersion>2.0.0.0</AssemblyVersion>
8     <AssemblyVersion>4.0.0.0</AssemblyVersion>
9   </AssemblyInfo>
10   <ThreadingSafetyStatement>This type is safe for multithreaded operations.</ThreadingSafetyStatement>
11   <Base>
12     <BaseTypeName>System.Object</BaseTypeName>
13   </Base>
14   <Interfaces />
15   <Docs>
16     <summary>
17       Provides a collection of miscellaneous methods for marshaling strings,
18       allocating memory, and interoperating with the operating system.
19     </summary>
20     <remarks>
21       <para>
22         The <b>UnixMarshal</b> class consists of many members to facilitate
23         the <see cref="T:System.Runtime.InteropServices.Marshal" /> class,
24         specifically for use with Unix.
25       </para>
26       <para>
27         The following table assigns each method to a category that describes
28         its usage:
29       </para>
30       <list type="table">
31         <listheader>
32           <term>Category</term>
33           <description>Members</description>
34         </listheader>
35         <item>
36           <term>Data Transformation</term>
37           <description>
38             <para>
39               Managed to unmanaged:
40               <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />,
41             </para>
42             <para>
43               Unmanaged to managed:
44               <see cref="M:Mono.Unix.UnixMarshal.PtrToString" />,
45               <see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" />,
46               <see cref="M:Mono.Unix.UnixMarshal.PtrToStringUnix" /></para>
47           </description>
48         </item>
49         <item>
50           <term>Error Handling</term>
51           <description>
52             <see cref="M:Mono.Unix.UnixMarshal.GetErrorDescription" />,
53             <see cref="M:Mono.Unix.UnixMarshal.ShouldRetrySyscall" />,
54             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" />,
55             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForErrorIf" />,
56             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForLastError" />,
57             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForLastErrorIf" /></description>
58         </item>
59         <item>
60           <term>Memory Management</term>
61           <description>
62             <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" />,
63             <see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />,
64             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /></description>
65         </item>
66       </list>
67     </remarks>
68   </Docs>
69   <Members>
70     <Member MemberName="AllocHeap">
71       <MemberSignature Language="C#" Value="public static IntPtr AllocHeap (long size);" />
72       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int AllocHeap(int64 size) cil managed" />
73       <MemberType>Method</MemberType>
74       <AssemblyInfo>
75         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
76         <AssemblyVersion>2.0.0.0</AssemblyVersion>
77         <AssemblyVersion>4.0.0.0</AssemblyVersion>
78       </AssemblyInfo>
79       <ReturnValue>
80         <ReturnType>System.IntPtr</ReturnType>
81       </ReturnValue>
82       <Parameters>
83         <Parameter Name="size" Type="System.Int64" />
84       </Parameters>
85       <Docs>
86         <param name="size">
87           A <see cref="T:System.Int64" /> containing the number of bytes to
88           allocate on the system heap.
89         </param>
90         <summary>Allocates <paramref name="size" /> bytes from the system heap.</summary>
91         <returns>
92           A <see cref="T:System.IntPtr" /> containing the address of 
93           <paramref name="size" /> bytes on the system heap, or
94           <see cref="F:System.IntPtr.Zero" /> if the memory could not be
95           allocated.
96         </returns>
97         <remarks>
98           <para>
99             The "system heap" is where dynamic memory is allocated by the
100             runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
101             Unix platforms.
102           </para>
103           <para>
104             The memory allocated by this function must be freed via
105             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
106             leak.
107           </para>
108         </remarks>
109         <exception cref="T:System.ArgumentOutOfRangeException">
110           <paramref name="size" /> is a negative value.
111         </exception>
112         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
113         <altmember cref="M:Mono.Unix.Native.Stdlib.malloc" />
114       </Docs>
115     </Member>
116     <Member MemberName="FreeHeap">
117       <MemberSignature Language="C#" Value="public static void FreeHeap (IntPtr ptr);" />
118       <MemberSignature Language="ILAsm" Value=".method public static hidebysig void FreeHeap(native int ptr) cil managed" />
119       <MemberType>Method</MemberType>
120       <AssemblyInfo>
121         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
122         <AssemblyVersion>2.0.0.0</AssemblyVersion>
123         <AssemblyVersion>4.0.0.0</AssemblyVersion>
124       </AssemblyInfo>
125       <ReturnValue>
126         <ReturnType>System.Void</ReturnType>
127       </ReturnValue>
128       <Parameters>
129         <Parameter Name="ptr" Type="System.IntPtr" />
130       </Parameters>
131       <Docs>
132         <param name="ptr">
133           A <see cref="T:System.IntPtr" /> containing the address of a block
134           of memory previously returned by 
135           <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or
136           <see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />.
137         </param>
138         <summary>Frees the memory referenced by <paramref name="ptr" />.</summary>
139         <remarks>
140           <para>
141             If <paramref name="ptr" /> is <see cref="F:System.IntPtr.Zero" />,
142             no action occurs.
143           </para>
144           <para>
145             The "system heap" is where dynamic memory is allocated by the
146             runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
147             Unix platforms.
148           </para>
149         </remarks>
150         <altmember cref="M:Mono.Unix.UnixMarshal.AllocHeap" />
151         <altmember cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />
152         <altmember cref="M:Mono.Unix.Native.Stdlib.free" />
153       </Docs>
154     </Member>
155     <Member MemberName="GetErrorDescription">
156       <MemberSignature Language="C#" Value="public static string GetErrorDescription (Mono.Unix.Native.Errno errno);" />
157       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetErrorDescription(valuetype Mono.Unix.Native.Errno errno) cil managed" />
158       <MemberType>Method</MemberType>
159       <AssemblyInfo>
160         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
161         <AssemblyVersion>2.0.0.0</AssemblyVersion>
162         <AssemblyVersion>4.0.0.0</AssemblyVersion>
163       </AssemblyInfo>
164       <Attributes>
165         <Attribute>
166           <AttributeName>System.CLSCompliant(false)</AttributeName>
167         </Attribute>
168       </Attributes>
169       <ReturnValue>
170         <ReturnType>System.String</ReturnType>
171       </ReturnValue>
172       <Parameters>
173         <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
174       </Parameters>
175       <Docs>
176         <param name="errno">
177           A <see cref="T:Mono.Unix.Native.Errno" /> containing the error code
178           to get the description for.
179         </param>
180         <summary>Gets a description for the error code <paramref name="errno" />.</summary>
181         <returns>
182           A <see cref="T:System.String" /> containing a description of the
183           specified error code <paramref name="errno" />.
184         </returns>
185         <remarks>
186           <para>
187             If <paramref name="errno" /> isn't a valid error number or isn't
188             supported by the operating system, then the string 
189             "<c>** Unknown error code: <paramref name="errno" />**</c>" is
190             returned.
191           </para>
192         </remarks>
193         <altmember cref="M:Mono.Unix.Native.Stdlib.strerror" />
194         <altmember cref="M:Mono.Unix.Native.Syscall.strerror_r" />
195       </Docs>
196     </Member>
197     <Member MemberName="PtrToString">
198       <MemberSignature Language="C#" Value="public static string PtrToString (IntPtr p);" />
199       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToString(native int p) cil managed" />
200       <MemberType>Method</MemberType>
201       <AssemblyInfo>
202         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
203         <AssemblyVersion>2.0.0.0</AssemblyVersion>
204         <AssemblyVersion>4.0.0.0</AssemblyVersion>
205       </AssemblyInfo>
206       <ReturnValue>
207         <ReturnType>System.String</ReturnType>
208       </ReturnValue>
209       <Parameters>
210         <Parameter Name="p" Type="System.IntPtr" />
211       </Parameters>
212       <Docs>
213         <param name="p">
214           A <see cref="T:System.IntPtr" /> containing the address of an
215           unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
216           encoding.
217         </param>
218         <summary>
219           Allocates a managed <see cref="T:System.String" /> and marshals the
220           unmanaged string into the managed string.
221         </summary>
222         <returns>
223           A <see cref="T:System.String" /> containing a copy of the unmanaged
224           string <paramref name="p" />, or <see langword="null" /> if 
225           <paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
226         </returns>
227         <remarks>
228           <para>
229             The input string <paramref name="p" /> must have a terminating
230             null <c>0x00</c> byte.
231           </para>
232           <para>
233             This method is identical to
234             <see cref="M:Mono.Unix.UnixMarshal.PtrToString" />(<paramref name="p" />, 
235             <see cref="F:Mono.Unix.UnixEncoding.Instance" />).
236           </para>
237         </remarks>
238         <altmember cref="M:Mono.Unix.UnixMarshal.PtrToStringUnix" />
239       </Docs>
240     </Member>
241     <Member MemberName="PtrToString">
242       <MemberSignature Language="C#" Value="public static string PtrToString (IntPtr p, System.Text.Encoding encoding);" />
243       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToString(native int p, class System.Text.Encoding encoding) cil managed" />
244       <MemberType>Method</MemberType>
245       <AssemblyInfo>
246         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
247         <AssemblyVersion>2.0.0.0</AssemblyVersion>
248         <AssemblyVersion>4.0.0.0</AssemblyVersion>
249       </AssemblyInfo>
250       <ReturnValue>
251         <ReturnType>System.String</ReturnType>
252       </ReturnValue>
253       <Parameters>
254         <Parameter Name="p" Type="System.IntPtr" />
255         <Parameter Name="encoding" Type="System.Text.Encoding" />
256       </Parameters>
257       <Docs>
258         <param name="p">
259           A <see cref="T:System.IntPtr" /> containing the address of an
260           unmanaged string in the <paramref name="encoding" />
261           encoding.
262         </param>
263         <param name="encoding">
264           A <see cref="T:System.Text.Encoding" /> specifying which encoding
265           <paramref name="p" /> is in.
266         </param>
267         <summary>
268           Allocates a managed <see cref="T:System.String" /> and marshals the
269           unmanaged string into the managed string using the specified
270           encoding.
271         </summary>
272         <returns>
273           A <see cref="T:System.String" /> containing a copy of the unmanaged
274           string <paramref name="p" />, or <see langword="null" /> if 
275           <paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
276         </returns>
277         <remarks>
278           <para>
279             The input string <paramref name="p" /> must have a terminating
280             null.  The definition of "terminating null" is fluid in this
281             context, since the size of a terminating null depends upon the
282             encoding specified.
283           </para>
284           <para>
285             A terminating null is a single byte containing the value
286             <c>0x00</c> if <paramref name="encoding" /> is one of the
287             following encodings:
288             <see cref="T:System.Text.ASCIIEncoding" />,
289             <see cref="T:System.Text.UTF8Encoding" />,
290             <see cref="T:System.Text.UTF7Encoding" />, or
291             <see cref="T:Mono.Unix.UnixEncoding" />.
292           </para>
293           <para>
294             A terminating null is the <see cref="T:System.Int16" /> value
295             <c>0x0000</c> if <paramref name="encoding" /> is 
296             <see cref="T:System.Text.UnicodeEncoding" />.
297           </para>
298           <para>
299             Otherwise, the terminating null must consist of a sequence of 
300             <see cref="M:System.Text.Encoding.GetMaxByteCount" />(1) bytes
301             having the value <c>0x00</c>.
302             <block subset="none" type="note">
303               This potentially plays havoc with multi-byte encodings, as many
304               multi-byte encodings would only use a single byte for the
305               terminating null, and not the maximum possible number of bytes
306               used for encoding any character to be used for the terminating
307               null.
308             </block></para>
309           <para>
310             Any buffer returned by 
311             <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" /> will satisfy
312             this requirement.
313           </para>
314         </remarks>
315         <exception cref="T:System.ArgumentNullException">
316           <paramref name="encoding" /> is <see langword="null" />.
317         </exception>
318       </Docs>
319     </Member>
320     <Member MemberName="PtrToStringArray">
321       <MemberSignature Language="C#" Value="public static string[] PtrToStringArray (IntPtr stringArray);" />
322       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(native int stringArray) cil managed" />
323       <MemberType>Method</MemberType>
324       <AssemblyInfo>
325         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
326         <AssemblyVersion>2.0.0.0</AssemblyVersion>
327         <AssemblyVersion>4.0.0.0</AssemblyVersion>
328       </AssemblyInfo>
329       <ReturnValue>
330         <ReturnType>System.String[]</ReturnType>
331       </ReturnValue>
332       <Parameters>
333         <Parameter Name="stringArray" Type="System.IntPtr" />
334       </Parameters>
335       <Docs>
336         <param name="stringArray">
337           A <see cref="T:System.IntPtr" /> containing a 
338           <c><see cref="T:System.Byte" />**</c> array
339           which follows the ANSI C rules for the <c>argv</c> argument passed
340           to <c>main</c>.
341         </param>
342         <summary>
343           Allocates a <see cref="T:System.String" /> array and unmarshals the
344           unmanaged string array into a managed string array.
345         </summary>
346         <returns>
347           A <see cref="T:System.String" /> array containing all the strings in
348           the unmanaged string array.  If <paramref name="stringArray" /> is
349           <see cref="F:System.IntPtr.Zero" />, a string array containing zero
350           elements is returned.
351         </returns>
352         <remarks>
353           <para>
354             This is identical to calling
355             <see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" />(<paramref name="stringArray" />, 
356             <see cref="F:Mono.Unix.UnixEncoding.Instance" />).
357           </para>
358         </remarks>
359       </Docs>
360     </Member>
361     <Member MemberName="PtrToStringArray">
362       <MemberSignature Language="C#" Value="public static string[] PtrToStringArray (int count, IntPtr stringArray);" />
363       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(int32 count, native int stringArray) cil managed" />
364       <MemberType>Method</MemberType>
365       <AssemblyInfo>
366         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
367         <AssemblyVersion>2.0.0.0</AssemblyVersion>
368         <AssemblyVersion>4.0.0.0</AssemblyVersion>
369       </AssemblyInfo>
370       <ReturnValue>
371         <ReturnType>System.String[]</ReturnType>
372       </ReturnValue>
373       <Parameters>
374         <Parameter Name="count" Type="System.Int32" />
375         <Parameter Name="stringArray" Type="System.IntPtr" />
376       </Parameters>
377       <Docs>
378         <param name="count">
379           A <see cref="T:System.Int32" /> containing the number of strings in
380           <paramref name="stringArray" />.
381         </param>
382         <param name="stringArray">
383           A <see cref="T:System.IntPtr" /> containing a 
384           <c><see cref="T:System.Byte" />**</c> array.
385         </param>
386         <summary>
387           Allocates a <see cref="T:System.String" /> array and unmarshals the
388           unmanaged string array into a managed string array.
389         </summary>
390         <returns>
391           A <see cref="T:System.String" /> array containing 
392           <paramref name="count" /> strings from the 
393           unmanaged string array <paramref name="stringArray" />.  
394           If <paramref name="stringArray" /> is
395           <see cref="F:System.IntPtr.Zero" />, a string array containing zero
396           elements is returned.
397         </returns>
398         <remarks>
399           <para>
400             This method is identical to
401             <see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray" /> (<paramref name="count" />, <paramref name="stringArray" />,
402             <see cref="F:Mono.Unix.UnixEncoding.Instance" />).
403           </para>
404         </remarks>
405       </Docs>
406     </Member>
407     <Member MemberName="PtrToStringArray">
408       <MemberSignature Language="C#" Value="public static string[] PtrToStringArray (IntPtr stringArray, System.Text.Encoding encoding);" />
409       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(native int stringArray, class System.Text.Encoding encoding) cil managed" />
410       <MemberType>Method</MemberType>
411       <AssemblyInfo>
412         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
413         <AssemblyVersion>2.0.0.0</AssemblyVersion>
414         <AssemblyVersion>4.0.0.0</AssemblyVersion>
415       </AssemblyInfo>
416       <ReturnValue>
417         <ReturnType>System.String[]</ReturnType>
418       </ReturnValue>
419       <Parameters>
420         <Parameter Name="stringArray" Type="System.IntPtr" />
421         <Parameter Name="encoding" Type="System.Text.Encoding" />
422       </Parameters>
423       <Docs>
424         <param name="stringArray">
425           A <see cref="T:System.IntPtr" /> containing a 
426           <c><see cref="T:System.Byte" />**</c> array
427           which follows the ANSI C rules for the <c>argv</c> argument passed
428           to <c>main</c>.
429         </param>
430         <param name="encoding">
431           A <see cref="System.Text.Encoding" /> specifying the encoding of the 
432           unmanaged strings within <paramref name="stringArray" />.
433         </param>
434         <summary>
435           Allocates a <see cref="T:System.String" /> array and unmarshals the
436           unmanaged string array into a managed string array using the
437           specified encoding.
438         </summary>
439         <returns>
440           A <see cref="T:System.String" /> array containing all the strings in
441           the unmanaged string array.  If <paramref name="stringArray" /> is
442           <see cref="F:System.IntPtr.Zero" />, a string array containing zero
443           elements is returned.
444         </returns>
445         <remarks>
446           <para>
447             <paramref name="stringArray" /> is assumed to be a <c>C</c><c>char**</c> pointer containing a terminating 
448             <see cref="F:System.IntPtr.Zero" /> pointer to designate the end
449             of the array.  This follows the requirements for <c>argv</c> in
450             the ANSI C <c>main</c> function declaration.
451           </para>
452           <code lang="C">static const char* 
453 stringArray[] = {
454     "string 1",
455     "string 2",
456     NULL
457 };
458           </code>
459           <para>
460             The final null string will not be returned from this method; the
461             above <b>stringArray</b> declaration would create an array
462             containing two elements if passed through this method.
463           </para>
464         </remarks>
465         <exception cref="T:System.ArgumentNullException">
466           <paramref name="encoding" /> is <see langword="null" />.
467         </exception>
468       </Docs>
469     </Member>
470     <Member MemberName="PtrToStringArray">
471       <MemberSignature Language="C#" Value="public static string[] PtrToStringArray (int count, IntPtr stringArray, System.Text.Encoding encoding);" />
472       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string[] PtrToStringArray(int32 count, native int stringArray, class System.Text.Encoding encoding) cil managed" />
473       <MemberType>Method</MemberType>
474       <AssemblyInfo>
475         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
476         <AssemblyVersion>2.0.0.0</AssemblyVersion>
477         <AssemblyVersion>4.0.0.0</AssemblyVersion>
478       </AssemblyInfo>
479       <ReturnValue>
480         <ReturnType>System.String[]</ReturnType>
481       </ReturnValue>
482       <Parameters>
483         <Parameter Name="count" Type="System.Int32" />
484         <Parameter Name="stringArray" Type="System.IntPtr" />
485         <Parameter Name="encoding" Type="System.Text.Encoding" />
486       </Parameters>
487       <Docs>
488         <param name="count">
489           A <see cref="T:System.Int32" /> containing the number of strings in
490           <paramref name="stringArray" />.
491         </param>
492         <param name="stringArray">
493           A <see cref="T:System.IntPtr" /> containing a 
494           <c><see cref="T:System.Byte" />**</c> array.
495         </param>
496         <param name="encoding">
497           A <see cref="System.Text.Encoding" /> specifying the encoding of the 
498           unmanaged strings within <paramref name="stringArray" />.
499         </param>
500         <summary>
501           Allocates a <see cref="T:System.String" /> array and unmarshals the
502           unmanaged string array into a managed string array using the
503           specified encoding.
504         </summary>
505         <returns>
506           A <see cref="T:System.String" /> array containing 
507           <paramref name="count" /> strings from the 
508           unmanaged string array <paramref name="stringArray" />.  
509           If <paramref name="stringArray" /> is
510           <see cref="F:System.IntPtr.Zero" />, a string array containing zero
511           elements is returned.
512         </returns>
513         <remarks>
514           <para>
515             No validation is done to ensure that the pointers for embedded
516             strings are valid.  This could result in an access violation or
517             corrupted strings if you're not careful.  Embedded null pointers 
518             will become <see langword="null" /> strings within the returned 
519             array.
520           </para>
521           <para>
522             The difference between this method and 
523             <see cref="M:Mono.Unix.UnixMarshal.PtrToStringArray(System.IntPtr,System.Text.Encoding)" />
524             is that this method doesn't require a terminating null pointer.
525           </para>
526         </remarks>
527         <exception cref="T:System.ArgumentNullException">
528           <paramref name="encoding" /> is <see langword="null" />.
529         </exception>
530       </Docs>
531     </Member>
532     <Member MemberName="PtrToStringUnix">
533       <MemberSignature Language="C#" Value="public static string PtrToStringUnix (IntPtr p);" />
534       <MemberSignature Language="ILAsm" Value=".method public static hidebysig string PtrToStringUnix(native int p) cil managed" />
535       <MemberType>Method</MemberType>
536       <AssemblyInfo>
537         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
538         <AssemblyVersion>2.0.0.0</AssemblyVersion>
539         <AssemblyVersion>4.0.0.0</AssemblyVersion>
540       </AssemblyInfo>
541       <ReturnValue>
542         <ReturnType>System.String</ReturnType>
543       </ReturnValue>
544       <Parameters>
545         <Parameter Name="p" Type="System.IntPtr" />
546       </Parameters>
547       <Docs>
548         <param name="p">
549           A <see cref="T:System.IntPtr" /> containing the address of an
550           unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
551           encoding.
552         </param>
553         <summary>
554           Allocates a managed <see cref="T:System.String" /> and marshals the
555           unmanaged string into the managed string using the 
556           <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
557         </summary>
558         <returns>
559           A <see cref="T:System.String" /> containing a copy of the unmanaged
560           string <paramref name="p" />, or <see langword="null" /> if 
561           <paramref name="p" /> is <see cref="F:System.IntPtr.Zero" />.
562         </returns>
563         <remarks>
564           <para>
565             The input string <paramref name="p" /> must have a terminating
566             null <c>0x00</c> byte.
567           </para>
568           <para>
569             This is an optimized version of 
570             <see cref="M:Mono.Unix.UnixMarshal.PtrToString(System.IntPtr)" />
571             for the <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
572           </para>
573         </remarks>
574       </Docs>
575     </Member>
576     <Member MemberName="ReAllocHeap">
577       <MemberSignature Language="C#" Value="public static IntPtr ReAllocHeap (IntPtr ptr, long size);" />
578       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int ReAllocHeap(native int ptr, int64 size) cil managed" />
579       <MemberType>Method</MemberType>
580       <AssemblyInfo>
581         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
582         <AssemblyVersion>2.0.0.0</AssemblyVersion>
583         <AssemblyVersion>4.0.0.0</AssemblyVersion>
584       </AssemblyInfo>
585       <ReturnValue>
586         <ReturnType>System.IntPtr</ReturnType>
587       </ReturnValue>
588       <Parameters>
589         <Parameter Name="ptr" Type="System.IntPtr" />
590         <Parameter Name="size" Type="System.Int64" />
591       </Parameters>
592       <Docs>
593         <param name="ptr">
594           A <see cref="T:System.IntPtr" /> containing the address of the
595           memory block to resize.  This value must either be 
596           <see cref="F:System.IntPtr.Zero" /> or a value previously returned
597           by <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or 
598           <see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />.
599         </param>
600         <param name="size">
601           A <see cref="T:System.Int64" /> containing the number of bytes to
602           allocate on the system heap.
603         </param>
604         <summary>
605           Changes the size of the memory block <paramref name="ptr" /> to
606           refer to <paramref name="size" /> bytes of memory on the system
607           heap.
608         </summary>
609         <returns>
610           <para>
611             A <see cref="T:System.IntPtr" /> containing the address of 
612             <paramref name="size" /> bytes on the system heap, or
613             <see cref="F:System.IntPtr.Zero" /> if the memory could not be
614             allocated.
615           </para>
616           <block subset="none" type="note">
617             If <see cref="F:System.IntPtr.Zero" /> is returned, 
618             <paramref name="ptr" /> is still a valid memory address, and must
619             still be freed.
620           </block>
621         </returns>
622         <remarks>
623           <para>
624             This function changes the size of the previously allocated memory
625             referenced by <paramref name="ptr" /> to <paramref name="size" />
626             bytes.  <paramref name="ptr" /> 
627             must have been previously allocated via 
628             <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" /> or
629             <see cref="M:Mono.Unix.UnixMarshal.ReAllocHeap" />, or 
630             <paramref name="ptr" /> must be the
631             value <see cref="F:System.IntPtr.Zero" /> (in which case this 
632             method is identical to 
633             <see cref="M:Mono.Unix.UnixMarshal.AllocHeap" />). 
634             The contents of the memory are unchanged up to the lesser 
635             of the new and old sizes.  If the new size is larger, the value of 
636             the newly allocated portion of the memory is undefined.
637           </para>
638           <para>
639             The memory allocated by this function must be freed via
640             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
641             leak.
642           </para>
643           <block subset="none" type="note">
644             <para>
645               If the requested memory cannot be allocated, 
646               <see cref="F:System.IntPtr.Zero" /> is returned and
647               the memory referenced by <paramref name="ptr" /> is valid and 
648               unchanged.
649             </para>
650             <para>
651               If memory can be allocated, the memory referenced by 
652               <paramref name="ptr" /> is freed and a pointer to the
653               newly allocated memory is returned.  Note that this may be 
654               different from the value passed as <paramref name="ptr" />.
655             </para>
656           </block>
657           <para>
658             The "system heap" is where dynamic memory is allocated by the
659             runtime C library, <c>MSVCRT.DLL</c> on Win32 and <c>libc</c> on
660             Unix platforms.
661           </para>
662         </remarks>
663         <exception cref="T:System.ArgumentOutOfRangeException">
664           <paramref name="size" /> is a negative value.
665         </exception>
666         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
667         <altmember cref="M:Mono.Unix.Native.Stdlib.realloc" />
668       </Docs>
669     </Member>
670     <Member MemberName="ShouldRetrySyscall">
671       <MemberSignature Language="C#" Value="public static bool ShouldRetrySyscall (int r);" />
672       <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ShouldRetrySyscall(int32 r) cil managed" />
673       <MemberType>Method</MemberType>
674       <AssemblyInfo>
675         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
676         <AssemblyVersion>2.0.0.0</AssemblyVersion>
677         <AssemblyVersion>4.0.0.0</AssemblyVersion>
678       </AssemblyInfo>
679       <ReturnValue>
680         <ReturnType>System.Boolean</ReturnType>
681       </ReturnValue>
682       <Parameters>
683         <Parameter Name="r" Type="System.Int32" />
684       </Parameters>
685       <Docs>
686         <param name="r">
687           A <see cref="T:System.Int32" /> containing the return value of a
688           method from <see cref="T:Mono.Unix.Native.Syscall" />.
689         </param>
690         <summary>
691           Returns a <see cref="T:System.Boolean" /> indicating whether a
692           system call should be retried.
693         </summary>
694         <returns>
695           Returns <see langword="true" /> if <paramref name="r" /> is
696           <c>-1</c> and <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
697           returns <see cref="F:Mono.Unix.Native.Errno.EINTR" />.
698           Otherwise, <see langword="false" /> is returned.
699         </returns>
700         <remarks>
701           <para>
702             System calls may need to be restarted for a variety of reasons,
703             generally explained within the system call documentation.  The
704             most typical reason is that the system call was interrupted, and
705             the caller is expected to re-invoke the system call to complete
706             the operation.
707           </para>
708         </remarks>
709       </Docs>
710     </Member>
711     <Member MemberName="ShouldRetrySyscall">
712       <MemberSignature Language="C#" Value="public static bool ShouldRetrySyscall (int r, out Mono.Unix.Native.Errno errno);" />
713       <MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ShouldRetrySyscall(int32 r, valuetype Mono.Unix.Native.Errno errno) cil managed" />
714       <MemberType>Method</MemberType>
715       <AssemblyInfo>
716         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
717         <AssemblyVersion>2.0.0.0</AssemblyVersion>
718         <AssemblyVersion>4.0.0.0</AssemblyVersion>
719       </AssemblyInfo>
720       <Attributes>
721         <Attribute>
722           <AttributeName>System.CLSCompliant(false)</AttributeName>
723         </Attribute>
724       </Attributes>
725       <ReturnValue>
726         <ReturnType>System.Boolean</ReturnType>
727       </ReturnValue>
728       <Parameters>
729         <Parameter Name="r" Type="System.Int32" />
730         <Parameter Name="errno" Type="Mono.Unix.Native.Errno&amp;" RefType="out" />
731       </Parameters>
732       <Docs>
733         <param name="r">
734           A <see cref="T:System.Int32" /> containing the return value of a
735           method from <see cref="T:Mono.Unix.Native.Syscall" />.
736         </param>
737         <param name="errno">
738           A reference to a <see cref="T:Mono.Unix.Native.Errno" /> variable
739           which will capture the last error value.
740         </param>
741         <summary>
742           Returns a <see cref="T:System.Boolean" /> indicating whether a
743           system call should be retried, saving the last error value for later
744           processing.
745         </summary>
746         <returns>
747           Returns <see langword="true" /> if <paramref name="r" /> is
748           <c>-1</c> and <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
749           returns <see cref="F:Mono.Unix.Native.Errno.EINTR" />, in which case
750           <paramref name="errno" /> will have the value 
751           <see cref="F:Mono.Unix.Native.Errno.EINTR" />.
752           Otherwise, <see langword="false" /> is returned, and 
753           <paramref name="errno" /> will store the value from the call to 
754           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />.
755         </returns>
756         <remarks>
757           <para>
758             System calls may need to be restarted for a variety of reasons,
759             generally explained within the system call documentation.  The
760             most typical reason is that the system call was interrupted, and
761             the caller is expected to re-invoke the system call to complete
762             the operation.
763           </para>
764           <para>
765             This method saves the last error value returned from 
766             <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> into the
767             <paramref name="errno" /> parameter.
768           </para>
769         </remarks>
770       </Docs>
771     </Member>
772     <Member MemberName="StringToHeap">
773       <MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s);" />
774       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s) cil managed" />
775       <MemberType>Method</MemberType>
776       <AssemblyInfo>
777         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
778         <AssemblyVersion>2.0.0.0</AssemblyVersion>
779         <AssemblyVersion>4.0.0.0</AssemblyVersion>
780       </AssemblyInfo>
781       <ReturnValue>
782         <ReturnType>System.IntPtr</ReturnType>
783       </ReturnValue>
784       <Parameters>
785         <Parameter Name="s" Type="System.String" />
786       </Parameters>
787       <Docs>
788         <param name="s">
789           A <see cref="T:System.String" /> to copy into the system heap.
790         </param>
791         <summary>
792           Allocates a copy of <paramref name="s" /> on the system heap in the 
793           <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
794         </summary>
795         <returns>
796           A <see cref="T:System.IntPtr" /> containing a pointer on the system
797           heap containing the marshaled string.  If <paramref name="s" /> is
798           <see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
799           returned.
800         </returns>
801         <remarks>
802           <para>
803             The pointer returned should be freed with 
804             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
805             leak.
806           </para>
807           <para>
808             This is identical to 
809             <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, 
810             <see cref="F:Mono.Unix.UnixMarshal.Instance" />).
811           </para>
812         </remarks>
813         <exception cref="T:System.NotSupportedException">
814           There was an error marshaling <paramref name="s" /> into the
815           <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
816         </exception>
817         <exception cref="T:Mono.Unix.UnixIOException">
818           Unable to allocate enough memory for the marshaled string.
819           [<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
820         </exception>
821         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
822       </Docs>
823     </Member>
824     <Member MemberName="StringToHeap">
825       <MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, System.Text.Encoding encoding);" />
826       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, class System.Text.Encoding encoding) cil managed" />
827       <MemberType>Method</MemberType>
828       <AssemblyInfo>
829         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
830         <AssemblyVersion>2.0.0.0</AssemblyVersion>
831         <AssemblyVersion>4.0.0.0</AssemblyVersion>
832       </AssemblyInfo>
833       <ReturnValue>
834         <ReturnType>System.IntPtr</ReturnType>
835       </ReturnValue>
836       <Parameters>
837         <Parameter Name="s" Type="System.String" />
838         <Parameter Name="encoding" Type="System.Text.Encoding" />
839       </Parameters>
840       <Docs>
841         <param name="s">
842           A <see cref="T:System.String" /> to copy into the system heap.
843         </param>
844         <param name="encoding">
845           A <see cref="T:System.Text.Encoding" /> specifying which encoding to
846           marshal the string into.
847         </param>
848         <summary>
849           Allocates a copy of <paramref name="s" /> on the system heap in the 
850           <paramref name="encoding" /> encoding.
851         </summary>
852         <returns>
853           A <see cref="T:System.IntPtr" /> containing a pointer on the system
854           heap containing the marshaled string.  If <paramref name="s" /> is
855           <see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
856           returned.
857         </returns>
858         <remarks>
859           <para>
860             The pointer returned should be freed with 
861             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
862             leak.
863           </para>
864           <para>
865             This is identical to 
866             <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, 0, <i>s.Length</i>,
867             <see cref="F:Mono.Unix.UnixMarshal.Instance" />).
868           </para>
869         </remarks>
870         <exception cref="T:System.ArgumentNullException">
871           <paramref name="encoding" /> is <see langword="null" />.
872         </exception>
873         <exception cref="T:System.NotSupportedException">
874           There was an error marshaling <paramref name="s" /> into the
875           specified encoding <paramref name="encoding" />.
876         </exception>
877         <exception cref="T:Mono.Unix.UnixIOException">
878           Unable to allocate enough memory for the marshaled string.
879           [<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
880         </exception>
881         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
882       </Docs>
883     </Member>
884     <Member MemberName="StringToHeap">
885       <MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, int index, int count);" />
886       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, int32 index, int32 count) cil managed" />
887       <MemberType>Method</MemberType>
888       <AssemblyInfo>
889         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
890         <AssemblyVersion>2.0.0.0</AssemblyVersion>
891         <AssemblyVersion>4.0.0.0</AssemblyVersion>
892       </AssemblyInfo>
893       <ReturnValue>
894         <ReturnType>System.IntPtr</ReturnType>
895       </ReturnValue>
896       <Parameters>
897         <Parameter Name="s" Type="System.String" />
898         <Parameter Name="index" Type="System.Int32" />
899         <Parameter Name="count" Type="System.Int32" />
900       </Parameters>
901       <Docs>
902         <param name="s">
903           A <see cref="T:System.String" /> to copy into the system heap.
904         </param>
905         <param name="index">
906           A <see cref="T:System.Int32" /> containing the start index into
907           <paramref name="s" /> to start marshaling.
908         </param>
909         <param name="count">
910           A <see cref="T:System.Int32" /> containing the number of characters
911           to marshal from <paramref name="s" /> starting at index 
912           <paramref name="index" />.
913         </param>
914         <summary>
915           Allocates a copy of <paramref name="s" /> on the system heap in the 
916           <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
917         </summary>
918         <returns>
919           A <see cref="T:System.IntPtr" /> containing a pointer on the system
920           heap containing the marshaled string.  If <paramref name="s" /> is
921           <see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
922           returned.
923         </returns>
924         <remarks>
925           <para>
926             The pointer returned should be freed with 
927             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
928             leak.
929           </para>
930           <para>
931             This is identical to 
932             <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, <paramref name="count" />,
933             <paramref name="index" />,
934             <see cref="F:Mono.Unix.UnixMarshal.Instance" />).
935           </para>
936         </remarks>
937         <exception cref="T:System.ArgumentOutOfRangeException">
938           <para>
939             <paramref name="count" /> or <paramref name="index" /> is less
940             than zero.
941           </para>
942           <para>-or-</para>
943           <para>
944             <paramref name="index" /> plus <paramref name="count" /> is
945             greater than the length of <paramref name="s" />.
946           </para>
947         </exception>
948         <exception cref="T:System.NotSupportedException">
949           There was an error marshaling <paramref name="s" /> into the
950           <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
951         </exception>
952         <exception cref="T:Mono.Unix.UnixIOException">
953           Unable to allocate enough memory for the marshaled string.
954           [<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
955         </exception>
956         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
957       </Docs>
958     </Member>
959     <Member MemberName="StringToHeap">
960       <MemberSignature Language="C#" Value="public static IntPtr StringToHeap (string s, int index, int count, System.Text.Encoding encoding);" />
961       <MemberSignature Language="ILAsm" Value=".method public static hidebysig native int StringToHeap(string s, int32 index, int32 count, class System.Text.Encoding encoding) cil managed" />
962       <MemberType>Method</MemberType>
963       <AssemblyInfo>
964         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
965         <AssemblyVersion>2.0.0.0</AssemblyVersion>
966         <AssemblyVersion>4.0.0.0</AssemblyVersion>
967       </AssemblyInfo>
968       <ReturnValue>
969         <ReturnType>System.IntPtr</ReturnType>
970       </ReturnValue>
971       <Parameters>
972         <Parameter Name="s" Type="System.String" />
973         <Parameter Name="index" Type="System.Int32" />
974         <Parameter Name="count" Type="System.Int32" />
975         <Parameter Name="encoding" Type="System.Text.Encoding" />
976       </Parameters>
977       <Docs>
978         <param name="s">
979           A <see cref="T:System.String" /> to copy into the system heap.
980         </param>
981         <param name="index">
982           A <see cref="T:System.Int32" /> containing the start index into
983           <paramref name="s" /> to start marshaling.
984         </param>
985         <param name="count">
986           A <see cref="T:System.Int32" /> containing the number of characters
987           to marshal from <paramref name="s" /> starting at index 
988           <paramref name="index" />.
989         </param>
990         <param name="encoding">
991           A <see cref="T:System.Text.Encoding" /> specifying which encoding to
992           marshal the string into.
993         </param>
994         <summary>
995           Allocates a copy of <paramref name="s" /> on the system heap in the 
996           <paramref name="encoding" /> encoding.
997         </summary>
998         <returns>
999           A <see cref="T:System.IntPtr" /> containing a pointer on the system
1000           heap containing the marshaled string.  If <paramref name="s" /> is
1001           <see langword="null" />, then <see cref="F:System.IntPtr.Zero" /> is
1002           returned.
1003         </returns>
1004         <remarks>
1005           <para>
1006             The pointer returned should be freed with 
1007             <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
1008             leak.
1009           </para>
1010         </remarks>
1011         <exception cref="T:System.ArgumentNullException">
1012           <paramref name="encoding" /> is <see langword="null" />.
1013         </exception>
1014         <exception cref="T:System.ArgumentOutOfRangeException">
1015           <para>
1016             <paramref name="count" /> or <paramref name="index" /> is less
1017             than zero.
1018           </para>
1019           <para>-or-</para>
1020           <para>
1021             <paramref name="index" /> plus <paramref name="count" /> is
1022             greater than the length of <paramref name="s" />.
1023           </para>
1024         </exception>
1025         <exception cref="T:System.NotSupportedException">
1026           There was an error marshaling <paramref name="s" /> into the
1027           specified encoding <paramref name="encoding" />.
1028         </exception>
1029         <exception cref="T:Mono.Unix.UnixIOException">
1030           Unable to allocate enough memory for the marshaled string.
1031           [<see cref="F:Mono.Unix.Native.Errno.ENOMEM" />]
1032         </exception>
1033         <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
1034       </Docs>
1035     </Member>
1036     <Member MemberName="ThrowExceptionForError">
1037       <MemberSignature Language="C#" Value="public static void ThrowExceptionForError (Mono.Unix.Native.Errno errno);" />
1038       <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForError(valuetype Mono.Unix.Native.Errno errno) cil managed" />
1039       <MemberType>Method</MemberType>
1040       <AssemblyInfo>
1041         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1042         <AssemblyVersion>2.0.0.0</AssemblyVersion>
1043         <AssemblyVersion>4.0.0.0</AssemblyVersion>
1044       </AssemblyInfo>
1045       <Attributes>
1046         <Attribute>
1047           <AttributeName>System.CLSCompliant(false)</AttributeName>
1048         </Attribute>
1049       </Attributes>
1050       <ReturnValue>
1051         <ReturnType>System.Void</ReturnType>
1052       </ReturnValue>
1053       <Parameters>
1054         <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
1055       </Parameters>
1056       <Docs>
1057         <param name="errno">
1058           A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
1059           to throw.
1060         </param>
1061         <summary>
1062           Throws an exception that best matches <paramref name="errno" />.
1063         </summary>
1064         <remarks>
1065           <para>
1066             This method translates <paramref name="errno" /> into its closest
1067             matching exception type, and throws the exception.
1068           </para>
1069           <para>
1070             If the exception thrown is not a 
1071             <see cref="T:Mono.Unix.UnixIOException" />, then the exception's
1072             <see cref="P:System.Exception.InnerException" /> property will
1073             be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
1074             wrapping <paramref name="errno" />, if possible.
1075             <block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
1076               have its 
1077               <see cref="P:System.Exception.InnerException" /> property set, as 
1078               <see cref="T:System.ArgumentOutOfRangeException" /> does not
1079               provide a constructor that sets this property.
1080             </block></para>
1081         </remarks>
1082         <exception cref="T:System.ArgumentException">
1083           <paramref name="errno" />
1084           is 
1085           <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1086           <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1087         </exception>
1088         <exception cref="T:System.ArgumentOutOfRangeException">
1089           <paramref name="errno" />
1090           is 
1091           <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1092         </exception>
1093         <exception cref="T:System.InvalidOperationException">
1094           <paramref name="errno" />
1095           is 
1096           <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1097           <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1098         </exception>
1099         <exception cref="T:System.InvalidProgramException">
1100           <paramref name="errno" />
1101           is 
1102           <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1103         </exception>
1104         <exception cref="T:System.NullReferenceException">
1105           <paramref name="errno" />
1106           is 
1107           <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1108         </exception>
1109         <exception cref="T:System.OverflowException">
1110           <paramref name="errno" />
1111           is 
1112           <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1113         </exception>
1114         <exception cref="T:System.UnauthorizedAccessException">
1115           <paramref name="errno" />
1116           is 
1117           <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1118           <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1119         </exception>
1120         <exception cref="T:System.IO.DirectoryNotFoundException">
1121           <paramref name="errno" />
1122           is 
1123           <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1124         </exception>
1125         <exception cref="T:System.IO.FileNotFoundException">
1126           <paramref name="errno" />
1127           is 
1128           <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1129         </exception>
1130         <exception cref="T:System.IO.IOException">
1131           <paramref name="errno" />
1132           is one of:
1133           <see cref="F:Mono.Unix.Native.Errno.EIO" />,
1134           <see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
1135           <see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
1136           <see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
1137           <see cref="F:Mono.Unix.Native.Errno.EROFS" />,
1138           <see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
1139         </exception>
1140         <exception cref="T:System.IO.PathTooLongException">
1141           <paramref name="errno" />
1142           is 
1143           <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1144         </exception>
1145         <exception cref="T:Mono.Unix.UnixIOException">
1146           <paramref name="errno" /> is not any of the above error values.
1147         </exception>
1148       </Docs>
1149     </Member>
1150     <Member MemberName="ThrowExceptionForErrorIf">
1151       <MemberSignature Language="C#" Value="public static void ThrowExceptionForErrorIf (int retval, Mono.Unix.Native.Errno errno);" />
1152       <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForErrorIf(int32 retval, valuetype Mono.Unix.Native.Errno errno) cil managed" />
1153       <MemberType>Method</MemberType>
1154       <AssemblyInfo>
1155         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1156         <AssemblyVersion>2.0.0.0</AssemblyVersion>
1157         <AssemblyVersion>4.0.0.0</AssemblyVersion>
1158       </AssemblyInfo>
1159       <Attributes>
1160         <Attribute>
1161           <AttributeName>System.CLSCompliant(false)</AttributeName>
1162         </Attribute>
1163       </Attributes>
1164       <ReturnValue>
1165         <ReturnType>System.Void</ReturnType>
1166       </ReturnValue>
1167       <Parameters>
1168         <Parameter Name="retval" Type="System.Int32" />
1169         <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
1170       </Parameters>
1171       <Docs>
1172         <param name="retval">
1173           A <see cref="T:System.Int32" /> containing the return value of a
1174           method from <see cref="T:Mono.Unix.Native.Syscall" />.
1175         </param>
1176         <param name="errno">
1177           A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
1178           to throw.
1179         </param>
1180         <summary>
1181           Throws an exception that best matches <paramref name="errno" />
1182           if <paramref name="retval" /> is <c>-1</c>.
1183         </summary>
1184         <remarks>
1185           <para>
1186             If <paramref name="retval" /> is <c>-1</c>, then this method is
1187             equivalent to calling 
1188             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<paramref name="errno" />).
1189             Otherwise, nothing is done.
1190           </para>
1191           <para>
1192             If the exception thrown is not a 
1193             <see cref="T:Mono.Unix.UnixIOException" />, then the exception's
1194             <see cref="P:System.Exception.InnerException" /> property will
1195             be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
1196             wrapping <paramref name="errno" />, if possible.
1197             <block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
1198               have its 
1199               <see cref="P:System.Exception.InnerException" /> property set, as 
1200               <see cref="T:System.ArgumentOutOfRangeException" /> does not
1201               provide a constructor that sets this property.
1202             </block></para>
1203         </remarks>
1204         <exception cref="T:System.ArgumentException">
1205           <paramref name="errno" />
1206           is 
1207           <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1208           <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1209         </exception>
1210         <exception cref="T:System.ArgumentOutOfRangeException">
1211           <paramref name="errno" />
1212           is 
1213           <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1214         </exception>
1215         <exception cref="T:System.InvalidOperationException">
1216           <paramref name="errno" />
1217           is 
1218           <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1219           <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1220         </exception>
1221         <exception cref="T:System.InvalidProgramException">
1222           <paramref name="errno" />
1223           is 
1224           <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1225         </exception>
1226         <exception cref="T:System.NullReferenceException">
1227           <paramref name="errno" />
1228           is 
1229           <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1230         </exception>
1231         <exception cref="T:System.OverflowException">
1232           <paramref name="errno" />
1233           is 
1234           <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1235         </exception>
1236         <exception cref="T:System.UnauthorizedAccessException">
1237           <paramref name="errno" />
1238           is 
1239           <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1240           <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1241         </exception>
1242         <exception cref="T:System.IO.DirectoryNotFoundException">
1243           <paramref name="errno" />
1244           is 
1245           <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1246         </exception>
1247         <exception cref="T:System.IO.FileNotFoundException">
1248           <paramref name="errno" />
1249           is 
1250           <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1251         </exception>
1252         <exception cref="T:System.IO.IOException">
1253           <paramref name="errno" />
1254           is one of:
1255           <see cref="F:Mono.Unix.Native.Errno.EIO" />,
1256           <see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
1257           <see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
1258           <see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
1259           <see cref="F:Mono.Unix.Native.Errno.EROFS" />,
1260           <see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
1261         </exception>
1262         <exception cref="T:System.IO.PathTooLongException">
1263           <paramref name="errno" />
1264           is 
1265           <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1266         </exception>
1267         <exception cref="T:Mono.Unix.UnixIOException">
1268           <paramref name="errno" /> is not any of the above error values.
1269         </exception>
1270       </Docs>
1271     </Member>
1272     <Member MemberName="ThrowExceptionForLastError">
1273       <MemberSignature Language="C#" Value="public static void ThrowExceptionForLastError ();" />
1274       <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForLastError() cil managed" />
1275       <MemberType>Method</MemberType>
1276       <AssemblyInfo>
1277         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1278         <AssemblyVersion>2.0.0.0</AssemblyVersion>
1279         <AssemblyVersion>4.0.0.0</AssemblyVersion>
1280       </AssemblyInfo>
1281       <ReturnValue>
1282         <ReturnType>System.Void</ReturnType>
1283       </ReturnValue>
1284       <Parameters />
1285       <Docs>
1286         <summary>
1287           Throws an exception that best matches the last error returned
1288           from <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />.
1289         </summary>
1290         <remarks>
1291           <para>
1292             This is equivalent to calling
1293             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> ()).
1294           </para>
1295           <para>
1296             If the exception thrown is not a 
1297             <see cref="T:Mono.Unix.UnixIOException" />, then the exception's
1298             <see cref="P:System.Exception.InnerException" /> property will
1299             be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
1300             wrapping <paramref name="errno" />, if possible.
1301             <block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
1302               have its 
1303               <see cref="P:System.Exception.InnerException" /> property set, as 
1304               <see cref="T:System.ArgumentOutOfRangeException" /> does not
1305               provide a constructor that sets this property.
1306             </block></para>
1307         </remarks>
1308         <exception cref="T:System.ArgumentException">
1309           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1310           is 
1311           <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1312           <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1313         </exception>
1314         <exception cref="T:System.ArgumentOutOfRangeException">
1315           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1316           is 
1317           <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1318         </exception>
1319         <exception cref="T:System.InvalidOperationException">
1320           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1321           is 
1322           <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1323           <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1324         </exception>
1325         <exception cref="T:System.InvalidProgramException">
1326           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1327           is 
1328           <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1329         </exception>
1330         <exception cref="T:System.NullReferenceException">
1331           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1332           is 
1333           <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1334         </exception>
1335         <exception cref="T:System.OverflowException">
1336           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1337           is 
1338           <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1339         </exception>
1340         <exception cref="T:System.UnauthorizedAccessException">
1341           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1342           is 
1343           <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1344           <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1345         </exception>
1346         <exception cref="T:System.IO.DirectoryNotFoundException">
1347           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1348           is 
1349           <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1350         </exception>
1351         <exception cref="T:System.IO.FileNotFoundException">
1352           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1353           is 
1354           <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1355         </exception>
1356         <exception cref="T:System.IO.IOException">
1357           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1358           is one of:
1359           <see cref="F:Mono.Unix.Native.Errno.EIO" />,
1360           <see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
1361           <see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
1362           <see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
1363           <see cref="F:Mono.Unix.Native.Errno.EROFS" />,
1364           <see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
1365         </exception>
1366         <exception cref="T:System.IO.PathTooLongException">
1367           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1368           is 
1369           <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1370         </exception>
1371         <exception cref="T:Mono.Unix.UnixIOException">
1372           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1373           is not any of the above error values.
1374         </exception>
1375       </Docs>
1376     </Member>
1377     <Member MemberName="ThrowExceptionForLastErrorIf">
1378       <MemberSignature Language="C#" Value="public static void ThrowExceptionForLastErrorIf (int retval);" />
1379       <MemberSignature Language="ILAsm" Value=".method public static hidebysig void ThrowExceptionForLastErrorIf(int32 retval) cil managed" />
1380       <MemberType>Method</MemberType>
1381       <AssemblyInfo>
1382         <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1383         <AssemblyVersion>2.0.0.0</AssemblyVersion>
1384         <AssemblyVersion>4.0.0.0</AssemblyVersion>
1385       </AssemblyInfo>
1386       <ReturnValue>
1387         <ReturnType>System.Void</ReturnType>
1388       </ReturnValue>
1389       <Parameters>
1390         <Parameter Name="retval" Type="System.Int32" />
1391       </Parameters>
1392       <Docs>
1393         <param name="retval">
1394           A <see cref="T:System.Int32" /> containing the return value of a
1395           method from <see cref="T:Mono.Unix.Native.Syscall" />.
1396         </param>
1397         <summary>
1398           Throws an exception that best matches the last error returned
1399           from <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> if
1400           <paramref name="retval" /> is <c>-1</c>.
1401         </summary>
1402         <remarks>
1403           <para>
1404             If <paramref name="retval" /> is <c>-1</c>, then this method is
1405             equivalent to calling 
1406             <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> ()).
1407             Otherwise, nothing is done.
1408           </para>
1409           <para>
1410             If the exception thrown is not a 
1411             <see cref="T:Mono.Unix.UnixIOException" />, then the exception's
1412             <see cref="P:System.Exception.InnerException" /> property will
1413             be set to a <see cref="T:Mono.Unix.UnixIOException" /> instance
1414             wrapping <paramref name="errno" />, if possible.
1415             <block subset="none" type="note"><see cref="T:System.ArgumentOutOfRangeException" /> does not
1416               have its 
1417               <see cref="P:System.Exception.InnerException" /> property set, as 
1418               <see cref="T:System.ArgumentOutOfRangeException" /> does not
1419               provide a constructor that sets this property.
1420             </block></para>
1421         </remarks>
1422         <exception cref="T:System.ArgumentException">
1423           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1424           is 
1425           <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1426           <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1427         </exception>
1428         <exception cref="T:System.ArgumentOutOfRangeException">
1429           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1430           is 
1431           <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1432         </exception>
1433         <exception cref="T:System.InvalidOperationException">
1434           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1435           is 
1436           <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1437           <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1438         </exception>
1439         <exception cref="T:System.InvalidProgramException">
1440           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1441           is 
1442           <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1443         </exception>
1444         <exception cref="T:System.NullReferenceException">
1445           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1446           is 
1447           <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1448         </exception>
1449         <exception cref="T:System.OverflowException">
1450           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1451           is 
1452           <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1453         </exception>
1454         <exception cref="T:System.UnauthorizedAccessException">
1455           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1456           is 
1457           <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1458           <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1459         </exception>
1460         <exception cref="T:System.IO.DirectoryNotFoundException">
1461           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1462           is 
1463           <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1464         </exception>
1465         <exception cref="T:System.IO.FileNotFoundException">
1466           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1467           is 
1468           <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1469         </exception>
1470         <exception cref="T:System.IO.IOException">
1471           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1472           is one of:
1473           <see cref="F:Mono.Unix.Native.Errno.EIO" />,
1474           <see cref="F:Mono.Unix.Native.Errno.ENOSPC" />,
1475           <see cref="F:Mono.Unix.Native.Errno.ENOTEMPTY" />,
1476           <see cref="F:Mono.Unix.Native.Errno.ENXIO" />,
1477           <see cref="F:Mono.Unix.Native.Errno.EROFS" />,
1478           <see cref="F:Mono.Unix.Native.Errno.ESPIPE" />.
1479         </exception>
1480         <exception cref="T:System.IO.PathTooLongException">
1481           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1482           is 
1483           <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1484         </exception>
1485         <exception cref="T:Mono.Unix.UnixIOException">
1486           <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1487           is not any of the above error values.
1488         </exception>
1489       </Docs>
1490     </Member>
1491   </Members>
1492 </Type>