Back to index

glibc  2.9
xattr.h
Go to the documentation of this file.
00001 /* Copyright (C) 2002 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_XATTR_H
00020 #define _SYS_XATTR_H 1
00021 
00022 #include <features.h>
00023 #include <sys/types.h>
00024 
00025 
00026 __BEGIN_DECLS
00027 
00028 /* The following constants should be used for the fifth parameter of
00029    `*setxattr'.  */
00030 enum
00031 {
00032   XATTR_CREATE = 1,  /* set value, fail if attr already exists.  */
00033 #define XATTR_CREATE XATTR_CREATE
00034   XATTR_REPLACE = 2  /* set value, fail if attr does not exist.  */
00035 #define XATTR_REPLACE       XATTR_REPLACE
00036 };
00037 
00038 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which
00039    is SIZE bytes long).  Return 0 on success, -1 for errors.  */
00040 extern int setxattr (__const char *__path, __const char *__name,
00041                    __const void *__value, size_t __size, int __flags)
00042        __THROW;
00043 
00044 /* Set the attribute NAME of the file pointed to by PATH to VALUE (which is
00045    SIZE bytes long), not following symlinks for the last pathname component.
00046    Return 0 on success, -1 for errors.  */
00047 extern int lsetxattr (__const char *__path, __const char *__name,
00048                     __const void *__value, size_t __size, int __flags)
00049        __THROW;
00050 
00051 /* Set the attribute NAME of the file descriptor FD to VALUE (which is SIZE
00052    bytes long).  Return 0 on success, -1 for errors.  */
00053 extern int fsetxattr (int __fd, __const char *__name, __const void *__value,
00054                     size_t __size, int __flags) __THROW;
00055 
00056 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
00057    SIZE bytes long).  Return 0 on success, -1 for errors.  */
00058 extern ssize_t getxattr (__const char *__path, __const char *__name,
00059                       void *__value, size_t __size) __THROW;
00060 
00061 /* Get the attribute NAME of the file pointed to by PATH to VALUE (which is
00062    SIZE bytes long), not following symlinks for the last pathname component.
00063    Return 0 on success, -1 for errors.  */
00064 extern ssize_t lgetxattr (__const char *__path, __const char *__name,
00065                        void *__value, size_t __size) __THROW;
00066 
00067 /* Get the attribute NAME of the file descriptor FD to VALUE (which is SIZE
00068    bytes long).  Return 0 on success, -1 for errors.  */
00069 extern ssize_t fgetxattr (int __fd, __const char *__name, void *__value,
00070                        size_t __size) __THROW;
00071 
00072 /* List attributes of the file pointed to by PATH into the user-supplied
00073    buffer LIST (which is SIZE bytes big).  Return 0 on success, -1 for
00074    errors.  */
00075 extern ssize_t listxattr (__const char *__path, char *__list, size_t __size)
00076        __THROW;
00077 
00078 /* List attributes of the file pointed to by PATH into the user-supplied
00079    buffer LIST (which is SIZE bytes big), not following symlinks for the
00080    last pathname component.  Return 0 on success, -1 for errors.  */
00081 extern ssize_t llistxattr (__const char *__path, char *__list, size_t __size)
00082        __THROW;
00083 
00084 /* List attributes of the file descriptor FD into the user-supplied buffer
00085    LIST (which is SIZE bytes big).  Return 0 on success, -1 for errors.  */
00086 extern ssize_t flistxattr (int __fd, char *__list, size_t __size)
00087        __THROW;
00088 
00089 /* Remove the attribute NAME from the file pointed to by PATH.  Return 0
00090    on success, -1 for errors.  */
00091 extern int removexattr (__const char *__path, __const char *__name) __THROW;
00092 
00093 /* Remove the attribute NAME from the file pointed to by PATH, not
00094    following symlinks for the last pathname component.  Return 0 on
00095    success, -1 for errors.  */
00096 extern int lremovexattr (__const char *__path, __const char *__name) __THROW;
00097 
00098 /* Remove the attribute NAME from the file descriptor FD.  Return 0 on
00099    success, -1 for errors.  */
00100 extern int fremovexattr (int __fd, __const char *__name) __THROW;
00101 
00102 __END_DECLS
00103 
00104 #endif /* sys/xattr.h  */