summaryrefslogtreecommitdiff
path: root/sys/dev/streams
AgeCommit message (Collapse)Author
2017-02-28Remove SVR4 (System V Release 4) binary compatibility support.Gleb Smirnoff
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
2016-04-23Fix streams and svr4 module dependency. Both modules are complaining aboutDmitry Chagin
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
2015-04-11fd: remove filedesc argument from fdcloseMateusz Guzik
Just accept a thread instead. This makes it consistent with fdalloc. No functional changes. Notes: svn path=/head/; revision=281436
2014-11-13Remove the no-at variants of the kern_xx() syscall helpers. E.g., weKonstantin Belousov
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
2014-08-26- Remove socket file operations declaration from sys/file.h.Gleb Smirnoff
- 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
2013-08-16Restore the previous sendfile(2) behaviour on the block devices.Konstantin Belousov
Provide valid .fo_sendfile method for several missed struct fileops. Reviewed by: glebius Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=254415
2012-10-10Revert previous commit...Kevin Lo
Pointyhat to: kevlo (myself) Notes: svn path=/head/; revision=241394
2012-10-09Prefer NULL over 0 for pointersKevin Lo
Notes: svn path=/head/; revision=241370
2011-08-16Add the fo_chown and fo_chmod methods to struct fileops and use themKonstantin Belousov
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
2011-04-01After the r219999 is merged to stable/8, rename fallocf(9) to falloc(9)Konstantin Belousov
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
2009-02-16The streams ptm code is pretty awful and likely incorrect. I don't knowEd Schouten
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
2008-09-27Replace all calls to minor() with dev2unit().Ed Schouten
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
2008-01-07Make ftruncate a 'struct file' operation rather than a vnode operation.John Baldwin
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
2007-12-30Remove explicit locking of struct file.Jeff Roberson
- 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
2007-08-06Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, whichRobert Watson
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
2007-04-04Replace custom file descriptor array sleep lock constructed using a mutexRobert Watson
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
2006-07-21Clean up the svr4 socket cache and streams code some to make it more easilyJohn Baldwin
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
2006-07-19Whitespace fix after s/dev_t/struct cdev */.John Baldwin
Notes: svn path=/head/; revision=160508
2006-07-19Initialize svr4_head during MOD_LOAD rather than on demand.John Baldwin
Notes: svn path=/head/; revision=160504
2006-07-18Remove unnecessary locking for td_dupfd (it requires no locks).John Baldwin
Notes: svn path=/head/; revision=160490
2005-02-07Use kern_open() directly rather than a stackgap detour via open().John Baldwin
Notes: svn path=/head/; revision=141466
2005-01-06Start each of the license/copyright comments with /*-, minor shuffle of linesWarner Losh
Notes: svn path=/head/; revision=139749
2004-11-13Introduce an alias for FILEDESC_{UN}LOCK() with the suffix _FAST.Poul-Henning Kamp
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
2004-07-15Do a pass over all modules in the kernel and make them return EOPNOTSUPPPoul-Henning Kamp
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
2004-06-16Do the dreaded s/dev_t/struct cdev */Poul-Henning Kamp
Bump __FreeBSD_version accordingly. Notes: svn path=/head/; revision=130585
2004-02-21Device megapatch 4/6:Poul-Henning Kamp
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
2004-02-21Device megapatch 1/6:Poul-Henning Kamp
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
2003-10-19falloc allocates a file structure and adds it to the file descriptorDavid Malone
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
2003-08-24Use __FBSDID().David E. O'Brien
Also some minor style cleanups. Notes: svn path=/head/; revision=119420
2003-06-18Initialize struct fileops with C99 sparse initialization.Poul-Henning Kamp
Notes: svn path=/head/; revision=116546
2003-05-31Put definition of struct svr4_sockcache_entry in a .h file rather thanPoul-Henning Kamp
having two independent definitions in two .c files. Fiddle surrounding details to match. Found by: FlexeLint Notes: svn path=/head/; revision=115550
2003-03-03Gigacommit to improve device-driver source compatibility betweenPoul-Henning Kamp
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
2003-02-19Back out M_* changes, per decision of the TRB.Warner Losh
Approved by: trb Notes: svn path=/head/; revision=111119
2003-01-21Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.Alfred Perlstein
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT. Notes: svn path=/head/; revision=109623
2003-01-13Bow to the whining masses and change a union back into void *. RetainMatthew Dillon
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
2003-01-12Change struct file f_data to un_data, a union of the correct structMatthew Dillon
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
2002-12-23s/sokqfilter/soo_kqfilter/ for consistency with the naming of allPoul-Henning Kamp
other socket/file operations. Notes: svn path=/head/; revision=108235
2002-12-14SCARGS removal take II.Alfred Perlstein
Notes: svn path=/head/; revision=107849
2002-12-13Backout removal SCARGS, the code freeze is only "selectively" over.Alfred Perlstein
Notes: svn path=/head/; revision=107839
2002-12-13Remove SCARGS.Alfred Perlstein
Reviewed by: md5 Notes: svn path=/head/; revision=107838
2002-03-20Remove __P.Alfred Perlstein
Notes: svn path=/head/; revision=92739
2002-02-27Simple p_ucred -> td_ucred changes to start using the per-thread ucredJohn Baldwin
reference. Notes: svn path=/head/; revision=91406
2002-01-13SMP Lock struct file, filedesc and the global file list.Alfred Perlstein
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
2002-01-08Staticise the device node pointers.Mike Smith
Notes: svn path=/head/; revision=89059
2001-12-31o Make the credential used by socreate() an explicit argument toRobert Watson
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
2001-10-29cast dev_t to int in printf to fix warning.Matthew Dillon
Notes: svn path=/head/; revision=85653
2001-09-12KSE Milestone 2Julian Elischer
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
2001-03-26Send the remains (such as I have located) of "block major numbers" toPoul-Henning Kamp
the bit-bucket. Notes: svn path=/head/; revision=74810
2001-02-15Extend kqueue down to the device layer.Jonathan Lemon
Backwards compatible approach suggested by: peter Notes: svn path=/head/; revision=72521
2001-01-23- Add necessary proc locking.John Baldwin
- 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