summaryrefslogtreecommitdiff
path: root/sys/kern/kern_descrip.c
AgeCommit message (Collapse)Author
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.
2002-02-09Protect the whole sys_fnctl with one big FREF/FRELE pair.Artur Grabowski
2002-02-08Add a comment about an obscure behavior in dup2(2).Artur Grabowski
2002-02-08Add a slightly redundant arg to finishdup that's the struct file *Artur Grabowski
present on the 'old' descriptor. It's not really necessary because we can easily find it with 'fp = p->p_fd->fd_ofiles[old];', but this allows us to require that the fp is FREFed without violating all rules of good taste and all callers have to do fd_getfile on it anyway (to detect larval and closing files. FREF the fp in all callers.
2002-02-08No more need for ffree. Since it's hard to use it safely, remove it.Artur Grabowski
2002-02-08- Rename FILE_{,UN}USE to FREF and FRELE. USE is a bad verb and we don't haveArtur Grabowski
the same semantics as NetBSD anyway, so it's good to avoid name collissions. - Always fdremove before freeing the file, not the other way around. - falloc FREFs the file. - have FILE_SET_MATURE FRELE the file (It feels like a good ortogonality to falloc FREFing the file). - Use closef as much as possible instead of ffree in error paths of falloc:ing functions. closef is much more careful with the fd and can deal with the fd being forcibly closed by dup2. Also try to avoid manually calling *fo_close when closef can do that for us (this makes some error paths mroe complicated (sys_socketpair and sys_pipe), but others become simpler (sys_open)).
2002-02-05Add counting of temporary references to a struct file (as opposed to referencesArtur Grabowski
from fd tables and other long-lived objects). This is to avoid races between using a file descriptor and having another process (with shared fd table) close it. We use a separate refence count so that error values from close(2) will be correctly returned to the caller of close(2). The macros for those reference counts are FILE_USE(fp) and FILE_UNUSE(fp). Make sure that the cases where closef can be called "incorrectly" (most notably dup2(2)) are handled. Right now only callers of closef (and {,p}read) use FILE_{,UN}USE correctly, more fixes incoming soon.
2002-02-04Add some comments documenting why we use fd_ofiles insteadArtur Grabowski
of fd_getfile in some places. Also, get rid of the check for old == new in dupfdopen and document why the semantics of fd_getfile make it unnecessary.
2002-02-02Reorganize sys_fcntl to make future changes easier.Artur Grabowski
2002-01-23Pool deals fairly well with physical memory shortage, but it doesn't dealArtur Grabowski
well (not at all) with shortages of the vm_map where the pages are mapped (usually kmem_map). Try to deal with it: - group all information the backend allocator for a pool in a separate struct. The pool will only have a pointer to that struct. - change the pool_init API to reflect that. - link all pools allocating from the same allocator on a linked list. - Since an allocator is responsible to wait for physical memory it will only fail (waitok) when it runs out of its backing vm_map, carefully drain pools using the same allocator so that va space is freed. (see comments in code for caveats and details). - change pool_reclaim to return if it actually succeeded to free some memory, use that information to make draining easier and more efficient. - get rid of PR_URGENT, noone uses it.
2001-11-15Initialize listNiklas Hallqvist
2001-11-06Replace inclusion of <vm/foo.h> with the correct <uvm/bar.h> when necessary.Miod Vallat
(Look ma, I might have broken the tree)
2001-11-05let finishdup take the proc as arguemnt instead of the filedesc.Artur Grabowski
2001-10-26 - every new fd created by falloc() is marked as larval and should not be usedArtur Grabowski
any anyone. Every caller of falloc matures the fd when it's usable. - Since every lookup in the fd table must now check this flag and all of them do the same thing, move all the necessary checks into a function - fd_getfile.
2001-10-26 - split fdalloc into two functions. fdalloc now returns ENOSPC if itArtur Grabowski
would have to grow the table and fdexpand that grows the table. Since fdexpand can sleep we have to restart all operations if we have to call it. - dup2 changed so that finishdup frees the destination descriptor. - unp_externalize is a completly rewritten version from NetBSD. Changes mostly inspired by NetBSD.
2001-10-07Clean up fdrelease.Artur Grabowski
2001-10-07gc UF_MAPPED.Artur Grabowski
2001-10-01Avoid panic when unconfiguring raid device which was autoconfigured andGrigoriy Orlov
so has fdp->fd_cdir = NULL. From Tertou <TDeval@PrimeOBJ.COM>
2001-09-29Avoid panic at time of raid autoconfiguration. Raid kernel thread startsGrigoriy Orlov
when root filesystem isn't configured yet and some kernel variables can't be initialized. From Thierry Deval <TDeval@PrimeOBJ.COM>
2001-07-28Allow negative lock length in case of lockf(3). This makes lockf(3)Grigoriy Orlov
compliant to specification. costa@ ok.
2001-07-25Random cleanups that generate noise in my cvs updates.Artur Grabowski
2001-06-27remove old vmArtur Grabowski
2001-06-22KNFTheo de Raadt
2001-05-23Don't panic on kqueues and crypto descriptors in fpathconf.Artur Grabowski
Just return EOPNOTSUPP.
2001-05-16Use pool to allocate struct filedesc0 and struct file.Artur Grabowski
2001-05-14gc OLD_PIPE.Artur Grabowski
2001-05-14use fo_stat in fileops instead of huge switch statements.Artur Grabowski
2001-05-14Implement a wrapper round vn_stat that takes the same argumentsArtur Grabowski
as soo_stat and pipe_stat.
2001-05-14More generic arguments to soo_stat.Artur Grabowski
2001-05-14More generic arguments to pipe_stat.Artur Grabowski
2000-11-16support kernel event queues, from FreeBSD by Jonathan Lemon,Niels Provos
okay art@, millert@
2000-09-27replace MALLOC/FREE w/ malloc/free for non-constant-sized memory ↵Michael Shalayeff
allocations; art@ ok
2000-09-24prevent memory leak in fdalloc; fix by greg@nest.cxNiels Provos
2000-04-01fdup could fail when want for fdalloc > than the free fd in the block.Niels Provos
slightly different fix than in the bug report by Rob Pickering <rob@syntonet.co.uk>
2000-02-28Optimized fdalloc as in Banga and Mogul paper:Niels Provos
http://www.usenix.org/publications/library/proceedings/usenix98/banga.html