diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 617eb122291..c5b6ec9b32c 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -2220,6 +2220,97 @@ linprocfs_dosysvipc_shm(PFS_FILL_ARGS) return (0); } +/* + * Filler function for proc/sys/fs/mqueue/msg_default + */ +static int +linprocfs_domqueue_msg_default(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.default_maxmsg", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/msgsize_default + */ +static int +linprocfs_domqueue_msgsize_default(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.default_msgsize", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); + +} + +/* + * Filler function for proc/sys/fs/mqueue/msg_max + */ +static int +linprocfs_domqueue_msg_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmsg", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/msgsize_max + */ +static int +linprocfs_domqueue_msgsize_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmsgsize", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + +/* + * Filler function for proc/sys/fs/mqueue/queues_max + */ +static int +linprocfs_domqueue_queues_max(PFS_FILL_ARGS) +{ + int res, error; + size_t size = sizeof(res); + + error = kernel_sysctlbyname(curthread, "kern.mqueue.maxmq", + &res, &size, NULL, 0, 0, 0); + if (error != 0) + return (error); + + sbuf_printf(sb, "%d\n", res); + return (0); +} + /* * Constructor */ @@ -2378,6 +2469,22 @@ linprocfs_init(PFS_INIT_ARGS) pfs_create_file(dir, "shm", &linprocfs_dosysvipc_shm, NULL, NULL, NULL, PFS_RD); + /* /proc/sys/fs/... */ + dir = pfs_create_dir(sys, "fs", NULL, NULL, NULL, 0); + + /* /proc/sys/fs/mqueue/... */ + dir = pfs_create_dir(dir, "mqueue", NULL, NULL, NULL, 0); + pfs_create_file(dir, "msg_default", &linprocfs_domqueue_msg_default, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgsize_default", &linprocfs_domqueue_msgsize_default, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msg_max", &linprocfs_domqueue_msg_max, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "msgsize_max", &linprocfs_domqueue_msgsize_max, + NULL, NULL, NULL, PFS_RD); + pfs_create_file(dir, "queues_max", &linprocfs_domqueue_queues_max, + NULL, NULL, NULL, PFS_RD); + return (0); }