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" />
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>
10 <ThreadingSafetyStatement>This type is safe for multithreaded operations.</ThreadingSafetyStatement>
12 <BaseTypeName>System.Object</BaseTypeName>
17 Provides a collection of miscellaneous methods for marshaling strings,
18 allocating memory, and interoperating with the operating system.
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.
27 The following table assigns each method to a category that describes
33 <description>Members</description>
36 <term>Data Transformation</term>
40 <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />,
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>
50 <term>Error Handling</term>
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>
60 <term>Memory Management</term>
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>
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>
75 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
76 <AssemblyVersion>2.0.0.0</AssemblyVersion>
77 <AssemblyVersion>4.0.0.0</AssemblyVersion>
80 <ReturnType>System.IntPtr</ReturnType>
83 <Parameter Name="size" Type="System.Int64" />
87 A <see cref="T:System.Int64" /> containing the number of bytes to
88 allocate on the system heap.
90 <summary>Allocates <paramref name="size" /> bytes from the system heap.</summary>
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
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
104 The memory allocated by this function must be freed via
105 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
109 <exception cref="T:System.ArgumentOutOfRangeException">
110 <paramref name="size" /> is a negative value.
112 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
113 <altmember cref="M:Mono.Unix.Native.Stdlib.malloc" />
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>
121 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
122 <AssemblyVersion>2.0.0.0</AssemblyVersion>
123 <AssemblyVersion>4.0.0.0</AssemblyVersion>
126 <ReturnType>System.Void</ReturnType>
129 <Parameter Name="ptr" Type="System.IntPtr" />
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" />.
138 <summary>Frees the memory referenced by <paramref name="ptr" />.</summary>
141 If <paramref name="ptr" /> is <see cref="F:System.IntPtr.Zero" />,
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
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" />
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>
160 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
161 <AssemblyVersion>2.0.0.0</AssemblyVersion>
162 <AssemblyVersion>4.0.0.0</AssemblyVersion>
166 <AttributeName>System.CLSCompliant(false)</AttributeName>
170 <ReturnType>System.String</ReturnType>
173 <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
177 A <see cref="T:Mono.Unix.Native.Errno" /> containing the error code
178 to get the description for.
180 <summary>Gets a description for the error code <paramref name="errno" />.</summary>
182 A <see cref="T:System.String" /> containing a description of the
183 specified error code <paramref name="errno" />.
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
193 <altmember cref="M:Mono.Unix.Native.Stdlib.strerror" />
194 <altmember cref="M:Mono.Unix.Native.Syscall.strerror_r" />
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>
202 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
203 <AssemblyVersion>2.0.0.0</AssemblyVersion>
204 <AssemblyVersion>4.0.0.0</AssemblyVersion>
207 <ReturnType>System.String</ReturnType>
210 <Parameter Name="p" Type="System.IntPtr" />
214 A <see cref="T:System.IntPtr" /> containing the address of an
215 unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
219 Allocates a managed <see cref="T:System.String" /> and marshals the
220 unmanaged string into the managed string.
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" />.
229 The input string <paramref name="p" /> must have a terminating
230 null <c>0x00</c> byte.
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" />).
238 <altmember cref="M:Mono.Unix.UnixMarshal.PtrToStringUnix" />
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>
246 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
247 <AssemblyVersion>2.0.0.0</AssemblyVersion>
248 <AssemblyVersion>4.0.0.0</AssemblyVersion>
251 <ReturnType>System.String</ReturnType>
254 <Parameter Name="p" Type="System.IntPtr" />
255 <Parameter Name="encoding" Type="System.Text.Encoding" />
259 A <see cref="T:System.IntPtr" /> containing the address of an
260 unmanaged string in the <paramref name="encoding" />
263 <param name="encoding">
264 A <see cref="T:System.Text.Encoding" /> specifying which encoding
265 <paramref name="p" /> is in.
268 Allocates a managed <see cref="T:System.String" /> and marshals the
269 unmanaged string into the managed string using the specified
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" />.
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
285 A terminating null is a single byte containing the value
286 <c>0x00</c> if <paramref name="encoding" /> is one of the
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" />.
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" />.
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
310 Any buffer returned by
311 <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" /> will satisfy
315 <exception cref="T:System.ArgumentNullException">
316 <paramref name="encoding" /> is <see langword="null" />.
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>
325 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
326 <AssemblyVersion>2.0.0.0</AssemblyVersion>
327 <AssemblyVersion>4.0.0.0</AssemblyVersion>
330 <ReturnType>System.String[]</ReturnType>
333 <Parameter Name="stringArray" Type="System.IntPtr" />
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
343 Allocates a <see cref="T:System.String" /> array and unmarshals the
344 unmanaged string array into a managed string array.
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.
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" />).
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>
366 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
367 <AssemblyVersion>2.0.0.0</AssemblyVersion>
368 <AssemblyVersion>4.0.0.0</AssemblyVersion>
371 <ReturnType>System.String[]</ReturnType>
374 <Parameter Name="count" Type="System.Int32" />
375 <Parameter Name="stringArray" Type="System.IntPtr" />
379 A <see cref="T:System.Int32" /> containing the number of strings in
380 <paramref name="stringArray" />.
382 <param name="stringArray">
383 A <see cref="T:System.IntPtr" /> containing a
384 <c><see cref="T:System.Byte" />**</c> array.
387 Allocates a <see cref="T:System.String" /> array and unmarshals the
388 unmanaged string array into a managed string array.
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.
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" />).
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>
412 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
413 <AssemblyVersion>2.0.0.0</AssemblyVersion>
414 <AssemblyVersion>4.0.0.0</AssemblyVersion>
417 <ReturnType>System.String[]</ReturnType>
420 <Parameter Name="stringArray" Type="System.IntPtr" />
421 <Parameter Name="encoding" Type="System.Text.Encoding" />
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
430 <param name="encoding">
431 A <see cref="System.Text.Encoding" /> specifying the encoding of the
432 unmanaged strings within <paramref name="stringArray" />.
435 Allocates a <see cref="T:System.String" /> array and unmarshals the
436 unmanaged string array into a managed string array using the
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.
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.
452 <code lang="C">static const char*
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.
465 <exception cref="T:System.ArgumentNullException">
466 <paramref name="encoding" /> is <see langword="null" />.
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>
475 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
476 <AssemblyVersion>2.0.0.0</AssemblyVersion>
477 <AssemblyVersion>4.0.0.0</AssemblyVersion>
480 <ReturnType>System.String[]</ReturnType>
483 <Parameter Name="count" Type="System.Int32" />
484 <Parameter Name="stringArray" Type="System.IntPtr" />
485 <Parameter Name="encoding" Type="System.Text.Encoding" />
489 A <see cref="T:System.Int32" /> containing the number of strings in
490 <paramref name="stringArray" />.
492 <param name="stringArray">
493 A <see cref="T:System.IntPtr" /> containing a
494 <c><see cref="T:System.Byte" />**</c> array.
496 <param name="encoding">
497 A <see cref="System.Text.Encoding" /> specifying the encoding of the
498 unmanaged strings within <paramref name="stringArray" />.
501 Allocates a <see cref="T:System.String" /> array and unmarshals the
502 unmanaged string array into a managed string array using the
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.
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
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.
527 <exception cref="T:System.ArgumentNullException">
528 <paramref name="encoding" /> is <see langword="null" />.
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>
537 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
538 <AssemblyVersion>2.0.0.0</AssemblyVersion>
539 <AssemblyVersion>4.0.0.0</AssemblyVersion>
542 <ReturnType>System.String</ReturnType>
545 <Parameter Name="p" Type="System.IntPtr" />
549 A <see cref="T:System.IntPtr" /> containing the address of an
550 unmanaged string in the <see cref="T:Mono.Unix.UnixEncoding" />
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.
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" />.
565 The input string <paramref name="p" /> must have a terminating
566 null <c>0x00</c> byte.
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.
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>
581 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
582 <AssemblyVersion>2.0.0.0</AssemblyVersion>
583 <AssemblyVersion>4.0.0.0</AssemblyVersion>
586 <ReturnType>System.IntPtr</ReturnType>
589 <Parameter Name="ptr" Type="System.IntPtr" />
590 <Parameter Name="size" Type="System.Int64" />
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" />.
601 A <see cref="T:System.Int64" /> containing the number of bytes to
602 allocate on the system heap.
605 Changes the size of the memory block <paramref name="ptr" /> to
606 refer to <paramref name="size" /> bytes of memory on the system
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
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
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.
639 The memory allocated by this function must be freed via
640 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
643 <block subset="none" type="note">
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
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" />.
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
663 <exception cref="T:System.ArgumentOutOfRangeException">
664 <paramref name="size" /> is a negative value.
666 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
667 <altmember cref="M:Mono.Unix.Native.Stdlib.realloc" />
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>
675 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
676 <AssemblyVersion>2.0.0.0</AssemblyVersion>
677 <AssemblyVersion>4.0.0.0</AssemblyVersion>
680 <ReturnType>System.Boolean</ReturnType>
683 <Parameter Name="r" Type="System.Int32" />
687 A <see cref="T:System.Int32" /> containing the return value of a
688 method from <see cref="T:Mono.Unix.Native.Syscall" />.
691 Returns a <see cref="T:System.Boolean" /> indicating whether a
692 system call should be retried.
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.
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
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>
716 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
717 <AssemblyVersion>2.0.0.0</AssemblyVersion>
718 <AssemblyVersion>4.0.0.0</AssemblyVersion>
722 <AttributeName>System.CLSCompliant(false)</AttributeName>
726 <ReturnType>System.Boolean</ReturnType>
729 <Parameter Name="r" Type="System.Int32" />
730 <Parameter Name="errno" Type="Mono.Unix.Native.Errno&" RefType="out" />
734 A <see cref="T:System.Int32" /> containing the return value of a
735 method from <see cref="T:Mono.Unix.Native.Syscall" />.
738 A reference to a <see cref="T:Mono.Unix.Native.Errno" /> variable
739 which will capture the last error value.
742 Returns a <see cref="T:System.Boolean" /> indicating whether a
743 system call should be retried, saving the last error value for later
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" />.
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
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.
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>
777 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
778 <AssemblyVersion>2.0.0.0</AssemblyVersion>
779 <AssemblyVersion>4.0.0.0</AssemblyVersion>
782 <ReturnType>System.IntPtr</ReturnType>
785 <Parameter Name="s" Type="System.String" />
789 A <see cref="T:System.String" /> to copy into the system heap.
792 Allocates a copy of <paramref name="s" /> on the system heap in the
793 <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
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
803 The pointer returned should be freed with
804 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
809 <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />,
810 <see cref="F:Mono.Unix.UnixMarshal.Instance" />).
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.
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" />]
821 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
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>
829 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
830 <AssemblyVersion>2.0.0.0</AssemblyVersion>
831 <AssemblyVersion>4.0.0.0</AssemblyVersion>
834 <ReturnType>System.IntPtr</ReturnType>
837 <Parameter Name="s" Type="System.String" />
838 <Parameter Name="encoding" Type="System.Text.Encoding" />
842 A <see cref="T:System.String" /> to copy into the system heap.
844 <param name="encoding">
845 A <see cref="T:System.Text.Encoding" /> specifying which encoding to
846 marshal the string into.
849 Allocates a copy of <paramref name="s" /> on the system heap in the
850 <paramref name="encoding" /> encoding.
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
860 The pointer returned should be freed with
861 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
866 <see cref="M:Mono.Unix.UnixMarshal.StringToHeap" />(<paramref name="s" />, 0, <i>s.Length</i>,
867 <see cref="F:Mono.Unix.UnixMarshal.Instance" />).
870 <exception cref="T:System.ArgumentNullException">
871 <paramref name="encoding" /> is <see langword="null" />.
873 <exception cref="T:System.NotSupportedException">
874 There was an error marshaling <paramref name="s" /> into the
875 specified encoding <paramref name="encoding" />.
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" />]
881 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
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>
889 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
890 <AssemblyVersion>2.0.0.0</AssemblyVersion>
891 <AssemblyVersion>4.0.0.0</AssemblyVersion>
894 <ReturnType>System.IntPtr</ReturnType>
897 <Parameter Name="s" Type="System.String" />
898 <Parameter Name="index" Type="System.Int32" />
899 <Parameter Name="count" Type="System.Int32" />
903 A <see cref="T:System.String" /> to copy into the system heap.
906 A <see cref="T:System.Int32" /> containing the start index into
907 <paramref name="s" /> to start marshaling.
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" />.
915 Allocates a copy of <paramref name="s" /> on the system heap in the
916 <see cref="T:Mono.Unix.UnixEncoding" /> encoding.
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
926 The pointer returned should be freed with
927 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
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" />).
937 <exception cref="T:System.ArgumentOutOfRangeException">
939 <paramref name="count" /> or <paramref name="index" /> is less
944 <paramref name="index" /> plus <paramref name="count" /> is
945 greater than the length of <paramref name="s" />.
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.
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" />]
956 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
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>
964 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
965 <AssemblyVersion>2.0.0.0</AssemblyVersion>
966 <AssemblyVersion>4.0.0.0</AssemblyVersion>
969 <ReturnType>System.IntPtr</ReturnType>
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" />
979 A <see cref="T:System.String" /> to copy into the system heap.
982 A <see cref="T:System.Int32" /> containing the start index into
983 <paramref name="s" /> to start marshaling.
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" />.
990 <param name="encoding">
991 A <see cref="T:System.Text.Encoding" /> specifying which encoding to
992 marshal the string into.
995 Allocates a copy of <paramref name="s" /> on the system heap in the
996 <paramref name="encoding" /> encoding.
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
1006 The pointer returned should be freed with
1007 <see cref="M:Mono.Unix.UnixMarshal.FreeHeap" /> to avoid a memory
1011 <exception cref="T:System.ArgumentNullException">
1012 <paramref name="encoding" /> is <see langword="null" />.
1014 <exception cref="T:System.ArgumentOutOfRangeException">
1016 <paramref name="count" /> or <paramref name="index" /> is less
1021 <paramref name="index" /> plus <paramref name="count" /> is
1022 greater than the length of <paramref name="s" />.
1025 <exception cref="T:System.NotSupportedException">
1026 There was an error marshaling <paramref name="s" /> into the
1027 specified encoding <paramref name="encoding" />.
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" />]
1033 <altmember cref="M:Mono.Unix.UnixMarshal.FreeHeap" />
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>
1041 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1042 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1043 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1047 <AttributeName>System.CLSCompliant(false)</AttributeName>
1051 <ReturnType>System.Void</ReturnType>
1054 <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
1057 <param name="errno">
1058 A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
1062 Throws an exception that best matches <paramref name="errno" />.
1066 This method translates <paramref name="errno" /> into its closest
1067 matching exception type, and throws the exception.
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
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.
1082 <exception cref="T:System.ArgumentException">
1083 <paramref name="errno" />
1085 <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1086 <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1088 <exception cref="T:System.ArgumentOutOfRangeException">
1089 <paramref name="errno" />
1091 <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1093 <exception cref="T:System.InvalidOperationException">
1094 <paramref name="errno" />
1096 <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1097 <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1099 <exception cref="T:System.InvalidProgramException">
1100 <paramref name="errno" />
1102 <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1104 <exception cref="T:System.NullReferenceException">
1105 <paramref name="errno" />
1107 <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1109 <exception cref="T:System.OverflowException">
1110 <paramref name="errno" />
1112 <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1114 <exception cref="T:System.UnauthorizedAccessException">
1115 <paramref name="errno" />
1117 <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1118 <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1120 <exception cref="T:System.IO.DirectoryNotFoundException">
1121 <paramref name="errno" />
1123 <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1125 <exception cref="T:System.IO.FileNotFoundException">
1126 <paramref name="errno" />
1128 <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1130 <exception cref="T:System.IO.IOException">
1131 <paramref name="errno" />
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" />.
1140 <exception cref="T:System.IO.PathTooLongException">
1141 <paramref name="errno" />
1143 <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1145 <exception cref="T:Mono.Unix.UnixIOException">
1146 <paramref name="errno" /> is not any of the above error values.
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>
1155 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1156 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1157 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1161 <AttributeName>System.CLSCompliant(false)</AttributeName>
1165 <ReturnType>System.Void</ReturnType>
1168 <Parameter Name="retval" Type="System.Int32" />
1169 <Parameter Name="errno" Type="Mono.Unix.Native.Errno" />
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" />.
1176 <param name="errno">
1177 A <see cref="T:Mono.Unix.Native.Errno" /> specifying the exception
1181 Throws an exception that best matches <paramref name="errno" />
1182 if <paramref name="retval" /> is <c>-1</c>.
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.
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
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.
1204 <exception cref="T:System.ArgumentException">
1205 <paramref name="errno" />
1207 <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1208 <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1210 <exception cref="T:System.ArgumentOutOfRangeException">
1211 <paramref name="errno" />
1213 <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1215 <exception cref="T:System.InvalidOperationException">
1216 <paramref name="errno" />
1218 <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1219 <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1221 <exception cref="T:System.InvalidProgramException">
1222 <paramref name="errno" />
1224 <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1226 <exception cref="T:System.NullReferenceException">
1227 <paramref name="errno" />
1229 <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1231 <exception cref="T:System.OverflowException">
1232 <paramref name="errno" />
1234 <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1236 <exception cref="T:System.UnauthorizedAccessException">
1237 <paramref name="errno" />
1239 <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1240 <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1242 <exception cref="T:System.IO.DirectoryNotFoundException">
1243 <paramref name="errno" />
1245 <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1247 <exception cref="T:System.IO.FileNotFoundException">
1248 <paramref name="errno" />
1250 <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1252 <exception cref="T:System.IO.IOException">
1253 <paramref name="errno" />
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" />.
1262 <exception cref="T:System.IO.PathTooLongException">
1263 <paramref name="errno" />
1265 <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
1267 <exception cref="T:Mono.Unix.UnixIOException">
1268 <paramref name="errno" /> is not any of the above error values.
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>
1277 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1278 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1279 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1282 <ReturnType>System.Void</ReturnType>
1287 Throws an exception that best matches the last error returned
1288 from <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />.
1292 This is equivalent to calling
1293 <see cref="M:Mono.Unix.UnixMarshal.ThrowExceptionForError" /> (<see cref="M:Mono.Unix.Native.Stdlib.GetLastError" /> ()).
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
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.
1308 <exception cref="T:System.ArgumentException">
1309 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1311 <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1312 <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1314 <exception cref="T:System.ArgumentOutOfRangeException">
1315 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1317 <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1319 <exception cref="T:System.InvalidOperationException">
1320 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1322 <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1323 <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1325 <exception cref="T:System.InvalidProgramException">
1326 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1328 <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1330 <exception cref="T:System.NullReferenceException">
1331 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1333 <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1335 <exception cref="T:System.OverflowException">
1336 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1338 <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1340 <exception cref="T:System.UnauthorizedAccessException">
1341 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1343 <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1344 <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1346 <exception cref="T:System.IO.DirectoryNotFoundException">
1347 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1349 <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1351 <exception cref="T:System.IO.FileNotFoundException">
1352 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1354 <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1356 <exception cref="T:System.IO.IOException">
1357 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
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" />.
1366 <exception cref="T:System.IO.PathTooLongException">
1367 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1369 <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
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.
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>
1382 <AssemblyVersion>1.0.5000.0</AssemblyVersion>
1383 <AssemblyVersion>2.0.0.0</AssemblyVersion>
1384 <AssemblyVersion>4.0.0.0</AssemblyVersion>
1387 <ReturnType>System.Void</ReturnType>
1390 <Parameter Name="retval" Type="System.Int32" />
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" />.
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>.
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.
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
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.
1422 <exception cref="T:System.ArgumentException">
1423 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1425 <see cref="F:Mono.Unix.Native.Errno.EBADF" /> or
1426 <see cref="F:Mono.Unix.Native.Errno.EINVAL" />.
1428 <exception cref="T:System.ArgumentOutOfRangeException">
1429 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1431 <see cref="F:Mono.Unix.Native.Errno.ERANGE" />.
1433 <exception cref="T:System.InvalidOperationException">
1434 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1436 <see cref="F:Mono.Unix.Native.Errno.EOPNOTSUPP" /> or
1437 <see cref="F:Mono.Unix.Native.Errno.EPERM" />.
1439 <exception cref="T:System.InvalidProgramException">
1440 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1442 <see cref="F:Mono.Unix.Native.Errno.ENOEXEC" />.
1444 <exception cref="T:System.NullReferenceException">
1445 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1447 <see cref="F:Mono.Unix.Native.Errno.EFAULT" />.
1449 <exception cref="T:System.OverflowException">
1450 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1452 <see cref="F:Mono.Unix.Native.Errno.EOVERFLOW" />.
1454 <exception cref="T:System.UnauthorizedAccessException">
1455 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1457 <see cref="F:Mono.Unix.Native.Errno.EACCES" /> or
1458 <see cref="F:Mono.Unix.Native.Errno.EISDIR" />.
1460 <exception cref="T:System.IO.DirectoryNotFoundException">
1461 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1463 <see cref="F:Mono.Unix.Native.Errno.ENOTDIR" />.
1465 <exception cref="T:System.IO.FileNotFoundException">
1466 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1468 <see cref="F:Mono.Unix.Native.Errno.ENOENT" />.
1470 <exception cref="T:System.IO.IOException">
1471 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
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" />.
1480 <exception cref="T:System.IO.PathTooLongException">
1481 <see cref="M:Mono.Unix.Native.Stdlib.GetLastError" />
1483 <see cref="F:Mono.Unix.Native.Errno.ENAMETOOLONG" />.
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.