c1f565
From 182a48b83c0319ec4bad60aecf1b688288bf0f9d Mon Sep 17 00:00:00 2001
c1f565
From: Riku Voipio <riku.voipio@linaro.org>
c1f565
Date: Wed, 20 Mar 2013 07:51:18 -0700
c1f565
Subject: [PATCH] libattr: syscalls: use syscalls.h
c1f565
c1f565
Include syscalls.h and check for __NR_setxattr being set. This fixes the
c1f565
build on new and odd archs but may break on really really old machines
c1f565
with out of date syscalls.h.
c1f565
c1f565
[upstream commit db54b565deace6d27eaa158508087ce54fe959c4]
c1f565
c1f565
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c1f565
---
c1f565
 libattr/syscalls.c |  166 +---------------------------------------------------
c1f565
 1 files changed, 2 insertions(+), 164 deletions(-)
c1f565
c1f565
diff --git a/libattr/syscalls.c b/libattr/syscalls.c
c1f565
index cbfec57..51fe98c 100644
c1f565
--- a/libattr/syscalls.c
c1f565
+++ b/libattr/syscalls.c
c1f565
@@ -23,172 +23,10 @@
c1f565
 
c1f565
 #include <errno.h>
c1f565
 #include <unistd.h>
c1f565
+#include <sys/syscall.h>
c1f565
 
c1f565
-#if defined (__i386__)
c1f565
+#if defined (__NR_setxattr)
c1f565
 # define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		226
c1f565
-# define __NR_lsetxattr		227
c1f565
-# define __NR_fsetxattr		228
c1f565
-# define __NR_getxattr		229
c1f565
-# define __NR_lgetxattr		230
c1f565
-# define __NR_fgetxattr		231
c1f565
-# define __NR_listxattr		232
c1f565
-# define __NR_llistxattr	233
c1f565
-# define __NR_flistxattr	234
c1f565
-# define __NR_removexattr	235
c1f565
-# define __NR_lremovexattr	236
c1f565
-# define __NR_fremovexattr	237
c1f565
-#elif defined (__sparc__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		169
c1f565
-# define __NR_lsetxattr		170
c1f565
-# define __NR_fsetxattr		171
c1f565
-# define __NR_getxattr		172
c1f565
-# define __NR_lgetxattr		173
c1f565
-# define __NR_fgetxattr		177
c1f565
-# define __NR_listxattr		178
c1f565
-# define __NR_llistxattr	179
c1f565
-# define __NR_flistxattr	180
c1f565
-# define __NR_removexattr	181
c1f565
-# define __NR_lremovexattr	182
c1f565
-# define __NR_fremovexattr	186
c1f565
-#elif defined (__ia64__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		1217
c1f565
-# define __NR_lsetxattr		1218
c1f565
-# define __NR_fsetxattr		1219
c1f565
-# define __NR_getxattr		1220
c1f565
-# define __NR_lgetxattr		1221
c1f565
-# define __NR_fgetxattr		1222
c1f565
-# define __NR_listxattr		1223
c1f565
-# define __NR_llistxattr	1224
c1f565
-# define __NR_flistxattr	1225
c1f565
-# define __NR_removexattr	1226
c1f565
-# define __NR_lremovexattr	1227
c1f565
-# define __NR_fremovexattr	1228
c1f565
-#elif defined (__powerpc__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		209
c1f565
-# define __NR_lsetxattr		210
c1f565
-# define __NR_fsetxattr		211
c1f565
-# define __NR_getxattr		212
c1f565
-# define __NR_lgetxattr		213
c1f565
-# define __NR_fgetxattr		214
c1f565
-# define __NR_listxattr		215
c1f565
-# define __NR_llistxattr	216
c1f565
-# define __NR_flistxattr	217
c1f565
-# define __NR_removexattr	218
c1f565
-# define __NR_lremovexattr	219
c1f565
-# define __NR_fremovexattr	220
c1f565
-#elif defined (__x86_64__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		188
c1f565
-# define __NR_lsetxattr		189
c1f565
-# define __NR_fsetxattr		190
c1f565
-# define __NR_getxattr		191
c1f565
-# define __NR_lgetxattr		192
c1f565
-# define __NR_fgetxattr		193
c1f565
-# define __NR_listxattr		194
c1f565
-# define __NR_llistxattr	195
c1f565
-# define __NR_flistxattr	196
c1f565
-# define __NR_removexattr	197
c1f565
-# define __NR_lremovexattr	198
c1f565
-# define __NR_fremovexattr	199
c1f565
-#elif defined (__s390__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		224
c1f565
-# define __NR_lsetxattr		225
c1f565
-# define __NR_fsetxattr		226
c1f565
-# define __NR_getxattr		227
c1f565
-# define __NR_lgetxattr		228
c1f565
-# define __NR_fgetxattr		229
c1f565
-# define __NR_listxattr		230
c1f565
-# define __NR_llistxattr	231
c1f565
-# define __NR_flistxattr	232
c1f565
-# define __NR_removexattr	233
c1f565
-# define __NR_lremovexattr	234
c1f565
-# define __NR_fremovexattr	235
c1f565
-#elif defined (__arm__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# if defined(__ARM_EABI__) || defined(__thumb__)
c1f565
-#  define __NR_SYSCALL_BASE 0
c1f565
-# else
c1f565
-#  define __NR_SYSCALL_BASE 0x900000
c1f565
-# endif
c1f565
-# define __NR_setxattr		(__NR_SYSCALL_BASE+226)
c1f565
-# define __NR_lsetxattr		(__NR_SYSCALL_BASE+227)
c1f565
-# define __NR_fsetxattr		(__NR_SYSCALL_BASE+228)
c1f565
-# define __NR_getxattr		(__NR_SYSCALL_BASE+229)
c1f565
-# define __NR_lgetxattr		(__NR_SYSCALL_BASE+230)
c1f565
-# define __NR_fgetxattr		(__NR_SYSCALL_BASE+231)
c1f565
-# define __NR_listxattr		(__NR_SYSCALL_BASE+232)
c1f565
-# define __NR_llistxattr	(__NR_SYSCALL_BASE+233)
c1f565
-# define __NR_flistxattr	(__NR_SYSCALL_BASE+234)
c1f565
-# define __NR_removexattr	(__NR_SYSCALL_BASE+235)
c1f565
-# define __NR_lremovexattr	(__NR_SYSCALL_BASE+236)
c1f565
-# define __NR_fremovexattr	(__NR_SYSCALL_BASE+237)
c1f565
-#elif defined (__mips64)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# ifdef __LP64__ /* mips64 using n64 ABI */
c1f565
-#  define __NR_Linux 5000
c1f565
-# else /* mips64 using n32 ABI */
c1f565
-#  define __NR_Linux 6000
c1f565
-# endif
c1f565
-# define __NR_setxattr		(__NR_Linux + 180)
c1f565
-# define __NR_lsetxattr		(__NR_Linux + 181)
c1f565
-# define __NR_fsetxattr		(__NR_Linux + 182)
c1f565
-# define __NR_getxattr		(__NR_Linux + 183)
c1f565
-# define __NR_lgetxattr		(__NR_Linux + 184)
c1f565
-# define __NR_fgetxattr		(__NR_Linux + 185)
c1f565
-# define __NR_listxattr		(__NR_Linux + 186)
c1f565
-# define __NR_llistxattr	(__NR_Linux + 187)
c1f565
-# define __NR_flistxattr	(__NR_Linux + 188)
c1f565
-# define __NR_removexattr	(__NR_Linux + 189)
c1f565
-# define __NR_lremovexattr	(__NR_Linux + 190)
c1f565
-# define __NR_fremovexattr	(__NR_Linux + 191)
c1f565
-#elif defined (__mips__) /* mips32, or mips64 using o32 ABI */
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_Linux 4000
c1f565
-# define __NR_setxattr		(__NR_Linux + 224)
c1f565
-# define __NR_lsetxattr		(__NR_Linux + 225)
c1f565
-# define __NR_fsetxattr		(__NR_Linux + 226)
c1f565
-# define __NR_getxattr		(__NR_Linux + 227)
c1f565
-# define __NR_lgetxattr		(__NR_Linux + 228)
c1f565
-# define __NR_fgetxattr		(__NR_Linux + 229)
c1f565
-# define __NR_listxattr		(__NR_Linux + 230)
c1f565
-# define __NR_llistxattr	(__NR_Linux + 231)
c1f565
-# define __NR_flistxattr	(__NR_Linux + 232)
c1f565
-# define __NR_removexattr	(__NR_Linux + 233)
c1f565
-# define __NR_lremovexattr	(__NR_Linux + 234)
c1f565
-# define __NR_fremovexattr	(__NR_Linux + 235)
c1f565
-#elif defined (__alpha__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		382
c1f565
-# define __NR_lsetxattr		383
c1f565
-# define __NR_fsetxattr		384
c1f565
-# define __NR_getxattr		385
c1f565
-# define __NR_lgetxattr		386
c1f565
-# define __NR_fgetxattr		387
c1f565
-# define __NR_listxattr		388
c1f565
-# define __NR_llistxattr	389
c1f565
-# define __NR_flistxattr	390
c1f565
-# define __NR_removexattr	391
c1f565
-# define __NR_lremovexattr	392
c1f565
-# define __NR_fremovexattr	393
c1f565
-#elif defined (__mc68000__)
c1f565
-# define HAVE_XATTR_SYSCALLS 1
c1f565
-# define __NR_setxattr		223
c1f565
-# define __NR_lsetxattr		224
c1f565
-# define __NR_fsetxattr		225
c1f565
-# define __NR_getxattr		226
c1f565
-# define __NR_lgetxattr		227
c1f565
-# define __NR_fgetxattr		228
c1f565
-# define __NR_listxattr		229
c1f565
-# define __NR_llistxattr	230
c1f565
-# define __NR_flistxattr	231
c1f565
-# define __NR_removexattr	232
c1f565
-# define __NR_lremovexattr	233
c1f565
-# define __NR_fremovexattr	234
c1f565
 #else
c1f565
 # warning "Extended attribute syscalls undefined for this architecture"
c1f565
 # define HAVE_XATTR_SYSCALLS 0
c1f565
-- 
c1f565
1.7.1
c1f565