From ee5eb673a55e30eaac5a78f77de2d144da0ad0b6 Mon Sep 17 00:00:00 2001
From: Adwait Nadkarni <anadkarni@ncsu.edu>
Date: Sat, 26 Oct 2013 14:19:04 -0400
Subject: [PATCH 1/2] Changes to bionic for aquifer

---
 libc/SYSCALLS.TXT                 |    4 ++++
 libc/arch-arm/syscalls.mk         |    4 ++++
 libc/arch-sh/syscalls.mk          |    4 ++++
 libc/arch-x86/syscalls.mk         |    4 ++++
 libc/include/sys/linux-syscalls.h |    4 ++++
 libc/include/sys/linux-unistd.h   |    4 ++++
 6 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 46e7b1f..a6b41e2 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -157,6 +157,10 @@ int     access(const char *, int)  33
 int     symlink(const char *, const char *)  83
 int     fchdir(int)    133
 int     truncate(const char*, off_t)    92
+int     setxattr(const char *, const char *, const void *, size_t, int) 226
+int     lsetxattr(const char *, const char *, const void *, size_t, int) 227
+ssize_t getxattr(const char *, const char *, void *, size_t) 229
+ssize_t lgetxattr(const char *, const char *, void *, size_t) 230
 int     __statfs64:statfs64(const char *, size_t, struct statfs *)  266,268
 # time
 int           pause ()                       29
diff --git a/libc/arch-arm/syscalls.mk b/libc/arch-arm/syscalls.mk
index e6c84f6..4e1a037 100644
--- a/libc/arch-arm/syscalls.mk
+++ b/libc/arch-arm/syscalls.mk
@@ -106,6 +106,10 @@ syscall_src += arch-arm/syscalls/access.S
 syscall_src += arch-arm/syscalls/symlink.S
 syscall_src += arch-arm/syscalls/fchdir.S
 syscall_src += arch-arm/syscalls/truncate.S
+syscall_src += arch-arm/syscalls/setxattr.S
+syscall_src += arch-arm/syscalls/lsetxattr.S
+syscall_src += arch-arm/syscalls/getxattr.S
+syscall_src += arch-arm/syscalls/lgetxattr.S
 syscall_src += arch-arm/syscalls/__statfs64.S
 syscall_src += arch-arm/syscalls/pause.S
 syscall_src += arch-arm/syscalls/gettimeofday.S
diff --git a/libc/arch-sh/syscalls.mk b/libc/arch-sh/syscalls.mk
index 1d87600..cf95ceb 100644
--- a/libc/arch-sh/syscalls.mk
+++ b/libc/arch-sh/syscalls.mk
@@ -109,6 +109,10 @@ syscall_src += arch-sh/syscalls/access.S
 syscall_src += arch-sh/syscalls/symlink.S
 syscall_src += arch-sh/syscalls/fchdir.S
 syscall_src += arch-sh/syscalls/truncate.S
+syscall_src += arch-sh/syscalls/setxattr.S
+syscall_src += arch-sh/syscalls/lsetxattr.S
+syscall_src += arch-sh/syscalls/getxattr.S
+syscall_src += arch-sh/syscalls/lgetxattr.S
 syscall_src += arch-sh/syscalls/__statfs64.S
 syscall_src += arch-sh/syscalls/pause.S
 syscall_src += arch-sh/syscalls/gettimeofday.S
diff --git a/libc/arch-x86/syscalls.mk b/libc/arch-x86/syscalls.mk
index 3b85025..5580499 100644
--- a/libc/arch-x86/syscalls.mk
+++ b/libc/arch-x86/syscalls.mk
@@ -109,6 +109,10 @@ syscall_src += arch-x86/syscalls/access.S
 syscall_src += arch-x86/syscalls/symlink.S
 syscall_src += arch-x86/syscalls/fchdir.S
 syscall_src += arch-x86/syscalls/truncate.S
+syscall_src += arch-x86/syscalls/setxattr.S
+syscall_src += arch-x86/syscalls/lsetxattr.S
+syscall_src += arch-x86/syscalls/getxattr.S
+syscall_src += arch-x86/syscalls/lgetxattr.S
 syscall_src += arch-x86/syscalls/__statfs64.S
 syscall_src += arch-x86/syscalls/pause.S
 syscall_src += arch-x86/syscalls/gettimeofday.S
diff --git a/libc/include/sys/linux-syscalls.h b/libc/include/sys/linux-syscalls.h
index 7b74a4b..8f7b865 100644
--- a/libc/include/sys/linux-syscalls.h
+++ b/libc/include/sys/linux-syscalls.h
@@ -99,6 +99,10 @@
 #define __NR_symlink                      (__NR_SYSCALL_BASE + 83)
 #define __NR_fchdir                       (__NR_SYSCALL_BASE + 133)
 #define __NR_truncate                     (__NR_SYSCALL_BASE + 92)
+#define __NR_setxattr                     (__NR_SYSCALL_BASE + 226)
+#define __NR_lsetxattr                    (__NR_SYSCALL_BASE + 227)
+#define __NR_getxattr                     (__NR_SYSCALL_BASE + 229)
+#define __NR_lgetxattr                    (__NR_SYSCALL_BASE + 230)
 #define __NR_pause                        (__NR_SYSCALL_BASE + 29)
 #define __NR_gettimeofday                 (__NR_SYSCALL_BASE + 78)
 #define __NR_settimeofday                 (__NR_SYSCALL_BASE + 79)
diff --git a/libc/include/sys/linux-unistd.h b/libc/include/sys/linux-unistd.h
index ae9077f..40d1bc5 100644
--- a/libc/include/sys/linux-unistd.h
+++ b/libc/include/sys/linux-unistd.h
@@ -120,6 +120,10 @@ int              access (const char *, int);
 int              symlink (const char *, const char *);
 int              fchdir (int);
 int              truncate (const char*, off_t);
+int              setxattr (const char *, const char *, const void *, size_t, int);
+int              lsetxattr (const char *, const char *, const void *, size_t, int);
+ssize_t          getxattr (const char *, const char *, void *, size_t);
+ssize_t          lgetxattr (const char *, const char *, void *, size_t);
 int              __statfs64 (const char *, size_t, struct statfs *);
 int              pause (void);
 int              gettimeofday (struct timeval*, struct timezone*);
-- 
1.7.4.1


From 29db439f3429c2c20242690c211ec119ba6a5837 Mon Sep 17 00:00:00 2001
From: Adwait Nadkarni <anadkarni@ncsu.edu>
Date: Sat, 26 Oct 2013 22:20:52 -0400
Subject: [PATCH 2/2] Changes for Aquifer CCS2013

---
 libc/include/sys/xattr.h |   56 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 56 insertions(+), 0 deletions(-)
 create mode 100644 libc/include/sys/xattr.h

diff --git a/libc/include/sys/xattr.h b/libc/include/sys/xattr.h
new file mode 100644
index 0000000..39b25b1
--- /dev/null
+++ b/libc/include/sys/xattr.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+#ifndef _SYS_XATTR_H_
+#define _SYS_XATTR_H_
+
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define XATTR_CREATE 1
+#define XATTR_REPLACE 2
+
+extern int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
+extern int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+extern int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);
+
+extern ssize_t fgetxattr(int fd, const char *name, void *value, size_t size);
+extern ssize_t getxattr(const char *path, const char *name, void *value, size_t size);
+extern ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size);
+
+extern ssize_t listxattr(const char *path, char *list, size_t size);
+extern ssize_t llistxattr(const char *path, char *list, size_t size);
+extern ssize_t flistxattr(int fd, char *list, size_t size);
+
+extern int removexattr(const char *path, const char *name);
+extern int lremovexattr(const char *path, const char *name);
+extern int fremovexattr(int fd, const char *name);
+
+__END_DECLS
+
+#endif /* _SYS_XATTR_H_ */
-- 
1.7.4.1

