2016-10-19 09:28:06 -04:00
|
|
|
/*
|
|
|
|
|
ISC License
|
|
|
|
|
|
2026-02-23 13:22:21 -06:00
|
|
|
Copyright (c) 2026, Antonio SJ Musumeci <trapexit@spawn.link>
|
2016-10-19 09:28:06 -04:00
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
|
purpose with or without fee is hereby granted, provided that the above
|
|
|
|
|
copyright notice and this permission notice appear in all copies.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
|
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
|
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
|
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
|
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
|
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
|
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
|
2017-06-30 11:15:20 -04:00
|
|
|
#pragma once
|
2016-12-22 22:46:20 -05:00
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
#include "to_neg_errno.hpp"
|
2016-10-19 09:28:06 -04:00
|
|
|
#include "xattr.hpp"
|
|
|
|
|
|
2018-10-09 11:58:06 -04:00
|
|
|
#include <string>
|
|
|
|
|
|
2019-01-25 07:03:46 -05:00
|
|
|
#include <sys/types.h>
|
|
|
|
|
|
2020-12-19 15:06:08 -05:00
|
|
|
|
2016-10-19 09:28:06 -04:00
|
|
|
namespace fs
|
|
|
|
|
{
|
|
|
|
|
static
|
|
|
|
|
inline
|
2025-07-21 18:18:59 -05:00
|
|
|
ssize_t
|
2018-10-09 11:58:06 -04:00
|
|
|
llistxattr(const char *path_,
|
|
|
|
|
char *list_,
|
|
|
|
|
const size_t size_)
|
|
|
|
|
{
|
|
|
|
|
#ifdef USE_XATTR
|
2025-07-21 18:18:59 -05:00
|
|
|
ssize_t rv;
|
|
|
|
|
|
|
|
|
|
rv = ::llistxattr(path_,list_,size_);
|
|
|
|
|
|
2025-07-25 17:53:48 -05:00
|
|
|
return ::to_neg_errno(rv);
|
2018-10-09 11:58:06 -04:00
|
|
|
#else
|
2025-07-21 18:18:59 -05:00
|
|
|
return -ENOTSUP;
|
2018-10-09 11:58:06 -04:00
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
|
inline
|
2025-07-21 18:18:59 -05:00
|
|
|
ssize_t
|
2018-10-09 11:58:06 -04:00
|
|
|
llistxattr(const std::string &path_,
|
|
|
|
|
char *list_,
|
|
|
|
|
const size_t size_)
|
|
|
|
|
{
|
|
|
|
|
return fs::llistxattr(path_.c_str(),list_,size_);
|
|
|
|
|
}
|
2016-10-19 09:28:06 -04:00
|
|
|
}
|