jorisgio / dragonflybsd Goto Github PK
View Code? Open in Web Editor NEWThis project forked from dragonflybsd/dragonflybsd
gsoc work on kernel capsicum implementation
Home Page: http://www.dragonflybsd.org/
License: Other
This project forked from dragonflybsd/dragonflybsd
gsoc work on kernel capsicum implementation
Home Page: http://www.dragonflybsd.org/
License: Other
Convert the various subsystem to the new API if needed.
netproto/smb/smb_dev.c:391: fp = holdfp(scred->scr_td->td_proc->p_fd, fd, FREAD|FWRITE);
sys/filedesc.h:186:struct file holdfp (struct filedesc *fdp, int fd, int flag);
vm/vm_mmap.c:267: fp = holdfp(p->p_fd, fd, -1);
kern/sys_mqueue.c:185: fp = holdfp(curproc->p_fd, (int)mqd, -1); / XXX: Why -1 ? _/
kern/kern_event.c:791: fp = holdfp(p->p_fd, uap->fd, -1);
kern/kern_event.c:844: fp = holdfp(fdp, kev->ident, -1);
kern/kern_checkpoint.c:742: else if ((fp = holdfp(fdp, uap->fd, FWRITE)) == NULL)
kern/kern_checkpoint.c:754: if ((fp = holdfp(fdp, uap->fd, FREAD)) == NULL) {
kern/vfs_syscalls.c:1060: fp = holdfp(p->p_fd, uap->fd, -1);
kern/vfs_syscalls.c:2552: fp = holdfp(p->p_fd, fd, -1);
kern/imgact_elf.c:1582: fp = holdfp(p->p_fd, i, -1);
kern/uipc_syscalls.c:1463: fp = holdfp(p->p_fd, uap->fd, FREAD);
kern/kern_descrip.c:115:int holdfp_capcheck(struct filedesc *fdp, int fd, struct file *_fpp, int flag,
kern/kern_descrip.c:445: error = holdfp_capcheck(p->p_fd, fd, &fp, -1, CAP_FLOCK, 0);
kern/kern_descrip.c:513: error = holdfp_capcheck(p->p_fd, fd, &fp, -1, CAP_FLOCK, 0);
kern/kern_descrip.c:544: error = holdfp_capcheck(p->p_fd, fd, &fp, -1, CAP_FCNTL, cmd);
kern/kern_descrip.c:1181: error = holdfp_capcheck(p->p_fd, fd, &fp, -1, CAP_SHUTDOWN, 0);
kern/kern_descrip.c:1216: if ((error = holdfp_capcheck(p->p_fd, fd, &fp, -1, CAP_FSTAT, 0)) == NULL)
kern/kern_descrip.c:1256: if ((error = holdfp_capcheck(p->p_fd, uap->fd, &fp, -1, CAP_FPATHCONF, 0)) == NULL)
kern/kern_descrip.c:2401:holdfp_capcheck(struct filedesc _fdp, int fd, struct file *_fpp, int flag, cap_rights_t needrights, int needfcntl)
kern/kern_descrip.c:2445:holdfp(struct filedesc *fdp, int fd, int flag) {
kern/kern_descrip.c:2846: error = holdfp_capcheck(p->p_fd, uap->fd, &fp, -1, CAP_FLOCK, 0);
kern/kern_descrip.c:2924: if ((wfp = holdfp(fdp, sfd, -1)) == NULL)
kern/sys_generic.c:259: fp = holdfp(p->p_fd, fd, FREAD);
kern/sys_generic.c:467: fp = holdfp(p->p_fd, fd, FWRITE);
kern/sys_generic.c:588: fp = holdfp(p->p_fd, fd, FREAD|FWRITE);
kern/subr_diskiocom.c:116: fp = holdfp(curproc->p_fd, recl->fd, -1);
vfs/fdesc/fdesc_vnops.c:303: fp = holdfp(p->p_fd, fd, -1);
vfs/hammer2/hammer2_vfsops.c:532: fp = holdfp(curproc->p_fd, info.cluster_fd, -1);
vfs/hammer2/hammer2_ioctl.c:158: fp = holdfp(curproc->p_fd, recl->fd, -1);
emulation/linux/linux_epoll.c:215: fp = holdfp(p->p_fd, args->epfd, -1);
emulation/linux/linux_epoll.c:266: fp = holdfp(p->p_fd, args->epfd, -1);
emulation/linux/linux_file.c:146: fp = holdfp(p->p_fd, *iresult, -1);
emulation/linux/linux_file.c:160: fp = holdfp(p->p_fd, *iresult, -1);
emulation/linux/linux_file.c:1453: fp = holdfp(td->td_proc->p_fd, args->fd, -1);
dev/disk/xdisk/xdisk.c:259: fp = holdfp(curproc->p_fd, xaioc->fd, -1);
int pdkill(int fd, int signum)
send signal to a process referenced by a process descriptor
flag inherited by forked childs.
Convert subsystem to the new holdsock API if needed.
sys/filedesc.h:187:int holdsock (struct filedesc _fdp, int fdes, struct file *_fpp);
kern/uipc_syscalls.c:147: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:184: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:276: error = holdsock(td->td_proc->p_fd, s, &lfp);
kern/uipc_syscalls.c:499: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:687: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:865: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:1106: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:1169: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:1244: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:1310: error = holdsock(p->p_fd, s, &fp);
kern/uipc_syscalls.c:1569: error = holdsock(p->p_fd, sfd, &fp);
kern/uipc_syscalls.c:1861: error = holdsock(td->td_proc->p_fd, uap->sd, &lfp);
kern/kern_descrip.c:2469: * holdsock() - load the struct file pointer associated
kern/kern_descrip.c:2476:holdsock(struct filedesc _fdp, int fd, struct file *_fpp)
vfs/portal/portal_vfsops.c:93: error = holdsock(curproc->p_fd, args.pa_socket, &fp);
vfs/nfs/nfs_syscalls.c:195: error = holdsock(td->td_proc->p_fd, nfsdarg.sock, &fp);
emulation/linux/linux_socket.c:377: error = holdsock(p->p_fd, linux_args.s, &fp);
dev/disk/iscsi/initiator/iscsi.c:427: if ((error = holdsock(td->td_proc->p_fd, fd, &fp)) == 0) {
stat retrieves the credentials and the start time of the process referenced by the procdescriptor
On dragonfly, poll is implemented using kqueue.
https://github.com/jorisgio/DragonFlyBSD/blob/procdesc/sys/kern/sys_generic.c#L1222
It uses EVFIL_READ and EVFILT_WRITE to implement POLLIN and POLLOUT. For process, since read/write are not implemented, we only want to handle POLLHUP. The current code does not seems to be design for that.
Note that their is also NOTE_PROC https://github.com/jorisgio/DragonFlyBSD/blob/procdesc/sys/kern/kern_event.c#L207 which contains some code we need for process descriptors. Adding a filter for kqueue is as simple as creating a filterops struct with the needed functions. For a file descriptor, the kqfilter function handles the different fileters for NOTE_FILE. Here, we want implement a NOTE_PROC like as NOTE_FILE
ioctls lists are whitelists of ioctls allowed on a file descriptor when CAP_IOCTL is set. Since filedesc entries are protected by spin_lock, we cannot allocate memory easily in critical sections. Hence, the ioctls list are shared, and copy on write.
It removes the malloc out the fork path : we don't need to do a full copy of ioctls list when copying a filedesc entry.
Syscalls API to limit and grant rigths, and IOCTLs to filedescriptors.
See : http://bxr.su/FreeBSD/sys/sys/capability.h.
FreeBSD caches the pid of the referenced process in a struct ( see http://bxr.su/FreeBSD/sys/sys/procdesc.h#63).
There are 3 cases :
In case 3, if pdgetpid is called, it will succeed and return the pid of the now dead process. http://bxr.su/FreeBSD/sys/kern/sys_procdesc.c#187
What the point of caching the pid ?
There are two alternatives :
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.