[Toybox] [PATCH 09/10] Define sethostname(), swapon() and swapoff().
Georgi Chorbadzhiyski
gf at unixsol.org
Wed Mar 7 16:39:01 PST 2012
---
toys/hostname.c | 7 +++++++
toys/swapoff.c | 7 +++++++
toys/swapon.c | 7 +++++++
3 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/toys/hostname.c b/toys/hostname.c
index 5f1c20e..ad71bef 100644
--- a/toys/hostname.c
+++ b/toys/hostname.c
@@ -19,6 +19,13 @@ config HOSTNAME
#include "toys.h"
+#ifdef __ANDROID__
+#include <asm/unistd.h>
+int sethostname(const char *name, size_t len) {
+ return syscall(__NR_sethostname, name, len);
+}
+#endif
+
void hostname_main(void)
{
const char *hostname = toys.optargs[0];
diff --git a/toys/swapoff.c b/toys/swapoff.c
index fba0de8..49f7027 100644
--- a/toys/swapoff.c
+++ b/toys/swapoff.c
@@ -19,6 +19,13 @@ config SWAPOFF
#include "toys.h"
+#ifdef __ANDROID__
+#include <asm/unistd.h>
+int swapoff(const char *path) {
+ return syscall(__NR_swapon, path);
+}
+#endif
+
void swapoff_main(void)
{
if (swapoff(toys.optargs[0]))
diff --git a/toys/swapon.c b/toys/swapon.c
index 16ce8d1..fff8dac 100644
--- a/toys/swapon.c
+++ b/toys/swapon.c
@@ -25,6 +25,13 @@ DEFINE_GLOBALS(
#define TT this.swapon
+#ifdef __ANDROID__
+#include <asm/unistd.h>
+int swapon(const char *path, int swapflags) {
+ return syscall(__NR_swapon, path, swapflags);
+}
+#endif
+
void swapon_main(void)
{
int flags = 0;
--
1.7.5.1
More information about the Toybox
mailing list