mirror of
https://github.com/claunia/Claunia.IO.git
synced 2025-12-16 19:24:44 +00:00
Changed everything to use base API type definitions, with
"using" as alias to .NET types.
This commit is contained in:
@@ -1,3 +1,21 @@
|
||||
2015-05-07 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Interop/Linux/Interop.Linux.stat.cs:
|
||||
* Interop/Linux/Interop.Linux.xattr.cs:
|
||||
* Interop/Linux/Interop.Linux.types.cs:
|
||||
* Interop/Linux/Interop.Linux.statfs.cs:
|
||||
* Interop/Linux/Interop.Linux.stat64.cs:
|
||||
* Interop/Linux/Interop.Linux.xattr64.cs:
|
||||
* Interop/FreeBSD/Interop.FreeBSD.stat.cs:
|
||||
* Interop/Linux/Interop.Linux.statfs64.cs:
|
||||
* Interop/FreeBSD/Interop.FreeBSD.types.cs:
|
||||
* Interop/FreeBSD/Interop.FreeBSD.uname.cs:
|
||||
* Interop/Linux/Interop.Linux.Libraries.cs:
|
||||
* Interop/FreeBSD/Interop.FreeBSD.statfs.cs:
|
||||
* Interop/FreeBSD/Interop.FreeBSD.extattr.cs:
|
||||
Changed everything to use base API type definitions, with
|
||||
"using" as alias to .NET types.
|
||||
|
||||
2015-05-07 Natalia Portillo <claunia@claunia.com>
|
||||
|
||||
* Claunia.IO.csproj:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Interop.Apple.xattr.cs
|
||||
// Interop.FreeBSD.extattr.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
@@ -26,93 +26,43 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region FreeBSD 32-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using int64_t = System.Int64;
|
||||
using nlink_t = System.UInt16;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.Int32;
|
||||
using ssize_t = System.Int32;
|
||||
using uid_t = System.UInt32;
|
||||
using uint32_t = System.UInt32;
|
||||
using uint64_t = System.UInt64;
|
||||
using __dev_t = System.UInt32;
|
||||
using __int32_t = System.Int32;
|
||||
using __uint32_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal static partial class FreeBSD
|
||||
{
|
||||
public enum attrNamespace
|
||||
{
|
||||
/// <summary>
|
||||
/// Empty namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x00000000,
|
||||
/// <summary>
|
||||
/// User namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_USER = 0x00000001,
|
||||
/// <summary>
|
||||
/// System namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x00000002
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets an extended attribute value
|
||||
/// Calls to system's extattr_get_file(2)
|
||||
/// </summary>
|
||||
/// <returns>Number of bytes read. If <paramref name="data"/> is <see cref="null"/>, then the size for the buffer to store the data.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where to store the data.</param>
|
||||
/// <param name="nbytes">Size of the buffer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 extattr_get_file(string path, attrNamespace attrnamespace, string attrname, IntPtr data, Int64 nbytes);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an extended attribute value
|
||||
/// Calls to system's extattr_set_file(2)
|
||||
/// </summary>
|
||||
/// <returns>Number of bytes written.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer where the data is stored.</param>
|
||||
/// <param name="nbytes">Size of the data.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 extattr_set_file(string path, attrNamespace attrnamespace, string attrname, IntPtr data, Int64 nbytes);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an extended attribute value
|
||||
/// Calls to system's extattr_delete_file(2)
|
||||
/// </summary>
|
||||
/// <returns>0 if successful, -1 if failure.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where the data is stored.</param>
|
||||
/// <param name="nbytes">Size of the pointer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 extattr_delete_file(string path, attrNamespace attrnamespace, string attrname);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of extended attributes that the file has in that namespace
|
||||
/// The list is stored in the buffer as an undetermined length of Pascal strings,
|
||||
/// 1 byte tells the size of the extended attribute name in bytes, and is followed by the name.
|
||||
/// Calls to system's extattr_list_file(2)
|
||||
/// </summary>
|
||||
/// <returns>Size of the list in bytes. If <paramref name="data"/> is <see cref="null"/>, then the size for the buffer to store the list.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where to store the list.</param>
|
||||
/// <param name="nbytes">Size of the buffer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 extattr_list_file(string path, attrNamespace attrnamespace, IntPtr data, Int64 nbytes);
|
||||
|
||||
/// <summary>
|
||||
/// Gets an extended attribute value
|
||||
/// Calls to system's extattr_get_file(2)
|
||||
/// For 32-bit systems
|
||||
/// </summary>
|
||||
/// <returns>Number of bytes read. If <paramref name="data"/> is <see cref="null"/>, then the size for the buffer to store the data.</returns>
|
||||
/// <returns>Number of bytes read. If <paramref name="data"/> is <c>null</c>, then the size for the buffer to store the data.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where to store the data.</param>
|
||||
/// <param name="nbytes">Size of the buffer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi, EntryPoint = "extattr_get_file")]
|
||||
public static extern Int32 extattr_get_file32(string path, attrNamespace attrnamespace, string attrname, IntPtr data, Int32 nbytes);
|
||||
public static extern ssize_t extattr_get_file32(string path, attrNamespace attrnamespace, string attrname, IntPtr data, size_t nbytes);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an extended attribute value
|
||||
@@ -126,7 +76,7 @@ internal static partial class Interop
|
||||
/// <param name="data">Pointer where the data is stored.</param>
|
||||
/// <param name="nbytes">Size of the data.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi, EntryPoint = "extattr_set_file")]
|
||||
public static extern Int32 extattr_set_file32(string path, attrNamespace attrnamespace, string attrname, IntPtr data, Int32 nbytes);
|
||||
public static extern ssize_t extattr_set_file32(string path, attrNamespace attrnamespace, string attrname, IntPtr data, size_t nbytes);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes an extended attribute value
|
||||
@@ -137,10 +87,8 @@ internal static partial class Interop
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where the data is stored.</param>
|
||||
/// <param name="nbytes">Size of the pointer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi, EntryPoint = "extattr_delete_file")]
|
||||
public static extern Int32 extattr_delete_file32(string path, attrNamespace attrnamespace, string attrname);
|
||||
public static extern ssize_t extattr_delete_file32(string path, attrNamespace attrnamespace, string attrname);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of extended attributes that the file has in that namespace
|
||||
@@ -149,14 +97,13 @@ internal static partial class Interop
|
||||
/// Calls to system's extattr_list_file(2)
|
||||
/// For 32-bit systems
|
||||
/// </summary>
|
||||
/// <returns>Size of the list in bytes. If <paramref name="data"/> is <see cref="null"/>, then the size for the buffer to store the list.</returns>
|
||||
/// <returns>Size of the list in bytes. If <paramref name="data"/> is <c>null</c>, then the size for the buffer to store the list.</returns>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="attrnamespace">Extended attribute namespace, <see cref="attrNamespace"/>.</param>
|
||||
/// <param name="attrname">Extended attribute name.</param>
|
||||
/// <param name="data">Pointer to buffer where to store the list.</param>
|
||||
/// <param name="nbytes">Size of the buffer.</param>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi, EntryPoint = "extattr_list_file")]
|
||||
public static extern Int32 extattr_list_file32(string path, attrNamespace attrnamespace, IntPtr data, Int32 nbytes);
|
||||
public static extern ssize_t extattr_list_file32(string path, attrNamespace attrnamespace, IntPtr data, size_t nbytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Interop.Apple.stat.cs
|
||||
// Interop.FreeBSD.stat.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
@@ -23,86 +23,32 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region FreeBSD 32-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using int64_t = System.Int64;
|
||||
using nlink_t = System.UInt16;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.Int32;
|
||||
using ssize_t = System.Int32;
|
||||
using uid_t = System.UInt32;
|
||||
using uint32_t = System.UInt32;
|
||||
using uint64_t = System.UInt64;
|
||||
using __dev_t = System.UInt32;
|
||||
using __int32_t = System.Int32;
|
||||
using __uint32_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal static partial class FreeBSD
|
||||
{
|
||||
/// <summary>
|
||||
/// stat(2) structure when 64 bit
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
internal struct Stat64
|
||||
{
|
||||
/// <summary>
|
||||
/// inode's device
|
||||
/// </summary>
|
||||
UInt32 st_dev;
|
||||
/// <summary>
|
||||
/// inode's number
|
||||
/// </summary>
|
||||
UInt32 st_ino;
|
||||
/// <summary>
|
||||
/// inode protection mode
|
||||
/// </summary>
|
||||
mode_t st_mode;
|
||||
/// <summary>
|
||||
/// number of hard links
|
||||
/// </summary>
|
||||
UInt16 st_nlink;
|
||||
/// <summary>
|
||||
/// user ID of the file's owner
|
||||
/// </summary>
|
||||
UInt32 st_uid;
|
||||
/// <summary>
|
||||
/// group ID of the file's group
|
||||
/// </summary>
|
||||
UInt32 st_gid;
|
||||
/// <summary>
|
||||
/// device type
|
||||
/// </summary>
|
||||
UInt32 st_rdev;
|
||||
/// <summary>
|
||||
/// time of last access
|
||||
/// </summary>
|
||||
Timespec64 st_atim;
|
||||
/// <summary>
|
||||
/// time of last data modification
|
||||
/// </summary>
|
||||
Timespec64 st_mtim;
|
||||
/// <summary>
|
||||
/// time of last file status change
|
||||
/// </summary>
|
||||
Timespec64 st_ctim;
|
||||
/// <summary>
|
||||
/// file size, in bytes
|
||||
/// </summary>
|
||||
Int64 st_size;
|
||||
/// <summary>
|
||||
/// blocks allocated for file
|
||||
/// </summary>
|
||||
Int64 st_blocks;
|
||||
/// <summary>
|
||||
/// optimal blocksize for I/O
|
||||
/// </summary>
|
||||
Int32 st_blksize;
|
||||
/// <summary>
|
||||
/// user defined flags for file
|
||||
/// </summary>
|
||||
flags_t st_flags;
|
||||
/// <summary>
|
||||
/// file generation number
|
||||
/// </summary>
|
||||
UInt32 st_gen;
|
||||
Int32 st_lspare;
|
||||
/// <summary>
|
||||
/// time of file creation
|
||||
/// </summary>
|
||||
Timespec64 st_birthtim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// stat(2) structure when 32 bit
|
||||
/// </summary>
|
||||
@@ -112,11 +58,11 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// inode's device
|
||||
/// </summary>
|
||||
UInt32 st_dev;
|
||||
__dev_t st_dev;
|
||||
/// <summary>
|
||||
/// inode's number
|
||||
/// </summary>
|
||||
UInt32 st_ino;
|
||||
ino_t st_ino;
|
||||
/// <summary>
|
||||
/// inode protection mode
|
||||
/// </summary>
|
||||
@@ -124,19 +70,19 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// number of hard links
|
||||
/// </summary>
|
||||
UInt16 st_nlink;
|
||||
nlink_t st_nlink;
|
||||
/// <summary>
|
||||
/// user ID of the file's owner
|
||||
/// </summary>
|
||||
UInt32 st_uid;
|
||||
uid_t st_uid;
|
||||
/// <summary>
|
||||
/// group ID of the file's group
|
||||
/// </summary>
|
||||
UInt32 st_gid;
|
||||
gid_t st_gid;
|
||||
/// <summary>
|
||||
/// device type
|
||||
/// </summary>
|
||||
UInt32 st_rdev;
|
||||
__dev_t st_rdev;
|
||||
/// <summary>
|
||||
/// time of last access
|
||||
/// </summary>
|
||||
@@ -152,15 +98,15 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// file size, in bytes
|
||||
/// </summary>
|
||||
Int64 st_size;
|
||||
off_t st_size;
|
||||
/// <summary>
|
||||
/// blocks allocated for file
|
||||
/// </summary>
|
||||
Int64 st_blocks;
|
||||
blkcnt_t st_blocks;
|
||||
/// <summary>
|
||||
/// optimal blocksize for I/O
|
||||
/// </summary>
|
||||
Int32 st_blksize;
|
||||
blksize_t st_blksize;
|
||||
/// <summary>
|
||||
/// user defined flags for file
|
||||
/// </summary>
|
||||
@@ -168,167 +114,14 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// file generation number
|
||||
/// </summary>
|
||||
UInt32 st_gen;
|
||||
Int32 st_lspare;
|
||||
__uint32_t st_gen;
|
||||
__int32_t st_lspare;
|
||||
/// <summary>
|
||||
/// time of file creation
|
||||
/// </summary>
|
||||
Timespec st_birthtim;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File mode and permissions
|
||||
/// </summary>
|
||||
[Flags]
|
||||
internal enum mode_t : ushort
|
||||
{
|
||||
/// <summary>type of file mask</summary>
|
||||
S_IFMT = 0xF000,
|
||||
/// <summary>named pipe (fifo)</summary>
|
||||
S_IFIFO = 0x1000,
|
||||
/// <summary>character special</summary>
|
||||
S_IFCHR = 0x2000,
|
||||
/// <summary>directory</summary>
|
||||
S_IFDIR = 0x4000,
|
||||
/// <summary>block special</summary>
|
||||
S_IFBLK = 0x6000,
|
||||
/// <summary>regular</summary>
|
||||
S_IFREG = 0x8000,
|
||||
/// <summary>symbolic link </summary>
|
||||
S_IFLNK = 0xA000,
|
||||
/// <summary>socket</summary>
|
||||
S_IFSOCK = 0xC000,
|
||||
/// <summary>whiteout</summary>
|
||||
S_IFWHT = 0xE000,
|
||||
/// <summary>set user id on execution</summary>
|
||||
S_ISUID = 0x0800,
|
||||
/// <summary>set group id on execution</summary>
|
||||
S_ISGID = 0x0400,
|
||||
/// <summary>save swapped text even after use</summary>
|
||||
S_ISVTX = 0x0200,
|
||||
/// <summary>RWX mask for owner</summary>
|
||||
S_IRWXU = 0x01C0,
|
||||
/// <summary>read permission, owner</summary>
|
||||
S_IRUSR = 0x0100,
|
||||
/// <summary>write permission, owner</summary>
|
||||
S_IWUSR = 0x0080,
|
||||
/// <summary>execute/search permission, owner</summary>
|
||||
S_IXUSR = 0x0040,
|
||||
/// <summary>RWX mask for group</summary>
|
||||
S_IRWXG = 0x0038,
|
||||
/// <summary>read permission, group</summary>
|
||||
S_IRGRP = 0x0020,
|
||||
/// <summary>write permission, group</summary>
|
||||
S_IWGRP = 0x0010,
|
||||
/// <summary>execute/search permission, group</summary>
|
||||
S_IXGRP = 0x0008,
|
||||
/// <summary>RWX mask for other</summary>
|
||||
S_IRWXO = 0x0007,
|
||||
/// <summary>read permission, other</summary>
|
||||
S_IROTH = 0x0004,
|
||||
/// <summary>write permission, other</summary>
|
||||
S_IWOTH = 0x0002,
|
||||
/// <summary>execute/search permission, other</summary>
|
||||
S_IXOTH = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User-set flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
internal enum flags_t : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Mask of owner changeable flags
|
||||
/// </summary>
|
||||
UF_SETTABLE = 0x0000FFFF,
|
||||
/// <summary>
|
||||
/// Do not dump file
|
||||
/// </summary>
|
||||
UF_NODUMP = 0x00000001,
|
||||
/// <summary>
|
||||
/// File may not be changed
|
||||
/// </summary>
|
||||
UF_IMMUTABLE = 0x00000002,
|
||||
/// <summary>
|
||||
/// Writes to file may only append
|
||||
/// </summary>
|
||||
UF_APPEND = 0x00000004,
|
||||
/// <summary>
|
||||
/// The directory is opaque when viewed through a union stack.
|
||||
/// </summary>
|
||||
UF_OPAQUE = 0x00000008,
|
||||
/// <summary>
|
||||
/// File may not be removed or renamed.
|
||||
/// </summary>
|
||||
UF_NOUNLINK = 0x00000010,
|
||||
/// <summary>
|
||||
/// File is compressed in HFS+ (>=10.6)
|
||||
/// </summary>
|
||||
[Obsolete("Unimplemented in FreeBSD")]
|
||||
UF_COMPRESSED = 0x00000020,
|
||||
/// <summary>
|
||||
/// OBSOLETE: No longer used.
|
||||
/// Issue notifications for deletes or renames of files with this flag set
|
||||
/// </summary>
|
||||
[Obsolete("Unimplemented in FreeBSD")]
|
||||
UF_TRACKED = 0x00000040,
|
||||
/// <summary>
|
||||
/// Windows system file bit
|
||||
/// </summary>
|
||||
UF_SYSTEM = 0x00000080,
|
||||
/// <summary>
|
||||
/// Sparse file
|
||||
/// </summary>
|
||||
UF_SPARSE = 0x00000100,
|
||||
/// <summary>
|
||||
/// File is offline
|
||||
/// </summary>
|
||||
UF_OFFLINE = 0x00000200,
|
||||
/// <summary>
|
||||
/// Windows reparse point file bit
|
||||
/// </summary>
|
||||
UF_REPARSE = 0x00000400,
|
||||
/// <summary>
|
||||
/// File needs to be archived
|
||||
/// </summary>
|
||||
UF_ARCHIVE = 0x00000800,
|
||||
/// <summary>
|
||||
/// Windows readonly file bit
|
||||
/// </summary>
|
||||
UF_READONLY = 0x00001000,
|
||||
|
||||
/// <summary>
|
||||
/// File is hidden
|
||||
/// </summary>
|
||||
UF_HIDDEN = 0x00008000,
|
||||
|
||||
/// <summary>
|
||||
/// Mask of superuser changeable flags
|
||||
/// </summary>
|
||||
SF_SETTABLE = 0xffff0000,
|
||||
/// <summary>
|
||||
/// File is archived
|
||||
/// </summary>
|
||||
SF_ARCHIVED = 0x00010000,
|
||||
/// <summary>
|
||||
/// File may not be changed
|
||||
/// </summary>
|
||||
SF_IMMUTABLE = 0x00020000,
|
||||
/// <summary>
|
||||
/// Writes to file may only append
|
||||
/// </summary>
|
||||
SF_APPEND = 0x00040000,
|
||||
/// <summary>
|
||||
/// File may not be removed or renamed
|
||||
/// </summary>
|
||||
SF_NOUNLINK = 0x00100000,
|
||||
/// <summary>
|
||||
/// Snapshot inode
|
||||
/// </summary>
|
||||
SF_SNAPSHOT = 0x00200000
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Obtains information of the file pointed by <paramref name="path"/>.
|
||||
/// Calls to system's stat(2)
|
||||
@@ -338,15 +131,5 @@ internal static partial class Interop
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set.</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true)]
|
||||
public static extern int stat(string path, out Stat buf);
|
||||
|
||||
/// <summary>
|
||||
/// Obtains information of the file pointed by <paramref name="path"/>.
|
||||
/// Calls to system's stat64(2)
|
||||
/// </summary>
|
||||
/// <param name="path">Path to the file.</param>
|
||||
/// <param name="buf"><see cref="Stat64"/>.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set.</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, EntryPoint="stat")]
|
||||
public static extern int stat64(string path, out Stat64 buf);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// Interop.FreeBSD.stat.cs
|
||||
// Interop.FreeBSD.statfs.cs
|
||||
//
|
||||
// Author:
|
||||
// Natalia Portillo <claunia@claunia.com>
|
||||
@@ -23,8 +23,27 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region FreeBSD 64-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using int64_t = System.Int64;
|
||||
using nlink_t = System.UInt16;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.Int64;
|
||||
using ssize_t = System.Int64;
|
||||
using uid_t = System.UInt32;
|
||||
using uint32_t = System.UInt32;
|
||||
using uint64_t = System.UInt64;
|
||||
using __dev_t = System.UInt32;
|
||||
using __int32_t = System.Int32;
|
||||
using __uint32_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
@@ -37,42 +56,42 @@ internal static partial class Interop
|
||||
internal struct StatFS
|
||||
{
|
||||
/// <summary>structure version number</summary>
|
||||
UInt32 f_version;
|
||||
uint32_t f_version;
|
||||
/// <summary>type of filesystem</summary>
|
||||
UInt32 f_type;
|
||||
uint32_t f_type;
|
||||
/// <summary>copy of mount exported flags</summary>
|
||||
mntflags_t f_flags;
|
||||
/// <summary>filesystem fragment size</summary>
|
||||
UInt64 f_bsize;
|
||||
uint64_t f_bsize;
|
||||
/// <summary>optimal transfer block size</summary>
|
||||
UInt64 f_iosize;
|
||||
uint64_t f_iosize;
|
||||
/// <summary>total data blocks in filesystem</summary>
|
||||
UInt64 f_blocks;
|
||||
uint64_t f_blocks;
|
||||
/// <summary>free blocks in filesystem</summary>
|
||||
UInt64 f_bfree;
|
||||
uint64_t f_bfree;
|
||||
/// <summary>free blocks avail to non-superuser</summary>
|
||||
Int64 f_bavail;
|
||||
int64_t f_bavail;
|
||||
/// <summary>total file nodes in filesystem</summary>
|
||||
UInt64 f_files;
|
||||
uint64_t f_files;
|
||||
/// <summary>free nodes avail to non-superuser</summary>
|
||||
Int64 f_ffree;
|
||||
int64_t f_ffree;
|
||||
/// <summary>count of sync writes since mount</summary>
|
||||
UInt64 f_syncwrites;
|
||||
uint64_t f_syncwrites;
|
||||
/// <summary>count of async writes since mount</summary>
|
||||
UInt64 f_asyncwrites;
|
||||
uint64_t f_asyncwrites;
|
||||
/// <summary>count of sync reads since mount</summary>
|
||||
UInt64 f_syncreads;
|
||||
uint64_t f_syncreads;
|
||||
/// <summary>count of async reads since mount</summary>
|
||||
UInt64 f_asyncreads;
|
||||
uint64_t f_asyncreads;
|
||||
/// <summary>unused spare</summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray,
|
||||
ArraySubType = UnmanagedType.U8, SizeConst = 10)]
|
||||
[Obsolete("RESERVED: DO NOT USE")]
|
||||
UInt64[] f_spare;
|
||||
uint64_t[] f_spare;
|
||||
/// <summary>maximum filename length</summary>
|
||||
UInt32 f_namemax;
|
||||
uint32_t f_namemax;
|
||||
/// <summary>user that mounted the filesystem</summary>
|
||||
UInt32 f_owner;
|
||||
uid_t f_owner;
|
||||
/// <summary>filesystem id</summary>
|
||||
fsid_t f_fsid;
|
||||
/// <summary>spare string space</summary>
|
||||
|
||||
@@ -141,5 +141,174 @@ internal static partial class Interop
|
||||
/// <summary>do not show entry in df</summary>
|
||||
MNT_IGNORE = 0x0000000000800000
|
||||
}
|
||||
|
||||
public enum attrNamespace
|
||||
{
|
||||
/// <summary>
|
||||
/// Empty namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_EMPTY = 0x00000000,
|
||||
/// <summary>
|
||||
/// User namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_USER = 0x00000001,
|
||||
/// <summary>
|
||||
/// System namespace
|
||||
/// </summary>
|
||||
EXTATTR_NAMESPACE_SYSTEM = 0x00000002
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// File mode and permissions
|
||||
/// </summary>
|
||||
[Flags]
|
||||
internal enum mode_t : ushort
|
||||
{
|
||||
/// <summary>type of file mask</summary>
|
||||
S_IFMT = 0xF000,
|
||||
/// <summary>named pipe (fifo)</summary>
|
||||
S_IFIFO = 0x1000,
|
||||
/// <summary>character special</summary>
|
||||
S_IFCHR = 0x2000,
|
||||
/// <summary>directory</summary>
|
||||
S_IFDIR = 0x4000,
|
||||
/// <summary>block special</summary>
|
||||
S_IFBLK = 0x6000,
|
||||
/// <summary>regular</summary>
|
||||
S_IFREG = 0x8000,
|
||||
/// <summary>symbolic link </summary>
|
||||
S_IFLNK = 0xA000,
|
||||
/// <summary>socket</summary>
|
||||
S_IFSOCK = 0xC000,
|
||||
/// <summary>whiteout</summary>
|
||||
S_IFWHT = 0xE000,
|
||||
/// <summary>set user id on execution</summary>
|
||||
S_ISUID = 0x0800,
|
||||
/// <summary>set group id on execution</summary>
|
||||
S_ISGID = 0x0400,
|
||||
/// <summary>save swapped text even after use</summary>
|
||||
S_ISVTX = 0x0200,
|
||||
/// <summary>RWX mask for owner</summary>
|
||||
S_IRWXU = 0x01C0,
|
||||
/// <summary>read permission, owner</summary>
|
||||
S_IRUSR = 0x0100,
|
||||
/// <summary>write permission, owner</summary>
|
||||
S_IWUSR = 0x0080,
|
||||
/// <summary>execute/search permission, owner</summary>
|
||||
S_IXUSR = 0x0040,
|
||||
/// <summary>RWX mask for group</summary>
|
||||
S_IRWXG = 0x0038,
|
||||
/// <summary>read permission, group</summary>
|
||||
S_IRGRP = 0x0020,
|
||||
/// <summary>write permission, group</summary>
|
||||
S_IWGRP = 0x0010,
|
||||
/// <summary>execute/search permission, group</summary>
|
||||
S_IXGRP = 0x0008,
|
||||
/// <summary>RWX mask for other</summary>
|
||||
S_IRWXO = 0x0007,
|
||||
/// <summary>read permission, other</summary>
|
||||
S_IROTH = 0x0004,
|
||||
/// <summary>write permission, other</summary>
|
||||
S_IWOTH = 0x0002,
|
||||
/// <summary>execute/search permission, other</summary>
|
||||
S_IXOTH = 0x0001
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// User-set flags
|
||||
/// </summary>
|
||||
[Flags]
|
||||
internal enum flags_t : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// Mask of owner changeable flags
|
||||
/// </summary>
|
||||
UF_SETTABLE = 0x0000FFFF,
|
||||
/// <summary>
|
||||
/// Do not dump file
|
||||
/// </summary>
|
||||
UF_NODUMP = 0x00000001,
|
||||
/// <summary>
|
||||
/// File may not be changed
|
||||
/// </summary>
|
||||
UF_IMMUTABLE = 0x00000002,
|
||||
/// <summary>
|
||||
/// Writes to file may only append
|
||||
/// </summary>
|
||||
UF_APPEND = 0x00000004,
|
||||
/// <summary>
|
||||
/// The directory is opaque when viewed through a union stack.
|
||||
/// </summary>
|
||||
UF_OPAQUE = 0x00000008,
|
||||
/// <summary>
|
||||
/// File may not be removed or renamed.
|
||||
/// </summary>
|
||||
UF_NOUNLINK = 0x00000010,
|
||||
/// <summary>
|
||||
/// File is compressed in HFS+ (>=10.6)
|
||||
/// </summary>
|
||||
[Obsolete("Unimplemented in FreeBSD")]
|
||||
UF_COMPRESSED = 0x00000020,
|
||||
/// <summary>
|
||||
/// OBSOLETE: No longer used.
|
||||
/// Issue notifications for deletes or renames of files with this flag set
|
||||
/// </summary>
|
||||
[Obsolete("Unimplemented in FreeBSD")]
|
||||
UF_TRACKED = 0x00000040,
|
||||
/// <summary>
|
||||
/// Windows system file bit
|
||||
/// </summary>
|
||||
UF_SYSTEM = 0x00000080,
|
||||
/// <summary>
|
||||
/// Sparse file
|
||||
/// </summary>
|
||||
UF_SPARSE = 0x00000100,
|
||||
/// <summary>
|
||||
/// File is offline
|
||||
/// </summary>
|
||||
UF_OFFLINE = 0x00000200,
|
||||
/// <summary>
|
||||
/// Windows reparse point file bit
|
||||
/// </summary>
|
||||
UF_REPARSE = 0x00000400,
|
||||
/// <summary>
|
||||
/// File needs to be archived
|
||||
/// </summary>
|
||||
UF_ARCHIVE = 0x00000800,
|
||||
/// <summary>
|
||||
/// Windows readonly file bit
|
||||
/// </summary>
|
||||
UF_READONLY = 0x00001000,
|
||||
|
||||
/// <summary>
|
||||
/// File is hidden
|
||||
/// </summary>
|
||||
UF_HIDDEN = 0x00008000,
|
||||
|
||||
/// <summary>
|
||||
/// Mask of superuser changeable flags
|
||||
/// </summary>
|
||||
SF_SETTABLE = 0xffff0000,
|
||||
/// <summary>
|
||||
/// File is archived
|
||||
/// </summary>
|
||||
SF_ARCHIVED = 0x00010000,
|
||||
/// <summary>
|
||||
/// File may not be changed
|
||||
/// </summary>
|
||||
SF_IMMUTABLE = 0x00020000,
|
||||
/// <summary>
|
||||
/// Writes to file may only append
|
||||
/// </summary>
|
||||
SF_APPEND = 0x00040000,
|
||||
/// <summary>
|
||||
/// File may not be removed or renamed
|
||||
/// </summary>
|
||||
SF_NOUNLINK = 0x00100000,
|
||||
/// <summary>
|
||||
/// Snapshot inode
|
||||
/// </summary>
|
||||
SF_SNAPSHOT = 0x00200000
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ internal static partial class Interop
|
||||
/// </summary>
|
||||
/// <param name="name"><see cref="utsname"/>.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set.</returns>
|
||||
[DllImport("libc", SetLastError = true)]
|
||||
[DllImport(Libraries.Libc, SetLastError = true)]
|
||||
internal static extern int uname(out utsname name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,4 @@ internal static partial class Interop
|
||||
internal const string Libc = "libc";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,8 +23,25 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 32-bit type definitions
|
||||
using blkcnt_t = System.Int32;
|
||||
using blksize_t = System.Int32;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt32;
|
||||
using fsfilcnt_t = System.UInt32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using nlink_t = System.UInt32;
|
||||
using off_t = System.Int32;
|
||||
using size_t = System.UInt32;
|
||||
using ssize_t = System.Int32;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
@@ -39,7 +56,7 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// ID of device containing file
|
||||
/// </summary>
|
||||
UInt64 st_dev;
|
||||
dev_t st_dev;
|
||||
/// <summary>
|
||||
/// padding
|
||||
/// </summary>
|
||||
@@ -47,7 +64,7 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// inode number
|
||||
/// </summary>
|
||||
UInt32 st_ino;
|
||||
ino_t st_ino;
|
||||
/// <summary>
|
||||
/// protection
|
||||
/// </summary>
|
||||
@@ -55,19 +72,19 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// number of hard links
|
||||
/// </summary>
|
||||
UInt32 st_nlink;
|
||||
nlink_t st_nlink;
|
||||
/// <summary>
|
||||
/// user ID of owner
|
||||
/// </summary>
|
||||
UInt32 st_uid;
|
||||
uid_t st_uid;
|
||||
/// <summary>
|
||||
/// group ID of owner
|
||||
/// </summary>
|
||||
UInt32 st_gid;
|
||||
gid_t st_gid;
|
||||
/// <summary>
|
||||
/// device ID (if special file)
|
||||
/// </summary>
|
||||
UInt64 st_rdev;
|
||||
dev_t st_rdev;
|
||||
/// <summary>
|
||||
/// padding
|
||||
/// </summary>
|
||||
@@ -75,15 +92,15 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// total size, in bytes
|
||||
/// </summary>
|
||||
Int32 st_size;
|
||||
off_t st_size;
|
||||
/// <summary>
|
||||
/// blocksize for filesystem I/O
|
||||
/// </summary>
|
||||
Int32 st_blksize;
|
||||
blksize_t st_blksize;
|
||||
/// <summary>
|
||||
/// number of 512B blocks allocated
|
||||
/// </summary>
|
||||
Int32 st_blocks;
|
||||
blkcnt_t st_blocks;
|
||||
/// <summary>
|
||||
/// time of last access
|
||||
/// </summary>
|
||||
|
||||
@@ -23,8 +23,25 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 64-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int64;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt64;
|
||||
using fsfilcnt_t = System.UInt64;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt64;
|
||||
using nlink_t = System.UInt64;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.UInt64;
|
||||
using ssize_t = System.Int64;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.Int64;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
@@ -39,15 +56,15 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// ID of device containing file
|
||||
/// </summary>
|
||||
UInt64 st_dev;
|
||||
dev_t st_dev;
|
||||
/// <summary>
|
||||
/// inode number
|
||||
/// </summary>
|
||||
UInt64 st_ino;
|
||||
ino_t st_ino;
|
||||
/// <summary>
|
||||
/// number of hard links
|
||||
/// </summary>
|
||||
UInt64 st_nlink;
|
||||
nlink_t st_nlink;
|
||||
/// <summary>
|
||||
/// protection
|
||||
/// </summary>
|
||||
@@ -55,11 +72,11 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// user ID of owner
|
||||
/// </summary>
|
||||
UInt32 st_uid;
|
||||
uid_t st_uid;
|
||||
/// <summary>
|
||||
/// group ID of owner
|
||||
/// </summary>
|
||||
UInt32 st_gid;
|
||||
gid_t st_gid;
|
||||
/// <summary>
|
||||
/// padding
|
||||
/// </summary>
|
||||
@@ -67,19 +84,19 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// device ID (if special file)
|
||||
/// </summary>
|
||||
UInt64 st_rdev;
|
||||
dev_t st_rdev;
|
||||
/// <summary>
|
||||
/// total size, in bytes
|
||||
/// </summary>
|
||||
Int64 st_size;
|
||||
off_t st_size;
|
||||
/// <summary>
|
||||
/// blocksize for filesystem I/O
|
||||
/// </summary>
|
||||
Int64 st_blksize;
|
||||
blksize_t st_blksize;
|
||||
/// <summary>
|
||||
/// number of 512B blocks allocated
|
||||
/// </summary>
|
||||
Int64 st_blocks;
|
||||
blkcnt_t st_blocks;
|
||||
/// <summary>
|
||||
/// time of last access
|
||||
/// </summary>
|
||||
|
||||
@@ -23,8 +23,25 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 32-bit type definitions
|
||||
using blkcnt_t = System.Int32;
|
||||
using blksize_t = System.Int32;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt32;
|
||||
using fsfilcnt_t = System.UInt32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using nlink_t = System.UInt32;
|
||||
using off_t = System.Int32;
|
||||
using size_t = System.UInt32;
|
||||
using ssize_t = System.Int32;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
@@ -39,31 +56,31 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// Type of filesystem (see below)
|
||||
/// </summary>
|
||||
Int32 f_type;
|
||||
__fsword_t f_type;
|
||||
/// <summary>
|
||||
/// Optimal transfer block size
|
||||
/// </summary>
|
||||
Int32 f_bsize;
|
||||
__fsword_t f_bsize;
|
||||
/// <summary>
|
||||
/// Total data blocks in filesystem
|
||||
/// </summary>
|
||||
UInt32 f_blocks;
|
||||
fsblkcnt_t f_blocks;
|
||||
/// <summary>
|
||||
/// Free blocks in filesystem
|
||||
/// </summary>
|
||||
UInt32 f_bfree;
|
||||
fsblkcnt_t f_bfree;
|
||||
/// <summary>
|
||||
/// Free blocks available to unprivileged user
|
||||
/// </summary>
|
||||
UInt32 f_bavail;
|
||||
fsblkcnt_t f_bavail;
|
||||
/// <summary>
|
||||
/// Total file nodes in filesystem
|
||||
/// </summary>
|
||||
UInt32 f_files;
|
||||
fsfilcnt_t f_files;
|
||||
/// <summary>
|
||||
/// Free file nodes in filesystem
|
||||
/// </summary>
|
||||
UInt32 f_ffree;
|
||||
fsfilcnt_t f_ffree;
|
||||
/// <summary>
|
||||
/// Filesystem ID
|
||||
/// </summary>
|
||||
@@ -71,11 +88,11 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// Maximum length of filenames
|
||||
/// </summary>
|
||||
Int32 f_namelen;
|
||||
__fsword_t f_namelen;
|
||||
/// <summary>
|
||||
/// Fragment size (since Linux 2.6)
|
||||
/// </summary>
|
||||
Int32 f_frsize;
|
||||
__fsword_t f_frsize;
|
||||
/// <summary>
|
||||
/// Mount flags of filesystem (since Linux 2.6.36)
|
||||
/// </summary>
|
||||
@@ -85,7 +102,7 @@ internal static partial class Interop
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray,
|
||||
ArraySubType = UnmanagedType.I4, SizeConst = 4)]
|
||||
Int32[] f_spare;
|
||||
__fsword_t[] f_spare;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -23,8 +23,25 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 64-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int64;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt64;
|
||||
using fsfilcnt_t = System.UInt64;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt64;
|
||||
using nlink_t = System.UInt64;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.UInt64;
|
||||
using ssize_t = System.Int64;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.Int64;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
@@ -39,31 +56,31 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// Type of filesystem (see below)
|
||||
/// </summary>
|
||||
Int64 f_type;
|
||||
__fsword_t f_type;
|
||||
/// <summary>
|
||||
/// Optimal transfer block size
|
||||
/// </summary>
|
||||
Int64 f_bsize;
|
||||
__fsword_t f_bsize;
|
||||
/// <summary>
|
||||
/// Total data blocks in filesystem
|
||||
/// </summary>
|
||||
UInt64 f_blocks;
|
||||
fsblkcnt_t f_blocks;
|
||||
/// <summary>
|
||||
/// Free blocks in filesystem
|
||||
/// </summary>
|
||||
UInt64 f_bfree;
|
||||
fsblkcnt_t f_bfree;
|
||||
/// <summary>
|
||||
/// Free blocks available to unprivileged user
|
||||
/// </summary>
|
||||
UInt64 f_bavail;
|
||||
fsblkcnt_t f_bavail;
|
||||
/// <summary>
|
||||
/// Total file nodes in filesystem
|
||||
/// </summary>
|
||||
UInt64 f_files;
|
||||
fsfilcnt_t f_files;
|
||||
/// <summary>
|
||||
/// Free file nodes in filesystem
|
||||
/// </summary>
|
||||
UInt64 f_ffree;
|
||||
fsfilcnt_t f_ffree;
|
||||
/// <summary>
|
||||
/// Filesystem ID
|
||||
/// </summary>
|
||||
@@ -71,11 +88,11 @@ internal static partial class Interop
|
||||
/// <summary>
|
||||
/// Maximum length of filenames
|
||||
/// </summary>
|
||||
Int64 f_namelen;
|
||||
__fsword_t f_namelen;
|
||||
/// <summary>
|
||||
/// Fragment size (since Linux 2.6)
|
||||
/// </summary>
|
||||
Int64 f_frsize;
|
||||
__fsword_t f_frsize;
|
||||
/// <summary>
|
||||
/// Mount flags of filesystem (since Linux 2.6.36)
|
||||
/// </summary>
|
||||
@@ -85,7 +102,7 @@ internal static partial class Interop
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray,
|
||||
ArraySubType = UnmanagedType.I8, SizeConst = 4)]
|
||||
Int64[] f_spare;
|
||||
__fsword_t[] f_spare;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
using System.Runtime.InteropServices;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
|
||||
@@ -26,6 +26,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 32-bit type definitions
|
||||
using blkcnt_t = System.Int32;
|
||||
using blksize_t = System.Int32;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt32;
|
||||
using fsfilcnt_t = System.UInt32;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt32;
|
||||
using nlink_t = System.UInt32;
|
||||
using off_t = System.Int32;
|
||||
using size_t = System.UInt32;
|
||||
using ssize_t = System.Int32;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.UInt32;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal static partial class Linux
|
||||
@@ -40,7 +57,7 @@ internal static partial class Interop
|
||||
/// <param name="size">Size of the allocated buffer.</param>
|
||||
/// <returns>Size of the extended attribute. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, EntryPoint = "getxattr", CharSet = CharSet.Ansi)]
|
||||
public static extern int getxattr32(string path, string name, IntPtr value, UInt32 size);
|
||||
public static extern ssize_t getxattr32(string path, string name, IntPtr value, size_t size);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an extended attribute value
|
||||
@@ -52,7 +69,7 @@ internal static partial class Interop
|
||||
/// <param name="size">Size of the allocated buffer.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, EntryPoint = "setxattr", CharSet = CharSet.Ansi)]
|
||||
public static extern int setxattr32(string path, string name, IntPtr value, UInt32 size, xattrFlags options);
|
||||
public static extern ssize_t setxattr32(string path, string name, IntPtr value, size_t size, xattrFlags options);
|
||||
|
||||
/// <summary>
|
||||
/// Removes an extended attribute
|
||||
@@ -62,7 +79,7 @@ internal static partial class Interop
|
||||
/// <param name="name">Name of the extended attribute.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, EntryPoint = "removexattr", CharSet = CharSet.Ansi)]
|
||||
public static extern int removexattr32(string path, string name);
|
||||
public static extern ssize_t removexattr32(string path, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Lists the extended attributes from a file
|
||||
@@ -76,7 +93,7 @@ internal static partial class Interop
|
||||
/// If the file has no extended attributes, 0.
|
||||
/// On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, EntryPoint = "listxattr", CharSet = CharSet.Ansi)]
|
||||
public static extern int listxattr32(string path, IntPtr namebuf, UInt32 size);
|
||||
public static extern ssize_t listxattr32(string path, IntPtr namebuf, size_t size);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
#region Linux 64-bit type definitions
|
||||
using blkcnt_t = System.Int64;
|
||||
using blksize_t = System.Int64;
|
||||
using dev_t = System.UInt64;
|
||||
using fsblkcnt_t = System.UInt64;
|
||||
using fsfilcnt_t = System.UInt64;
|
||||
using gid_t = System.UInt32;
|
||||
using ino_t = System.UInt64;
|
||||
using nlink_t = System.UInt64;
|
||||
using off_t = System.Int64;
|
||||
using size_t = System.UInt64;
|
||||
using ssize_t = System.Int64;
|
||||
using uid_t = System.UInt32;
|
||||
using __fsword_t = System.Int64;
|
||||
|
||||
#endregion
|
||||
|
||||
internal static partial class Interop
|
||||
{
|
||||
internal static partial class Linux
|
||||
@@ -40,7 +57,7 @@ internal static partial class Interop
|
||||
/// <param name="size">Size of the allocated buffer.</param>
|
||||
/// <returns>Size of the extended attribute. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 getxattr(string path, string name, IntPtr value, UInt64 size);
|
||||
public static extern ssize_t getxattr(string path, string name, IntPtr value, size_t size);
|
||||
|
||||
/// <summary>
|
||||
/// Sets an extended attribute value
|
||||
@@ -52,7 +69,7 @@ internal static partial class Interop
|
||||
/// <param name="size">Size of the allocated buffer.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 setxattr(string path, string name, IntPtr value, UInt64 size, xattrFlags options);
|
||||
public static extern ssize_t setxattr(string path, string name, IntPtr value, size_t size, xattrFlags options);
|
||||
|
||||
/// <summary>
|
||||
/// Removes an extended attribute
|
||||
@@ -62,7 +79,7 @@ internal static partial class Interop
|
||||
/// <param name="name">Name of the extended attribute.</param>
|
||||
/// <returns>On success, 0. On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 removexattr(string path, string name);
|
||||
public static extern ssize_t removexattr(string path, string name);
|
||||
|
||||
/// <summary>
|
||||
/// Lists the extended attributes from a file
|
||||
@@ -76,6 +93,6 @@ internal static partial class Interop
|
||||
/// If the file has no extended attributes, 0.
|
||||
/// On failure, -1, and errno is set</returns>
|
||||
[DllImport(Libraries.Libc, SetLastError = true, CharSet = CharSet.Ansi)]
|
||||
public static extern Int64 listxattr(string path, IntPtr namebuf, UInt64 size);
|
||||
public static extern ssize_t listxattr(string path, IntPtr namebuf, size_t size);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user