ntdll-DOS_Attributes: Restore some definitions for FreeBSD.

This commit is contained in:
Zebediah Figura 2020-10-24 10:28:17 -05:00
parent bf69e4ee2b
commit 7e7e0bbe3e

View File

@ -1,15 +1,15 @@
From 2b9b382e84ae850599bac82910efa0811b085e58 Mon Sep 17 00:00:00 2001
From 59c903c16b59c7b54479866c04532f7f501767d8 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Mon, 6 Oct 2014 14:26:24 -0600
Subject: [PATCH] libport: Add support for FreeBSD style extended attributes.
---
configure.ac | 2 +-
dlls/ntdll/unix/file.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+), 1 deletion(-)
dlls/ntdll/unix/file.c | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index e17d0498a58..1411f1b88f1 100644
index ec5e2da4490..b5586643fa9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -695,7 +695,7 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@ -22,20 +22,31 @@ index e17d0498a58..1411f1b88f1 100644
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/xattr.h>]], [[getxattr("", "", "", 0, 0, 0);]])],
[AC_DEFINE(XATTR_ADDITIONAL_OPTIONS, 1, [Define if xattr functions take additional arguments (Mac OS X)])])])
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 388ef0671fc..cbd8c7ea3db 100644
index 099663396e5..5889ec4dd3f 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -111,6 +111,9 @@
@@ -111,6 +111,10 @@
#elif defined(HAVE_SYS_XATTR_H)
#include <sys/xattr.h>
#endif
+#ifdef HAVE_SYS_EXTATTR_H
+#undef XATTR_ADDITIONAL_OPTIONS
+#include <sys/extattr.h>
+#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@@ -385,6 +388,9 @@ static int xattr_fremove( int filedes, const char *name )
@@ -378,6 +382,9 @@ NTSTATUS errno_to_status( int err )
#ifndef XATTR_USER_PREFIX
#define XATTR_USER_PREFIX "user."
#endif
+#ifndef XATTR_USER_PREFIX_LEN
+#define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1)
+#endif
static int xattr_fremove( int filedes, const char *name )
{
@@ -385,6 +392,9 @@ static int xattr_fremove( int filedes, const char *name )
return fremovexattr( filedes, name, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fremovexattr( filedes, name );
@ -45,7 +56,7 @@ index 388ef0671fc..cbd8c7ea3db 100644
#else
errno = ENOSYS;
return -1;
@@ -397,6 +403,10 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size )
@@ -397,6 +407,10 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size )
return fsetxattr( filedes, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fsetxattr( filedes, name, value, size, 0 );
@ -56,7 +67,7 @@ index 388ef0671fc..cbd8c7ea3db 100644
#else
errno = ENOSYS;
return -1;
@@ -409,6 +419,10 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
@@ -409,6 +423,10 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
return getxattr( path, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return getxattr( path, name, value, size );
@ -67,7 +78,7 @@ index 388ef0671fc..cbd8c7ea3db 100644
#else
errno = ENOSYS;
return -1;
@@ -421,6 +435,9 @@ static int xattr_remove( const char *path, const char *name )
@@ -421,6 +439,9 @@ static int xattr_remove( const char *path, const char *name )
return removexattr( path, name, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return removexattr( path, name );
@ -77,7 +88,7 @@ index 388ef0671fc..cbd8c7ea3db 100644
#else
errno = ENOSYS;
return -1;
@@ -433,6 +450,10 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
@@ -433,6 +454,10 @@ static int xattr_set( const char *path, const char *name, void *value, size_t si
return setxattr( path, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return setxattr( path, name, value, size, 0 );