| 1 |
/* openat-style fd-relative functions for operating with extended file |
| 2 |
attributes. |
| 3 |
|
| 4 |
Copyright 2012-2023 Free Software Foundation, Inc. |
| 5 |
|
| 6 |
This program 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 |
This program 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 this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 |
|
| 19 |
#include <config.h> |
| 20 |
|
| 21 |
#include "xattr-at.h" |
| 22 |
#include "openat.h" |
| 23 |
|
| 24 |
#include <stdlib.h> |
| 25 |
#include <unistd.h> |
| 26 |
#include <errno.h> |
| 27 |
#include <fcntl.h> |
| 28 |
|
| 29 |
#include "dirname.h" /* solely for definition of IS_ABSOLUTE_FILE_NAME */ |
| 30 |
#include "save-cwd.h" |
| 31 |
|
| 32 |
#include "openat-priv.h" |
| 33 |
|
| 34 |
#ifdef HAVE_XATTRS |
| 35 |
|
| 36 |
/* setxattrat */ |
| 37 |
#define AT_FUNC_NAME setxattrat |
| 38 |
#define AT_FUNC_F1 setxattr |
| 39 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, const void *value \ |
| 40 |
, size_t size, int flags |
| 41 |
#define AT_FUNC_POST_FILE_ARGS , name, value, size, flags |
| 42 |
#include "at-func.c" |
| 43 |
#undef AT_FUNC_NAME |
| 44 |
#undef AT_FUNC_F1 |
| 45 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 46 |
#undef AT_FUNC_POST_FILE_ARGS |
| 47 |
|
| 48 |
/* lsetxattrat */ |
| 49 |
#define AT_FUNC_NAME lsetxattrat |
| 50 |
#define AT_FUNC_F1 lsetxattr |
| 51 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, const void *value \ |
| 52 |
, size_t size, int flags |
| 53 |
#define AT_FUNC_POST_FILE_ARGS , name, value, size, flags |
| 54 |
#include "at-func.c" |
| 55 |
#undef AT_FUNC_NAME |
| 56 |
#undef AT_FUNC_F1 |
| 57 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 58 |
#undef AT_FUNC_POST_FILE_ARGS |
| 59 |
|
| 60 |
/* getxattrat */ |
| 61 |
#define AT_FUNC_NAME getxattrat |
| 62 |
#define AT_FUNC_RESULT ssize_t |
| 63 |
#define AT_FUNC_F1 getxattr |
| 64 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, void *value \ |
| 65 |
, size_t size |
| 66 |
#define AT_FUNC_POST_FILE_ARGS , name, value, size |
| 67 |
#include "at-func.c" |
| 68 |
#undef AT_FUNC_NAME |
| 69 |
#undef AT_FUNC_F1 |
| 70 |
#undef AT_FUNC_RESULT |
| 71 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 72 |
#undef AT_FUNC_POST_FILE_ARGS |
| 73 |
|
| 74 |
/* lgetxattrat */ |
| 75 |
#define AT_FUNC_NAME lgetxattrat |
| 76 |
#define AT_FUNC_RESULT ssize_t |
| 77 |
#define AT_FUNC_F1 lgetxattr |
| 78 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , const char *name, void *value \ |
| 79 |
, size_t size |
| 80 |
#define AT_FUNC_POST_FILE_ARGS , name, value, size |
| 81 |
#include "at-func.c" |
| 82 |
#undef AT_FUNC_NAME |
| 83 |
#undef AT_FUNC_F1 |
| 84 |
#undef AT_FUNC_RESULT |
| 85 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 86 |
#undef AT_FUNC_POST_FILE_ARGS |
| 87 |
|
| 88 |
/* listxattrat */ |
| 89 |
#define AT_FUNC_NAME listxattrat |
| 90 |
#define AT_FUNC_RESULT ssize_t |
| 91 |
#define AT_FUNC_F1 listxattr |
| 92 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , char *list , size_t size |
| 93 |
#define AT_FUNC_POST_FILE_ARGS , list , size |
| 94 |
#include "at-func.c" |
| 95 |
#undef AT_FUNC_NAME |
| 96 |
#undef AT_FUNC_F1 |
| 97 |
#undef AT_FUNC_RESULT |
| 98 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 99 |
#undef AT_FUNC_POST_FILE_ARGS |
| 100 |
|
| 101 |
/* llistxattrat */ |
| 102 |
#define AT_FUNC_NAME llistxattrat |
| 103 |
#define AT_FUNC_RESULT ssize_t |
| 104 |
#define AT_FUNC_F1 llistxattr |
| 105 |
#define AT_FUNC_POST_FILE_PARAM_DECLS , char *list , size_t size |
| 106 |
#define AT_FUNC_POST_FILE_ARGS , list , size |
| 107 |
#include "at-func.c" |
| 108 |
#undef AT_FUNC_NAME |
| 109 |
#undef AT_FUNC_F1 |
| 110 |
#undef AT_FUNC_RESULT |
| 111 |
#undef AT_FUNC_POST_FILE_PARAM_DECLS |
| 112 |
#undef AT_FUNC_POST_FILE_ARGS |
| 113 |
|
| 114 |
#endif /* HAVE_XATTRS */ |