--- ../busybox-1.23.2.orig/libbb/missing_syscalls.c 2015-03-23 06:06:55.000000000 +0300 +++ ./libbb/missing_syscalls.c 2015-09-27 12:54:00.630566524 +0300 @@ -39,4 +39,58 @@ { return syscall(__NR_pivot_root, new_root, put_old); } + +int swapoff(const char *path) +{ + return syscall(__NR_swapoff, path); +} + +int swapon(const char *path, int swapflags) +{ + return syscall(__NR_swapon, path, swapflags); +} + +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); +} + +int semget(key_t key, int nsems, int semflg) +{ + return syscall(__NR_semget, key, nsems, semflg); +} + +struct msqid_ds; /* #include */ +int msgctl(int msqid, int cmd, struct msqid_ds *buf) +{ + return syscall(__NR_msgctl, msqid, cmd, buf); +} + +struct shmid_ds; /* #include */ +// NOTE: IPC_INFO takes a struct shminfo64 +int shmctl(int shmid, int cmd, struct shmid_ds *buf) +{ + return syscall(__NR_shmctl, shmid, cmd, buf); +} + +struct sembuf; /* #include */ +int semop(int semid, struct sembuf *sops, unsigned nsops) +{ + return syscall(__NR_semop, semid, sops, nsops); +} #endif --- ../busybox-1.23.2.orig/libbb/semctl.c 1970-01-01 03:00:00.000000000 +0300 +++ ./libbb/semctl.c 2015-09-27 12:50:17.231609427 +0300 @@ -0,0 +1,58 @@ +/* Copyright (C) 1995,1997,1998,2000,2003,2004,2006 + Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , August 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ +/* originally from glibc-2.14/sysdeps/unix/sysv/linux/semctl.c, modified */ + +// syscall used by syslogd, ipcrm, ipcs +//kbuild:lib-y += semctl.o + +#include /* For __NR_xxx definitions */ +#include +#include +#include "libbb.h" + +/* code from GLIBC */ +int semctl(int semid, int semnum, int cmd, ...) { + union semun arg; + va_list ap; + + va_start (ap, cmd); + + /* Get the argument only if required. */ + arg.buf = NULL; + switch (cmd) + { + case SETVAL: /* arg.val */ + case GETALL: /* arg.array */ + case SETALL: + case IPC_STAT: /* arg.buf */ + case IPC_SET: + case SEM_STAT: + case IPC_INFO: /* arg.__buf */ + case SEM_INFO: + va_start (ap, cmd); + arg = va_arg (ap, union semun); + va_end (ap); + break; + } + + va_end (ap); + + return syscall(__NR_semctl, semid, semnum, cmd, arg); +}