linprocfs.c (aae8ae5ea5a67feb83a30e7c09553ab416d6830a) linprocfs.c (b7df7b987e8fac05006aa5f132c424e2b2bcf156)
1/*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav
5 * Copyright (c) 1999 Pierre Beyssac
6 * Copyright (c) 1993 Jan-Simon Pendry
7 * Copyright (c) 1993
8 * The Regents of the University of California. All rights reserved.

--- 66 unchanged lines hidden (view full) ---

75#include <sys/systm.h>
76#include <sys/time.h>
77#include <sys/tty.h>
78#include <sys/user.h>
79#include <sys/uuid.h>
80#include <sys/vmmeter.h>
81#include <sys/vnode.h>
82#include <sys/bus.h>
1/*-
2 * SPDX-License-Identifier: BSD-4-Clause
3 *
4 * Copyright (c) 2000 Dag-Erling Coïdan Smørgrav
5 * Copyright (c) 1999 Pierre Beyssac
6 * Copyright (c) 1993 Jan-Simon Pendry
7 * Copyright (c) 1993
8 * The Regents of the University of California. All rights reserved.

--- 66 unchanged lines hidden (view full) ---

75#include <sys/systm.h>
76#include <sys/time.h>
77#include <sys/tty.h>
78#include <sys/user.h>
79#include <sys/uuid.h>
80#include <sys/vmmeter.h>
81#include <sys/vnode.h>
82#include <sys/bus.h>
83#include <sys/uio.h>
83
84#include <net/if.h>
85#include <net/if_var.h>
86#include <net/if_types.h>
87
88#include <vm/vm.h>
89#include <vm/vm_extern.h>
90#include <vm/pmap.h>

--- 8 unchanged lines hidden (view full) ---

99#include <geom/geom_int.h>
100
101#if defined(__i386__) || defined(__amd64__)
102#include <machine/cputypes.h>
103#include <machine/md_var.h>
104#endif /* __i386__ || __amd64__ */
105
106#include <compat/linux/linux.h>
84
85#include <net/if.h>
86#include <net/if_var.h>
87#include <net/if_types.h>
88
89#include <vm/vm.h>
90#include <vm/vm_extern.h>
91#include <vm/pmap.h>

--- 8 unchanged lines hidden (view full) ---

100#include <geom/geom_int.h>
101
102#if defined(__i386__) || defined(__amd64__)
103#include <machine/cputypes.h>
104#include <machine/md_var.h>
105#endif /* __i386__ || __amd64__ */
106
107#include <compat/linux/linux.h>
108#include <compat/linux/linux_emul.h>
107#include <compat/linux/linux_mib.h>
108#include <compat/linux/linux_misc.h>
109#include <compat/linux/linux_util.h>
110#include <fs/pseudofs/pseudofs.h>
111#include <fs/procfs/procfs.h>
112
113/*
114 * Various conversion macros

--- 1813 unchanged lines hidden (view full) ---

1928
1929 if (error == 0)
1930 error = uiomove(sbuf_data(asb) + uio->uio_offset, buflen, uio);
1931 sbuf_delete(asb);
1932 return (error);
1933}
1934
1935/*
109#include <compat/linux/linux_mib.h>
110#include <compat/linux/linux_misc.h>
111#include <compat/linux/linux_util.h>
112#include <fs/pseudofs/pseudofs.h>
113#include <fs/procfs/procfs.h>
114
115/*
116 * Various conversion macros

--- 1813 unchanged lines hidden (view full) ---

1930
1931 if (error == 0)
1932 error = uiomove(sbuf_data(asb) + uio->uio_offset, buflen, uio);
1933 sbuf_delete(asb);
1934 return (error);
1935}
1936
1937/*
1938 * Filler function for proc/self/oom_score_adj
1939 */
1940static int
1941linprocfs_do_oom_score_adj(PFS_FILL_ARGS)
1942{
1943 struct linux_pemuldata *pem;
1944 long oom;
1945
1946 pem = pem_find(p);
1947 if (pem == NULL || uio == NULL)
1948 return (EOPNOTSUPP);
1949 if (uio->uio_rw == UIO_READ) {
1950 sbuf_printf(sb, "%d\n", pem->oom_score_adj);
1951 } else {
1952 sbuf_trim(sb);
1953 sbuf_finish(sb);
1954 oom = strtol(sbuf_data(sb), NULL, 10);
1955 if (oom < LINUX_OOM_SCORE_ADJ_MIN ||
1956 oom > LINUX_OOM_SCORE_ADJ_MAX)
1957 return (EINVAL);
1958 pem->oom_score_adj = oom;
1959 }
1960 return (0);
1961}
1962
1963/*
1936 * Constructor
1937 */
1938static int
1939linprocfs_init(PFS_INIT_ARGS)
1940{
1941 struct pfs_node *root;
1942 struct pfs_node *dir;
1943 struct pfs_node *sys;

--- 69 unchanged lines hidden (view full) ---

2013 pfs_create_file(dir, "status", &linprocfs_doprocstatus,
2014 NULL, NULL, NULL, PFS_RD);
2015 pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
2016 NULL, NULL, NULL, 0);
2017 pfs_create_file(dir, "auxv", &linprocfs_doauxv,
2018 NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD);
2019 pfs_create_file(dir, "limits", &linprocfs_doproclimits,
2020 NULL, NULL, NULL, PFS_RD);
1964 * Constructor
1965 */
1966static int
1967linprocfs_init(PFS_INIT_ARGS)
1968{
1969 struct pfs_node *root;
1970 struct pfs_node *dir;
1971 struct pfs_node *sys;

--- 69 unchanged lines hidden (view full) ---

2041 pfs_create_file(dir, "status", &linprocfs_doprocstatus,
2042 NULL, NULL, NULL, PFS_RD);
2043 pfs_create_link(dir, "fd", &linprocfs_dofdescfs,
2044 NULL, NULL, NULL, 0);
2045 pfs_create_file(dir, "auxv", &linprocfs_doauxv,
2046 NULL, &procfs_candebug, NULL, PFS_RD|PFS_RAWRD);
2047 pfs_create_file(dir, "limits", &linprocfs_doproclimits,
2048 NULL, NULL, NULL, PFS_RD);
2049 pfs_create_file(dir, "oom_score_adj", &linprocfs_do_oom_score_adj,
2050 procfs_attr_rw, &procfs_candebug, NULL, PFS_RDWR);
2021
2022 /* /proc/<pid>/task/... */
2023 dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0);
2024 pfs_create_file(dir, ".dummy", &linprocfs_dotaskdummy,
2025 NULL, NULL, NULL, PFS_RD);
2026
2027 /* /proc/scsi/... */
2028 dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);

--- 71 unchanged lines hidden ---
2051
2052 /* /proc/<pid>/task/... */
2053 dir = pfs_create_dir(dir, "task", linprocfs_dotaskattr, NULL, NULL, 0);
2054 pfs_create_file(dir, ".dummy", &linprocfs_dotaskdummy,
2055 NULL, NULL, NULL, PFS_RD);
2056
2057 /* /proc/scsi/... */
2058 dir = pfs_create_dir(root, "scsi", NULL, NULL, NULL, 0);

--- 71 unchanged lines hidden ---