// Jonathan Pryor (jonpryor@vt.edu)
//
// (C) 2004-2005 Jonathan Pryor
+//
+
+// Deprecated Warning:
+//
+// This class is deprecated, and exists only for backward compatibility
+// with development versions of Mono 1.1.x. It will be removed with
+// Mono 1.2. Migrate to the Mono.Unix.Native types, or use the Unix*
+// wrapper classes instead.
+//
+// The [Map] attributes have been removed. However, since the type names
+// are identical to those in Mono.Unix.Native, the MonoPosixHelper methods
+// will continue to exist and function correctly.
+//
+
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
//
using System;
+using System.Collections;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
#region Enumerations
+ [Obsolete ("Use Mono.Unix.Native.Errno")]
[Map]
public enum Error : int {
// errors & their values liberally copied from
#region Classes
+ [Obsolete ("Use Mono.Unix.Native.FilePosition")]
public sealed class FilePosition : IDisposable {
private static readonly int FilePositionDumpSize =
#if NET_2_0 && UNMANAGED_FN_PTR_SUPPORT_FIXED
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
#endif
+ [Obsolete ("Use Mono.Unix.Native.SignalHandler")]
public delegate void SignalHandler (int signal);
+#if !NET_2_0
internal sealed class SignalWrapper {
private IntPtr handler;
Stdlib.InvokeSignalHandler (signum, handler);
}
}
+#endif
internal class XPrintfFunctions
{
// anything from Syscall is non-portable, but restricting yourself to just
// Stdlib is intended to be portable.
//
+ [CLSCompliant (false)]
+ [Obsolete ("Use Mono.Unix.Native.Stdlib")]
public class Stdlib
{
internal const string LIBC = "msvcrt";
public static readonly SignalHandler SIG_ERR = new SignalHandler (_ErrorHandler);
public static readonly SignalHandler SIG_IGN = new SignalHandler (_IgnoreHandler);
+ private static readonly SignalHandler[] registered_signals;
+
+ static Stdlib ()
+ {
+ Array signals = Enum.GetValues(typeof(Signum));
+ registered_signals = new SignalHandler [(int) signals.GetValue (signals.Length-1)];
+ }
+
[DllImport (LIBC, CallingConvention=CallingConvention.Cdecl,
SetLastError=true, EntryPoint="signal")]
private static extern IntPtr sys_signal (int signum, SignalHandler handler);
public static SignalHandler signal (Signum signum, SignalHandler handler)
{
int _sig = UnixConvert.FromSignum (signum);
+
+ lock (registered_signals) {
+ registered_signals [(int) signum] = handler;
+ }
+
IntPtr r;
if (handler == SIG_DFL)
r = sys_signal (_sig, _SIG_DFL);
return SIG_ERR;
if (handler == _SIG_IGN)
return SIG_IGN;
+#if NET_2_0
+ return (SignalHandler) Marshal.GetDelegateForFunctionPointer (handler, typeof(SignalHandler));
+#else
return new SignalHandler (new SignalWrapper (handler).InvokeSignalHandler);
+#endif
}
[DllImport (LIBC, CallingConvention=CallingConvention.Cdecl, EntryPoint="raise")]