diff options
author | jkim <jkim@FreeBSD.org> | 2007-03-30 17:56:44 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2007-03-30 17:56:44 +0000 |
commit | 5657d675b3f849c04aee2c410adf07bccf066a38 (patch) | |
tree | ca969cd905c7902efeac30423b3cba9927de3718 /sys | |
parent | 6f5015604170a5431dcf80262b7572c51bac7ed8 (diff) | |
download | FreeBSD-src-5657d675b3f849c04aee2c410adf07bccf066a38.zip FreeBSD-src-5657d675b3f849c04aee2c410adf07bccf066a38.tar.gz |
Use underlying structures instead of kernel_sysctlbyname() for msginfo and
seminfo because kernel_sysctlbyname() is slow. There is no dependency
problem since linux module depends on both sysvmsg and sysvsem and linprocfs
depends on it in turn.
Pointed out by: des
Reviewed by: des
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 39 |
1 files changed, 5 insertions, 34 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 318689f..c990aa1 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -54,11 +54,13 @@ __FBSDID("$FreeBSD$"); #include <sys/lock.h> #include <sys/malloc.h> #include <sys/mount.h> +#include <sys/msg.h> #include <sys/mutex.h> #include <sys/namei.h> #include <sys/proc.h> #include <sys/resourcevar.h> #include <sys/sbuf.h> +#include <sys/sem.h> #include <sys/smp.h> #include <sys/socket.h> #include <sys/sysctl.h> @@ -1031,14 +1033,8 @@ linprocfs_doosbuild(PFS_FILL_ARGS) static int linprocfs_domsgmni(PFS_FILL_ARGS) { - int msgmni; - size_t size; - size = sizeof(msgmni); - if (kernel_sysctlbyname(td, "kern.ipc.msgmni", &msgmni, &size, - 0, 0, 0, 0) != 0) - msgmni = 0; - sbuf_printf(sb, "%i\n", msgmni); + sbuf_printf(sb, "%d\n", msginfo.msgmni); return (0); } @@ -1061,34 +1057,9 @@ linprocfs_dopid_max(PFS_FILL_ARGS) static int linprocfs_dosem(PFS_FILL_ARGS) { - int semmsl, semmns, semopm, semmni; - size_t size; - /* Field 1: SEMMSL */ - size = sizeof(semmsl); - if (kernel_sysctlbyname(td, "kern.ipc.semmsl", &semmsl, &size, - 0, 0, 0, 0) != 0) - semmsl = 0; - - /* Field 2: SEMMNS */ - size = sizeof(semmns); - if (kernel_sysctlbyname(td, "kern.ipc.semmns", &semmns, &size, - 0, 0, 0, 0) != 0) - semmns = 0; - - /* Field 3: SEMOPM */ - size = sizeof(semopm); - if (kernel_sysctlbyname(td, "kern.ipc.semopm", &semopm, &size, - 0, 0, 0, 0) != 0) - semopm = 0; - - /* Field 4: SEMMNI */ - size = sizeof(semmni); - if (kernel_sysctlbyname(td, "kern.ipc.semmni", &semmni, &size, - 0, 0, 0, 0) != 0) - semmni = 0; - - sbuf_printf(sb, "%i %i %i %i\n", semmsl, semmns, semopm, semmni); + sbuf_printf(sb, "%d %d %d %d\n", seminfo.semmsl, seminfo.semmns, + seminfo.semopm, seminfo.semmni); return (0); } |