Rebase against 314368e6c442f043ebfc22b70c1113e4e6232c04.

This commit is contained in:
Zebediah Figura
2020-09-03 21:02:52 -05:00
parent 285e594688
commit 1d149ff59d
21 changed files with 874 additions and 828 deletions

View File

@@ -1,23 +1,19 @@
From f96ab0203c4119942b9d8ccc27207cc73389b375 Mon Sep 17 00:00:00 2001
From 80247bc4566977f67a1851f46facba226fbd93df Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Tue, 19 Aug 2014 22:10:49 -0600
Subject: [PATCH] ntdll: Implement retrieving DOS attributes in
[fd_]get_file_info().
---
configure.ac | 12 +++++++++++
dlls/ntdll/unix/file.c | 22 ++++++++++++++++++-
include/wine/port.h | 9 ++++++++
libs/port/Makefile.in | 3 ++-
libs/port/xattr.c | 49 ++++++++++++++++++++++++++++++++++++++++++
5 files changed, 93 insertions(+), 2 deletions(-)
create mode 100644 libs/port/xattr.c
configure.ac | 12 ++++++++++++
dlls/ntdll/unix/file.c | 39 ++++++++++++++++++++++++++++++++++++++-
2 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 4829648c3a5..cff2d4b8288 100644
index f60cd593549..cca97ee403b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -88,6 +88,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
@@ -89,6 +89,7 @@ AC_ARG_WITH(usb, AS_HELP_STRING([--without-usb],[do not use the libusb lib
AC_ARG_WITH(v4l2, AS_HELP_STRING([--without-v4l2],[do not use v4l2 (video capture)]))
AC_ARG_WITH(vkd3d, AS_HELP_STRING([--without-vkd3d],[do not use vkd3d (Direct3D 12 support)]))
AC_ARG_WITH(vulkan, AS_HELP_STRING([--without-vulkan],[do not use Vulkan]))
@@ -25,7 +21,7 @@ index 4829648c3a5..cff2d4b8288 100644
AC_ARG_WITH(xcomposite,AS_HELP_STRING([--without-xcomposite],[do not use the Xcomposite extension]),
[if test "x$withval" = "xno"; then ac_cv_header_X11_extensions_Xcomposite_h=no; fi])
AC_ARG_WITH(xcursor, AS_HELP_STRING([--without-xcursor],[do not use the Xcursor extension]),
@@ -697,6 +698,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -698,6 +699,17 @@ AC_CHECK_HEADERS([libprocstat.h],,,
#include <sys/socket.h>
#endif])
@@ -44,10 +40,41 @@ index 4829648c3a5..cff2d4b8288 100644
AC_SUBST(DLLFLAGS,"-D_REENTRANT")
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index bf435f109f1..6ac9b18da57 100644
index 03e92a5c59e..da8f65af7b3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1448,6 +1448,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
@@ -105,6 +105,9 @@
#ifdef HAVE_SYS_STATFS_H
#include <sys/statfs.h>
#endif
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@@ -369,6 +372,20 @@ NTSTATUS errno_to_status( int err )
}
}
+#ifndef XATTR_USER_PREFIX
+#define XATTR_USER_PREFIX "user."
+#endif
+
+static int xattr_get( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return getxattr( path, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -1448,6 +1465,22 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
}
@@ -70,7 +97,7 @@ index bf435f109f1..6ac9b18da57 100644
/* fetch the attributes of a file */
static inline ULONG get_file_attributes( const struct stat *st )
{
@@ -1491,7 +1507,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
@@ -1491,7 +1524,8 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
char *parent_path;
@@ -80,7 +107,7 @@ index bf435f109f1..6ac9b18da57 100644
*attr = 0;
ret = lstat( path, st );
@@ -1517,6 +1534,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
@@ -1517,6 +1551,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
free( parent_path );
}
*attr |= get_file_attributes( st );
@@ -90,92 +117,6 @@ index bf435f109f1..6ac9b18da57 100644
return ret;
}
diff --git a/include/wine/port.h b/include/wine/port.h
index 928730a41d7..4670891ae77 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -352,6 +352,15 @@ int usleep (unsigned int useconds);
extern int mkstemps(char *template, int suffix_len);
+/* Extended attribute functions */
+
+#ifndef XATTR_USER_PREFIX
+# define XATTR_USER_PREFIX "user."
+#endif
+
+extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
+extern int xattr_get( const char *path, const char *name, void *value, size_t size );
+
#else /* NO_LIBWINE_PORT */
#define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
diff --git a/libs/port/Makefile.in b/libs/port/Makefile.in
index 7bc67fa3fee..d1de285d527 100644
--- a/libs/port/Makefile.in
+++ b/libs/port/Makefile.in
@@ -21,4 +21,5 @@ C_SRCS = \
strnlen.c \
symlink.c \
usleep.c \
- wctype.c
+ wctype.c \
+ xattr.c
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
new file mode 100644
index 00000000000..88e900dac6d
--- /dev/null
+++ b/libs/port/xattr.c
@@ -0,0 +1,49 @@
+/*
+ * extended attributes functions
+ *
+ * Copyright 2014 Erich E. Hoover
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "config.h"
+#include "wine/port.h"
+
+#if defined(HAVE_ATTR_XATTR_H)
+# include <attr/xattr.h>
+#endif
+
+#include <ctype.h>
+#include <errno.h>
+
+int xattr_fget( int filedes, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fgetxattr( filedes, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+int xattr_get( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return getxattr( path, name, value, size );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
--
2.27.0
2.28.0

View File

@@ -1,21 +1,19 @@
From b099458217b2855bd8615b8c97bcc2462eb74b25 Mon Sep 17 00:00:00 2001
From 6bbf7676b4b7887a54f47b43929b8f3f1d7e77ae Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 00:08:52 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in
NtSetInformationFile.
---
dlls/ntdll/tests/file.c | 8 +++---
dlls/ntdll/unix/file.c | 54 ++++++++++++++++++++++++++---------------
include/wine/port.h | 2 ++
libs/port/xattr.c | 20 +++++++++++++++
4 files changed, 60 insertions(+), 24 deletions(-)
dlls/ntdll/tests/file.c | 8 ++---
dlls/ntdll/unix/file.c | 74 ++++++++++++++++++++++++++++++-----------
2 files changed, 58 insertions(+), 24 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 184b7cdad59..37e5ac5d8a5 100644
index 8b9ec4f624d..6d2c8d2fc94 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -1364,7 +1364,7 @@ static void test_file_basic_information(void)
@@ -1389,7 +1389,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -24,7 +22,7 @@ index 184b7cdad59..37e5ac5d8a5 100644
/* Then HIDDEN */
memset(&fbi, 0, sizeof(fbi));
@@ -1377,7 +1377,7 @@ static void test_file_basic_information(void)
@@ -1402,7 +1402,7 @@ static void test_file_basic_information(void)
memset(&fbi, 0, sizeof(fbi));
res = pNtQueryInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -33,7 +31,7 @@ index 184b7cdad59..37e5ac5d8a5 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fbi, 0, sizeof(fbi));
@@ -1434,7 +1434,7 @@ static void test_file_all_information(void)
@@ -1459,7 +1459,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes, res %x\n", res);
@@ -42,7 +40,7 @@ index 184b7cdad59..37e5ac5d8a5 100644
/* Then HIDDEN */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
@@ -1447,7 +1447,7 @@ static void test_file_all_information(void)
@@ -1472,7 +1472,7 @@ static void test_file_all_information(void)
memset(&fai_buf.fai, 0, sizeof(fai_buf.fai));
res = pNtQueryInformationFile(h, &io, &fai_buf.fai, sizeof fai_buf, FileAllInformation);
ok ( res == STATUS_SUCCESS, "can't get attributes\n");
@@ -52,10 +50,37 @@ index 184b7cdad59..37e5ac5d8a5 100644
/* Check NORMAL last of all (to make sure we can clear attributes) */
memset(&fai_buf.fai.BasicInformation, 0, sizeof(fai_buf.fai.BasicInformation));
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 70a76ca81ee..924d06b2caa 100644
index da8f65af7b3..0a326a7a1bd 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1497,6 +1497,39 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
@@ -376,6 +376,26 @@ NTSTATUS errno_to_status( int err )
#define XATTR_USER_PREFIX "user."
#endif
+static int xattr_fremove( int filedes, const char *name )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fremovexattr( filedes, name );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static int xattr_fset( int filedes, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fsetxattr( filedes, name, value, size, 0 );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
static int xattr_get( const char *path, const char *name, void *value, size_t size )
{
#if defined(HAVE_ATTR_XATTR_H)
@@ -1520,6 +1540,39 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
}
@@ -95,7 +120,7 @@ index 70a76ca81ee..924d06b2caa 100644
/* get the stat info and file attributes for a file (by name) */
static int get_file_info( const char *path, struct stat *st, ULONG *attr )
{
@@ -4000,7 +4033,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4139,7 +4192,6 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
case FileBasicInformation:
if (len >= sizeof(FILE_BASIC_INFORMATION))
{
@@ -103,7 +128,7 @@ index 70a76ca81ee..924d06b2caa 100644
const FILE_BASIC_INFORMATION *info = ptr;
LARGE_INTEGER mtime, atime;
@@ -4014,25 +4046,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
@@ -4153,25 +4205,7 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
io->u.Status = set_file_times( fd, &mtime, &atime );
if (io->u.Status == STATUS_SUCCESS && info->FileAttributes)
@@ -130,50 +155,6 @@ index 70a76ca81ee..924d06b2caa 100644
if (needs_close) close( fd );
}
diff --git a/include/wine/port.h b/include/wine/port.h
index 4670891ae77..e0249b4c59f 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -359,6 +359,8 @@ extern int mkstemps(char *template, int suffix_len);
#endif
extern int xattr_fget( int filedes, const char *name, void *value, size_t size );
+extern int xattr_fremove( int filedes, const char *name );
+extern int xattr_fset( int filedes, const char *name, void *value, size_t size );
extern int xattr_get( const char *path, const char *name, void *value, size_t size );
#else /* NO_LIBWINE_PORT */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 88e900dac6d..6918c9956cc 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -38,6 +38,26 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
#endif
}
+int xattr_fremove( int filedes, const char *name )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fremovexattr( filedes, name );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+int xattr_fset( int filedes, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return fsetxattr( filedes, name, value, size, 0 );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
int xattr_get( const char *path, const char *name, void *value, size_t size )
{
#if defined(HAVE_ATTR_XATTR_H)
--
2.27.0
2.28.0

View File

@@ -1,17 +1,15 @@
From 29333aaab5e4d2b62741a8321382b24f1630eb70 Mon Sep 17 00:00:00 2001
From 92aeb076183fd7311b5fa05b33af0304d897361d Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Wed, 20 Aug 2014 15:28:00 -0600
Subject: [PATCH] ntdll: Implement storing DOS attributes in NtCreateFile.
---
dlls/ntdll/tests/directory.c | 24 +++++++++++-------------
dlls/ntdll/unix/file.c | 31 ++++++++++++++++++++++++++-----
include/wine/port.h | 2 ++
libs/port/xattr.c | 20 ++++++++++++++++++++
4 files changed, 59 insertions(+), 18 deletions(-)
dlls/ntdll/tests/directory.c | 24 ++++++++---------
dlls/ntdll/unix/file.c | 51 ++++++++++++++++++++++++++++++++----
2 files changed, 57 insertions(+), 18 deletions(-)
diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c
index 248ed99ab20..e0f4debc624 100644
index d21a2e64f8e..dc4f09729ac 100644
--- a/dlls/ntdll/tests/directory.c
+++ b/dlls/ntdll/tests/directory.c
@@ -55,7 +55,6 @@ static NTSTATUS (WINAPI *pRtlWow64EnableFsRedirectionEx)( ULONG disable, ULONG *
@@ -60,10 +58,37 @@ index 248ed99ab20..e0f4debc624 100644
}
testfiles[i].nfound++;
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 7ab1c130bf2..7c737edd22c 100644
index 0a326a7a1bd..a72d95f8378 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3549,6 +3549,20 @@ void CDECL set_show_dot_files( BOOL enable )
@@ -406,6 +406,26 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
#endif
}
+static int xattr_remove( const char *path, const char *name )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return removexattr( path, name );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+static int xattr_set( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return setxattr( path, name, value, size, 0 );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
/* get space from the current directory data buffer, allocating a new one if necessary */
static void *get_dir_data_space( struct dir_data *data, unsigned int size )
{
@@ -3582,6 +3602,20 @@ void CDECL set_show_dot_files( BOOL enable )
show_dot_files = enable;
}
@@ -84,7 +109,7 @@ index 7ab1c130bf2..7c737edd22c 100644
/******************************************************************************
* open_unix_file
@@ -3636,13 +3650,14 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3669,13 +3703,14 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->u.Status = STATUS_SUCCESS;
}
@@ -104,7 +129,7 @@ index 7ab1c130bf2..7c737edd22c 100644
if (io->u.Status == STATUS_SUCCESS)
{
@@ -3664,6 +3679,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3697,6 +3732,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
io->Information = FILE_OVERWRITTEN;
break;
}
@@ -116,7 +141,7 @@ index 7ab1c130bf2..7c737edd22c 100644
}
else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES)
{
@@ -3671,6 +3691,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
@@ -3704,6 +3744,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" );
}
@@ -124,47 +149,6 @@ index 7ab1c130bf2..7c737edd22c 100644
return io->u.Status;
}
diff --git a/include/wine/port.h b/include/wine/port.h
index e0249b4c59f..930efeeea1f 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -362,6 +362,8 @@ extern int xattr_fget( int filedes, const char *name, void *value, size_t size )
extern int xattr_fremove( int filedes, const char *name );
extern int xattr_fset( int filedes, const char *name, void *value, size_t size );
extern int xattr_get( const char *path, const char *name, void *value, size_t size );
+extern int xattr_remove( const char *path, const char *name );
+extern int xattr_set( const char *path, const char *name, void *value, size_t size );
#else /* NO_LIBWINE_PORT */
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 6918c9956cc..683e7a615e2 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -67,3 +67,23 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
return -1;
#endif
}
+
+int xattr_remove( const char *path, const char *name )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return removexattr( path, name );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
+
+int xattr_set( const char *path, const char *name, void *value, size_t size )
+{
+#if defined(HAVE_ATTR_XATTR_H)
+ return setxattr( path, name, value, size, 0 );
+#else
+ errno = ENOSYS;
+ return -1;
+#endif
+}
--
2.27.0
2.28.0

View File

@@ -1,18 +1,18 @@
From f083b503de5dd5ae1805e633e191532a10896eab Mon Sep 17 00:00:00 2001
From 65442c83060ee1980900cc5fe38978ef8c29eba4 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Mon, 6 Oct 2014 14:21:11 -0600
Subject: libport: Add support for Mac OS X style extended attributes.
Subject: [PATCH] libport: Add support for Mac OS X style extended attributes.
---
configure.ac | 3 +++
libs/port/xattr.c | 27 +++++++++++++++++++++------
2 files changed, 24 insertions(+), 6 deletions(-)
configure.ac | 3 +++
dlls/ntdll/unix/file.c | 23 ++++++++++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3c91af3..68dca0a 100644
index cca97ee403b..5e33bfacf91 100644
--- a/configure.ac
+++ b/configure.ac
@@ -671,6 +671,9 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -702,6 +702,9 @@ AC_CHECK_HEADERS([libprocstat.h],,,
if test "x$with_xattr" != "xno"
then
AC_CHECK_HEADERS(attr/xattr.h, [HAVE_XATTR=1])
@@ -22,35 +22,24 @@ index 3c91af3..68dca0a 100644
fi
if test "x$with_xattr" = "xyes"
then
diff --git a/libs/port/xattr.c b/libs/port/xattr.c
index 683e7a6..efc65c5 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -22,7 +22,10 @@
#include "wine/port.h"
#if defined(HAVE_ATTR_XATTR_H)
+# undef XATTR_ADDITIONAL_OPTIONS
# include <attr/xattr.h>
+#elif defined(HAVE_SYS_XATTR_H)
+# include <sys/xattr.h>
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index a72d95f8378..5e0ac914e1c 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -106,7 +106,10 @@
#include <sys/statfs.h>
#endif
#ifdef HAVE_ATTR_XATTR_H
+#undef XATTR_ADDITIONAL_OPTIONS
#include <attr/xattr.h>
+#elif defined(HAVE_SYS_XATTR_H)
+#include <sys/xattr.h>
#endif
#include <time.h>
#ifdef HAVE_UNISTD_H
@@ -378,7 +381,9 @@ NTSTATUS errno_to_status( int err )
#include <ctype.h>
@@ -30,7 +33,9 @@
int xattr_fget( int filedes, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
+ return fgetxattr( filedes, name, value, size, 0, 0 );
+#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fgetxattr( filedes, name, value, size );
#else
errno = ENOSYS;
@@ -40,7 +45,9 @@ int xattr_fget( int filedes, const char *name, void *value, size_t size )
int xattr_fremove( int filedes, const char *name )
static int xattr_fremove( int filedes, const char *name )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
@@ -59,9 +48,9 @@ index 683e7a6..efc65c5 100644
return fremovexattr( filedes, name );
#else
errno = ENOSYS;
@@ -50,7 +57,9 @@ int xattr_fremove( int filedes, const char *name )
@@ -388,7 +393,9 @@ static int xattr_fremove( int filedes, const char *name )
int xattr_fset( int filedes, const char *name, void *value, size_t size )
static int xattr_fset( int filedes, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
@@ -70,9 +59,9 @@ index 683e7a6..efc65c5 100644
return fsetxattr( filedes, name, value, size, 0 );
#else
errno = ENOSYS;
@@ -60,7 +69,9 @@ int xattr_fset( int filedes, const char *name, void *value, size_t size )
@@ -398,7 +405,9 @@ static int xattr_fset( int filedes, const char *name, void *value, size_t size )
int xattr_get( const char *path, const char *name, void *value, size_t size )
static int xattr_get( const char *path, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
@@ -81,9 +70,9 @@ index 683e7a6..efc65c5 100644
return getxattr( path, name, value, size );
#else
errno = ENOSYS;
@@ -70,7 +81,9 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
@@ -408,7 +417,9 @@ static int xattr_get( const char *path, const char *name, void *value, size_t si
int xattr_remove( const char *path, const char *name )
static int xattr_remove( const char *path, const char *name )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
@@ -92,9 +81,9 @@ index 683e7a6..efc65c5 100644
return removexattr( path, name );
#else
errno = ENOSYS;
@@ -80,7 +93,9 @@ int xattr_remove( const char *path, const char *name )
@@ -418,7 +429,9 @@ static int xattr_remove( const char *path, const char *name )
int xattr_set( const char *path, const char *name, void *value, size_t size )
static int xattr_set( const char *path, const char *name, void *value, size_t size )
{
-#if defined(HAVE_ATTR_XATTR_H)
+#if defined(XATTR_ADDITIONAL_OPTIONS)
@@ -104,5 +93,5 @@ index 683e7a6..efc65c5 100644
#else
errno = ENOSYS;
--
1.9.1
2.28.0

View File

@@ -1,18 +1,18 @@
From 64708643d4dc9454faaccd720ab9b8a53b5aecf9 Mon Sep 17 00:00:00 2001
From f4caa19ffcac13201c0c9bd45d3d93d44cb24980 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: libport: Add support for FreeBSD style extended attributes.
Subject: [PATCH] libport: Add support for FreeBSD style extended attributes.
---
configure.ac | 2 +-
libs/port/xattr.c | 41 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 42 insertions(+), 1 deletion(-)
configure.ac | 2 +-
dlls/ntdll/unix/file.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 68dca0a..3b0da05 100644
index 5e33bfacf91..aef00416461 100644
--- a/configure.ac
+++ b/configure.ac
@@ -670,7 +670,7 @@ AC_CHECK_HEADERS([libprocstat.h],,,
@@ -701,7 +701,7 @@ AC_CHECK_HEADERS([libprocstat.h],,,
if test "x$with_xattr" != "xno"
then
@@ -21,52 +21,11 @@ index 68dca0a..3b0da05 100644
AC_CHECK_HEADERS(sys/xattr.h, [HAVE_XATTR=1]
[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/libs/port/xattr.c b/libs/port/xattr.c
index efc65c5..92a717e 100644
--- a/libs/port/xattr.c
+++ b/libs/port/xattr.c
@@ -26,17 +26,40 @@
# include <attr/xattr.h>
#elif defined(HAVE_SYS_XATTR_H)
# include <sys/xattr.h>
+#elif defined(HAVE_SYS_EXTATTR_H)
+# undef XATTR_ADDITIONAL_OPTIONS
+# include <sys/extattr.h>
#endif
#include <ctype.h>
#include <errno.h>
+#ifndef XATTR_USER_PREFIX_LEN
+# define XATTR_USER_PREFIX_LEN (sizeof(XATTR_USER_PREFIX) - 1)
+#endif
+
+#ifdef HAVE_SYS_EXTATTR_H
+static inline int xattr_valid_namespace( const char *name )
+{
+ if (strncmp( XATTR_USER_PREFIX, name, XATTR_USER_PREFIX_LEN ) != 0)
+ {
+ errno = EPERM;
+ return 0;
+ }
+ return 1;
+}
+#endif
+
int xattr_fget( int filedes, const char *name, void *value, size_t size )
{
#if defined(XATTR_ADDITIONAL_OPTIONS)
return fgetxattr( filedes, name, value, size, 0, 0 );
#elif defined(HAVE_SYS_XATTR_H) || defined(HAVE_ATTR_XATTR_H)
return fgetxattr( filedes, name, value, size );
+#elif defined(HAVE_SYS_EXTATTR_H)
+ if (!xattr_valid_namespace( name )) return -1;
+ return extattr_get_fd( filedes, EXTATTR_NAMESPACE_USER, &name[XATTR_USER_PREFIX_LEN],
+ value, size );
#else
errno = ENOSYS;
return -1;
@@ -49,6 +72,9 @@ int xattr_fremove( int filedes, const char *name )
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 5e0ac914e1c..c4d5f9c9028 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -385,6 +385,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 );
@@ -76,7 +35,7 @@ index efc65c5..92a717e 100644
#else
errno = ENOSYS;
return -1;
@@ -61,6 +87,10 @@ int xattr_fset( int filedes, const char *name, void *value, size_t size )
@@ -397,6 +400,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 );
@@ -87,7 +46,7 @@ index efc65c5..92a717e 100644
#else
errno = ENOSYS;
return -1;
@@ -73,6 +103,10 @@ int xattr_get( const char *path, const char *name, void *value, size_t size )
@@ -409,6 +416,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 );
@@ -98,7 +57,7 @@ index efc65c5..92a717e 100644
#else
errno = ENOSYS;
return -1;
@@ -85,6 +119,9 @@ int xattr_remove( const char *path, const char *name )
@@ -421,6 +432,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 );
@@ -108,7 +67,7 @@ index efc65c5..92a717e 100644
#else
errno = ENOSYS;
return -1;
@@ -97,6 +134,10 @@ int xattr_set( const char *path, const char *name, void *value, size_t size )
@@ -433,6 +447,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 );
@@ -120,5 +79,5 @@ index efc65c5..92a717e 100644
errno = ENOSYS;
return -1;
--
1.9.1
2.28.0