Skip to content

Commit

Permalink
rework 018-syslogd-logread.patch
Browse files Browse the repository at this point in the history
  • Loading branch information
tias committed Aug 5, 2012
1 parent a2c6ece commit ae8e0d1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 48 deletions.
44 changes: 44 additions & 0 deletions patches/018-semop-shmdt-syscalls.patch
@@ -0,0 +1,44 @@
From: Tias Guns <tias@ulyssis.org>
Date: Sun, 5 Aug 2012 15:39:30 +0200
Subject: [PATCH] android syscalls: shmdt shmat sembuf

Signed-off-by: Tias Guns <tias@ulyssis.org>
---
libbb/missing_syscalls.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/libbb/missing_syscalls.c b/libbb/missing_syscalls.c
index ac75829..474accb 100644
--- a/libbb/missing_syscalls.c
+++ b/libbb/missing_syscalls.c
@@ -55,6 +55,16 @@ int shmget(key_t key, size_t size, int shmflg)
return syscall(__NR_shmget, key, size, shmflg);
}

+int shmdt(const void *shmaddr)
+{
+ return syscall(__NR_shmdt, shmaddr);
+}
+
+void *shmat(int shmid, const void *shmaddr, int shmflg)
+{
+ return (void *)syscall(__NR_shmat, shmid, shmaddr, shmflg);
+}
+
int msgget(key_t key, int msgflg)
{
return syscall(__NR_msgget, key, msgflg);
@@ -77,4 +87,10 @@ int shmctl(int shmid, int cmd, struct shmid_ds *buf)
{
return syscall(__NR_shmctl, shmid, cmd, buf);
}
+
+struct sembuf; /* #include <linux/sem.h> */
+int semop(int semid, struct sembuf *sops, unsigned nsops)
+{
+ return syscall(__NR_semop, semid, sops, nsops);
+}
#endif
--
1.7.10.4

Expand Up @@ -7,16 +7,11 @@ patch from 'no-sys-shm,msg,sem' and 'sys-syslog' by Dan Drown
http://dan.drown.org/android/src/busybox/
---
include/sys/syslog.h | 138 +++++++++++++++++++++++++++++++++++++++++
libbb/Kbuild.src | 2 +
libbb/semop.c | 8 +++
libbb/shmdt-at.c | 11 +++
sysklogd/logread.c | 4 +-
sysklogd/syslogd.c | 4 +-
sysklogd/syslogd_and_logger.c | 1 +
7 files changed, 164 insertions(+), 4 deletions(-)
4 files changed, 143 insertions(+), 4 deletions(-)
create mode 100644 include/sys/syslog.h
create mode 100644 libbb/semop.c
create mode 100644 libbb/shmdt-at.c

diff --git a/include/sys/syslog.h b/include/sys/syslog.h
new file mode 100644
Expand Down Expand Up @@ -162,47 +157,6 @@ index 0000000..3c749a0
+#define LOG_PERROR 0x20 /* log to stderr as well */
+
+#endif /* sys/syslog.h */
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 9c0d13f..d2e8c94 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -201,3 +201,5 @@ lib-$(CONFIG_HOSTNAME) += sethostname.o

lib-$(CONFIG_ADJTIMEX) += adjtimex.o
lib-$(CONFIG_SWAPONOFF) += swapon.o swapoff.o
+
+lib-$(CONFIG_SYSLOGD) += semop.o shmdt-at.o
diff --git a/libbb/semop.c b/libbb/semop.c
new file mode 100644
index 0000000..362aa62
--- /dev/null
+++ b/libbb/semop.c
@@ -0,0 +1,8 @@
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <linux/sem.h>
+
+int semop(int semid, struct sembuf *sops, unsigned nsops) {
+ return syscall(__NR_semop, semid, sops, nsops);
+}
+
diff --git a/libbb/shmdt-at.c b/libbb/shmdt-at.c
new file mode 100644
index 0000000..1831e11
--- /dev/null
+++ b/libbb/shmdt-at.c
@@ -0,0 +1,11 @@
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <linux/shm.h>
+
+int shmdt(const void *shmaddr) {
+ return syscall(__NR_shmdt, shmaddr);
+}
+
+void *shmat(int shmid, const void *shmaddr, int shmflg) {
+ return (void *)syscall(__NR_shmat, shmid, shmaddr, shmflg);
+}
diff --git a/sysklogd/logread.c b/sysklogd/logread.c
index 9939569..e978a5d 100644
--- a/sysklogd/logread.c
Expand Down Expand Up @@ -246,5 +200,5 @@ index 0964f23..81c8909 100644
#if 0
/* For the record: with SYSLOG_NAMES <syslog.h> defines
--
1.7.0.4
1.7.10.4

0 comments on commit ae8e0d1

Please sign in to comment.