(root)/
attr-2.5.1/
libattr/
syscalls.c
       1  /*
       2    Copyright (C) 2015  Dmitry V. Levin <ldv@altlinux.org>
       3  
       4    This program is free software: you can redistribute it and/or modify it
       5    under the terms of the GNU Lesser General Public License as published by
       6    the Free Software Foundation, either version 2.1 of the License, or
       7    (at your option) any later version.
       8  
       9    This program is distributed in the hope that it will be useful,
      10    but WITHOUT ANY WARRANTY; without even the implied warranty of
      11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      12    GNU Lesser General Public License for more details.
      13  
      14    You should have received a copy of the GNU Lesser General Public License
      15    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      16   */
      17  
      18  /*
      19   * These dumb wrappers are for backwards compatibility only.
      20   * Actual syscall wrappers are long gone to libc.
      21   */
      22  
      23  #include "config.h"
      24  
      25  #include <unistd.h>
      26  #include <sys/syscall.h>
      27  #include <sys/xattr.h>
      28  
      29  #ifdef HAVE_VISIBILITY_ATTRIBUTE
      30  # pragma GCC visibility push(default)
      31  #endif
      32  
      33  int libattr_setxattr(const char *path, const char *name,
      34  		     void *value, size_t size, int flags)
      35  {
      36  	return syscall(__NR_setxattr, path, name, value, size, flags);
      37  }
      38  
      39  int libattr_lsetxattr(const char *path, const char *name,
      40  		      void *value, size_t size, int flags)
      41  {
      42  	return syscall(__NR_lsetxattr, path, name, value, size, flags);
      43  }
      44  
      45  int libattr_fsetxattr(int filedes, const char *name,
      46  		      void *value, size_t size, int flags)
      47  {
      48  	return syscall(__NR_fsetxattr, filedes, name, value, size, flags);
      49  }
      50  
      51  ssize_t libattr_getxattr(const char *path, const char *name,
      52  			 void *value, size_t size)
      53  {
      54  	return syscall(__NR_getxattr, path, name, value, size);
      55  }
      56  
      57  ssize_t libattr_lgetxattr(const char *path, const char *name,
      58  			  void *value, size_t size)
      59  {
      60  	return syscall(__NR_lgetxattr, path, name, value, size);
      61  }
      62  
      63  ssize_t libattr_fgetxattr(int filedes, const char *name,
      64  			  void *value, size_t size)
      65  {
      66  	return syscall(__NR_fgetxattr, filedes, name, value, size);
      67  }
      68  
      69  ssize_t libattr_listxattr(const char *path, char *list, size_t size)
      70  {
      71  	return syscall(__NR_listxattr, path, list, size);
      72  }
      73  
      74  ssize_t libattr_llistxattr(const char *path, char *list, size_t size)
      75  {
      76  	return syscall(__NR_llistxattr, path, list, size);
      77  }
      78  
      79  ssize_t libattr_flistxattr(int filedes, char *list, size_t size)
      80  {
      81  	return syscall(__NR_flistxattr, filedes, list, size);
      82  }
      83  
      84  int libattr_removexattr(const char *path, const char *name)
      85  {
      86  	return syscall(__NR_removexattr, path, name);
      87  }
      88  
      89  int libattr_lremovexattr(const char *path, const char *name)
      90  {
      91  	return syscall(__NR_lremovexattr, path, name);
      92  }
      93  
      94  int libattr_fremovexattr(int filedes, const char *name)
      95  {
      96  	return syscall(__NR_fremovexattr, filedes, name);
      97  }
      98  
      99  #ifdef HAVE_VISIBILITY_ATTRIBUTE
     100  # pragma GCC visibility pop
     101  #endif