mirror of
git://git.musl-libc.org/musl
synced 2024-12-16 19:55:38 +00:00
add extended attributes syscalls
based on patch by orc and Isaac Dunham, with some fixes.
This commit is contained in:
parent
42f0e965c4
commit
207460d097
27
include/sys/xattr.h
Normal file
27
include/sys/xattr.h
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef _SYS_XATTR_H
|
||||
#define _SYS_XATTR_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define __NEED_ssize_t
|
||||
#define __NEED_size_t
|
||||
#include <bits/alltypes.h>
|
||||
|
||||
#define XATTR_CREATE 1
|
||||
#define XATTR_REPLACE 2
|
||||
|
||||
ssize_t getxattr(const char *, const char *, void *, size_t);
|
||||
ssize_t lgetxattr(const char *, const char *, void *, size_t);
|
||||
ssize_t fgetxattr(int filedes, const char *, void *, size_t);
|
||||
ssize_t listxattr(const char *, char *, size_t);
|
||||
ssize_t llistxattr(const char *, char *, size_t);
|
||||
ssize_t flistxattr(int filedes, char *, size_t);
|
||||
int setxattr(const char *, const char *, const void *, size_t, int);
|
||||
int lsetxattr(const char *, const char *, const void *, size_t, int);
|
||||
int fsetxattr(int, const char *, const void *, size_t, int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
47
src/linux/xattr.c
Normal file
47
src/linux/xattr.c
Normal file
@ -0,0 +1,47 @@
|
||||
#include <sys/xattr.h>
|
||||
#include "syscall.h"
|
||||
|
||||
ssize_t getxattr(const char *path, const char *name, void *value, size_t size)
|
||||
{
|
||||
return syscall(SYS_getxattr, path, name, value, size);
|
||||
}
|
||||
|
||||
ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size)
|
||||
{
|
||||
return syscall(SYS_lgetxattr, path, name, value, size);
|
||||
}
|
||||
|
||||
ssize_t fgetxattr(int filedes, const char *name, void *value, size_t size)
|
||||
{
|
||||
return syscall(SYS_fgetxattr, filedes, name, value, size);
|
||||
}
|
||||
|
||||
ssize_t listxattr(const char *path, char *list, size_t size)
|
||||
{
|
||||
return syscall(SYS_listxattr, path, list, size);
|
||||
}
|
||||
|
||||
ssize_t llistxattr(const char *path, char *list, size_t size)
|
||||
{
|
||||
return syscall(SYS_llistxattr, path, list, size);
|
||||
}
|
||||
|
||||
ssize_t flistxattr(int filedes, char *list, size_t size)
|
||||
{
|
||||
return syscall(SYS_flistxattr, filedes, list, size);
|
||||
}
|
||||
|
||||
int setxattr(const char *path, const char *name, const void *value, size_t size, int flags)
|
||||
{
|
||||
return syscall(SYS_setxattr, path, name, value, size, flags);
|
||||
}
|
||||
|
||||
int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags)
|
||||
{
|
||||
return syscall(SYS_lsetxattr, path, name, value, size, flags);
|
||||
}
|
||||
|
||||
int fsetxattr(int filedes, const char *name, const void *value, size_t size, int flags)
|
||||
{
|
||||
return syscall(SYS_fsetxattr, filedes, name, value, size, flags);
|
||||
}
|
Loading…
Reference in New Issue
Block a user