13 #ifndef __STOUT_OS_POSIX_XATTR_HPP__ 14 #define __STOUT_OS_POSIX_XATTR_HPP__ 17 #include <sys/types.h> 18 #include <sys/extattr.h> 20 #include <sys/xattr.h> 32 const std::string&
path,
33 const std::string&
name,
34 const std::string& value,
46 if (::extattr_set_file(
48 EXTATTR_NAMESPACE_USER,
51 value.length()) < 0) {
68 const std::string& path,
69 const std::string& name)
75 ssize_t size = ::extattr_get_file(path.c_str(),
76 EXTATTR_NAMESPACE_USER,
87 char*
temp =
new char[size + 1];
88 ::memset(temp, 0, (
size_t)size + 1);
91 if (::
getxattr(path.c_str(), name.c_str(),
temp, (size_t)size, 0, 0) < 0) {
93 if (::extattr_get_file(
95 EXTATTR_NAMESPACE_USER,
100 if (::
getxattr(path.c_str(), name.c_str(),
temp, (size_t)size) < 0) {
106 std::string result(temp);
114 const std::string& path,
115 const std::string& name)
118 if (::
removexattr(path.c_str(), name.c_str(), 0) < 0) {
120 if (::extattr_delete_file(path.c_str(),
121 EXTATTR_NAMESPACE_USER,
124 if (::
removexattr(path.c_str(), name.c_str()) < 0) {
SSIZE_T ssize_t
Definition: windows.hpp:186
Definition: nothing.hpp:16
Try< Nothing > removexattr(const std::string &path, const std::string &name)
Definition: xattr.hpp:113
Try< Bytes > size(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:130
Try< Nothing > setxattr(const std::string &path, const std::string &name, const std::string &value, int flags)
Definition: xattr.hpp:31
Definition: errorbase.hpp:50
Definition: posix_signalhandler.hpp:23
#define flags
Definition: decoder.hpp:18
std::string temp()
Definition: temp.hpp:27
Try< std::string > getxattr(const std::string &path, const std::string &name)
Definition: xattr.hpp:67
constexpr const char * name
Definition: shell.hpp:41