public static SignalHandler signal(Signum signum, SignalHandler handler) { int _sig = NativeConvert.FromSignum(signum); Delegate[] handlers = handler.GetInvocationList(); for (int i = 0; i < handlers.Length; ++i) { Marshal.Prelink(handlers [i].Method); } IntPtr r; if (handler == SIG_DFL) { r = sys_signal(_sig, _SIG_DFL); } else if (handler == SIG_ERR) { r = sys_signal(_sig, _SIG_ERR); } else if (handler == SIG_IGN) { r = sys_signal(_sig, _SIG_IGN); } else { r = sys_signal(_sig, handler); } return(TranslateHandler(r)); }
public static string strerror(Errno errnum) { int e = NativeConvert.FromErrno(errnum); lock (strerror_lock) { IntPtr r = sys_strerror(e); return(UnixMarshal.PtrToString(r)); } }
// // <errno.h> -- COMPLETE // public static Errno GetLastError() { if (Environment.OSVersion.Platform != PlatformID.Unix) { // On Windows Marshal.GetLastWin32Error() doesn't take errno // into account so we need to call Mono_Posix_Stdlib_GetLastError() // which returns the value of errno in the C runtime // libMonoPosixHelper.dll was linked against. return((Errno)_GetLastError()); } return(NativeConvert.ToErrno(Marshal.GetLastWin32Error())); }
public static string strerror(Errno errnum) { string str; int num = NativeConvert.FromErrno(errnum); object strerrorLock = Stdlib.strerror_lock; Monitor.Enter(strerrorLock); try { str = UnixMarshal.PtrToString(Stdlib.sys_strerror(num)); } finally { Monitor.Exit(strerrorLock); } return(str); }
// // <errno.h> -- COMPLETE // public static Errno GetLastError() { // Always call Marshal.GetLastWin32Error() before the OS check, // even on Windows where we don't use the return value. If we do // the OS check first Environment.OSVersion (if it happens to be // the first ever access) will clobber Marshal.GetLastWin32Error() // and we won't get the desired errno value on non-Windows platforms. int errno = Marshal.GetLastWin32Error(); if (Environment.OSVersion.Platform != PlatformID.Unix) { // On Windows Marshal.GetLastWin32Error() doesn't take errno // into account so we need to call Mono_Posix_Stdlib_GetLastError() // which returns the value of errno in the C runtime // libMonoPosixHelper.dll was linked against. errno = _GetLastError(); } return(NativeConvert.ToErrno(errno)); }
public static int chmod(string path, FilePermissions mode) { uint _mode = NativeConvert.FromFilePermissions(mode); return(sys_chmod(path, _mode)); }
public static int raise(RealTimeSignum rts) { return(sys_raise(NativeConvert.FromRealTimeSignum(rts))); }
public static int raise(Signum sig) { return(sys_raise(NativeConvert.FromSignum(sig))); }
public static int SetSignalAction(RealTimeSignum rts, SignalAction action) { return(SetSignalAction(NativeConvert.FromRealTimeSignum(rts), action)); }
public static int SetSignalAction(Signum signal, SignalAction action) { return(SetSignalAction(NativeConvert.FromSignum(signal), action)); }
public static int fseek(IntPtr stream, long offset, SeekFlags origin) { return(Stdlib.sys_fseek(stream, offset, NativeConvert.FromSeekFlags(origin))); }
protected static void SetLastError(Errno error) { int _error = NativeConvert.FromErrno(error); SetLastError(_error); }
// // <errno.h> -- COMPLETE // public static Errno GetLastError() { int errno = Marshal.GetLastWin32Error(); return(NativeConvert.ToErrno(errno)); }
public static int strerror_r(Errno errnum, StringBuilder buf, ulong n) { int e = NativeConvert.FromErrno(errnum); return(sys_strerror_r(e, buf, n)); }
public static int fseek(IntPtr stream, long offset, SeekFlags origin) { int _origin = NativeConvert.FromSeekFlags(origin); return(sys_fseek(stream, offset, _origin)); }
protected static void SetLastError(Errno error) { Stdlib.SetLastError(NativeConvert.FromErrno(error)); }
public static Errno GetLastError() { return(NativeConvert.ToErrno(Marshal.GetLastWin32Error())); }