summaryrefslogtreecommitdiffstats
path: root/sys/compat/linprocfs
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2006-11-27 21:10:55 +0000
committerjkim <jkim@FreeBSD.org>2006-11-27 21:10:55 +0000
commit8b7cde4e1adc94e84790c4be836d4c48f4659ca2 (patch)
tree57b2f7e97eee4b16a56324488b9c669c5b318313 /sys/compat/linprocfs
parent0fbb068e75df2822faadbc5d76a7c079e48e0998 (diff)
downloadFreeBSD-src-8b7cde4e1adc94e84790c4be836d4c48f4659ca2.zip
FreeBSD-src-8b7cde4e1adc94e84790c4be836d4c48f4659ca2.tar.gz
MFP4: Change 109654
Add two linprocfs entries for Linux IPC: /proc/sys/kernel/msgmni -> kern.ipc.msgmni /proc/sys/kernel/sem -> kern.ipc.semmsl kern.ipc.semmns kern.ipc.semopm kern.ipc.semmni This fixes msgget03 and semget05 from Linux Test Project (LTP) test suite. msgctl08 and msgctl09 also use /proc/sys/kernel/msgmni but another fix is required from p4 (Change 110179). Requested by: netchild
Diffstat (limited to 'sys/compat/linprocfs')
-rw-r--r--sys/compat/linprocfs/linprocfs.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c
index bdc2b72..3c21c93 100644
--- a/sys/compat/linprocfs/linprocfs.c
+++ b/sys/compat/linprocfs/linprocfs.c
@@ -925,6 +925,24 @@ linprocfs_donetdev(PFS_FILL_ARGS)
}
/*
+ * Filler function for proc/sys/kernel/msgmni
+ */
+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);
+
+ return (0);
+}
+
+/*
* Filler function for proc/sys/kernel/pid_max
*/
static int
@@ -937,6 +955,44 @@ linprocfs_dopid_max(PFS_FILL_ARGS)
}
/*
+ * Filler function for proc/sys/kernel/sem
+ */
+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);
+
+ return (0);
+}
+
+/*
* Filler function for proc/scsi/device_info
*/
static int
@@ -1080,8 +1136,12 @@ linprocfs_init(PFS_INIT_ARGS)
dir = pfs_create_dir(root, "sys", NULL, NULL, 0);
/* /proc/sys/kernel/... */
dir = pfs_create_dir(dir, "kernel", NULL, NULL, 0);
+ pfs_create_file(dir, "msgmni", &linprocfs_domsgmni,
+ NULL, NULL, PFS_RD);
pfs_create_file(dir, "pid_max", &linprocfs_dopid_max,
NULL, NULL, PFS_RD);
+ pfs_create_file(dir, "sem", &linprocfs_dosem,
+ NULL, NULL, PFS_RD);
return (0);
}
OpenPOWER on IntegriCloud