FreeBSD Bugzilla – Attachment 16123 Details for
Bug 29698
[linux] [patch] linux ipcs doesn'work
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
file.diff
file.diff (text/plain), 4.67 KB, created by
Michael Reifenberger
on 2001-08-14 10:20:01 UTC
(
hide
)
Description:
file.diff
Filename:
MIME Type:
Creator:
Michael Reifenberger
Created:
2001-08-14 10:20:01 UTC
Size:
4.67 KB
patch
obsolete
>--- ./i386/linux/linux.h.orig Wed Aug 8 00:09:28 2001 >+++ ./i386/linux/linux.h Mon Aug 13 00:41:50 2001 >@@ -457,4 +457,6 @@ > #define LINUX_SETVAL 16 > #define LINUX_SETALL 17 >+#define LINUX_SEM_STAT 18 >+#define LINUX_SEM_INFO 19 > > /* >--- ./kern/sysv_sem.c.orig Sun Aug 12 13:18:34 2001 >+++ ./kern/sysv_sem.c Sun Aug 12 23:31:10 2001 >@@ -171,4 +171,14 @@ > register int i; > >+ TUNABLE_INT_FETCH("kern.ipc.semmap", &seminfo.semmap); >+ TUNABLE_INT_FETCH("kern.ipc.semmni", &seminfo.semmni); >+ TUNABLE_INT_FETCH("kern.ipc.semmns", &seminfo.semmns); >+ TUNABLE_INT_FETCH("kern.ipc.semmnu", &seminfo.semmnu); >+ TUNABLE_INT_FETCH("kern.ipc.semmsl", &seminfo.semmsl); >+ TUNABLE_INT_FETCH("kern.ipc.semopm", &seminfo.semopm); >+ TUNABLE_INT_FETCH("kern.ipc.semume", &seminfo.semume); >+ TUNABLE_INT_FETCH("kern.ipc.semusz", &seminfo.semusz); >+ TUNABLE_INT_FETCH("kern.ipc.semvmx", &seminfo.semvmx); >+ TUNABLE_INT_FETCH("kern.ipc.semaem", &seminfo.semaem); > sem = malloc(sizeof(struct sem) * seminfo.semmns, M_SEM, M_WAITOK); > if (sem == NULL) >@@ -471,4 +481,21 @@ > return (ENOSYS); > >+ switch(cmd) { >+ case SEM_STAT: >+ if (semid < 0 || semid >= seminfo.semmsl) >+ return(EINVAL); >+ semaptr = &sema[semid]; >+ if ((semaptr->sem_perm.mode & SEM_ALLOC) == 0 ) >+ return(EINVAL); >+ if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R))) >+ return(eval); >+ if ((eval = copyin(arg, &real_arg, sizeof(real_arg))) != 0) >+ return(eval); >+ eval = copyout((caddr_t)semaptr, real_arg.buf, >+ sizeof(struct semid_ds)); >+ rval = IXSEQ_TO_IPCID(semid,semaptr->sem_perm); >+ goto out; >+ } >+ > semid = IPCID_TO_IX(semid); > if (semid < 0 || semid >= seminfo.semmsl) >@@ -602,4 +629,6 @@ > return(EINVAL); > } >+ >+out: > > if (eval == 0) >--- ./kern/sysv_shm.c.orig Sun Aug 12 13:18:43 2001 >+++ ./kern/sysv_shm.c Sun Aug 12 21:11:36 2001 >@@ -716,4 +716,10 @@ > int i; > >+TUNABLE_INT_FETCH("kern.ipc.shmmaxpgs", &shminfo.shmall); >+shminfo.shmmax = shminfo.shmall * PAGE_SIZE; >+TUNABLE_INT_FETCH("kern.ipc.shmmin", &shminfo.shmmin); >+TUNABLE_INT_FETCH("kern.ipc.shmmni", &shminfo.shmmni); >+TUNABLE_INT_FETCH("kern.ipc.shmseg", &shminfo.shmseg); >+TUNABLE_INT_FETCH("kern.ipc.shm_use_phys", &shm_use_phys); > shmalloced = shminfo.shmmni; > shmsegs = malloc(shmalloced * sizeof(shmsegs[0]), M_SHM, M_WAITOK); >--- ./sys/sem.h.orig Sun Aug 12 23:17:32 2001 >+++ ./sys/sem.h Mon Aug 13 00:40:50 2001 >@@ -59,4 +59,6 @@ > #define SETVAL 8 /* Set the value of semval to arg.val {ALTER} */ > #define SETALL 9 /* Set semvals from arg.array {ALTER} */ >+#define SEM_STAT 10 /* Like IPC_STAT but treats semid as sema-index*/ >+#define SEM_INFO 11 /* for future use */ > > /* >--- ./compat/linux/linux_ipc.c.orig Sat Aug 4 17:49:33 2001 >+++ ./compat/linux/linux_ipc.c Mon Aug 13 00:45:27 2001 >@@ -41,4 +41,34 @@ > #include <compat/linux/linux_util.h> > >+struct linux_seminfo { >+ int semmap; >+ int semmni; >+ int semmns; >+ int semmnu; >+ int semmsl; >+ int semopm; >+ int semume; >+ int semusz; >+ int semvmx; >+ int semaem; >+}; >+ >+struct linux_shminfo { >+ int shmmax; >+ int shmmin; >+ int shmmni; >+ int shmseg; >+ int shmall; >+}; >+ >+struct linux_shm_info { >+ int used_ids; >+ unsigned long shm_tot; /* total allocated shm */ >+ unsigned long shm_rss; /* total resident shm */ >+ unsigned long shm_swp; /* total swapped shm */ >+ unsigned long swap_attempts; >+ unsigned long swap_successes; >+}; >+ > struct linux_ipc_perm { > linux_key_t key; >@@ -183,4 +213,5 @@ > { > struct linux_semid_ds linux_semid; >+ struct linux_seminfo linux_seminfo; > struct semid_ds bsd_semid; > struct __semctl_args /* { >@@ -238,5 +269,9 @@ > return __semctl(p, &bsd_args); > case LINUX_IPC_STAT: >- bsd_args.cmd = IPC_STAT; >+ case LINUX_SEM_STAT: >+ if( args->arg3 == IPC_STAT ) >+ bsd_args.cmd = IPC_STAT; >+ else >+ bsd_args.cmd = SEM_STAT; > unptr = stackgap_alloc(&sg, sizeof(union semun *)); > dsp = stackgap_alloc(&sg, sizeof(struct semid_ds)); >@@ -255,5 +290,24 @@ > if (error) > return error; >+ p->p_retval[0] = IXSEQ_TO_IPCID(bsd_args.semid, bsd_semid.sem_perm); > return copyout((caddr_t)&linux_semid, ldsp, sizeof(linux_semid)); >+ case LINUX_IPC_INFO: >+ case LINUX_SEM_INFO: >+ error = copyin(args->ptr, &ldsp, sizeof(ldsp)); >+ if (error) >+ return error; >+ bcopy(&seminfo, &linux_seminfo, sizeof(linux_seminfo) ); >+/* XXX >+#define used_semids 10 >+#define used_sems 10 >+ linux_seminfo.semusz = used_semids; >+ linux_seminfo.semaem = used_sems; >+ } */ >+ error = copyout((caddr_t)&linux_seminfo, ldsp, >+ sizeof(linux_seminfo) ); >+ if (error) >+ return error; >+ p->p_retval[0] = seminfo.semmni; >+ return(0); > case LINUX_GETALL: > /* FALLTHROUGH */
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 29698
: 16123