summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_vnops.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Reorder checks in the read/write(2) family of syscalls to prepare makingmpi2018-08-201-15/+32
| | | | | | | | | | | | file operations mp-safe. This change makes it clear that `f_offset' is only accessed in vn_read() and vn_write(), which will help taking it out of the KERNEL_LOCK(). This refactoring uncovered a race in vn_read() which is now documented and will be addressed in a later diff. ok visa@
* Grab the KERNEL_LOCK() in MP-unsafe fo_close routines. This preventsvisa2018-08-151-3/+6
| | | | | | | a scenario where MP-unsafe code gets run without the kernel lock as a consequence of an unlocked system call. OK mpi@, kettenis@
* Add a new so_seek member to "struct file" such that we can have seekablekettenis2018-07-031-2/+44
| | | | | | | | | | | files that aren't vnodes. Move the vnode-specific code into its own function. Add an implementation for the "DMA buffers" that can be used by DRI3/prime code to find out the size of the graphics buffer. This implementation is very limited and only supports offset 0 and only for SEEK_SET and SEEK_END. This doesn't really make sense; implementing stat(2) would be a more obvious choice. But this is what Linux does. ok guenther@, visa@
* Avoid NULL pointer deref in vn_writechk() when calling ftruncate() on a fileanton2018-07-031-2/+2
| | | | | | descriptor belonging to a cloned device. ok kettenis@
* Make callers of VOP_CREATE(9) and VOP_MKNOD(9) responsible forvisa2018-06-071-1/+2
| | | | | | unlocking the directory vnode. OK mpi@, helg@
* Remove proc from the parameters of vn_lock(). The parameter isvisa2018-05-021-8/+6
| | | | | | unnecessary because curproc always does the locking. OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-6/+6
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Convert 'struct fileops' definitions to C99.mpi2018-04-101-4/+10
| | | | ok millert@, deraadt@, florian@
* Stop assuming <sys/file.h> will pull in fcntl.h when _KERNEL is defined.guenther2018-01-021-1/+2
| | | | ok millert@ sthen@
* Nuke trailing whitespacebeck2017-08-131-3/+3
|
* Drop a now unneeded variable initialization; spotted by bluhm@jca2016-09-301-2/+2
|
* Make read(2) return EISDIR on directories.jca2016-09-301-4/+6
| | | | | | | | | | | Years ago Theo made read(2) return 0 on directories, instead of dumping the directory content. Another behavior is allowed as an extension by POSIX, returning an EISDIR error, as used on a few other systems. This behavior is deemed more useful as it helps spotting errors. This implies that it might break some setups. Ports bulk builds by ajacoutot@ and naddy@, ok millert@ bluhm@ naddy@ deraadt@
* Remove the lockmgr() API. It is only used by filesystems, where it is anatano2016-06-191-4/+1
| | | | | | | | trivial change to use rrw locks instead. All it needs is LK_* defines for the RW_* flags. tested by naddy and sthen on package building infrastructure input and ok jmc mpi tedu
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-5/+5
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* remove unnecessary casts where the incoming type is void *.tedu2016-01-061-7/+7
|
* Pass fflag to VOP_POLL so vfs fifo functions can get at the filemillert2015-05-011-2/+2
| | | | | | flags to check FREAD/FWRITE if needed. This will be used by fifo_poll to avoid checking the write end of the fifo when the fd is read-only. OK guenther@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* primary change: move uvm_vnode out of vnode, keeping only a pointer.tedu2014-12-161-1/+2
| | | | | | objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
* include sys/unistd.h where needed instead of indirect reliance. ok jsgtedu2014-11-031-1/+2
|
* pass the size to free in some of the obvious casestedu2014-07-131-2/+2
|
* add a size argument to free. will be used soon, but for now default to 0.tedu2014-07-121-2/+2
| | | | after discussions with beck deraadt kettenis.
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-3/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* Copy timespecs member by member in fo_stat callback functions, to avoidguenther2014-01-241-4/+8
| | | | | | | leaking values in the padding bytes on LP64. Also, vn_stat() was lacking the zero-fill to clean its padding. ok kettenis@ deraadt@ phessler@
* Correct the handling of I/O of >=2^32 bytes and the ktracing there ofguenther2013-09-141-2/+2
| | | | | | by using size_t/ssize_t instead of int/u_int to handle I/O lengths in uiomove(), vn_fsizechk(), and ktrgenio(). Eliminate the always-zero 'error' argument to ktrgenio() at the same time.
* Move FHASLOCK from f_flag to f_iflags, freeing up a bit for passingguenther2013-06-051-2/+2
| | | | | | O_* flags and eliminating an XXX comment. ok matthew@ deraadt@
* vrele() is a tricky beast. it can sleep if the refcount hits zero,tedu2013-03-301-3/+4
| | | | | | leaving us with a free type function that isn't atomic. deal with this by erasing any reachable pointers to the vnode first, then free it. ok deraadt guenther
* If the current offset is strictly less than the process filesizeguenther2012-07-111-1/+36
| | | | | | | rlimit, then a write that would take it over the limit should be clamped, making it a partial write. ok beck@
* When checking for offset wrap around in vn_read(), compare againstguenther2011-11-271-2/+2
| | | | | | LLONG_MAX instead of SSIZE_MAX ok deraadt@
* Make pwrite/pwritev ignore the O_APPEND flag.guenther2011-11-071-4/+9
| | | | | | | Detect attempts to wrap the file offset by reading past the max (except for character devices). ok matthew@, deraadt@
* Add support for the O_CLOEXEC and O_DIRECTORY flags introduced inmatthew2011-07-091-1/+5
| | | | | | POSIX Issue 7. Requested by oga@ (and maybe djm@); ok guenther@
* Minor turd polishing: hold the vnode lock in vn_rdwr() only whilematthew2011-07-061-5/+7
| | | | | | necessary. "ok ... wait wait WAIT!! ... oh, yeah, it's fine, ok" guenther@
* move the specfs code to a place people can see it; ok guenther thib krwderaadt2011-07-041-2/+2
|
* Correct the links between threads, processes, pgrps, and sessions,guenther2010-07-261-4/+5
| | | | | | | | | 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
* As advertised in the man page, make open(2) return ELOOP (insteadstsp2010-01-081-2/+2
| | | | | | | of EMLINK) if the O_NOFOLLOW flag is set and the target is a symlink. Aligns with Solaris and Linux behaviour. ok tedu@ thib@ guenther@
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-091-2/+2
| | | | | | | | | | | 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.
* Switch struct stat's timespec members to the names standardized inguenther2009-01-291-4/+4
| | | | | | | | POSIX 1003.1-2008, with compatibility macros for the names used in previous version of OpenBSD. Update all the references in the kernel to use the new, standard member names. ok'ed by miod@, otto@; ports build test by naddy@
* propagate the O_EXCL flag down to the file systems, by settingthib2009-01-241-1/+3
| | | | | | | | | | VA_EXCLUSIVE. Handle this in NFS, also in NFS use arc4random() for the create verifier instead of an uninitialized long and the address of the first interface (which is likely to be lo0). Lifted from NetBSD with small tweaks; "looks good", miod@ OK blambert@
* Fix a bunch of problems and races with posix file locking.art2008-09-191-3/+14
| | | | | | | | | | | | | | | | - 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
* bring cloning up too date; Munge it so it will work with atleastthib2008-04-081-6/+8
| | | | | | | | | oga@'s upcoming DRM changes and too some degree ratchov@'s audio work. It still works for bpf's though. Parts from ratchov@; fstat(1) parts from Pedro Martelletto; tested by many, ok'ed by a few; "get going with cloning" deraadt@
* Forgotten hackton diff: bounds check for seek on special devicesotto2007-06-141-2/+1
| | | | with a disklabel. Original diff from pedro@; ok pedro@ deraadt@
* FIBMAP is used by nothing; checked by miod and pvalchevderaadt2007-06-011-4/+1
|
* vn_access hasn't been used for ages and it's just a wrapper withart2007-05-051-15/+1
| | | | locking around VOP_ACCESS. It can go.
* Remove the v_interlock simplelock from the vnode structure.thib2007-03-211-6/+2
| | | | | | | | | Zap all calls to simple_lock/unlock() on it (those calls are #defined away though). Remove the LK_INTERLOCK from the calls to vn_lock() and cleanup the filesystems wich implement VOP_LOCK(). (by remvoing the v_interlock from there calls to lockmgr()). ok pedro@, art@, tedu@
* Retire VOP_LEASE(); It was a bit for NQNFS and hasthib2007-01-161-7/+1
| | | | | | | | | effectively been a no-op for quite some time now, without promise for future usage. ok pedro@ Testing by krw@ (earlier diff) and Johan Mson Lindman (tybollt@solace.miun.se)
* Add a clonable devices implementation. Hacked along with thib@, inputpedro2006-06-021-1/+16
| | | | from krw@ and toby@, subliminal prodding from dlg@, okay deraadt@.
* Move vn_isunder() to vfs_vnops.c, that's the place for vn_* functionspedro2006-05-011-1/+15
|
* 'fall into' -> FALLTHROUGHpedro2006-04-231-3/+2
|
* Remove unnecessary ARGSUSED commentpedro2006-04-231-2/+1
|
* KNFpedro2006-04-231-4/+10
|
* Add vn_access(), discussed with and okay uwe@pedro2005-12-041-1/+19
|