sys_procdesc.c (6cec9cad762b6476313fb1f8e931a1647822db6b) | sys_procdesc.c (2d69d0dcc2bb94d874dd0fa77d53b08112b9d530) |
---|---|
1/*- 2 * Copyright (c) 2009 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed at the University of Cambridge Computer 6 * Laboratory with support from a grant from Google, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 73 unchanged lines hidden (view full) --- 82#include <security/audit/audit.h> 83 84#include <vm/uma.h> 85 86FEATURE(process_descriptors, "Process Descriptors"); 87 88static uma_zone_t procdesc_zone; 89 | 1/*- 2 * Copyright (c) 2009 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed at the University of Cambridge Computer 6 * Laboratory with support from a grant from Google, Inc. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 73 unchanged lines hidden (view full) --- 82#include <security/audit/audit.h> 83 84#include <vm/uma.h> 85 86FEATURE(process_descriptors, "Process Descriptors"); 87 88static uma_zone_t procdesc_zone; 89 |
90static fo_rdwr_t procdesc_read; 91static fo_rdwr_t procdesc_write; 92static fo_truncate_t procdesc_truncate; 93static fo_ioctl_t procdesc_ioctl; | |
94static fo_poll_t procdesc_poll; 95static fo_kqfilter_t procdesc_kqfilter; 96static fo_stat_t procdesc_stat; 97static fo_close_t procdesc_close; | 90static fo_poll_t procdesc_poll; 91static fo_kqfilter_t procdesc_kqfilter; 92static fo_stat_t procdesc_stat; 93static fo_close_t procdesc_close; |
98static fo_chmod_t procdesc_chmod; 99static fo_chown_t procdesc_chown; | |
100 101static struct fileops procdesc_ops = { | 94 95static struct fileops procdesc_ops = { |
102 .fo_read = procdesc_read, 103 .fo_write = procdesc_write, 104 .fo_truncate = procdesc_truncate, 105 .fo_ioctl = procdesc_ioctl, | 96 .fo_read = invfo_rdwr, 97 .fo_write = invfo_rdwr, 98 .fo_truncate = invfo_truncate, 99 .fo_ioctl = invfo_ioctl, |
106 .fo_poll = procdesc_poll, 107 .fo_kqfilter = procdesc_kqfilter, 108 .fo_stat = procdesc_stat, 109 .fo_close = procdesc_close, | 100 .fo_poll = procdesc_poll, 101 .fo_kqfilter = procdesc_kqfilter, 102 .fo_stat = procdesc_stat, 103 .fo_close = procdesc_close, |
110 .fo_chmod = procdesc_chmod, 111 .fo_chown = procdesc_chown, | 104 .fo_chmod = invfo_chmod, 105 .fo_chown = invfo_chown, |
112 .fo_sendfile = invfo_sendfile, 113 .fo_flags = DFLAG_PASSABLE, 114}; 115 116/* 117 * Initialize with VFS so that process descriptors are available along with 118 * other file descriptor types. As long as it runs before init(8) starts, 119 * there shouldn't be a problem. --- 288 unchanged lines hidden (view full) --- 408 /* 409 * Release the file descriptor's reference on the process descriptor. 410 */ 411 procdesc_free(pd); 412 return (0); 413} 414 415static int | 106 .fo_sendfile = invfo_sendfile, 107 .fo_flags = DFLAG_PASSABLE, 108}; 109 110/* 111 * Initialize with VFS so that process descriptors are available along with 112 * other file descriptor types. As long as it runs before init(8) starts, 113 * there shouldn't be a problem. --- 288 unchanged lines hidden (view full) --- 402 /* 403 * Release the file descriptor's reference on the process descriptor. 404 */ 405 procdesc_free(pd); 406 return (0); 407} 408 409static int |
416procdesc_read(struct file *fp, struct uio *uio, struct ucred *active_cred, 417 int flags, struct thread *td) 418{ 419 420 return (EOPNOTSUPP); 421} 422 423static int 424procdesc_write(struct file *fp, struct uio *uio, struct ucred *active_cred, 425 int flags, struct thread *td) 426{ 427 428 return (EOPNOTSUPP); 429} 430 431static int 432procdesc_truncate(struct file *fp, off_t length, struct ucred *active_cred, 433 struct thread *td) 434{ 435 436 return (EOPNOTSUPP); 437} 438 439static int 440procdesc_ioctl(struct file *fp, u_long com, void *data, 441 struct ucred *active_cred, struct thread *td) 442{ 443 444 return (EOPNOTSUPP); 445} 446 447static int | |
448procdesc_poll(struct file *fp, int events, struct ucred *active_cred, 449 struct thread *td) 450{ 451 struct procdesc *pd; 452 int revents; 453 454 revents = 0; 455 pd = fp->f_data; --- 108 unchanged lines hidden (view full) --- 564 sb->st_gid = pd->pd_proc->p_ucred->cr_rgid; 565 PROC_UNLOCK(pd->pd_proc); 566 } else 567 sb->st_mode = S_IFREG; 568 sx_sunlock(&proctree_lock); 569 return (0); 570} 571 | 410procdesc_poll(struct file *fp, int events, struct ucred *active_cred, 411 struct thread *td) 412{ 413 struct procdesc *pd; 414 int revents; 415 416 revents = 0; 417 pd = fp->f_data; --- 108 unchanged lines hidden (view full) --- 526 sb->st_gid = pd->pd_proc->p_ucred->cr_rgid; 527 PROC_UNLOCK(pd->pd_proc); 528 } else 529 sb->st_mode = S_IFREG; 530 sx_sunlock(&proctree_lock); 531 return (0); 532} 533 |
572static int 573procdesc_chmod(struct file *fp, mode_t mode, struct ucred *active_cred, 574 struct thread *td) 575{ 576 577 return (EOPNOTSUPP); 578} 579 580static int 581procdesc_chown(struct file *fp, uid_t uid, gid_t gid, struct ucred *active_cred, 582 struct thread *td) 583{ 584 585 return (EOPNOTSUPP); 586} | |