// Set a non-beagrep attribute private static void Set(string path, string name, string value) { if (!FileSystem.Exists(path)) { throw new IOException(path); } byte[] buffer = encoding.GetBytes(value); int retval = Syscall.lsetxattr(path, name, buffer); if (retval == -1) { throw new IOException("Could not set extended attribute on " + path + ": " + Mono.Unix.Native.Stdlib.strerror(Mono.Unix.Native.Stdlib.GetLastError())); } }
// Get a non-beagrep attribute public static string Get(string path, string name) { if (!FileSystem.Exists(path)) { throw new IOException(path); } long size = Syscall.lgetxattr(path, name, xa_buffer); if (size <= 0) { return(null); } return(encoding.GetString(xa_buffer)); }