Commit Graph

52 Commits

Author SHA1 Message Date
Poul-Henning Kamp
f711d546d2 Suser() simplification:
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.
1999-04-27 11:18:52 +00:00
Hellmuth Michaelis
00f8b3fd87 Make pcvt compile and run again after find_display() is gone as part of
the new-bus changes. Also fix several compiler warnings.
1999-04-20 08:45:27 +00:00
Eivind Eklund
c6d0e3f0c1 Staticize. 1999-04-11 03:06:07 +00:00
Poul-Henning Kamp
4e2d2aa1cd Use suser() to check for super user rather than examining cr_uid directly.
Use TTYDEF_SPEED rather than 9600 a couple of places.

Reviewed by:	bde, with a few grumbles.
1999-01-30 12:17:38 +00:00
Kazutaka YOKOTA
47d8621a0b Fix various breakage after the recent keyboard driver change.
- Don't try to set typematic rate if there is not a keyboard.
- Fix wrong test on error code.
- Don't try to claim the keyboard twice.  The second call will fail.
1999-01-14 03:17:32 +00:00
Kazutaka YOKOTA
2ad872c579 The first stage of console driver reorganization: activate new
keyboard and video card drivers.

Because of the changes, you are required to update your kernel
configuration file now!

The files in sys/dev/syscons are still i386-specific (but less so than
before), and won't compile for alpha and PC98 yet.

syscons still directly accesses the video card registers here and
there; this will be rectified in the later stages.
1999-01-11 03:18:56 +00:00
Kazutaka YOKOTA
fc847f6651 Remove a hard-coded table of kernel console I/O functions exported
from sc, vt and sio drivers.  Use instead a linker_set to collect them.

Staticize ??cngetc(), ??cnputc(), etc functions in sc and vt drivers.
We must still have siocngetc() and siocnputc() as globals because they
are directly referred to by i386-gdbstub.c :-(

Oked by: bde
1999-01-07 14:14:24 +00:00
Peter Wemm
b3c0a3cc54 Part 3 of the pcvt/voxware revival.
Reviewed by:	core
1999-01-01 08:23:23 +00:00
Poul-Henning Kamp
9034de81c2 Pre 3.0 branch cleanup casualty #4: pcvt 1998-12-27 12:52:46 +00:00
Doug Rabson
7095ee912b * Fix a couple of places in the device pager where an address was
truncated to 32 bits.
* Change the calling convention of the device mmap entry point to
  pass a vm_offset_t instead of an int for the offset allowing
  devices with a larger memory map than (1<<32) to be supported
  on the alpha (/dev/mem is one such).

These changes are required to allow the X server to mmap the various
I/O regions used for device port and memory access on the alpha.
1998-11-08 12:39:07 +00:00
Bruce Evans
fe310de802 Initialize isa_devtab entries for interrupt handlers in individual
device drivers, not in ioconf.c.  Use a different hack in isa_device.h
so that a new config(8) is not required yet.

pc98 parts approved by: kato
1998-10-22 05:58:45 +00:00
Bruce Evans
cf8c7b0963 Added D_TTY to the cdevswitch flags for all tty drivers. This is required
for the Lite2 fix for always returning EIO in dead_read().

Cleaned up the cdevswitch initializers for all tty drivers.

Removed explicit calls to ttsetwater() from all (tty) drivers.  ttsetwater()
is now called centrally for opens, not just for parameter changes.
1998-08-23 08:26:42 +00:00
Bruce Evans
18da528d41 Changed %n to %r in devfs name format strings. %n has almost gone away. 1998-07-15 12:18:34 +00:00
Jordan K. Hubbard
24fa2d131e Check for missing keyboard.
PR:		7108
Submitted by:	Hellmuth Michaelis <hm@hcs.de>
1998-07-03 14:34:28 +00:00
Doug Rabson
ecbb00a262 This commit fixes various 64bit portability problems required for
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.
1998-06-07 17:13:14 +00:00
Eivind Eklund
303b270b0a Staticize. 1998-02-09 06:11:36 +00:00
Eivind Eklund
7b778b5e61 Make all file-system (MFS, FFS, NFS, LFS, DEVFS) related option new-style.
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.
1998-01-24 02:54:56 +00:00
Bruce Evans
239b7b699e Use ENOIOCTL instead of -1 (= ERESTART) for tty ioctls that are
not handled at a particular level.  This fixes mainly restarting
of interrupted TIOCDRAINs and TIOCSETA{W,F}s.
1997-12-06 13:25:01 +00:00
Peter Wemm
35b8b2ddab Update select -> poll in drivers. 1997-09-14 03:19:42 +00:00
Bruce Evans
921cf4d2a2 #include <machine/stdarg.h> in the one place in pcvt that it is used
instead of centrally.
1997-07-20 11:28:41 +00:00
Bruce Evans
f5f91b3249 Removed a stray semicolon. 1997-07-20 11:19:46 +00:00
Bruce Evans
8fb722b5e1 Fixed the type of timeout functions and removed casts that hid the
type mismatches.  There was no problem in practice (at least on 386's).

Don't cast NULL in calls to timeout functions.  pcvt is fully prototyped
and doesn't support K&R.

Timeout functions take args of type `void *', so use magic numbers of
type `void *' for UPDATE_* to reduce the danger of wrong conversions.

Removed FreeBSD-pre-1.1-related TIMEOUT_FUNC_T macro.  It was especially
bogus for the pre-1.1 case.
1997-04-20 16:38:22 +00:00
Bruce Evans
da3df630ac Use the same IOPL check as in syscons.
Reviewed by:	pst, joerg
1997-04-14 15:54:39 +00:00
Joerg Wunsch
f9ba24beed Fix the new (kbdio) keyboard layer to correctly work if PCVT_SCANSET == 2
even early in the boot process (boot -c or -d).

Submitted by:	yokota@zodiac.mech.utsunomiya-u.ac.jp (Kazutaka YOKOTA)
1997-03-07 08:53:16 +00:00
Joerg Wunsch
8a973ca81c Move pcvt towards using kbdio (finally!).
Warning: this won't work yet with PCVT_SCANSET=2 along in early
console mode (boot -c, or boot -d).

A big thanks to Kazutaka, and a word of apologies for delaying the
review for that long time...

Submitted by:	yokota@zodiac.mech.utsunomiya-u.ac.jp (Kazutaka YOKOTA)
1997-03-06 22:34:24 +00:00
Bruce Evans
14f3567a32 Don't claim the console when the driver is disabled. The getc/putc
part of the console driver usually works when the driver is disabled,
but the normal read/write part doesn't (it caused a panic).
1996-10-09 15:24:21 +00:00
Bruce Evans
4fab2f9bc7 Changed cncheckc() interface so that it is 8-bit clean - return -1
instead of 0 if there is no input.

pcvt_drv.c:
Partially fixed pccncheckc().  It returned a boolean value instead of
the character that it fetches from the input fifo (if any).  I think
it still discards characters after the first for multi-char input.
1996-09-14 04:30:32 +00:00
Bruce Evans
f313170d3c Updated #includes to 4.4Lite style. 1996-09-10 08:32:01 +00:00
Poul-Henning Kamp
bfbb029d87 Remove devconf, it never grew up to be of any use. 1996-09-06 23:09:20 +00:00
Joerg Wunsch
3f0aecd3b5 Fix two minor oddities introduced by my yesterday's patches:
. preserve a multi-char sequence in a small static buffer inside
  pccngetc(), so it won't be clobbered later (used to happen when
  breaking into DDB user Ctrl-Alt-ESC), and

. simplify the ``keystroke is present'' determination in sgetc(), thus
  making pccncheck() actually working without waiting for a keystroke.
1996-08-12 21:31:07 +00:00
Joerg Wunsch
fae988778b Fix many long-standing bugs and problems with pcvt, namely:
. make pccncheck() work even when interrupts are disabled, so the
  ``Press a key on the console...'' procedure will work,
. make kernel colors #ifndef, so they can be overridden from the
  config file,
. use shutdown_nice() instead of cpu_reset() if Ctrl-Alt-Del is
  enabled,
. allow pccngetc() to return more than a single character, so the
  arrow keys will work (and thus visual UserConfig!),
. fix a warning.

This closes all know PRs related to pcvt, in particular #845, #1236,
and #1265.  PR #991 is a duplicate for 845, and PR #1283 has already
been fixed earlier in rev 1.11 of pcvt_conf.h.

Submitted by:	Ulf Kieber (kieber@sax.de), for the kernel color fix
1996-08-10 22:14:36 +00:00
Gary Palmer
10a466c7d3 Clean up -Wunused warnings. Also clean up a -Winline warning while here.
Reviewed by:		bde
1996-06-12 05:04:51 +00:00
Marc G. Fournier
719d4dc5bd Added DEVFS support to create ttyv* devices
Reviewed by:	julian@freebsd.org
1996-03-28 14:30:37 +00:00
Poul-Henning Kamp
791d77e0dd Get rid of two and a half printf in the kernel.
Add more features to the one remaining to handle the job:
	+	signed quantity.
	#	alternate format
	-	left padding
	*	read width as next arg.
	n	numeric in (argument specified) default radix.

Fix the DDB debugger to use these.
Use vprintf in debug routine in pcvt.

The warnings from gcc may become more wrong and  intolerable because
of this.

Warning:  I have not checked the entire source for unsupported or
changed constructs, but generally belive that there are only a few.

Suggested by: bde
1996-01-15 22:41:03 +00:00
Bruce Evans
d1022821ae Removed my devsw access functions [un]register_cdev() and
getmajorbyname() which were a better (sigh) temporary interface to
the going-away devswitches.

Note that SYSINIT()s to initialize the devswitches would be fatal
in syscons.c and pcvt_drv.c (and are bogus elsewhere) because they
get called independently of whether the device is attached; thus
devices that share a major clobber each other's devswitch entries
until the last one wins.

conf.c:
Removed stale #includes and comments.
1995-12-14 22:03:12 +00:00
Bruce Evans
c73feca0b7 Removed new alias d_size_t for d_psize_t.
Removed old aliases d_rdwr_t and d_ttycv_t for d_read_t/d_write_t and
d_devtotty_t.

Sorted declarations of switch functions into switch order.

Removed duplicated comments and declarations of nonexistent switch
functions.
1995-12-10 15:55:34 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
Bruce Evans
fec104de77 Completed function declarations and/or added prototypes. 1995-11-24 15:15:30 +00:00
Bruce Evans
278b94817a Don't allow mmapping the page after last video page.
Obtained from:	syscons.c (bug obtained from original pccons.c)
1995-10-14 05:54:47 +00:00
Bruce Evans
2e69f359d1 Fix benign type mismatches in isa interrupt handlers. Many returned int
instead of void.
1995-09-19 18:55:37 +00:00
Bruce Evans
e7451974bb Make pcvt and syscons live in the same kernel. If both are enabled, then
the first one in the config has priority.  They can be switched using
userconfig().

i386/i386/conf.c:
Initialize the shared syscons/pcvt cdevsw entry to `nx'.

Add cdevsw registration functions.

Use devsw functions of the correct type if they exist.

i386/i386/cons.c:
Add renamed syscons entry points to constab.

i386/i386/cons.h:
Declare the renamed syscons entry points.

i386/i386/machdep.c:
Repeat console initialization after userconfig() in case the current
console has become wrong.  This depends on cn functions not wiring down
anything important.

sys/conf.h:
Declare new functions.

i386/isa/isa.[ch]:
Add a function to decide which display driver has priority.  Should be
done better.

i386/isa/syscons.c:
Rename pccn* -> sccn*.

Initialize CRTC start address in case the previous driver has moved it.

i386/isa/syscons.c, i386/isa/pcvt/*
Initialize the bogusly shared variable Crtat dynamically in case the
stored value was changed by the previous driver.

Initialize cdevsw table from a template.

Don't grab the console if another display driver has priority.

i386/isa/syscons.h, i386/isa/pcvt/pcvt_hdr.h:
Don't externally declare now-static cdevsw functions.

i386/isa/pcvt/pcvt_hdr.h:
Set the sensitive hardware flag so that pcvt doesn't always have lower
priority than syscons.  This also fixes the "stupid" detection of the
display after filling the display with text.

i386/isa/pcvt/pcvt_out.c:
Don't be confused the off-screen cursor offset 0xffff set by syscons.

kern/subr_xxx.c:
Add enough nxio/nodev/null devsw functions of the correct type for syscons
and pcvt.
1995-09-10 21:36:12 +00:00
Bruce Evans
7922019b1c Eliminate the use of TS_TIMEOUT and ttstrt(). These are for handling
tab delays etc.  pcvt was using them to recover from a (rarely lost)
race.  Use a little more locking to avoid the race.
1995-07-31 21:35:17 +00:00
Bruce Evans
9fa18570a2 Obtained from: partly from ancient patches of mine via 1.1.5
Introduce TS_CONNECTED and TS_ZOMBIE states.  TS_CONNECTED is set
while a connection is established.  It is set while (TS_CARR_ON or
CLOCAL is set) and TS_ZOMBIE is clear.  TS_ZOMBIE is set for on to
off transitions of TS_CARR_ON that occur when CLOCAL is clear and
is cleared for off to on transitions of CLOCAL.  I/o can only occur
while TS_CONNECTED is set.  TS_ZOMBIE prevents further i/o.

Split the input-event sleep address TSA_CARR_ON(tp) into TSA_CARR_ON(tp)
and TSA_HUP_OR_INPUT(tp).  The former address is now used only for
off to on carrier transitions and equivalent CLOCAL transitions.
The latter is used for all input events, all carrier transitions
and certain CLOCAL transitions.  There are some harmless extra
wakeups for rare connection- related events.  Previously there were
too many extra wakeups for non-rare input events.

Drivers now call l_modem() instead of setting TS_CARR_ON directly
to handle even the initial off to on transition of carrier.  They
should always have done this.  l_modem() now handles TS_CONNECTED
and TS_ZOMBIE as well as TS_CARR_ON.

gnu/isdn/iitty.c:
Set TS_CONNECTED for first open ourself to go with bogusly setting
CLOCAL.

i386/isa/syscons.c, i386/isa/pcvt/pcvt_drv.c:
We fake carrier, so don't also fake CLOCAL.

kern/tty.c:
Testing TS_CONNECTED instead of TS_CARR_ON fixes TIOCCONS forgetting to
test CLOCAL.  TS_ISOPEN was tested instead, but that broke when we disabled
the clearing of TS_ISOPEN for certain transitions of CLOCAL.

Testing TS_CONNECTED fixes ttyselect() returning false success for output
to devices in state !TS_CARR_ON && !CLOCAL.

Optimize the other selwakeup() call (this is not related to the other
changes).

kern/tty_pty.c:
ptcopen() can be declared in traditional C now that dev_t isn't short.
1995-07-31 21:02:00 +00:00
Bruce Evans
a16721a13a Move the inline code for waking up writers to a new function
ttwwakeup().  The conditions for doing the wakeup will soon become
more complicated and I don't want them duplicated in all drivers.

It's probably not worth making ttwwakeup() a macro or an inline
function.  The cost of the function call is relatively small when
there is a process to wake up.  There is usually a process to wake
up for large writes and the system call overhead dwarfs the function
call overhead for small writes.
1995-07-22 01:30:45 +00:00
Bruce Evans
0d1de831ea Obtained from: partly from an ancient patch of mine via 1.1.5
Temporarily nuke TS_WOPEN.  It was only used for the obscure MDMBUF
flow control option in the kernel and for informational purposes
in `pstat -t'.  The latter worked properly only for ptys.  In
general there may be multiple processes sleeping in open() and
multiple processes that successfully opened the tty by opening it
in O_NONBLOCK mode or during a window when CLOCAL was set.  tty.c
doesn't have enough information to maintain the flag but always
cleared it in ttyopen().

TS_WOPEN should be restored someday just so that `pstat -t' can
display it (MDMBUF is already fixed).  Fixing it requires counting
of processes sleeping in open() in too many serial drivers.
1995-07-21 16:30:59 +00:00
Rodney W. Grimes
9b2e535452 Remove trailing whitespace. 1995-05-30 08:16:23 +00:00
Bruce Evans
6ec8ee4578 Fix benign type mismatches int console functions. dev_t was assumed
to be `int' or smaller and some functions returned `int' instead
of `void'.  The first bug was detected when console functions were
defined in a place central enough for type checking to actually
work and the second bug was introduced when the interface was
changed to match what the console functions in other drivers actually
return.
1995-04-25 12:18:05 +00:00
Joerg Wunsch
fe696eb64c Update pcvt to 3.20 b24 1995-04-08 15:49:25 +00:00
Joerg Wunsch
7fd9907e0b Correct a few minor things in pcvt:
o  the includes are now properly done by <sys/foo.h> instead of "foo.h"
o  a bunch of undeclared functions has been resolved
o  pcvt finally supports devconfig
1995-04-01 20:16:15 +00:00
Joerg Wunsch
175fa6182a Update pcvt to 3.20b23
Submitted by:	Hellmuth Michaelis <hm@altona.hamburg.com>
1995-04-01 17:16:40 +00:00