1 /* 2 * Copyright (c) 2015-2021 Free Software Foundation, Inc. 3 * 4 * This file is part of Wget. 5 * 6 * Wget is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * Wget is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with Wget. If not, see <https://www.gnu.org/licenses/>. 18 * 19 * 20 * Header file for xattr routines 21 */ 22 23 #ifndef SRC_WGET_XATTR_H 24 #define SRC_WGET_XATTR_H 25 26 #include <stdio.h> 27 #include <time.h> 28 29 #if defined __linux 30 /* libc on Linux has fsetxattr (5 arguments). */ 31 /* libc on Linux has fgetxattr (4 arguments). */ 32 # include <sys/xattr.h> 33 # define USE_XATTR 34 #elif defined __APPLE__ 35 /* libc on OS/X has fsetxattr (6 arguments). */ 36 /* libc on OS/X has fgetxattr (6 arguments). */ 37 # include <sys/xattr.h> 38 # define fsetxattr(file, name, buffer, size, flags) \ 39 fsetxattr((file), (name), (buffer), (size), 0, (flags)) 40 # define fgetxattr(file, name, buffer, size) \ 41 fgetxattr((file), (name), (buffer), (size), 0, 0) 42 # define USE_XATTR 43 #elif defined __FreeBSD_version && (__FreeBSD_version > 500000) 44 /* FreeBSD */ 45 # include <sys/types.h> 46 # include <sys/extattr.h> 47 # define fsetxattr(file, name, buffer, size, flags) \ 48 extattr_set_fd((file), EXTATTR_NAMESPACE_USER, (name), (buffer), (size)) 49 # define fgetxattr(file, name, buffer, size) \ 50 extattr_set_fd((file), EXTATTR_NAMESPACE_USER, (name), (buffer), (size)) 51 # define USE_XATTR 52 #endif 53 54 #endif /* SRC_WGET_XATTR_H */ 55