1/* $NetBSD: procfs_vfsops.c,v 1.116 2024/05/12 17:26:50 christos Exp $ */ 2 3/* 4 * Copyright (c) 1993 5 * The Regents of the University of California. All rights reserved. 6 * 7 * This code is derived from software contributed to Berkeley by 8 * Jan-Simon Pendry. 9 * 10 * Redistribution and use in source and binary forms, with or without 11 * modification, are permitted provided that the following conditions 12 * are met: 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 2. Redistributions in binary form must reproduce the above copyright 16 * notice, this list of conditions and the following disclaimer in the 17 * documentation and/or other materials provided with the distribution. 18 * 3. Neither the name of the University nor the names of its contributors 19 * may be used to endorse or promote products derived from this software 20 * without specific prior written permission. 21 * 22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 35 */ 36 37/* 38 * Copyright (c) 1993 Jan-Simon Pendry 39 * 40 * This code is derived from software contributed to Berkeley by 41 * Jan-Simon Pendry. 42 * 43 * Redistribution and use in source and binary forms, with or without 44 * modification, are permitted provided that the following conditions 45 * are met: 46 * 1. Redistributions of source code must retain the above copyright 47 * notice, this list of conditions and the following disclaimer. 48 * 2. Redistributions in binary form must reproduce the above copyright 49 * notice, this list of conditions and the following disclaimer in the 50 * documentation and/or other materials provided with the distribution. 51 * 3. All advertising materials mentioning features or use of this software 52 * must display the following acknowledgement: 53 * This product includes software developed by the University of 54 * California, Berkeley and its contributors. 55 * 4. Neither the name of the University nor the names of its contributors 56 * may be used to endorse or promote products derived from this software 57 * without specific prior written permission. 58 * 59 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 60 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 61 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 62 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 63 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 64 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 65 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 66 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 67 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 68 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 69 * SUCH DAMAGE. 70 * 71 * @(#)procfs_vfsops.c 8.7 (Berkeley) 5/10/95 72 */ 73 74/* 75 * procfs VFS interface 76 */ 77 78#include <sys/cdefs.h> 79__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.116 2024/05/12 17:26:50 christos Exp $"); 80 81#if defined(_KERNEL_OPT) 82#include "opt_compat_netbsd.h" 83#endif 84 85#include <sys/param.h> 86#include <sys/atomic.h> 87#include <sys/buf.h> 88#include <sys/dirent.h> 89#include <sys/file.h> 90#include <sys/filedesc.h> 91#include <sys/fstrans.h> 92#include <sys/kauth.h> 93#include <sys/kernel.h> 94#include <sys/module.h> 95#include <sys/mount.h> 96#include <sys/proc.h> 97#include <sys/signalvar.h> 98#include <sys/sysctl.h> 99#include <sys/syslog.h> 100#include <sys/systm.h> 101#include <sys/time.h> 102#include <sys/vnode.h> 103 104#include <miscfs/genfs/genfs.h> 105 106#include <miscfs/procfs/procfs.h> 107 108#include <uvm/uvm_extern.h> /* for PAGE_SIZE */ 109 110MODULE(MODULE_CLASS_VFS, procfs, "ptrace_common"); 111 112VFS_PROTOS(procfs); 113 114#define PROCFS_HASHSIZE 256 115#define PROCFS_EXEC_HOOK ((void *)1) 116#define PROCFS_EXIT_HOOK ((void *)2) 117 118static kauth_listener_t procfs_listener; 119static void *procfs_exechook; 120static void *procfs_exithook; 121LIST_HEAD(hashhead, pfsnode); 122static u_long procfs_hashmask; 123static struct hashhead *procfs_hashtab; 124static kmutex_t procfs_hashlock; 125 126static struct hashhead * 127procfs_hashhead(pid_t pid) 128{ 129 130 return &procfs_hashtab[pid & procfs_hashmask]; 131} 132 133void 134procfs_hashrem(struct pfsnode *pfs) 135{ 136 137 mutex_enter(&procfs_hashlock); 138 LIST_REMOVE(pfs, pfs_hash); 139 mutex_exit(&procfs_hashlock); 140} 141 142/* 143 * VFS Operations. 144 * 145 * mount system call 146 */ 147/* ARGSUSED */ 148int 149procfs_mount( 150 struct mount *mp, 151 const char *path, 152 void *data, 153 size_t *data_len) 154{ 155 struct lwp *l = curlwp; 156 struct procfsmount *pmnt; 157 struct procfs_args *args = data; 158 int error; 159 160 if (args == NULL) 161 return EINVAL; 162 163 if (UIO_MX & (UIO_MX-1)) { 164 log(LOG_ERR, "procfs: invalid directory entry size"); 165 return (EINVAL); 166 } 167 168 if (mp->mnt_flag & MNT_GETARGS) { 169 if (*data_len < sizeof *args) 170 return EINVAL; 171 172 pmnt = VFSTOPROC(mp); 173 if (pmnt == NULL) 174 return EIO; 175 args->version = PROCFS_ARGSVERSION; 176 args->flags = pmnt->pmnt_flags; 177 *data_len = sizeof *args; 178 return 0; 179 } 180 181 if (mp->mnt_flag & MNT_UPDATE) 182 return (EOPNOTSUPP); 183 184 if (*data_len >= sizeof *args && args->version != PROCFS_ARGSVERSION) 185 return EINVAL; 186 187 pmnt = kmem_zalloc(sizeof(struct procfsmount), KM_SLEEP); 188 189 mp->mnt_stat.f_namemax = PROCFS_MAXNAMLEN; 190 mp->mnt_flag |= MNT_LOCAL; 191 mp->mnt_data = pmnt; 192 vfs_getnewfsid(mp); 193 194 error = set_statvfs_info(path, UIO_USERSPACE, "procfs", UIO_SYSSPACE, 195 mp->mnt_op->vfs_name, mp, l); 196 if (*data_len >= sizeof *args) 197 pmnt->pmnt_flags = args->flags; 198 else 199 pmnt->pmnt_flags = 0; 200 201 mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP; 202 return error; 203} 204 205/* 206 * unmount system call 207 */ 208int 209procfs_unmount(struct mount *mp, int mntflags) 210{ 211 int error; 212 int flags = 0; 213 214 if (mntflags & MNT_FORCE) 215 flags |= FORCECLOSE; 216 217 if ((error = vflush(mp, 0, flags)) != 0) 218 return (error); 219 220 kmem_free(mp->mnt_data, sizeof(struct procfsmount)); 221 mp->mnt_data = NULL; 222 223 return 0; 224} 225 226int 227procfs_root(struct mount *mp, int lktype, struct vnode **vpp) 228{ 229 int error; 230 231 error = procfs_allocvp(mp, vpp, 0, PFSroot, -1); 232 if (error == 0) { 233 error = vn_lock(*vpp, lktype); 234 if (error != 0) { 235 vrele(*vpp); 236 *vpp = NULL; 237 } 238 } 239 240 return error; 241} 242 243/* ARGSUSED */ 244int 245procfs_start(struct mount *mp, int flags) 246{ 247 248 return (0); 249} 250 251/* 252 * Get file system statistics. 253 */ 254int 255procfs_statvfs(struct mount *mp, struct statvfs *sbp) 256{ 257 258 genfs_statvfs(mp, sbp); 259 260 sbp->f_bsize = PAGE_SIZE; 261 sbp->f_frsize = PAGE_SIZE; 262 sbp->f_iosize = PAGE_SIZE; 263 sbp->f_blocks = 1; 264 sbp->f_files = maxproc; /* approx */ 265 sbp->f_ffree = maxproc - atomic_load_relaxed(&nprocs); /* approx */ 266 sbp->f_favail = maxproc - atomic_load_relaxed(&nprocs); /* approx */ 267 268 return (0); 269} 270 271/*ARGSUSED*/ 272int 273procfs_sync( 274 struct mount *mp, 275 int waitfor, 276 kauth_cred_t uc) 277{ 278 279 return (0); 280} 281 282/*ARGSUSED*/ 283int 284procfs_vget(struct mount *mp, ino_t ino, int lktype, 285 struct vnode **vpp) 286{ 287 return (EOPNOTSUPP); 288} 289 290int 291procfs_loadvnode(struct mount *mp, struct vnode *vp, 292 const void *key, size_t key_len, const void **new_key) 293{ 294 int error; 295 struct pfskey pfskey; 296 struct pfsnode *pfs; 297 298 KASSERT(key_len == sizeof(pfskey)); 299 memcpy(&pfskey, key, key_len); 300 301 pfs = kmem_alloc(sizeof(*pfs), KM_SLEEP); 302 pfs->pfs_pid = pfskey.pk_pid; 303 pfs->pfs_type = pfskey.pk_type; 304 pfs->pfs_fd = pfskey.pk_fd; 305 pfs->pfs_vnode = vp; 306 pfs->pfs_mount = mp; 307 pfs->pfs_flags = 0; 308 pfs->pfs_fileno = 309 PROCFS_FILENO(pfs->pfs_pid, pfs->pfs_type, pfs->pfs_fd); 310 vp->v_tag = VT_PROCFS; 311 vp->v_op = procfs_vnodeop_p; 312 vp->v_data = pfs; 313 314 switch (pfs->pfs_type) { 315 case PFSroot: /* /proc = dr-xr-xr-x */ 316 vp->v_vflag |= VV_ROOT; 317 /*FALLTHROUGH*/ 318 case PFSproc: /* /proc/N = dr-xr-xr-x */ 319 pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; 320 vp->v_type = VDIR; 321 break; 322 323 case PFStask: /* /proc/N/task = dr-xr-xr-x */ 324 if (pfs->pfs_fd == -1) { 325 pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP| 326 S_IROTH|S_IXOTH; 327 vp->v_type = VDIR; 328 break; 329 } 330 /*FALLTHROUGH*/ 331 case PFScurproc: /* /proc/curproc = lr-xr-xr-x */ 332 case PFSself: /* /proc/self = lr-xr-xr-x */ 333 case PFScwd: /* /proc/N/cwd = lr-xr-xr-x */ 334 case PFSchroot: /* /proc/N/chroot = lr-xr-xr-x */ 335 case PFSexe: /* /proc/N/exe = lr-xr-xr-x */ 336 pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH; 337 vp->v_type = VLNK; 338 break; 339 340 case PFSfd: 341 if (pfs->pfs_fd == -1) { /* /proc/N/fd = dr-x------ */ 342 pfs->pfs_mode = S_IRUSR|S_IXUSR; 343 vp->v_type = VDIR; 344 } else { /* /proc/N/fd/M = [ps-]rw------- */ 345 file_t *fp; 346 vnode_t *vxp; 347 struct proc *p; 348 349 mutex_enter(&proc_lock); 350 p = procfs_proc_find(mp, pfs->pfs_pid); 351 mutex_exit(&proc_lock); 352 if (p == NULL) { 353 error = ENOENT; 354 goto bad; 355 } 356 KASSERT(rw_read_held(&p->p_reflock)); 357 if ((fp = fd_getfile2(p, pfs->pfs_fd)) == NULL) { 358 error = EBADF; 359 goto bad; 360 } 361 362 pfs->pfs_mode = S_IRUSR|S_IWUSR; 363 switch (fp->f_type) { 364 case DTYPE_VNODE: 365 vxp = fp->f_vnode; 366 367 /* 368 * We make symlinks for directories 369 * to avoid cycles. 370 */ 371 if (vxp->v_type == VDIR || 372 procfs_proc_is_linux_compat()) 373 goto symlink; 374 vp->v_type = vxp->v_type; 375 break; 376 case DTYPE_PIPE: 377 vp->v_type = VFIFO; 378 break; 379 case DTYPE_SOCKET: 380 vp->v_type = VSOCK; 381 break; 382 case DTYPE_KQUEUE: 383 case DTYPE_MISC: 384 case DTYPE_SEM: 385 symlink: 386 pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP| 387 S_IXGRP|S_IROTH|S_IXOTH; 388 vp->v_type = VLNK; 389 break; 390 default: 391 error = EOPNOTSUPP; 392 closef(fp); 393 goto bad; 394 } 395 closef(fp); 396 } 397 break; 398 399 case PFSfile: /* /proc/N/file = -rw------- */ 400 case PFSmem: /* /proc/N/mem = -rw------- */ 401 case PFSregs: /* /proc/N/regs = -rw------- */ 402 case PFSfpregs: /* /proc/N/fpregs = -rw------- */ 403 pfs->pfs_mode = S_IRUSR|S_IWUSR; 404 vp->v_type = VREG; 405 break; 406 407 case PFSnote: /* /proc/N/note = --w------ */ 408 case PFSnotepg: /* /proc/N/notepg = --w------ */ 409 pfs->pfs_mode = S_IWUSR; 410 vp->v_type = VREG; 411 break; 412 413 case PFSmap: /* /proc/N/map = -r-------- */ 414 case PFSmaps: /* /proc/N/maps = -r-------- */ 415 case PFSauxv: /* /proc/N/auxv = -r-------- */ 416 case PFSenviron: /* /proc/N/environ = -r-------- */ 417 pfs->pfs_mode = S_IRUSR; 418 vp->v_type = VREG; 419 break; 420 421 case PFSstatus: /* /proc/N/status = -r--r--r-- */ 422 case PFSstat: /* /proc/N/stat = -r--r--r-- */ 423 case PFScmdline: /* /proc/N/cmdline = -r--r--r-- */ 424 case PFSemul: /* /proc/N/emul = -r--r--r-- */ 425 case PFSmeminfo: /* /proc/meminfo = -r--r--r-- */ 426 case PFScpustat: /* /proc/stat = -r--r--r-- */ 427 case PFSdevices: /* /proc/devices = -r--r--r-- */ 428 case PFScpuinfo: /* /proc/cpuinfo = -r--r--r-- */ 429 case PFSuptime: /* /proc/uptime = -r--r--r-- */ 430 case PFSmounts: /* /proc/mounts = -r--r--r-- */ 431 case PFSloadavg: /* /proc/loadavg = -r--r--r-- */ 432 case PFSstatm: /* /proc/N/statm = -r--r--r-- */ 433 case PFSversion: /* /proc/version = -r--r--r-- */ 434 case PFSlimit: /* /proc/N/limit = -r--r--r-- */ 435 case PFSlimits: /* /proc/N/limits = -r--r--r-- */ 436 pfs->pfs_mode = S_IRUSR|S_IRGRP|S_IROTH; 437 vp->v_type = VREG; 438 break; 439 440 case PFSsysvipc:/* /proc/sysvipc = dr-xr-xr-x */ 441 if (pfs->pfs_fd == -1) { 442 pfs->pfs_mode = S_IRUSR|S_IXUSR|S_IRGRP|S_IXGRP| 443 S_IROTH|S_IXOTH; 444 vp->v_type = VDIR; 445 break; 446 } 447 /*FALLTHROUGH*/ 448 case PFSsysvipc_msg: /* /proc/sysvipc/msg = -r--r--r-- */ 449 case PFSsysvipc_sem: /* /proc/sysvipc/sem = -r--r--r-- */ 450 case PFSsysvipc_shm: /* /proc/sysvipc/shm = -r--r--r-- */ 451 pfs->pfs_mode = S_IRUSR|S_IRGRP|S_IROTH; 452 vp->v_type = VREG; 453 break; 454 455#ifdef __HAVE_PROCFS_MACHDEP 456 PROCFS_MACHDEP_NODETYPE_CASES 457 procfs_machdep_allocvp(vp); 458 break; 459#endif 460 461 default: 462 panic("procfs_allocvp"); 463 } 464 465 mutex_enter(&procfs_hashlock); 466 LIST_INSERT_HEAD(procfs_hashhead(pfs->pfs_pid), pfs, pfs_hash); 467 mutex_exit(&procfs_hashlock); 468 469 uvm_vnp_setsize(vp, 0); 470 *new_key = &pfs->pfs_key; 471 472 return 0; 473 474bad: 475 vp->v_tag =VT_NON; 476 vp->v_type = VNON; 477 vp->v_op = NULL; 478 vp->v_data = NULL; 479 kmem_free(pfs, sizeof(*pfs)); 480 return error; 481} 482 483void 484procfs_init(void) 485{ 486 487} 488 489void 490procfs_reinit(void) 491{ 492 493} 494 495void 496procfs_done(void) 497{ 498 499} 500 501extern const struct vnodeopv_desc procfs_vnodeop_opv_desc; 502 503const struct vnodeopv_desc * const procfs_vnodeopv_descs[] = { 504 &procfs_vnodeop_opv_desc, 505 NULL, 506}; 507 508struct vfsops procfs_vfsops = { 509 .vfs_name = MOUNT_PROCFS, 510 .vfs_min_mount_data = sizeof (struct procfs_args), 511 .vfs_mount = procfs_mount, 512 .vfs_start = procfs_start, 513 .vfs_unmount = procfs_unmount, 514 .vfs_root = procfs_root, 515 .vfs_quotactl = (void *)eopnotsupp, 516 .vfs_statvfs = procfs_statvfs, 517 .vfs_sync = procfs_sync, 518 .vfs_vget = procfs_vget, 519 .vfs_loadvnode = procfs_loadvnode, 520 .vfs_fhtovp = (void *)eopnotsupp, 521 .vfs_vptofh = (void *)eopnotsupp, 522 .vfs_init = procfs_init, 523 .vfs_reinit = procfs_reinit, 524 .vfs_done = procfs_done, 525 .vfs_snapshot = (void *)eopnotsupp, 526 .vfs_extattrctl = vfs_stdextattrctl, 527 .vfs_suspendctl = genfs_suspendctl, 528 .vfs_renamelock_enter = genfs_renamelock_enter, 529 .vfs_renamelock_exit = genfs_renamelock_exit, 530 .vfs_fsync = (void *)eopnotsupp, 531 .vfs_opv_descs = procfs_vnodeopv_descs 532}; 533 534static void 535procfs_exechook_cb(struct proc *p, void *arg) 536{ 537 struct hashhead *head; 538 struct pfsnode *pfs; 539 struct mount *mp; 540 struct pfskey key; 541 struct vnode *vp; 542 int error; 543 544 if (arg == PROCFS_EXEC_HOOK && !(p->p_flag & PK_SUGID)) 545 return; 546 547 head = procfs_hashhead(p->p_pid); 548 549again: 550 mutex_enter(&procfs_hashlock); 551 LIST_FOREACH(pfs, head, pfs_hash) { 552 if (pfs->pfs_pid != p->p_pid) 553 continue; 554 mp = pfs->pfs_mount; 555 key = pfs->pfs_key; 556 vfs_ref(mp); 557 mutex_exit(&procfs_hashlock); 558 559 error = vcache_get(mp, &key, sizeof(key), &vp); 560 vfs_rele(mp); 561 if (error != 0) 562 goto again; 563 if (vrecycle(vp)) 564 goto again; 565 do { 566 error = vfs_suspend(mp, 0); 567 } while (error == EINTR || error == ERESTART); 568 vgone(vp); 569 if (error == 0) 570 vfs_resume(mp); 571 goto again; 572 } 573 mutex_exit(&procfs_hashlock); 574} 575 576static int 577procfs_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie, 578 void *arg0, void *arg1, void *arg2, void *arg3) 579{ 580 struct proc *p; 581 struct pfsnode *pfs; 582 int result; 583 584 result = KAUTH_RESULT_DEFER; 585 p = arg0; 586 pfs = arg1; 587 588 if (action != KAUTH_PROCESS_PROCFS) 589 return result; 590 591 switch (pfs->pfs_type) { 592 case PFSregs: 593 case PFSfpregs: 594 case PFSmem: 595 if (kauth_cred_getuid(cred) != kauth_cred_getuid(p->p_cred) || 596 ISSET(p->p_flag, PK_SUGID)) 597 break; 598 599 /*FALLTHROUGH*/ 600 default: 601 result = KAUTH_RESULT_ALLOW; 602 break; 603 } 604 605 return result; 606} 607 608SYSCTL_SETUP(procfs_sysctl_setup, "procfs sysctl") 609{ 610 611 sysctl_createv(clog, 0, NULL, NULL, 612 CTLFLAG_PERMANENT, 613 CTLTYPE_NODE, "procfs", 614 SYSCTL_DESCR("Process file system"), 615 NULL, 0, NULL, 0, 616 CTL_VFS, 12, CTL_EOL); 617 /* 618 * XXX the "12" above could be dynamic, thereby eliminating 619 * one more instance of the "number to vfs" mapping problem, 620 * but "12" is the order as taken from sys/mount.h 621 */ 622} 623 624static int 625procfs_modcmd(modcmd_t cmd, void *arg) 626{ 627 int error; 628 629 switch (cmd) { 630 case MODULE_CMD_INIT: 631 error = vfs_attach(&procfs_vfsops); 632 if (error != 0) 633 break; 634 635 procfs_listener = kauth_listen_scope(KAUTH_SCOPE_PROCESS, 636 procfs_listener_cb, NULL); 637 638 procfs_exechook = exechook_establish(procfs_exechook_cb, 639 PROCFS_EXEC_HOOK); 640 procfs_exithook = exithook_establish(procfs_exechook_cb, 641 PROCFS_EXIT_HOOK); 642 643 mutex_init(&procfs_hashlock, MUTEX_DEFAULT, IPL_NONE); 644 procfs_hashtab = hashinit(PROCFS_HASHSIZE, HASH_LIST, true, 645 &procfs_hashmask); 646 647 break; 648 case MODULE_CMD_FINI: 649 error = vfs_detach(&procfs_vfsops); 650 if (error != 0) 651 break; 652 kauth_unlisten_scope(procfs_listener); 653 exechook_disestablish(procfs_exechook); 654 exithook_disestablish(procfs_exithook); 655 mutex_destroy(&procfs_hashlock); 656 hashdone(procfs_hashtab, HASH_LIST, procfs_hashmask); 657 break; 658 default: 659 error = ENOTTY; 660 break; 661 } 662 663 return (error); 664} 665