diff options
author | mr <mr@FreeBSD.org> | 2001-09-15 09:50:38 +0000 |
---|---|---|
committer | mr <mr@FreeBSD.org> | 2001-09-15 09:50:38 +0000 |
commit | 99ae75a097ca7f2e4fabca5b0c137987e421bd91 (patch) | |
tree | 404d7be16ab6c9ab5b9122b39a5b306417b35272 /sys/compat | |
parent | 57403f5f90e0bf91957389f03a1d9ad47746a5c7 (diff) | |
download | FreeBSD-src-99ae75a097ca7f2e4fabca5b0c137987e421bd91.zip FreeBSD-src-99ae75a097ca7f2e4fabca5b0c137987e421bd91.tar.gz |
Implement LINUX_[SEM|IPC]_[STAT|INFO]
to make /compat/linux/usr/bin/ipcs -s happy.
PR: kern/29698 (part)
Reviewed by: audit
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_ipc.c | 60 |
1 files changed, 58 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_ipc.c b/sys/compat/linux/linux_ipc.c index 9053efc..300c67a 100644 --- a/sys/compat/linux/linux_ipc.c +++ b/sys/compat/linux/linux_ipc.c @@ -40,6 +40,36 @@ #include <compat/linux/linux_ipc.h> #include <compat/linux/linux_util.h> +struct l_seminfo { + l_int semmap; + l_int semmni; + l_int semmns; + l_int semmnu; + l_int semmsl; + l_int semopm; + l_int semume; + l_int semusz; + l_int semvmx; + l_int semaem; +}; + +struct l_shminfo { + l_int shmmax; + l_int shmmin; + l_int shmmni; + l_int shmseg; + l_int shmall; +}; + +struct l_shm_info { + l_int used_ids; + l_ulong shm_tot; /* total allocated shm */ + l_ulong shm_rss; /* total resident shm */ + l_ulong shm_swp; /* total swapped shm */ + l_ulong swap_attempts; + l_ulong swap_successes; +}; + struct l_ipc_perm { l_key_t key; l_uid16_t uid; @@ -188,6 +218,7 @@ linux_semctl(struct thread *td, struct linux_semctl_args *args) int cmd; union semun *arg; } */ bsd_args; + struct l_seminfo linux_seminfo; int error; union semun *unptr; caddr_t sg; @@ -228,16 +259,41 @@ linux_semctl(struct thread *td, struct linux_semctl_args *args) bsd_args.arg = unptr; return __semctl(td, &bsd_args); case LINUX_IPC_STAT: - bsd_args.cmd = IPC_STAT; + case LINUX_SEM_STAT: + if( args->cmd == LINUX_IPC_STAT ) + bsd_args.cmd = IPC_STAT; + else + bsd_args.cmd = SEM_STAT; unptr = stackgap_alloc(&sg, sizeof(union semun)); unptr->buf = stackgap_alloc(&sg, sizeof(struct semid_ds)); bsd_args.arg = unptr; error = __semctl(td, &bsd_args); if (error) return error; + td->td_retval[0] = IXSEQ_TO_IPCID(bsd_args.semid, + unptr->buf->sem_perm); bsd_to_linux_semid_ds(unptr->buf, &linux_semid); return copyout(&linux_semid, (caddr_t)args->arg.buf, - sizeof(linux_semid)); + sizeof(linux_semid)); + case LINUX_IPC_INFO: + case LINUX_SEM_INFO: + error = copyin((caddr_t)args->arg.buf, &linux_seminfo, + sizeof(linux_seminfo) ); + if (error) + return error; + bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) ); +/* XXX BSD equivalent? +#define used_semids 10 +#define used_sems 10 + linux_seminfo.semusz = used_semids; + linux_seminfo.semaem = used_sems; +*/ + error = copyout((caddr_t)&linux_seminfo, (caddr_t)args->arg.buf, + sizeof(linux_seminfo) ); + if (error) + return error; + td->td_retval[0] = seminfo.semmni; + return 0; /* No need for __semctl call */ case LINUX_GETALL: /* FALLTHROUGH */ case LINUX_SETALL: |