summaryrefslogtreecommitdiffstats
path: root/sys/dev/snp/snp.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove __P.alfred2002-03-201-7/+7
|
* Fixes to make select/poll mpsafe.alfred2002-03-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: selwakeup required calling pfind which would cause lock order reversals with the allproc_lock and the per-process filedesc lock. Solution: Instead of recording the pid of the select()'ing process into the selinfo structure, actually record a pointer to the thread. To avoid dereferencing a bad address all the selinfo structures that are in use by a thread are kept in a list hung off the thread (protected by sellock). When a selwakeup occurs the selinfo is removed from that threads list, it is also removed on the way out of select or poll where the thread will traverse its list removing all the selinfos from its own list. Problem: Previously the PROC_LOCK was used to provide the mutual exclusion needed to ensure proper locking, this couldn't work because there was a single condvar used for select and poll and condvars can only be used with a single mutex. Solution: Introduce a global mutex 'sellock' which is used to provide mutual exclusion when recording events to wait on as well as performing notification when an event occurs. Interesting note: schedlock is required to manipulate the per-thread TDF_SELECT flag, however if given its own field it would not need schedlock, also because TDF_SELECT is only manipulated under sellock one doesn't actually use schedlock for syncronization, only to protect against corruption. Proc locks are no longer used in select/poll. Portions contributed by: davidc
* Make the diagnostics printfs less ugly.dd2002-03-111-4/+6
|
* Check the return value of tsleep() in snpread(). This may bedd2001-11-241-1/+4
| | | | | | | | important, since our sleep is interruptable (PCATCH flag). PR: 30985 Discovered by: Vladimir Jakovenko <vovik@lucky.net> Submitted by: Valentin Nechayev <netch@segfault.kiev.ua>
* Return EBUSY if we try to attach to a tty that is already beingdd2001-11-241-0/+2
| | | | | | | | snooped on. This causes all kinds of Bad Things(tm) to happen since closing one session will clobber state that's needed for the other one. This could theoretically be supported if the code was careful, but until somebody implements that, preventing this will stop people from unknowingly shooting themselves in the foot.
* Create a snpbasedev variable which holds a reference to the first snpdd2001-11-241-3/+9
| | | | | | | | | | | | | | | | device cloned, and assign all further devices to depend on it. This allows us to call dev_depends() on it at module unload time to get rid of /dev/snp* (in the devfs case, anyway). For this to work, we must not destroy the device at close time. [Idea stolen from if_tun.] The above has the following sideaffects: (a) The snp device used by watch(8) will remain after watch(8) exits. This is probably how it should have been all along, and how it was before devfs came along. (b) Module unload doesn't panic if there are any /dev/snp* devices which haven't been used (and thus previously destroyed). Thus, we can reenable the unload functionality disabled in rev. 1.65. PR: 32012
* 'error' is now unused, since its only purpose was to catch therwatson2001-11-151-1/+0
| | | | results of suser_td().
* Temporarily disable unloading, as it appears to be broken (read: causesrwatson2001-11-151-0/+2
| | | | panics)
* o Rely on /dev/snp* permissions, rather than using suser() in snpopen()rwatson2001-11-151-3/+0
| | | | | | to prevent inappropriate use of the snoop device. This means that, with appropriate chmod'ing, arbitrary users may make use of the snoop device.
* KSE Milestone 2julian2001-09-121-11/+11
| | | | | | | | | | | | | | 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
* Don't allocate a 512 byte buffer on the stack in snplwrite. It'sdd2001-08-161-5/+12
| | | | | | | | probably harmless in this case, since the latter is called on tty input, which is usually a result of some system call, so we've got plenty of stack left. It's still nice to fix these things, though, in case somebody ever decides this driver is a good example of something (perhaps "what you probably shouldn't do").
* Move the kernel stuff out of snoop.h. It was only there because somedd2001-07-251-0/+39
| | | | | of the snp* functions needed to be called from tty.c, which is no longer the case.
* Keep track of all "struct snoop"'s so that snp_modevent can fail withdd2001-07-181-1/+9
| | | | EBUSY if there's a device still open.
* Add a line discipline close routine which restores some functionalitydd2001-06-051-5/+21
| | | | | I accidently nuked in rev. 1.54. Also rework the error handling in snplwrite a little.
* Style and cosmetic cleanups. This driver is now reasonably stlye(9)dd2001-06-051-111/+127
| | | | | | | | | compliant. All the variable definitions and function names are reasonably consistent, and the functions which should be static (i.e., all of them) are. Other assorted fixes were made. The majority of the delta is indentation fixes. Partially reviewed by: bde
* Use the l_nullioctl exported from tty_conf.c rather than rolling our own.dd2001-06-041-10/+0
|
* Remove unused includes, use *min() inline functions rather than add2001-06-031-26/+8
| | | | | | | home-grown macro, rewrite a confusing conditional in snpdevtotty(), and change ibuf to 512 bytes instead of 1024 bytes in dsnwrite(). Reviewed by: bde
* Convert this driver to (ab?)use line disciplines to get the input itdd2001-05-221-17/+84
| | | | | | | needs instead of relying on idiosyncratic hacks in the tty subsystem. Also add module code since this can now be compiled as a module. Silence by: -hackers, -audit
* Make this driver play ball with devfs(5).dd2001-04-171-3/+19
| | | | Reviewed by: brian
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
* Remove unused #include "snp.h"peter2001-01-291-1/+0
|
* Convert more malloc+bzero to malloc+M_ZERO.dwmalone2000-12-081-2/+1
| | | | | Submitted by: josh@zipperup.org Submitted by: Robert Drehmel <robd@gmx.net>
* Staticize some malloc M_ instances.phk2000-12-081-1/+1
|
* Move suser() and suser_xxx() prototypes and a related #define fromphk2000-10-291-1/+0
| | | | | | | | | <sys/proc.h> to <sys/systm.h>. Correctly document the #includes needed in the manpage. Add one now needed #include of <sys/systm.h>. Remove the consequent 48 unused #includes of <sys/proc.h>.
* Unstaticize this driver. You can have as many snoop devices as you cangreen2000-04-021-65/+61
| | | | | | mknod :) Clean things up a lot while I'm here. A lot of KNF changes.
* Remove cdevsw_add() - the make_dev() calls are already there.peter1999-11-181-8/+1
| | | | | Don't '#if NSNP > 0' around the thing as it's silly and not required. config(8) only causes it to be compiled if NSNP is > 0 by definition.
* Remove five now unused fields from struct cdevsw. They should neverphk1999-09-251-5/+0
| | | | | | | | have been there in the first place. A GENERIC kernel shrinks almost 1k. Add a slightly different safetybelt under nostop for tty drivers. Add some missing FreeBSD tags
* This patch clears the way for removing a number of tty relatedphk1999-09-251-3/+3
| | | | | | | | | | | | | | | | | | | | | fields in struct cdevsw: d_stop moved to struct tty. d_reset already unused. d_devtotty linkage now provided by dev_t->si_tty. These fields will be removed from struct cdevsw together with d_params and d_maxio Real Soon Now. The changes in this patch consist of: initialize dev->si_tty in *_open() initialize tty->t_stop remove devtotty functions rename ttpoll to ttypoll a few adjustments to these changes in the generic code a bump of __FreeBSD_version add a couple of FreeBSD tags
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Convert DEVFS hooks in (most) drivers to make_dev().phk1999-08-231-24/+5
| | | | | | | | | | | | | | | | Diskslice/label code not yet handled. Vinum, i4b, alpha, pc98 not dealt with (left to respective Maintainers) Add the correct hook for devfs to kern_conf.c The net result of this excercise is that a lot less files depends on DEVFS, and devtoname() gets more sensible output in many cases. A few drivers had minor additional cleanups performed relating to cdevsw registration. A few drivers don't register a cdevsw{} anymore, but only use make_dev().
* Add Id stringsgpalmer1999-06-171-0/+2
|
* Fixed a missing userland dev_t to kernel dev_t conversion.bde1999-06-171-1/+1
|
* Simplify cdevsw registration.phk1999-05-311-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | The cdevsw_add() function now finds the major number(s) in the struct cdevsw passed to it. cdevsw_add_generic() is no longer needed, cdevsw_add() does the same thing. cdevsw_add() will print an message if the d_maj field looks bogus. Remove nblkdev and nchrdev variables. Most places they were used bogusly. Instead check a dev_t for validity by seeing if devsw() or bdevsw() returns NULL. Move bdevsw() and devsw() functions to kern/kern_conf.c Bump __FreeBSD_version to 400006 This commit removes: 72 bogus makedev() calls 26 bogus SYSINIT functions if_xe.c bogusly accessed cdevsw[], author/maintainer please fix. I4b and vinum not changed. Patches emailed to authors. LINT probably broken until they catch up.
* This commit should be a extensive NO-OP:phk1999-05-301-4/+21
| | | | | | | | | | | | | Reformat and initialize correctly all "struct cdevsw". Initialize the d_maj and d_bmaj fields. The d_reset field was not removed, although it is never used. I used a program to do most of this, so all the files now use the same consistent format. Please keep it that way. Vinum and i4b not modified, patches emailed to respective authors.
* Use NODEV instead of -1phk1999-05-101-4/+4
|
* I got tired of seeing all the cdevsw[major(foo)] all over the place.phk1999-05-081-1/+1
| | | | | | | | Made a new (inline) function devsw(dev_t dev) and substituted it. Changed to the BDEV variant to this format as well: bdevsw(dev_t dev) DEVFS will eventually benefit from this change too.
* Add sufficient braces to keep egcs happy about potentially ambiguouspeter1999-05-061-2/+2
| | | | if/else nesting.
* Suser() simplification:phk1999-04-271-1/+1
| | | | | | | | | | | | | | | | | | | 1: s/suser/suser_xxx/ 2: Add new function: suser(struct proc *), prototyped in <sys/proc.h>. 3: s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/ The remaining suser_xxx() calls will be scrutinized and dealt with later. There may be some unneeded #include <sys/cred.h>, but they are left as an exercise for Bruce. More changes to the suser() API will come along with the "jail" code.
* Fix warnings in preparation for adding -Wall -Wcast-qual to thedillon1999-01-271-2/+2
| | | | kernel compile
* KNFize, by bde.eivind1999-01-101-3/+2
|
* Split DIAGNOSTIC -> DIAGNOSTIC, INVARIANTS, and INVARIANT_SUPPORT aseivind1999-01-081-7/+4
| | | | | | | | | discussed on -hackers. Introduce 'KASSERT(assertion, ("panic message", args))' for simple check + panic. Reviewed by: msmith
* This commit fixes various 64bit portability problems required fordfr1998-06-071-1/+1
| | | | | | | | | | FreeBSD/alpha. The most significant item is to change the command argument to ioctl functions from int to u_long. This change brings us inline with various other BSD versions. Driver writers may like to use (__FreeBSD_version == 300003) to detect this change. The prototype FreeBSD/alpha machdep will follow in a couple of days time.
* Don't depend on "implicit int" or bloat the data section in thebde1998-02-201-1/+1
| | | | declaration of xxx_devsw_installed.
* Back out DIAGNOSTIC changes.eivind1998-02-061-1/+0
|
* Turn DIAGNOSTIC into a new-style option.eivind1998-02-041-0/+1
|
* Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.eivind1998-01-241-0/+1
| | | | | | | | This introduce an xxxFS_BOOT for each of the rootable filesystems. (Presently not required, but encouraged to allow a smooth move of option *FS to opt_dontuse.h later.) LFS is temporarily disabled, and will be re-enabled tomorrow.
* Make COMPAT_43 and COMPAT_SUNOS new-style options.eivind1997-12-161-0/+2
|
* Removed unused #includes. Ifdefed a conditionally used #include.bde1997-11-181-14/+7
| | | | | | | | Fixed nonblocking mode. It was per-device instead of per-file. Don't depend on gcc's misfeature of rewriting char args in old-style function definitions to match wrong prototypes. Break K&R1 support to fix this quickly.
* Last major round (Unless Bruce thinks of somthing :-) of malloc changes.phk1997-10-121-1/+1
| | | | | | | | Distribute all but the most fundamental malloc types. This time I also remembered the trick to making things static: Put "static" in front of them. A couple of finer points by: bde
* Fixed gratuitous ANSIisms.bde1997-09-161-1/+3
|
OpenPOWER on IntegriCloud