summaryrefslogtreecommitdiff
path: root/sys/kern/kern_descrip.c
AgeCommit message (Collapse)Author
2013-07-04Format string fixes:Stefan Fritsch
f_count is long ok kettenis@ Change esm_sensor_map.arg to int ok deraadt@
2013-06-11convert some easy bcopy to memcpy and clean up fdexpand a bit.Ted Unangst
ok kettenis
2013-06-05Move FHASLOCK from f_flag to f_iflags, freeing up a bit for passingPhilip Guenther
O_* flags and eliminating an XXX comment. ok matthew@ deraadt@
2012-08-23To protect assumptions inside systrace, don't let systrace fds bePhilip Guenthe
shared between processes. ok djm@
2012-07-11Revert the blocked FIFO open fix, as there's either a race in thePhilip Guenthe
ref-count handling under handling, or blambert@ is messing with my head
2012-07-08Don't hold the fd-table lock across vn_open(), as opening a FIFO may block.Philip Guenthe
Having done that, dupfdopen() has to handle a possible race. ok matthew@ krw@
2012-05-21Cleanup O_CLOEXEC handling and make sure UF_EXCLOSE is set correctlyMatthew Dempsky
when opening /dev/fd/* (i.e., UF_EXCLOSE is now set iff O_CLOEXEC is set, rather than copying UF_EXCLOSE from the file descriptor being dup'd). Also, add support for O_CLOEXEC and O_DIRECTORY to fhopen(). ok krw, guenther; feedback from millert; testing and bug finding by krw
2012-05-14Remove the "vn_open() returning ENXIO means dup+close" hook thatPhilip Guenthe
was used by the now defunct portalfs. Zero out fd_ofileflags[fd] when allocating an fd instead of when releasing it. ok krw@ matthew@
2012-05-01Eliminate the f_usecount ref count in struct file; instead of sleepingPhilip Guenthe
at the top of closef() until all in-progress calls finish, just do the advisory locking bits required of close() by POSIX and let whichever thread has the last reference do the call to the file's fo_close() method and the final cleanup. lots of discussion with deraadt@ and others; worked out with and ok krw@
2012-04-22Add struct proc * argument to FRELE() and FILE_SET_MATURE() inPhilip Guenthe
anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
2012-04-12In this case where dup2() extends the table using fdalloc, the newlyTheo de Raadt
selected fd is automatically fd_used(). We need to fd_unused() it, because it will be fd_used() again in finishdup(). spotted by guenther ok miod
2012-04-12New system call: getdtablecount(2) returns the number of fileTheo de Raadt
descriptors the process currently has open. ok guenther miod gilles ...
2012-04-12dup() was calling fd_used() twice for the new file descriptor. SeperateTheo de Raadt
the dup and dup2 cases. with guenther ok miod
2012-02-15Hold struct filedesc's fd_lock when writing to the fd_ofiles, fd_ofileflags,Philip Guenthe
or fd_{lo,hi}maps members, or when doing a read for a write. Fixes hangs when an rthreaded processes sleeps while copying the fd table for fork() and catches another thread with the lock. ok jsing@ tedu@
2011-07-08Add F_DUPFD_CLOEXEC.Matthew Dempsky
"Sure" deraadt@
2011-07-08Support sending struct info to kdump. So far for struct stat andOtto Moerbeek
struct sockaddress; mostly from freebsd. ok deraadt@ tedu@ nicm@
2011-04-02Move P_SUGID and P_SUGIDEXEC from struct proc to struct process, soPhilip Guenthe
that you can't evade the checks by doing the dirty work in an rthread ok blambert@, deraadt@
2010-07-26Correct the links between threads, processes, pgrps, and sessions,Philip Guenthe
so that the process-level stuff is to/from struct process and not struct proc. This fixes a bunch of problem cases in rthreads. Based on earlier work by blambert and myself, but mostly written at c2k10. Tested by many: deraadt, sthen, krw, ray, and in snapshots
2010-07-19Rollback the allproclk and fileheadlk addition. When grabbing anPhilip Guenthe
rwlock, the thread will release biglock if it sleeps, means that atomicity from before the rw_enter() to after it is not guaranteed. The change didn't address those, so pulling it until it does. "go for it" tedu@
2010-03-24Add a rwlock around the filehead and allproc lists, mainly to protectTed Unangst
list walkers in sysctl that can block. As a reward, no more vslock. With some feedback from art, guenther, phessler. ok guenther.
2009-07-09Remove the VREF() macro and replaces all instances with a call to verf(),Thordur I. Bjornsson
which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
2008-11-25Punctuate comment for clarity, and keep tense consistent throughoutBret Lambert
ok and improvements jmc@
2008-09-19Fix a bunch of problems and races with posix file locking.Artur Grabowski
- file descriptor table becomes the owner of the lock instead of the proc. - When grabbing the lock, we check if the fd hasn't changed under our feet, this is more or less impossible to solve without a hack like this. I've banged my head against the wall, I figured out a solution, but implementing it correctly would cost me 12 gray hairs. Screw it, this is ugly, but it works. - Wait until usecount drains before releasing the posix lock in closef. - Add missing FREF/FRELE to sys_flock - keep the pid in the flock struct instead of abusing the fact that we used to use the proc as the lock owner. Pointed out by and discussed with Al Viro, big thanks. miod@ ok
2008-06-12use PR_ZERO instead of a bzero() right after the pool_get();Thordur I. Bjornsson
ok blambert@
2008-05-06Add a PR_ZERO flag for pools, to compliment the M_ZEROThordur I. Bjornsson
malloc flag, does the same thing. use it in a few places. OK tedu@, "then go ahead. and don't forget the manpage (-:" miod@
2007-10-29MALLOC/FREE -> malloc/freeCharles Longeau
replace an hard coded value with M_WAITOK ok krw@
2007-03-15Since p_flag is often manipulated in interrupts and without biglockArtur Grabowski
it's a good idea to use atomic.h operations on it. This mechanic change updates all bit operations on p_flag to atomic_{set,clear}bits_int. Only exception is that P_OWEUPC is set by MI code before calling need_proftick and it's automatically cleared by ADDUPC. There's no reason for MD handling of that flag since everyone handles it the same way. kettenis@ ok
2006-11-14grammar, spelling, and style fixes from bret lambert;Jason McIntyre
kern_descrip.c change ok deraadt
2006-05-07add a name to rwlock so that we can tell where procs are getting stuckTed Unangst
without breaking into ddb. doubles the size of rwlock [1], but moving forward this really helps. ok/tested pedro fgsch millert krw [1 - next person to add a field to this struct gets whipped with a wet noodle]
2006-01-06typo fix from ray lai;Jason McIntyre
ok deraadt
2005-12-07do not allow setugid processes to use /dev/fd/#, unless they are aTheo de Raadt
setuid-script and are attempting to dup is the specific setuid-script fd via such a pathname; ok tedu pedro millert
2005-11-28ansi/deregister.Jonathan Gray
'go for it' deraadt@
2005-07-03change VOP_PATHCONF to take a locked vnode, as itsJared Yanovich
comment entry describes. requires that sys_fpathconf() lock its vnode. lots of testing by jolan and myself, ok pedro
2004-07-22remove p arg from fdplockTed Unangst
2004-01-12new syscall closefrom(int fd) closes all fds equal and greater than fd.Ted Unangst
ok deraadt@ millert@
2004-01-06lock filedesc before manipulating. avoids some rare races.Ted Unangst
testing for quite some time by brad + otto
2003-12-02Check array index before using it; from Tim Robbins via Niels.Todd C. Miller
2003-08-15change arguments to suser. suser now takes the process, and a flagsTed Unangst
argument. old cred only calls user suser_ucred. this will allow future work to more flexibly implement the idea of a root process. looks like something i saw in freebsd, but a little different. use of suser_ucred vs suser in file system code should be looked at again, for the moment semantics remain unchanged. review and input from art@ testing and further review miod@
2003-08-06Remove unreachable return statement after break; Patrick LatifiTodd C. Miller
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2002-11-22Allow fdinit to be called with p == NULL so that we can useArtur Grabowski
it to properly init filedescs for proc0.
2002-11-08finishdup: Avoid reference count leak in error case by reordering some code.Artur Grabowski
2002-10-15Match reality by changing (u_int) -> (int) in comments.Thomas Nordin
2002-08-23Add missing FRELE() in finishdup() error case; ok artPeter Valchev
2002-06-03compatiblity -> compatibilityTheo de Raadt
decriptor -> descriptor authentciated -> authenticated transmition -> transmission
2002-05-23Fix a comment I missed when renaming FILE_UNUSE to FRELE.Artur Grabowski
2002-03-14First round of __P removal in sysTodd C. Miller
2002-02-19Missing FRELE in error case. ok provos@Thomas Nordin
2002-02-18fix issue on LP64 BE arch's w/ fcntl's F_GETOWNEric Jackson
pointed out by der Mouse <mouse@Rodents.Montreal.QC.CA>
2002-02-13More FREF/FRELE on relevant places. Now, only sys_mmap and a bunch of ioctl ↵Artur Grabowski
functions in sys/compat are left.