aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/streams
Commit message (Collapse)AuthorAgeFilesLines
* Remove SVR4 (System V Release 4) binary compatibility support.Gleb Smirnoff2017-02-281-339/+0
| | | | | | | | UNIX System V Release 4 is operating system released in 1988. It ceased to exist in early 2000-s. Notes: svn path=/head/; revision=314373
* Fix streams and svr4 module dependency. Both modules are complaining aboutDmitry Chagin2016-04-231-13/+1
| | | | | | | | | | | | | undefined symbol svr4_delete_socket which was moved from streams to the svr4 module in r160558 that created a two-way dependency between them. PR: 208464 Submitted by: Kristoffer Eriksson Reported by: Kristoffer Eriksson MFC after: 2 week Notes: svn path=/head/; revision=298519
* fd: remove filedesc argument from fdcloseMateusz Guzik2015-04-111-3/+1
| | | | | | | | | Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Notes: svn path=/head/; revision=281436
* Remove the no-at variants of the kern_xx() syscall helpers. E.g., weKonstantin Belousov2014-11-131-1/+2
| | | | | | | | | | | | | | | have both kern_open() and kern_openat(); change the callers to use kern_openat(). This removes one (sometimes two) levels of indirection and consolidates arguments checks. Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Notes: svn path=/head/; revision=274476
* - Remove socket file operations declaration from sys/file.h.Gleb Smirnoff2014-08-261-16/+13
| | | | | | | | | | | - Make them static in sys_socket.c. - Provide generic invfo_truncate() instead of soo_truncate(). Sponsored by: Netflix Sponsored by: Nginx, Inc. Notes: svn path=/head/; revision=270664
* Restore the previous sendfile(2) behaviour on the block devices.Konstantin Belousov2013-08-161-0/+1
| | | | | | | | | | Provide valid .fo_sendfile method for several missed struct fileops. Reviewed by: glebius Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=254415
* Revert previous commit...Kevin Lo2012-10-101-1/+1
| | | | | | | Pointyhat to: kevlo (myself) Notes: svn path=/head/; revision=241394
* Prefer NULL over 0 for pointersKevin Lo2012-10-091-1/+1
| | | | Notes: svn path=/head/; revision=241370
* Add the fo_chown and fo_chmod methods to struct fileops and use themKonstantin Belousov2011-08-161-1/+3
| | | | | | | | | | | | | to implement fchown(2) and fchmod(2) support for several file types that previously lacked it. Add MAC entries for chown/chmod done on posix shared memory and (old) in-kernel posix semaphores. Based on the submission by: glebius Reviewed by: rwatson Approved by: re (bz) Notes: svn path=/head/; revision=224914
* After the r219999 is merged to stable/8, rename fallocf(9) to falloc(9)Konstantin Belousov2011-04-011-1/+1
| | | | | | | | | | | and remove the falloc() version that lacks flag argument. This is done to reduce the KPI bloat. Requested by: jhb X-MFC-note: do not Notes: svn path=/head/; revision=220245
* The streams ptm code is pretty awful and likely incorrect. I don't knowEd Schouten2009-02-161-0/+2
| | | | | | | | anything about streams, so I'm not going to fix it. Just a small comment to redirect folks to posix_openpt(). Notes: svn path=/head/; revision=188697
* Replace all calls to minor() with dev2unit().Ed Schouten2008-09-271-2/+2
| | | | | | | | | | | | | | | | | | After I removed all the unit2minor()/minor2unit() calls from the kernel yesterday, I realised calling minor() everywhere is quite confusing. Character devices now only have the ability to store a unit number, not a minor number. Remove the confusion by using dev2unit() everywhere. This commit could also be considered as a bug fix. A lot of drivers call minor(), while they should actually be calling dev2unit(). In -CURRENT this isn't a problem, but it turns out we never had any problem reports related to that issue in the past. I suspect not many people connect more than 256 pieces of the same hardware. Reviewed by: kib Notes: svn path=/head/; revision=183397
* Make ftruncate a 'struct file' operation rather than a vnode operation.John Baldwin2008-01-071-0/+1
| | | | | | | | | | | | | | | | | This makes it possible to support ftruncate() on non-vnode file types in the future. - 'struct fileops' grows a 'fo_truncate' method to handle an ftruncate() on a given file descriptor. - ftruncate() moves to kern/sys_generic.c and now just fetches a file object and invokes fo_truncate(). - The vnode-specific portions of ftruncate() move to vn_truncate() in vfs_vnops.c which implements fo_truncate() for vnode file types. - Non-vnode file types return EINVAL in their fo_truncate() method. Submitted by: rwatson Notes: svn path=/head/; revision=175140
* Remove explicit locking of struct file.Jeff Roberson2007-12-301-6/+1
| | | | | | | | | | | | | | | | - Introduce a finit() which is used to initailize the fields of struct file in such a way that the ops vector is only valid after the data, type, and flags are valid. - Protect f_flag and f_count with atomic operations. - Remove the global list of all files and associated accounting. - Rewrite the unp garbage collection such that it no longer requires the global list of all files and instead uses a list of all unp sockets. - Mark sockets in the accept queue so we don't incorrectly gc them. Tested by: kris, pho Notes: svn path=/head/; revision=174988
* Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, whichRobert Watson2007-08-061-2/+0
| | | | | | | | | | | | | | | | | | previously conditionally acquired Giant based on debug.mpsafenet. As that has now been removed, they are no longer required. Removing them significantly simplifies error-handling in the socket layer, eliminated quite a bit of unwinding of locking in error cases. While here clean up the now unneeded opt_net.h, which previously was used for the NET_WITH_GIANT kernel option. Clean up some related gotos for consistency. Reviewed by: bz, csjp Tested by: kris Approved by: re (kensmith) Notes: svn path=/head/; revision=171744
* Replace custom file descriptor array sleep lock constructed using a mutexRobert Watson2007-04-041-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and flags with an sxlock. This leads to a significant and measurable performance improvement as a result of access to shared locking for frequent lookup operations, reduced general overhead, and reduced overhead in the event of contention. All of these are imported for threaded applications where simultaneous access to a shared file descriptor array occurs frequently. Kris has reported 2x-4x transaction rate improvements on 8-core MySQL benchmarks; smaller improvements can be expected for many workloads as a result of reduced overhead. - Generally eliminate the distinction between "fast" and regular acquisisition of the filedesc lock; the plan is that they will now all be fast. Change all locking instances to either shared or exclusive locks. - Correct a bug (pointed out by kib) in fdfree() where previously msleep() was called without the mutex held; sx_sleep() is now always called with the sxlock held exclusively. - Universally hold the struct file lock over changes to struct file, rather than the filedesc lock or no lock. Always update the f_ops field last. A further memory barrier is required here in the future (discussed with jhb). - Improve locking and reference management in linux_at(), which fails to properly acquire vnode references before using vnode pointers. Annotate improper use of vn_fullpath(), which will be replaced at a future date. In fcntl(), we conservatively acquire an exclusive lock, even though in some cases a shared lock may be sufficient, which should be revisited. The dropping of the filedesc lock in fdgrowtable() is no longer required as the sxlock can be held over the sleep operation; we should consider removing that (pointed out by attilio). Tested by: kris Discussed with: jhb, kris, attilio, jeff Notes: svn path=/head/; revision=168355
* Clean up the svr4 socket cache and streams code some to make it more easilyJohn Baldwin2006-07-211-75/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | locked. - Move all the svr4 socket cache code into svr4_socket.c, specifically move svr4_delete_socket() over from streams.c. Make the socket cache entry structure and svr4_head private to svr4_socket.c as a result. - Add a mutex to protect the svr4 socket cache. - Change svr4_find_socket() to copy the sockaddr_un struct into a caller-supplied sockaddr_un rather than giving the caller a pointer to our internal one. This removes the one case where code outside of svr4_socket.c could access data in the cache. - Add an eventhandler for process_exit and process_exec to purge the cache of any entries for the exiting or execing process. - Add methods to init and destroy the socket cache and call them from the svr4 ABI module's event handler. - Conditionally grab Giant around socreate() in streamsopen(). - Use fdclose() instead of inlining it in streamsopen() when handling socreate() failure. - Only allocate a stream structure and attach it to a socket in streamsopen(). Previously, if a svr4 program performed a stream operation on an arbitrary socket not opened via the streams device, we would attach streams state data to it and change f_ops of the associated struct file while it was in use. The latter was especially not safe, and if a program wants a stream object it should open it via the streams device anyway. - Don't bother locking so_emuldata in the streams code now that we only touch it right after creating a socket (in streamsopen()) or when tearing it down when the file is closed. - Remove D_NEEDGIANT from the streams device as it is no longer needed. Notes: svn path=/head/; revision=160558
* Whitespace fix after s/dev_t/struct cdev */.John Baldwin2006-07-191-2/+2
| | | | Notes: svn path=/head/; revision=160508
* Initialize svr4_head during MOD_LOAD rather than on demand.John Baldwin2006-07-191-12/+1
| | | | Notes: svn path=/head/; revision=160504
* Remove unnecessary locking for td_dupfd (it requires no locks).John Baldwin2006-07-181-9/+1
| | | | Notes: svn path=/head/; revision=160490
* Use kern_open() directly rather than a stackgap detour via open().John Baldwin2005-02-071-15/+10
| | | | Notes: svn path=/head/; revision=141466
* Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh2005-01-061-1/+1
| | | | Notes: svn path=/head/; revision=139749
* Introduce an alias for FILEDESC_{UN}LOCK() with the suffix _FAST.Poul-Henning Kamp2004-11-131-4/+4
| | | | | | | | | | | Use this in all the places where sleeping with the lock held is not an issue. The distinction will become significant once we finalize the exact lock-type to use for this kind of case. Notes: svn path=/head/; revision=137647
* Do a pass over all modules in the kernel and make them return EOPNOTSUPPPoul-Henning Kamp2004-07-151-0/+1
| | | | | | | | | | | for unknown events. A number of modules return EINVAL in this instance, and I have left those alone for now and instead taught MOD_QUIESCE to accept this as "didn't do anything". Notes: svn path=/head/; revision=132199
* Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp2004-06-161-3/+3
| | | | | | | Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
* Device megapatch 4/6:Poul-Henning Kamp2004-02-211-0/+2
| | | | | | | | | | | Introduce d_version field in struct cdevsw, this must always be initialized to D_VERSION. Flip sense of D_NOGIANT flag to D_NEEDGIANT, this involves removing four D_NOGIANT flags and adding 145 D_NEEDGIANT flags. Notes: svn path=/head/; revision=126080
* Device megapatch 1/6:Poul-Henning Kamp2004-02-211-2/+0
| | | | | | | | | | Free approx 86 major numbers with a mostly automatically generated patch. A number of strategic drivers have been left behind by caution, and a few because they still (ab)use their major number. Notes: svn path=/head/; revision=126076
* falloc allocates a file structure and adds it to the file descriptorDavid Malone2003-10-191-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | table, acquiring the necessary locks as it works. It usually returns two references to the new descriptor: one in the descriptor table and one via a pointer argument. As falloc releases the FILEDESC lock before returning, there is a potential for a process to close the reference in the file descriptor table before falloc's caller gets to use the file. I don't think this can happen in practice at the moment, because Giant indirectly protects closes. To stop the file being completly closed in this situation, this change makes falloc set the refcount to two when both references are returned. This makes life easier for several of falloc's callers, because the first thing they previously did was grab an extra reference on the file. Reviewed by: iedowse Idea run past: jhb Notes: svn path=/head/; revision=121256
* Use __FBSDID().David E. O'Brien2003-08-241-1/+3
| | | | | | | Also some minor style cleanups. Notes: svn path=/head/; revision=119420
* Initialize struct fileops with C99 sparse initialization.Poul-Henning Kamp2003-06-181-2/+7
| | | | Notes: svn path=/head/; revision=116546
* Put definition of struct svr4_sockcache_entry in a .h file rather thanPoul-Henning Kamp2003-05-311-10/+1
| | | | | | | | | | having two independent definitions in two .c files. Fiddle surrounding details to match. Found by: FlexeLint Notes: svn path=/head/; revision=115550
* Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp2003-03-031-13/+3
| | | | | | | | | | | | | | | | branches: Initialize struct cdevsw using C99 sparse initializtion and remove all initializations to default values. This patch is automatically generated and has been tested by compiling LINT with all the fields in struct cdevsw in reverse order on alpha, sparc64 and i386. Approved by: re(scottl) Notes: svn path=/head/; revision=111815
* Back out M_* changes, per decision of the TRB.Warner Losh2003-02-191-1/+1
| | | | | | | Approved by: trb Notes: svn path=/head/; revision=111119
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein2003-01-211-1/+1
| | | | | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
* Bow to the whining masses and change a union back into void *. RetainMatthew Dillon2003-01-131-4/+4
| | | | | | | | removal of unnecessary casts and throw in some minor cleanups to see if anyone complains, just for the hell of it. Notes: svn path=/head/; revision=109153
* Change struct file f_data to un_data, a union of the correct structMatthew Dillon2003-01-121-4/+4
| | | | | | | | | | | | | pointer types, and remove a huge number of casts from code using it. Change struct xfile xf_data to xun_data (ABI is still compatible). If we need to add a #define for f_data and xf_data we can, but I don't think it will be necessary. There are no operational changes in this commit. Notes: svn path=/head/; revision=109123
* s/sokqfilter/soo_kqfilter/ for consistency with the naming of allPoul-Henning Kamp2002-12-231-1/+1
| | | | | | | other socket/file operations. Notes: svn path=/head/; revision=108235
* SCARGS removal take II.Alfred Perlstein2002-12-141-3/+3
| | | | Notes: svn path=/head/; revision=107849
* Backout removal SCARGS, the code freeze is only "selectively" over.Alfred Perlstein2002-12-131-3/+3
| | | | Notes: svn path=/head/; revision=107839
* Remove SCARGS.Alfred Perlstein2002-12-131-3/+3
| | | | | | | Reviewed by: md5 Notes: svn path=/head/; revision=107838
* Remove __P.Alfred Perlstein2002-03-201-2/+2
| | | | Notes: svn path=/head/; revision=92739
* Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin2002-02-271-1/+1
| | | | | | | reference. Notes: svn path=/head/; revision=91406
* SMP Lock struct file, filedesc and the global file list.Alfred Perlstein2002-01-131-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seigo Tanimura (tanimura) posted the initial delta. I've polished it quite a bit reducing the need for locking and adapting it for KSE. Locks: 1 mutex in each filedesc protects all the fields. protects "struct file" initialization, while a struct file is being changed from &badfileops -> &pipeops or something the filedesc should be locked. 1 mutex in each struct file protects the refcount fields. doesn't protect anything else. the flags used for garbage collection have been moved to f_gcflag which was the FILLER short, this doesn't need locking because the garbage collection is a single threaded container. could likely be made to use a pool mutex. 1 sx lock for the global filelist. struct file * fhold(struct file *fp); /* increments reference count on a file */ struct file * fhold_locked(struct file *fp); /* like fhold but expects file to locked */ struct file * ffind_hold(struct thread *, int fd); /* finds the struct file in thread, adds one reference and returns it unlocked */ struct file * ffind_lock(struct thread *, int fd); /* ffind_hold, but returns file locked */ I still have to smp-safe the fget cruft, I'll get to that asap. Notes: svn path=/head/; revision=89306
* Staticise the device node pointers.Mike Smith2002-01-081-1/+1
| | | | Notes: svn path=/head/; revision=89059
* o Make the credential used by socreate() an explicit argument toRobert Watson2001-12-311-1/+2
| | | | | | | | | | | | | | | | | socreate(), rather than getting it implicitly from the thread argument. o Make NFS cache the credential provided at mount-time, and use the cached credential (nfsmount->nm_cred) when making calls to socreate() on initially connecting, or reconnecting the socket. This fixes bugs involving NFS over TCP and ipfw uid/gid rules, as well as bugs involving NFS and mandatory access control implementations. Reviewed by: freebsd-arch Notes: svn path=/head/; revision=88739
* cast dev_t to int in printf to fix warning.Matthew Dillon2001-10-291-1/+1
| | | | Notes: svn path=/head/; revision=85653
* KSE Milestone 2Julian Elischer2001-09-121-15/+17
| | | | | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha Notes: svn path=/head/; revision=83366
* Send the remains (such as I have located) of "block major numbers" toPoul-Henning Kamp2001-03-261-1/+0
| | | | | | | the bit-bucket. Notes: svn path=/head/; revision=74810
* Extend kqueue down to the device layer.Jonathan Lemon2001-02-151-1/+2
| | | | | | | Backwards compatible approach suggested by: peter Notes: svn path=/head/; revision=72521
* - Add necessary proc locking.John Baldwin2001-01-231-5/+15
| | | | | | | | | - Use proper atomic operations to make the run time initialization controlled by svr_str_initialized be MP safe. - Use appropriate queue(3) macros where needed. Notes: svn path=/head/; revision=71448