Commit Graph

2723 Commits

Author SHA1 Message Date
Brian Feldman ff8b0106a8 Get rid of some evil defines (a pair of snd and rcv.) 1999-09-17 21:38:24 +00:00
Matthew Dillon bb01f28e97 Add vfs.enable_userblk_io sysctl to control whether user reads and writes
to buffered block devices are allowed.  The default is to be backwards
    compatible, i.e. reads and writes are allowed.

    The idea is for a larger crowd to start running with this disabled and
    see what problems, if any, crop up, and then to change the default to
    off and see if any problems crop up in the next 6 months prior to
    potentially removing support entirely.  There are still a few people,
    Julian and myself included, who believe the buffered block device
    access from usermode to be useful.

    Remove use of vnode->v_lastr from buffered block device I/O in
    preparation for removal of vnode->v_lastr field, replacing it with
    the already existing seqcount metric to detect sequential operation.

Reviewed by:	Alan Cox <alc@cs.rice.edu>, David Greenman <dg@root.com>
1999-09-17 06:10:27 +00:00
Poul-Henning Kamp abd1f5736e Register the right cdevsw on the master device.
Detected by:	sos
1999-09-13 18:20:21 +00:00
Bruce Evans 37d3877723 Moved the definition of `boottime' and its sysctl to the correct file. 1999-09-13 14:22:27 +00:00
Bruce Evans 34d32cd340 Const poisoning from d_name.
Fixed some style bugs in recent changes.
1999-09-13 14:12:23 +00:00
Bruce Evans 887ba12fc5 Removed diskerr()'s unused d_name arg and updated callers. This fixes
warnings caused by the arg having the wrong type (not const enough).
The arg was also wrong (a full name instead of a short one) for calls
from from subr_diskmbr.c and pc98/diskslice_machdep.c.
1999-09-13 12:59:41 +00:00
Bruce Evans c32cc1493f Const'ify devtoname() and d_name. This exposes some errors (2 non-benign).
Handle negative minor numbers properly in devtoname().
1999-09-13 12:29:32 +00:00
Poul-Henning Kamp 2016e4e906 Bite the bullet and allocate the devsw entry at compile time. 1999-09-12 20:40:29 +00:00
Poul-Henning Kamp 3febdd8fb8 Use a different tactic when creating the devsw so that disk_create()
doesn't need to malloc.
1999-09-12 09:16:00 +00:00
Poul-Henning Kamp f5756ee9f5 Remove replace phygetvpbuf() with direct call to getpbuf(); 1999-09-12 08:27:41 +00:00
Bruce Evans 9ef246c682 Get rid of MALLOC_INSTANTIATE and MALLOC_MAKE_TYPE(). Just handle the 3
malloc types declared in <sys/malloc.h> like other global malloc types.
1999-09-11 16:41:39 +00:00
Alfred Perlstein 818a7190ae regenerate to include proper "gererated from" taglines. 1999-09-11 01:06:03 +00:00
Alfred Perlstein c24fda81c9 Seperate the export check in VFS_FHTOVP, exports are now checked via
VFS_CHECKEXP.

Add fh(open|stat|stafs) syscalls to allow userland to query filesystems
based on (network) filehandle.

Obtained from:	NetBSD
1999-09-11 00:46:08 +00:00
Peter Wemm dc42fe3cb3 Add $FreeBSD$ tags to generated files otherwise the checker won't let them
be committed.
1999-09-10 23:34:30 +00:00
Poul-Henning Kamp 168e3d05f9 Create and use a dedicated malloc type for bus related stuff.
Reviewed by:	dfr
1999-09-10 21:11:23 +00:00
Julian Elischer 85a219d201 Changes to centralise the default blocksize behaviour.
More likely to follow.

Submitted by: phk@freebsd.org
1999-09-09 19:08:44 +00:00
Alfred Perlstein 5a5fccc8e7 All unimplemented VFS ops now have entries in kern/vfs_default.c that return
reasonable defaults.

This avoids confusing and ugly casting to eopnotsupp or making dummy functions.
Bogus casting of filesystem sysctls to eopnotsupp() have been removed.

This should make *_vfsops.c more readable and reduce bloat.

Reviewed by:	msmith, eivind
Approved by:	phk
Tested by:	Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>
1999-09-07 22:42:38 +00:00
Doug Rabson 062acdb7e7 Change isa_get/set_flags() to device_get/set_flags(). 1999-09-07 08:42:49 +00:00
Peter Wemm 05385ecdf7 Set up FPU state on the AP.
Tested by:	phk
1999-09-05 20:17:40 +00:00
Bruce Evans 8f5e349bf1 Fixed style bugs in rev.1.36-1.39. 1999-09-04 14:21:42 +00:00
Bruce Evans b9e91a85a6 Fixed style regressions in previous commit. 1999-09-04 13:30:18 +00:00
Peter Wemm 68103740e6 Fix a warning for the !DEVFS case. 1999-09-03 19:21:49 +00:00
Luoqi Chen d8a31f810f Allow getblk() to be called from an idle context (by panic() inside
an interrupt handler).

Reviewed by:	dillon
1999-09-03 17:49:25 +00:00
Julian Elischer 7012bab988 Revert a bunch of contraversial changes by PHK. After
a quick think and discussion among various people some form of some of
these changes will probably be recommitted.

The reversion requested was requested by dg while discussions proceed.
PHK has indicated that he can live with this, and it has been agreed
that some form of some of these changes may return shortly after further
discussion.
1999-09-03 05:16:59 +00:00
Sean Eric Fagan f3a6cf7052 Make prototype match function. 1999-09-01 16:21:57 +00:00
Poul-Henning Kamp e3dca63008 Use "multiple 4 char outdent until no wrap" rather than ANSI string
concatenation to preserve K&R compatibility.

Requested by: bde
Terminology by: grog
1999-09-01 09:39:11 +00:00
Poul-Henning Kamp 8684f73af8 Improve the micro "disk" layer after gaining more experience with it. 1999-09-01 05:38:09 +00:00
Poul-Henning Kamp de5f40afa6 Improve the returned values in st_blksize a little bit, avoid
accessing union fields not valid for dev_t type.
1999-09-01 05:36:55 +00:00
Julian Elischer fca666a142 General cleanup of core-dumping code.
Submitted by: Sean Fagan,
1999-09-01 00:29:56 +00:00
Poul-Henning Kamp d27535c143 Include "dscheck" and device name in all messages from dscheck(). 1999-08-31 18:36:15 +00:00
Tor Egge 87f7b9a9c1 If integration of a buffer into a cluster write operation fails, release
the buffer instead of creating a future deadlock.
PR:		12800
Submitted by:	dillon
1999-08-31 14:18:32 +00:00
Jonathan Lemon 9b8b58e033 Restructure TCP timeout handling:
- eliminate the fast/slow timeout lists for TCP and instead use a
    callout entry for each timer.
  - increase the TCP timer granularity to HZ
  - implement "bad retransmit" recovery, as presented in
    "On Estimating End-to-End Network Path Properties", by Allman and Paxson.

Submitted by:	jlemon, wollmann
1999-08-30 21:17:07 +00:00
Dima Ruban 8c0abeface ktrace should not follow symlinks either.
Suggested by:	bde
1999-08-30 19:08:28 +00:00
Poul-Henning Kamp 5968e18b69 pps_shiftmax only exists #ifdef PPS_SYNC
Found by:	Roger Hardiman <roger@cs.strath.ac.uk>
1999-08-30 16:21:32 +00:00
Poul-Henning Kamp 82e84c5bd2 Update to the latest nanokernel from Dave Mills. 1999-08-30 12:04:49 +00:00
Poul-Henning Kamp c5b72c3d85 s/si_tty_tty/si_tty/g 1999-08-30 10:35:37 +00:00
Poul-Henning Kamp 02e1576966 Make bdev userland access work like cdev userland access unless
the highly non-recommended option ALLOW_BDEV_ACCESS is used.

(bdev access is evil because you don't get write errors reported.)

Kill si_bsize_best before it kills Matt :-)

Use the specfs routines rather having cloned copies in devfs.
1999-08-30 07:56:23 +00:00
Poul-Henning Kamp c5b072197a Remove unneeded "maj" variable.
Give up if we have already started dumping once before.

Print name of dumpdev.
1999-08-29 14:54:11 +00:00
Poul-Henning Kamp da9e4f5550 Add micro "disk" layer which should enable us to pull all the slice/label
stuff out of the device drivers.
1999-08-29 13:28:55 +00:00
Poul-Henning Kamp f054c29093 Merge alpha and pc98 changes into i386 MBR handling code and replace all
three copies with one copy in MI land.
1999-08-29 09:12:54 +00:00
Poul-Henning Kamp 83d34e0b60 initialize si_bsize_phys from what the drive told us. 1999-08-29 09:10:05 +00:00
Poul-Henning Kamp d137accc89 Add dev_t freeing code. Controlled by sysctl debug.free_devt, default
is off.
1999-08-29 09:09:12 +00:00
Poul-Henning Kamp a87b535090 Put a brief comment on a couple of #defines. 1999-08-28 19:21:36 +00:00
Poul-Henning Kamp 9626728875 remove unused variables. 1999-08-28 19:21:03 +00:00
Poul-Henning Kamp 10af1a2b5f We don't need to pass the diskname argument all over the diskslice/label
code, we can find the name from any convenient dev_t
1999-08-28 14:33:44 +00:00
Peter Wemm 2185977908 Regen after Id->FreeBSD 1999-08-28 02:35:56 +00:00
Peter Wemm dacec3e8f2 Id -> FreeBSD 1999-08-28 01:15:37 +00:00
Peter Wemm c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Marcel Moolenaar c6dfea0ebd Add sysctl variables for the Linuxulator. These reside under `compat.linux' as
discussed on current.

The following variables are defined (for now):

    osname (defaults to "Linux")
        Allow users to change the name of the OS as returned by uname(2),
        specially added for all those Linux Netscape users and statistics
        maniacs :-) We now have what we all wanted!

    osrelease (defaults to "2.2.5")
        Allow users to change the version of the OS as returned by uname(2).
        Since -current supports glibc2.1 now, change the default to 2.2.5
        (was 2.0.36).

    oss_version (defaults to 198144 [0x030600])
        This one will be used by the OSS_GETVERSION ioctl (PR 12917) which I
        can commit now that we have the MIB. The default version number is the
        lowest version possible with the current 'encoding'.

A note about imprisoned processes (see jail(2)):
  These variables are copy-on-write (as suggested by phk). This means that
  imprisoned processes will use the system wide value unless it is written/set
  by the process. From that moment on, a copy local to the prison will be
  used.

A note about the implementation:
  I choose to add a single pointer to struct prison, because I didn't like the
  idea of changing struct prison every time I come up with a new variable. As
  a side effect, the extra storage is only needed when a variable is set from
  within the prison. This also minimizes kernel bloat when the Linuxulator is
  not used; both compiled in or as a module.

Reviewed by: bde (first version only) and phk
1999-08-27 19:47:41 +00:00
Brian Feldman b5fca1cb2a Add FIODTYPE ioctl for getting d_flags (type) info on a device.
Okayed by:	phk
1999-08-27 16:35:37 +00:00
Dima Ruban d44e415624 Don't follow symlinks on coredumps.
Reviewed by:	dillon && security-officer
1999-08-26 17:32:48 +00:00
Poul-Henning Kamp dbafb3660f Simplify the handling of VCHR and VBLK vnodes using the new dev_t:
Make the alias list a SLIST.

        Drop the "fast recycling" optimization of vnodes (including
        the returning of a prexisting but stale vnode from checkalias).
        It doesn't buy us anything now that we don't hardlimit
        vnodes anymore.

        Rename checkalias2() and checkalias() to addalias() and
        addaliasu() - which takes dev_t and udev_t arg respectively.

        Make the revoke syscalls use vcount() instead of VALIASED.

        Remove VALIASED flag, we don't need it now and it is faster
        to traverse the much shorter lists than to maintain the
        flag.

        vfs_mountedon() can check the dev_t directly, all the vnodes
        point to the same one.

Print the devicename in specfs/vprint().

Remove a couple of stale LFS vnode flags.

Remove unimplemented/unused LK_DRAINED;
1999-08-26 14:53:31 +00:00
Poul-Henning Kamp 41d2e3e09e Introduce vn_isdisk(struct vnode *vp) function, and use it to test for diskness. 1999-08-25 12:24:39 +00:00
Poul-Henning Kamp a431597b25 Add a couple of missing but unimportant break; statements. 1999-08-25 11:44:11 +00:00
Julian Elischer 0ff7b13acd Make DEVFS use PHK's specinfo struct as the source of dev_t and devsw.
In lookup() however it's the other way around as we need to supply the
dev_t for the vnode, so devfs still has a copy of it stashed away.

Sourcing it from the vnode in the vnops however is useful as it makes
a lot of the code almost the same as that in specfs.
1999-08-25 04:55:20 +00:00
Bruce Evans d009ccfaf5 Cast pointers to uintptr_t instead of casting them to u_long, and/or vice
versa.  Cosmetic.
1999-08-24 00:56:50 +00:00
Bruce Evans 0921e4886f Cast pointers to uintptr_t instead of casting them to u_long. They
are still converted to u_long by assignment of the uintptr_t, and
address calculations are still done using u_long.  This is OK for
currently supported machines, but addresses should be represented
by vm_offset_t or uintptr_t in case pointers are longer than longs.

"Fixed" size of linker_path[].  MAXPATHLEN + 1 was 1 too large for
search paths with only one file path in them, but much too small
for search paths with several long file paths in them.
1999-08-24 00:38:52 +00:00
Poul-Henning Kamp 9dcbe2404a Convert DEVFS hooks in (most) drivers to make_dev().
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().
1999-08-23 20:59:21 +00:00
Bruce Evans d918320517 Use devtoname() to print dev_t's instead of casting them to long or u_long
for misprinting in %lx format.
1999-08-23 20:35:21 +00:00
Martin Cracauer 84300d6265 Fix a mistake in my last SA_SIGINFO commit. Processes could block
SIGKILL and SIGSTOP.

PR:		kern/13293
Submitted by:	dwmalone@maths.tcd.ie
Obtained from:	PR had correct fix
1999-08-23 13:53:25 +00:00
John Polstra af255dc5f2 Go back to using microtime() to get the timestamps for {f,l,}utimes(path,
NULL) for now.  Bruce says I jumped the gun with my change in
revision 1.131, or maybe it should use nanotime(), or maybe it
shouldn't be decided in the VFS layer at all.  I'm leaving it with
the old behavior until the Trans-Pacific Internet Vulcan Mind Meld
yields fuller understanding.
1999-08-22 16:50:30 +00:00
Nick Hibma 4b012a7cb1 1) Add HEADER section. Similar to CODE.
2) deindent the two sections (CODE and HEADER), based on the indent found
   on the first line of the section; to make the output more readable.
1999-08-22 16:21:29 +00:00
John Polstra 4f2a0d4f96 Use the new vfs_timestamp() function to create the timestamps used
by utimes(path, NULL).  This gives them the same precision as the
timestamps produced by write operations.  Do likewise for lutimes()
and futimes().

Suggested by bde.
1999-08-22 01:46:57 +00:00
John Polstra a2801b7731 Support full-precision file timestamps. Until now, only the seconds
have been maintained, and that is still the default.  A new sysctl
variable "vfs.timestamp_precision" can be used to enable higher
levels of precision:

      0 = seconds only; nanoseconds zeroed (default).
      1 = seconds and nanoseconds, accurate within 1/HZ.
      2 = seconds and nanoseconds, truncated to microseconds.
    >=3 = seconds and nanoseconds, maximum precision.

Level 1 uses getnanotime(), which is fast but can be wrong by up
to 1/HZ.  Level 2 uses microtime().  It might be desirable for
consistency with utimes() and friends, which take timeval structures
rather than timespecs.  Level 3 uses nanotime() for the higest
precision.

I benchmarked levels 0, 1, and 3 by copying a 550 MB tree with
"cpio -pdu".  There was almost negligible difference in the system
times -- much less than 1%, and less than the variation among
multiple runs at the same level.  Bruce Evans dreamed up a torture
test involving 1-byte reads with intervening fstat() calls, but
the cpio test seems more realistic to me.

This feature is currently implemented only for the UFS (FFS and
MFS) filesystems.  But I think it should be easy to support it in
the others as well.

An earlier version of this was reviewed by Bruce.  He's not to
blame for any breakage I've introduced since then.

Reviewed by:	bde (an earlier version of the code)
1999-08-22 00:15:16 +00:00
Poul-Henning Kamp 60767bf422 Use more compiler friendly test for overflow.
Submitted by:	bde
1999-08-21 18:22:44 +00:00
Poul-Henning Kamp 3b782ee9d2 Detect if the the offset used to read from a raw device loose bits
when converted to block number.
1999-08-21 06:48:16 +00:00
Mike Smith fcb893a801 Implement a new generic mechanism for attaching handler functions to
events, in order to pave the way for removing a number of the ad-hoc
implementations currently in use.

Retire the at_shutdown family of functions and replace them with
new event handler lists.

Rework kern_shutdown.c to take greater advantage of the use of event
handlers.

Reviewed by:	green
1999-08-21 06:24:40 +00:00
Julian Elischer 1744fcd082 First small steps at merging DEVFS and PHK's Dev_t stuff. 1999-08-20 20:25:00 +00:00
Greg Lehey 4033a962bf Change the name of the static variable 'files' to 'linker_files' in
order to be able to refer to it uniquely from the kernel debugger.

Approved-by:	 peter
1999-08-20 00:18:07 +00:00
Peter Wemm 42cef09ba2 Fix a typo and a bug.
- One RTP_PRIO_REALTIME was meant to be RTP_PRIO_IDLE.
- RTP_PRIO_FIFO was not handled.
- Move the usual case first for setrunqueue() etc.
1999-08-19 16:06:08 +00:00
Peter Wemm 26d12af46c Don't initialize run queues here, do it all in one place. 1999-08-19 00:14:43 +00:00
Peter Wemm f33a7ade5d Run queue heads have moved to TAILQ's. 1999-08-19 00:13:58 +00:00
Peter Wemm dba6c5a6f9 Extract the next runnable process selection out of cpu_switch() into a
fairly machine independent C routine.  gcc actually does a pretty good
job of this.

Reviewed by:	msmith (in principle)
1999-08-19 00:06:53 +00:00
Nick Hibma 3d9a083508 Remove redundant spaces in the whole line, not only the first occurrence.
(not that anyone actually reads the created .c and .h files :)
1999-08-18 08:39:14 +00:00
Julian Elischer 944494356b Devfs isn't quite dead yet... Add back devfs support to ptys..
When you use pty(N) it creates pty(N+1) ready for your use in the DEVFS,
so DEVFS is not cluttered up with hundreds of ptys you are never going to
use.
1999-08-17 23:08:51 +00:00
Bill Fumerola b8e49f681b Welcome devtoname(), to most likely be used when printing information
about a dev_t.

printf("%x", dev) now becomes printf("%s", devtoname(dev)) because
printing actual information about the device is much more useful then
printing a pointer to an address that would never help the developer debug.

Submitted by:	phk, bde
1999-08-17 20:25:50 +00:00
Nick Hibma 394b7d0877 Change calling of chained event handler from always after
the attach/detach to
1) MOD_LOAD before attach
2) MOD_UNLOAD after detach

The driver specific event handler can now be used to function as
driver specific init/deinit function (compare to device specific
init/deinit functions: attach & detach).
1999-08-16 21:44:14 +00:00
Bill Fumerola 87f1de5f58 expand_name:
use pid_t and uid_t in the declaration as that is what we are passed
	fix printf formatters accordingly.

Reviewed by:	green
1999-08-16 18:13:39 +00:00
Poul-Henning Kamp 9a27d57978 Introduce lminor(dev_t dev), which returns a linear minor number,
ie: hides the fact that the major number is stuck in the middle.
1999-08-15 09:32:47 +00:00
Alfred Perlstein ce38ca0fb5 Fix potential overflow, remove unnecessary bzero.
Pointed out by: green

remove redundant strlen, sprintf returns the length.

Reviewed by: peter
1999-08-14 19:58:58 +00:00
Nick Hibma 43818d4ec7 add debugging message in unregister_method 1999-08-14 13:32:25 +00:00
Nick Hibma dd473d08e0 Minor spelling glitch 1999-08-14 13:20:04 +00:00
Poul-Henning Kamp 49ff4debd3 Spring cleaning around strategy and disklabels/slices:
Introduce BUF_STRATEGY(struct buf *, int flag) macro, and use it throughout.
please see comment in sys/conf.h about the flag argument.

Remove strategy argument from all the diskslice/label/bad144
implementations, it should be found from the dev_t.

Remove bogus and unused strategy1 routines.

Remove open/close arguments from dssize().  Pick them up from dev_t.

Remove unused and unfinished setgeom support from diskslice/label/bad144 code.
1999-08-14 11:40:51 +00:00
Bill Paul b7f6c65f7c Grrrr. Fix a really lame bug that I tripped over while testing my miibus
stuff: unregister_methods() is horribly broken. The idea, if I'm not mistaken,
is that the refcount on a method is decremented, and only when it reaches
zero is the method freed. However desc->method is set to NULL unconditionally
regardless of the refcount, which means the method pointer is trashed the
first time the method is deallocated. The obvious detrimental effect is
that memory is leaked. The not so obvious effect is that when you call
unregister_method() the second time on the same method, you get a NULL
pointer dereference and a panic.

Now I can successfully unload network device drivers and the miibus module
without crashing the system.

*sigh*
1999-08-14 05:11:01 +00:00
Poul-Henning Kamp 0232a25188 oops: Add missing include. 1999-08-13 11:22:48 +00:00
Poul-Henning Kamp 3a965c0db0 Move the special-casing of stat(2)->st_blksize for device files
from UFS to the generic level.  For chr/blk devices we don't care
about the blocksize of the filesystem, we want what the device
asked for.
1999-08-13 10:56:07 +00:00
Poul-Henning Kamp 7248b5ce36 Register our dev_t with make_dev 1999-08-13 10:52:22 +00:00
Poul-Henning Kamp 7dc5cd047f The bdevsw() and cdevsw() are now identical, so kill the former. 1999-08-13 10:29:38 +00:00
Poul-Henning Kamp 4d4f932326 s/v_specinfo/v_rdev/ 1999-08-13 10:10:12 +00:00
Alfred Perlstein f4af31cb1c Replace a redundant vfs_object_create() call (already done in vn_open)
with a KASSERT.

Reviewed by: Eivind, Alan Cox
1999-08-12 20:38:32 +00:00
Peter Wemm e426af039f Make subr_bus.c actually compile with -DBUS_DEBUG 1999-08-11 22:55:39 +00:00
Nik Clayton 2395507999 Add CPT_NOA, LIBCOMPAT, NODEF, NOARGS, NOPROTO, and NOIMPL to the commented
list of available types.

PR:             docs/13007
Submitted by:   Assar Westerlund <assar@sics.se>
1999-08-11 22:13:46 +00:00
Peter Wemm 3af0907ba4 Zap some stray references to DRIVER_TYPE_foo in the BUS_DEBUG case, as
discovered by Bill Paul.
1999-08-11 22:05:17 +00:00
Warner Losh fdf4e8b30c Stop profiling on exec.
Obtained from: NetBSD
1999-08-11 20:35:38 +00:00
Alfred Perlstein 59d5fe5a90 When doing a dump, if ENODEV is returned explain what happened to the user,
"the device doesn't support a dump routine"

Only print "dump succeeded" when 0 is returned, instead of when an unexpected
error number is returned, print that error number.

Reviewed by: Eivind
1999-08-11 14:02:20 +00:00
Poul-Henning Kamp f1fe3bf115 make alpha compile again. 1999-08-09 11:02:45 +00:00
Poul-Henning Kamp ce9edcf5b5 Merge the cons.c and cons.h to the best of my ability. alpha may or
may not compile, I can't test it.
1999-08-09 10:35:05 +00:00
Poul-Henning Kamp 7517504c24 Enable ttymalloc(). 1999-08-08 20:24:58 +00:00
Poul-Henning Kamp 08add33166 Add new sysctl "kern.ttys" which return all the struct tty's which have
been registered with ttyregister().

register ptys with ttyregister().
1999-08-08 19:47:32 +00:00
Poul-Henning Kamp ef40c56108 Make the pty driver as close to a cloning device as we can get for now,
we create the pty on the fly when it is first opened.

If you run out of ptys now, just MAKEDEV some more.

This also demonstrate the use of dev_t->si_tty_tty and dev_t->si_drv1
in a device driver.
1999-08-08 19:28:59 +00:00
Poul-Henning Kamp 0ef1c82630 Decommision miscfs/specfs/specdev.h. Most of it goes into <sys/conf.h>,
a few lines into <sys/vnode.h>.

Add a few fields to struct specinfo, paving the way for the fun part.
1999-08-08 18:43:05 +00:00
Greg Lehey 32c0c324d5 cdevsw_remove: place correct value in bmaj2cmaj. This had caused
warnings of the following nature on reloading a kld:

  WARNING: "vinum" is usurping "console"'s bmaj

This only applies to cases where "console" is mentioned.

Broken-by:	  grog
1999-08-08 00:34:00 +00:00
Brian Feldman 301ca4ffe6 Make long longs ("%ll" format) work.
Reviewed by:	msmith
1999-08-07 20:13:32 +00:00
Jordan K. Hubbard 909bbf3c49 Re-commit these files after updating syscalls.master (in the proper order
this time).

Pointed out by:		bde
1999-08-05 08:26:27 +00:00
Jordan K. Hubbard 45f26d4120 Move syscall 180 back to where it was before and fix the
incorrect comment which led me to move it in the first place.
1999-08-05 08:18:45 +00:00
Jordan K. Hubbard b24eb2795d Reserve a syscall for the arla folks. I'm assuming that since syscalls.c
and init_sysent.c are checked into CVS, I should also commit the regenerated
copies even though they're built by syscalls.master.  Correct?  Bruce? :)
1999-08-04 20:04:25 +00:00
Brian Feldman e32c66c539 Fix fd race conditions (during shared fd table usage.) Badfileops is
now used in f_ops in place of NULL, and modifications to the files
are more carefully ordered. f_ops should also be set to &badfileops
upon "close" of a file.

This does not fix other problems mentioned in this PR than the first
one.

PR:		11629
Reviewed by:	peter
1999-08-04 18:53:50 +00:00
Warner Losh 711103c1cc o Typo in prior version kept it from compiling (blush).
Noticed by: Nobody!

o Add comment about why we restrict chflags to root for devices.
o nit noticed by bde wrt return values.
1999-08-04 04:52:18 +00:00
Warner Losh e82ef978fe brucify:
o use suser_xxx rather than suser to support JAIL code.
	o KNF comment convention
	o use vp->type rather than vaddr.type and eliminate call to
	  VOP_GETATTR.  Bruce says that vp->type is valid at this
	  point.

Submitted by: bde.

Not fixed:
	o return (value)
	o Comment needs to be longer and more explicit.  It will be after
	  the advisory.
1999-08-03 17:07:04 +00:00
Warner Losh f76f09c129 Only allow root to set file flags on devices. 1999-08-02 21:34:46 +00:00
Brian Feldman ab533dd005 lutimes() bug: FOLLOW should be NOFOLLOW for this one.
Submitted by:	Dan Nelson <dnelson@emsphone.com>
1999-07-29 17:02:56 +00:00
Bruce Evans 992fd07673 Removed references to a nonexistent variable. This fixes building kernels
without -O.
1999-07-29 07:14:28 +00:00
Matthew N. Dodd f4e3b1e7dd Fix a typo.
Back out a few lines that I haven't dealt with properly yet.

Snickered at by: Mike Smith
1999-07-29 01:51:49 +00:00
Matthew N. Dodd 15317dd875 Alter the behavior of sys/kern/subr_bus.c:device_print_child()
- device_print_child() either lets the BUS_PRINT_CHILD
	  method produce the entire device announcement message or
	  it prints "foo0: not found\n"

Alter sys/kern/subr_bus.c:bus_generic_print_child() to take on
the previous behavior of device_print_child() (printing the
"foo0: <FooDevice 1.1>" bit of the announce message.)

Provide bus_print_child_header() and bus_print_child_footer()
to actually print the output for bus_generic_print_child().
These functions should be used whenever possible (unless you can
just use bus_generic_print_child())

The BUS_PRINT_CHILD method now returns int instead of void.

Modify everything else that defines or uses a BUS_PRINT_CHILD
method to comply with the above changes.

	- Devices are 'on' a bus, not 'at' it.
	- If a custom BUS_PRINT_CHILD method does the same thing
	  as bus_generic_print_child(), use bus_generic_print_child()
	- Use device_get_nameunit() instead of both
	  device_get_name() and device_get_unit()
	- All BUS_PRINT_CHILD methods return the number of
	  characters output.

Reviewed by: dfr, peter
1999-07-29 01:03:04 +00:00
Alan Cox 6745299365 Add sysctl and support code to allow directories to be VMIO'd. The default
setting for the sysctl is OFF, which is the historical operation.

Submitted by:	dillon
1999-07-26 06:25:53 +00:00
Martin Cracauer a7674320e9 On FPU exceptions, pass a useful error code (one of the FPE_...
macros) to the signal handler, for old-style BSD signal handlers as
the second (int) argument, for SA_SIGINFO signal handlers as
siginfo_t->si_code. This is source-compatible with Solaris, except
that we have no <siginfo.h> (which isn't even mentioned in POSIX
1003.1b).

An rather complete example program is at
  http://www3.cons.org/cracauer/freebsd-signal.c
This will be added to the regression tests in src/.

This commit also adds code to disable the (hardware) FPU from
userconfig, so that you can use a software FP emulator on a machine
that has hardware floating point. See LINT.
1999-07-25 13:16:09 +00:00
Bruce Evans a1a10fdfc0 Oops, the previous commit only worked in the one case it was tested for. 1999-07-24 20:21:10 +00:00
Kazutaka YOKOTA 3d03248c70 - Correctly initialize cn_dev_t and cn_udev_t.
- Add D_TTY for alpha.

Reviewed by: bde, dfr
1999-07-24 09:41:06 +00:00
Doug Rabson f1550d9d41 This makes the in kernel printf routines conform to the documented
behavior of their userland counterparts with respect to return values.

Submitted by: Matthew N. Dodd <winter@jurai.net>
1999-07-24 09:34:12 +00:00
Alan Cox d4da2dbae6 Fix the following problem:
When creating new processes (or performing exec), the new page
directory is initialized too early.  The kernel might grow before
p_vmspace is initialized for the new process.  Since pmap_growkernel
doesn't yet know about the new page directory, it isn't updated, and
subsequent use causes a failure.

The fix is (1) to clear p_vmspace early, to stop pmap_growkernel
from stomping on memory, and (2) to defer part of the initialization
of new page directories until p_vmspace is initialized.

PR:		kern/12378
Submitted by:	tegge
Reviewed by:	dfr
1999-07-21 18:02:27 +00:00
Brian Feldman 57d86fc695 Fix a REALLY embarrassing mistake. Don't look; I warned you. 1999-07-20 21:51:12 +00:00
Brian Feldman fb30b5bdaf Make a dev2budev() function, and use it. This refixes pstat (working, broken,
working, broken, working) and savecore (working, working, broken, working,
working).

Sorta Reviewed by:	phk
1999-07-20 21:29:13 +00:00
Brian Feldman 240a86a432 dev2udev() returns a CDEV udev_t, but we use block io in savecore. Savecore
also gets the device by st_rdev, which is alright except for the fact that
the sysctl kern.dumpdev passed out a char device. This is a workaround.
Sorry for not committing the fix earlier, before people started having
problems.
1999-07-20 20:55:50 +00:00
Poul-Henning Kamp 698bfad7f2 Now a dev_t is a pointer to struct specinfo which is shared by all specdev
vnodes referencing this device.

Details:
        cdevsw->d_parms has been removed, the specinfo is available
        now (== dev_t) and the driver should modify it directly
        when applicable, and the only driver doing so, does so:
        vn.c.  I am not sure the logic in checking for "<" was right
        before, and it looks even less so now.

        An intial pool of 50 struct specinfo are depleted during
        early boot, after that malloc had better work.  It is
        likely that fewer than 50 would do.

        Hashing is done from udev_t to dev_t with a prime number
        remainder hash, experiments show no better hash available
        for decent cost (MD5 is only marginally better)  The prime
        number used should not be close to a power of two, we use
        83 for now.

        Add new checkalias2() to get around the loss of info from
        dev2udev() in bdevvp();

        The aliased vnodes are hung on a list straight of the dev_t,
        and speclisth[SPECSZ] is unused.  The sharing of struct
        specinfo means that the v_specnext moves into the vnode
        which grows by 4 bytes.

        Don't use a VBLK dev_t which doesn't make sense in MFS, now
        we hang a dummy cdevsw on B/Cmaj 253 so that things look sane.

	Storage overhead from all of this is O(50k).

        Bump __FreeBSD_version to 400009

The next step will add the stuff needed so device-drivers can start to
hang things from struct specinfo
1999-07-20 09:47:55 +00:00
Poul-Henning Kamp d7bf417de7 add debug.sizeof.specinfo 1999-07-20 07:19:32 +00:00
Mike Smith 91fe3dc1e1 Implement an all-CPU shootdown-style rendezvous facility. This allows
the caller to specify a function to be guarded between an entry and exit
barrier, as well as pre- and post-barrier functions.

The primary use for this function is synchronised update of per-cpu private
data.  The implementation is almost (but not quite) MI; with a better
mechanism for masking per-CPU interrupts it could probably be hoisted.

Reviewed by:	peter (partially)
1999-07-20 06:52:35 +00:00
Poul-Henning Kamp 3de280c443 [click] Now all dev_t's in the kernel have their char device major.
Only know casualy of this is swapinfo/pstat which should be fixes
the right way:  Store the actual pathname in the kernel like mount
does.  [Volounteers sought for this task]

The road map from here is roughly:  expand struct specinfo into struct
based dev_t.  Add dev_t registration facilities for device drivers and
start to use them.
1999-07-19 09:37:59 +00:00
Poul-Henning Kamp 6f13bfc261 Add sysctl tree debug.sizeof to tell us how big things are. First two
entries are struct proc and struct vnode.
1999-07-19 09:13:12 +00:00
Bruce Evans 6b6ef746e5 Added a sysctl "kern.timecounter.hardware" for selecting the hardware
used for timecounting.  The possible values are the names of the
physically present harware timecounters ("i8254" and "TSC" on i386's).

Fixed some nearby bitrot in comments in <sys/time.h>.

Reviewed by:	phk
1999-07-18 15:07:20 +00:00
Poul-Henning Kamp 6ca5486476 Introduce the vn_todev(struct vnode*) function, which returns the dev_t
corresponding to a VBLK or VCHR node, or NODEV.
1999-07-18 14:30:37 +00:00
Peter Wemm 80e907a1df Reset SA_NOCLDWAIT on exec().
PR:		kern/12669
Submitted by:	Doug Ambrisko <ambrisko@whistle.com>
1999-07-18 13:40:11 +00:00
John Polstra 7ac9503b86 Remove four no-op casts. 1999-07-18 01:35:26 +00:00
Poul-Henning Kamp f06a54f0a0 Centralize dumpdev handling. 1999-07-17 20:47:52 +00:00
Poul-Henning Kamp 68f7448fd7 Reverse the sense of a test, dev2udev() will be much cheaper than
udev2dev().
1999-07-17 20:29:10 +00:00
Poul-Henning Kamp d21c632c4b Use 256 as magic in bmaj2cmaj[]. Treat BLK/CHR dev_t more correctly. 1999-07-17 19:57:25 +00:00
Poul-Henning Kamp c7119ea7dd Fix 2nd arg to udev2dev(). 1999-07-17 19:38:00 +00:00
Poul-Henning Kamp f008cfcc1a I have not one single time remembered the name of this function correctly
so obviously I gave it the wrong name.  s/umakedev/makeudev/g
1999-07-17 18:43:50 +00:00
Peter Wemm 341c61590c Oops, missed out one chunk of the last patch. (*blush*)
Submitted by:	Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
Submitted by:	"Matthew N. Dodd" <winter@jurai.net>
1999-07-14 17:37:53 +00:00
Kris Kennaway e7647e6c20 Correct a couple of spelling errors in comments. 1999-07-12 15:02:51 +00:00
Doug Rabson ca7036d8cb Add a hook for a bus to detect child devices which didn't find drivers.
This allows the bus to print an informative message about unknown devices.

Submitted by: Matthew N. Dodd <winter@jurai.net>
1999-07-11 13:42:37 +00:00
Peter Wemm 8294196430 Fixes for a couple of problems in last commit:
1. Printing large quads in small bases overflowed the buffer if
   sizeof(u_quad_t) > sizeof(u_long).
2. The sharpflag checks had operator precedence bugs due to excessive
   parentheses in all the wrong places.
3. The explicit 0L was bogus in the quad_t comparison and useless in
   the long comparision.
4. There was some more bitrot in the comment about ksprintn().  Our
   ksprintn() handles bases up to 36 as well as down to 2.

Bruce has other complaints about using %q in kernel and would rather
we went towards using the C9X style %ll and/or %j.  (I agree for that
matter, as long as gcc/egcs know how to deal with that.)

Submitted by:	bde
1999-07-10 15:27:05 +00:00
Poul-Henning Kamp 23d762834b Fix a dev_t/udev_t issue with accounting. lastcomm now shows the
right tty again.

Submitted by:	"D. Rock" <rock@dead-end.net>
Reviewed by:	phk
1999-07-10 06:27:36 +00:00
Peter Wemm bdbc8c265e Fix the previous warning a different way since the emul_path exposure was
intentional.  Avoid the warning by propagating the const filename through
to elf_load_file() instead.
1999-07-09 19:10:14 +00:00
Peter Wemm c6bb4a64b8 Minor tweak - don't cause a warning.
I don't know if it was intentional or not, but it would have printed out:
  /compat/linux/foo/bar.so: interpreter not found
If it was, then I've broken it.  De-constifying the 'interp' variable
or carrying the constness through to elf_load_file() are alternatives.
1999-07-09 18:05:03 +00:00
Peter Wemm 7d921a016d Implement the %q prefix for the integer types. Note that egcs on the
Alpha believes that %q is for long long, whereas our quad_t and int64_t
is only just a plain long.  long long on the alpha is the same size (64
bit) as a long.  It was requested, but I have not implemented yet, support
for C9X style %lld - it should be pretty easy though.
1999-07-09 17:54:39 +00:00
Peter Wemm 29a751bf4e bufhashinit() is called with a caddr_t and is expected to return the
same in both the alpha and i386 ports.
1999-07-09 16:41:19 +00:00
Jonathan Lemon ab001a72be Implement support for hardware debug registers on the i386.
Submitted by:	Brian Dean <brdean@unx.sas.com>
1999-07-09 04:16:00 +00:00
Kirk McKusick 025037833c Condition in KASSERT was reversed. 1999-07-08 17:58:55 +00:00
Kirk McKusick ad8ac923fa These changes appear to give us benefits with both small (32MB) and
large (1G) memory machine configurations.  I was able to run 'dbench 32'
on a 32MB system without bring the machine to a grinding halt.

    * buffer cache hash table now dynamically allocated.  This will
      have no effect on memory consumption for smaller systems and
      will help scale the buffer cache for larger systems.

    * minor enhancement to pmap_clearbit().  I noticed that
      all the calls to it used constant arguments.  Making
      it an inline allows the constants to propogate to
      deeper inlines and should produce better code.

    * removal of inherent vfs_ioopt support through the emplacement
      of appropriate #ifdef's, with John's permission.  If we do not
      find a use for it by the end of the year we will remove it entirely.

    * removal of getnewbufloops* counters & sysctl's - no longer
      necessary for debugging, getnewbuf() is now optimal.

    * buffer hash table functions removed from sys/buf.h and localized
      to vfs_bio.c

    * VFS_BIO_NEED_DIRTYFLUSH flag and support code added
      ( bwillwrite() ), allowing processes to block when too many dirty
      buffers are present in the system.

    * removal of a softdep test in bdwrite() that is no longer necessary
      now that bdwrite() no longer attempts to flush dirty buffers.

    * slight optimization added to bqrelse() - there is no reason
      to test for available buffer space on B_DELWRI buffers.

    * addition of reverse-scanning code to vfs_bio_awrite().
      vfs_bio_awrite() will attempt to locate clusterable areas
      in both the forward and reverse direction relative to the
      offset of the buffer passed to it.  This will probably not
      make much of a difference now, but I believe we will start
      to rely on it heavily in the future if we decide to shift
      some of the burden of the clustering closer to the actual
      I/O initiation.

    * Removal of the newbufcnt and lastnewbuf counters that Kirk
      added.  They do not fix any race conditions that haven't already
      been fixed by the gbincore() test done after the only call
      to getnewbuf().  getnewbuf() is a static, so there is no chance
      of it being misused by other modules.  ( Unless Kirk can think
      of a specific thing that this code fixes.  I went through it
      very carefully and didn't see anything ).

    * removal of VOP_ISLOCKED() check in flushbufqueues().  I do not
      think this check is necessary, the buffer should flush properly
      whether the vnode is locked or not. ( yes? ).

    * removal of extra arguments passed to getnewbuf() that are not
      necessary.

    * missed cluster_wbuild() that had to be a cluster_wbuild_wb() in
      vfs_cluster.c

    * vn_write() now calls bwillwrite() *PRIOR* to locking the vnode,
      which should greatly aid flushing operations in heavy load
      situations - both the pageout and update daemons will be able
      to operate more efficiently.

    * removal of b_usecount.  We may add it back in later but for now
      it is useless.  Prior implementations of the buffer cache never
      had enough buffers for it to be useful, and current implementations
      which make more buffers available might not benefit relative to
      the amount of sophistication required to implement a b_usecount.
      Straight LRU should work just as well, especially when most things
      are VMIO backed.  I expect that (even though John will not like
      this assumption) directories will become VMIO backed some point soon.

Submitted by:	Matthew Dillon <dillon@backplane.com>
Reviewed by:	Kirk McKusick <mckusick@mckusick.com>
1999-07-08 06:06:00 +00:00
Martin Cracauer aff66c5455 Implement SA_SIGINFO for i386. Thanks to Bruce Evans for much more
than a review, this was a nice puzzle.

This is supposed to be binary and source compatible with older
applications that access the old FreeBSD-style three arguments to a
signal handler.

Except those applications that access hidden signal handler arguments
bejond the documented third one. If you have applications that do,
please let me know so that we take the opportunity to provide the
functionality they need in a documented manner.

Also except application that use 'struct sigframe' directly. You need
to recompile gdb and doscmd. `make world` is recommended.

Example program that demonstrates how SA_SIGINFO and old-style FreeBSD
handlers (with their three args) may be used in the same process is at
http://www3.cons.org/tmp/fbsd-siginfo.c

Programs that use the old FreeBSD-style three arguments are easy to
change to SA_SIGINFO (although they don't need to, since the old style
will still work):

  Old args to signal handler:
    void handler_sn(int sig, int code, struct sigcontext *scp)

  New args:
    void handler_si(int sig, siginfo_t *si, void *third)
  where:
    old:code == new:second->si_code
    old:scp == &(new:si->si_scp)     /* Passed by value! */

The latter is also pointed to by new:third, but accessing via
si->si_scp is preferred because it is type-save.

FreeBSD implementation notes:
- This is just the framework to make the interface POSIX compatible.
  For now, no additional functionality is provided. This is supposed
  to happen now, starting with floating point values.
- We don't use 'sigcontext_t.si_value' for now (POSIX meant it for
  realtime-related values).
- Documentation will be updated when new functionality is added and
  the exact arguments passed are determined. The comments in
  sys/signal.h are meant to be useful.

Reviewed by:	BDE
1999-07-06 07:13:48 +00:00
Marcel Moolenaar 7a583b02b6 Also try to load the interpreter without prepending "emul_path". This allows
dynamicly linked binaries to run in a chroot'd environment with "emul_path"
as the new root. The new behavior of loading interpreters is identical to the
principle of overlaying.

PR: 10145
1999-07-05 18:38:29 +00:00
Mike Smith 134c934ce7 Move the initialisation/tuning of nmbclusters from param.c/machdep.c
into uipc_mbuf.c.  This reduces three sets of identical tunable code to
one set, and puts the initialisation with the mbuf code proper.

Make NMBUFs tunable as well.

Move the nmbclusters sysctl here as well.

Move the initialisation of maxsockets from param.c to uipc_socket2.c,
next to its corresponding sysctl.

Use the new tunable macros for the kern.vm.kmem.size tunable (this should have
been in a separate commit, whoops).
1999-07-05 08:52:54 +00:00
Poul-Henning Kamp 03016f421b Remove cmaj and bmaj args from DEV_DRIVER_MODULE. 1999-07-04 14:58:56 +00:00
Bruce Evans 1168ab0815 Fixed corruption of the "blocked" list in lf_setlock() when tsleep()
returns 0 after ptrace() attach and/or detach doesn't quite quite
deliver a signal.  Perhaps the process shouldn't be woken in this
case, but avoiding the problem is easy.

PR:		12247

Fixed a couple of places where mechanical fixing of compiler warnings
caused misspelling of NOLOCKF as NULL.
1999-07-04 14:43:01 +00:00
Kirk McKusick 1c9ca5858f The vfs.write_behind sysctl and related code support has been added to
allow changes to the filesystem's write_behind behavior.  By the
default the filesystem aggressively issues write_behind's.  Three values
may be specified for vfs.write_behind.  0 disables write_behind, 1 results
in historical operation (agressive write_behind), and 2 is an experimental
backed-off write_behind.  The values of 0 and 1 are recommended.  The value
of 0 is recommended in conjuction with an increase in the number of
NBUF's and the number of dirty buffers allowed (vfs.{lo,hi}dirtybuffers).
Note that a value of 0 will radically increase the dirty buffer load on
the system.  Future work on write_behind behavior will use values 2 and
greater for testing purposes.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Kirk McKusick <mckusick@mckusick.com>
1999-07-04 00:31:17 +00:00
Kirk McKusick e929c00d23 The buffer queue mechanism has been reformulated. Instead of having
QUEUE_AGE, QUEUE_LRU, and QUEUE_EMPTY we instead have QUEUE_CLEAN,
QUEUE_DIRTY, QUEUE_EMPTY, and QUEUE_EMPTYKVA.  With this patch clean
and dirty buffers have been separated.  Empty buffers with KVM
assignments have been separated from truely empty buffers.  getnewbuf()
has been rewritten and now operates in a 100% optimal fashion.  That is,
it is able to find precisely the right kind of buffer it needs to
allocate a new buffer, defragment KVM, or to free-up an existing buffer
when the buffer cache is full (which is a steady-state situation for
the buffer cache).

Buffer flushing has been reorganized.  Previously buffers were flushed
in the context of whatever process hit the conditions forcing buffer
flushing to occur.  This resulted in processes blocking on conditions
unrelated to what they were doing.  This also resulted in inappropriate
VFS stacking chains due to multiple processes getting stuck trying to
flush dirty buffers or due to a single process getting into a situation
where it might attempt to flush buffers recursively - a situation that
was only partially fixed in prior commits.  We have added a new daemon
called the buf_daemon which is responsible for flushing dirty buffers
when the number of dirty buffers exceeds the vfs.hidirtybuffers limit.
This daemon attempts to dynamically adjust the rate at which dirty buffers
are flushed such that getnewbuf() calls (almost) never block.

The number of nbufs and amount of buffer space is now scaled past the
8MB limit that was previously imposed for systems with over 64MB of
memory, and the vfs.{lo,hi}dirtybuffers limits have been relaxed
somewhat.  The number of physical buffers has been increased with the
intention that we will manage physical I/O differently in the future.

reassignbuf previously attempted to keep the dirtyblkhd list sorted which
could result in non-deterministic operation under certain conditions,
such as when a large number of dirty buffers are being managed.  This
algorithm has been changed.  reassignbuf now keeps buffers locally sorted
if it can do so cheaply, and otherwise gives up and adds buffers to
the head of the dirtyblkhd list.  The new algorithm is deterministic but
not perfect.  The new algorithm greatly reduces problems that previously
occured when write_behind was turned off in the system.

The P_FLSINPROG proc->p_flag bit has been replaced by the more descriptive
P_BUFEXHAUST bit.  This bit allows processes working with filesystem
buffers to use available emergency reserves.  Normal processes do not set
this bit and are not allowed to dig into emergency reserves.  The purpose
of this bit is to avoid low-memory deadlocks.

A small race condition was fixed in getpbuf() in vm/vm_pager.c.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by:	Kirk McKusick <mckusick@mckusick.com>
1999-07-04 00:25:38 +00:00
Peter Wemm 1943af613f Stop rfork(0) from panicing. (oops!!)
Submitted by:	Peter Holm <peter@holm.cc>
1999-07-03 20:58:44 +00:00
Peter Wemm ca224f89a9 Fix warnings in last commit (dev_t is not an int, and not even int
compatable in arg lists on the Alpha)
1999-07-03 17:40:31 +00:00
Poul-Henning Kamp ad6cb55952 Be more informative and try to ask the user in some instances if we can't
figure out the root device.
1999-07-03 08:24:00 +00:00
Poul-Henning Kamp c31558b215 Warn about drivers which take over other drivers cdevsw entries, but still
grant them squatters right.
1999-07-03 08:22:30 +00:00
Poul-Henning Kamp 8947a90a90 Make sure that stat(2) and friends always return a valid st_dev field.
Pseudo-FS need not fill in the va_fsid anymore, the syscall code
will use the first half of the fsid, which now looks like a udev_t
with major 255.
1999-07-02 16:29:47 +00:00
Peter Wemm b9dffbec61 Fix a warning - the code is correct but gcc can't tell. 1999-07-01 22:54:55 +00:00
Peter Wemm 7a0dde6879 Moving the initialization for write sooner quiets a warning. 1999-07-01 22:52:40 +00:00
Peter Wemm 00858ccd88 Quiet warnings on an Alpha. CBSIZE has long type and causes the other
ints to promote to long.
1999-07-01 19:46:36 +00:00
Peter Wemm 9c8b8baa38 Slight reorganization of kernel thread/process creation. Instead of using
SYSINIT_KT() etc (which is a static, compile-time procedure), use a
NetBSD-style kthread_create() interface.  kproc_start is still available
as a SYSINIT() hook.  This allowed simplification of chunks of the
sysinit code in the process.  This kthread_create() is our old kproc_start
internals, with the SYSINIT_KT fork hooks grafted in and tweaked to work
the same as the NetBSD one.

One thing I'd like to do shortly is get rid of nfsiod as a user initiated
process.  It makes sense for the nfs client code to create them on the
fly as needed up to a user settable limit.  This means that nfsiod
doesn't need to be in /sbin and is always "available".  This is a fair bit
easier to do outside of the SYSINIT_KT() framework.
1999-07-01 13:21:46 +00:00
Peter Wemm df8abd0bb9 Slight tweak to fork1() calling conventions. Add a third argument so
the caller can easily find the child proc struct.  fork(), rfork() etc
syscalls set p->p_retval[] themselves.  Simplify the SYSINIT_KT() code
and other kernel thread creators to not need to use pfind() to find the
child based on the pid.  While here, partly tidy up some of the fork1()
code for RF_SIGSHARE etc.
1999-06-30 15:33:41 +00:00
Peter Wemm ddebd8794d Hopefully fix the remaining glitches with the BUF_*() changes. This should
(really this time) fix pageout to swap and a couple of clustering cases.

This simplifies BUF_KERNPROC() so that it unconditionally reassigns the
lock owner rather than testing B_ASYNC and having the caller decide when
to do the reassign.  At present this is required because some places use
B_CALL/b_iodone to free the buffers without B_ASYNC being set.  Also,
vfs_cluster.c explicitly calls BUF_KERNPROC() when attaching the buffers
rather than the parent walking the cluster_head tailq.

Reviewed by:	Kirk McKusick <mckusick@mckusick.com>
1999-06-29 05:59:47 +00:00
Peter Wemm 72283ee95d Fix a bug that was almost certainly making breadn() fail. BUF_KERNPROC()
was being called on the wrong bp - it should be called on the one that's
just about to be fed to VOP_STRATEGY().
1999-06-28 15:32:10 +00:00
Kirk McKusick 33638e9384 When requesting an exclusive lock with LK_NOWAIT, do not panic
if LK_RECURSIVE is not set, as we will simply return that the
lock is busy and not actually deadlock. This allows processes
to use polling locks against buffers that they may already
hold exclusively locked.
1999-06-28 07:54:58 +00:00
Peter Wemm e96c1fdc3f Minor tweaks to make sure (new) prerequisites for <sys/buf.h> (mostly
splbio()/splx()) are #included in time.
1999-06-27 11:44:22 +00:00
Doug Rabson c049aba8c3 Call the chained module handler before unregistering the syscall so that
errors can be detected.

Submitted by: "A.Yu.Isupov" <isupov@moonhe.jinr.ru>
PR:	      kern/12239
1999-06-27 09:38:44 +00:00
Peter Wemm e6257a9a09 GC the remnants of the old pre-softupdates update daemon. It's been
#if 0'd for a fair while now.
1999-06-26 14:46:35 +00:00
Peter Wemm fec1aafc01 I'm tired of having a 'hanging root device'.. This isn't a "fix", just
a workaround for a specific case where cam interrupts right in the middle
of this printf.
1999-06-26 14:44:24 +00:00
Peter Wemm 82e4c0061b Quieten some warnings as a result of changes in ls_items[] constness over
time.
1999-06-26 12:19:03 +00:00
Doug Rabson 6d4ce7aa8c * Call cdevsw_remove from the MOD_UNLOAD event.
* Fix a couple of warnings while I'm here.
1999-06-26 11:39:27 +00:00
Doug Rabson 9fd5198d2d Make sure that we record the flags in all cases.
Submitted by: Bernd Walter <ticso@cicely.de>
PR:	      kern/12399
1999-06-26 10:27:30 +00:00
Kirk McKusick 67812eacd7 Convert buffer locking from using the B_BUSY and B_WANTED flags to using
lockmgr locks. This commit should be functionally equivalent to the old
semantics. That is, all buffer locking is done with LK_EXCLUSIVE
requests. Changes to take advantage of LK_SHARED and LK_RECURSIVE will
be done in future commits.
1999-06-26 02:47:16 +00:00
Greg Lehey 9a9eb2b92b Add function cdevsw_remove, the opposite of cdevsw_add: remove an
entry in cdevsw (and bdevsw if appropriate).

Reviewed-by: phk
1999-06-25 07:49:01 +00:00
Mike Smith d42c1ee5c3 Changes in the way that the APs are started appears to have removed the
problem with having more CPUs than NCPU.

PR:		kern/4255
Submitted by:	peter
1999-06-23 23:02:38 +00:00
Luoqi Chen 541e018708 Do not setup 4M pdir until all APs are up. 1999-06-23 21:47:24 +00:00
Mike Smith b9ab2461b6 Remove an unnecessary panic when sparse PCI bus numbering is encountered.
This is found eg. on some Compaq  Proliant systems.

Submitted by:	peter
1999-06-22 20:54:25 +00:00
Kazutaka YOKOTA 6e8394b8ba The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize
  some of complicated functions.

- Many static variables are moved to the softc structure.

- Added a new key function, PREV.  When this key is pressed, the vty
  immediately before the current vty will become foreground.  Analogue
  to PREV, which is usually assigned to the PrntScrn key.
  PR: kern/10113
  Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>

- Modified the kernel console input function sccngetc() so that it
  handles function keys properly.

- Reorganized the screen update routine.

- VT switching code is reorganized.  It now should be slightly more
  robust than before.

- Added the DEVICE_RESUME function so that syscons no longer hooks the
  APM resume event directly.

- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
  SC_NO_HISTORY and SC_NO_SYSMOUSE.
  Various parts of syscons can be omitted so that the kernel size is
  reduced.

  SC_PIXEL_MODE
  Made the VESA 800x600 mode an option, rather than a standard part of
  syscons.

  SC_DISABLE_DDBKEY
  Disables the `debug' key combination.

  SC_ALT_MOUSE_IMAGE
  Inverse the character cell at the mouse cursor position in the text
  console, rather than drawing an arrow on the screen.
  Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)

  SC_DFLT_FONT
  makeoptions "SC_DFLT_FONT=_font_name_"
  Include the named font as the default font of syscons.  16-line,
  14-line and 8-line font data will be compiled in.  This option replaces
  the existing STD8X16FONT option, which loads 16-line font data only.

- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.

- The video driver provides a set of ioctl commands to manipulate the
  frame buffer.

- New kernel configuration option: VGA_WIDTH90
  Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60.  These
  modes are mot always supported by the video card.
  PR: i386/7510
  Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.

- The header file machine/console.h is reorganized; its contents is now
  split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
  (another new file).  machine/console.h is still maintained for
  compatibility reasons.

- Kernel console selection/installation routines are fixed and
  slightly rebumped so that it should now be possible to switch between
  the interanl kernel console (sc or vt) and a remote kernel console
  (sio) again, as it was in 2.x, 3.0 and 3.1.

- Screen savers and splash screen decoders
  Because of the header file reorganization described above, screen
  savers and splash screen decoders are slightly modified.  After this
  update, /sys/modules/syscons/saver.h is no longer necessary and is
  removed.
1999-06-22 14:14:06 +00:00
Kirk McKusick 45623f31bc When allocating new buffers in getnewbuf, there are several points
at which we may sleep. So, after completing our buffer allocation
we must ensure that another process has not come along and allocated
a different buffer with the same identity. We do this by keeping a
global counter of the number of buffers that getnewbuf has allocated.
We save this count when we enter getnewbuf and check it when we are
about to return. If it has changed, then other buffers were allocated
while we were in getnewbuf, so we must return NULL to let our parent
know that it must recheck to see if it still needs the new buffer.
Hopefully this fix will eliminate the creation of duplicate buffers
with the same identity and the obscure corruptions that they cause.
1999-06-22 01:39:53 +00:00
Tim Vanderhoek 8630d8cfc6 Correctly return ENOEXEC for really short zipped files. The way this is
done is less-than cute, but this whole file is suffering from some amount
of bitrot.  Execution of zipped files should probably be implemented in a
manner similar to that of #!/interpreted files.

PR:		kern/10780
1999-06-21 16:23:13 +00:00
Greg Lehey 53a03d1c97 dsopen: Print a message if the unit has an invalid sector size.
Reviewed-by:	ken, bde
1999-06-21 03:48:16 +00:00
Alan Cox dc92aa57fd For consistency with other implementations, check for the existence
of the segment before checking its permissions.

PR:		kern/11999
Submitted by:	Brooks Davis <brooks@one-eyed-alien.net>
1999-06-19 23:53:13 +00:00
Bruce Evans 50045fbc7c Changed the global `idt' from an array to a pointer so that npx.c
automatically hacks on the active copy of the IDT if f00f_hack()
has changed it.  This also allows simplifications in setidt().
This fixes breakage of FP exception handling by rev.1.55 of
sys/kernel.h.  FP exceptions were sent to npx.c's probe handlers
because npx.c "restored" the old handlers to the wrong copy of the
IDT.  The SYSINIT for f00f_hack() was purposely run quite late to
avoid problems like this, but it is bogusly associated with the
SYSINIT for proc0 so it was moved with the latter.

Problem reported and fix tested by:  Martin Cracauer <cracauer@cons.org>
1999-06-18 14:32:21 +00:00
Brian Feldman f29be02190 Reviewed by: the cast of thousands
This is the change to struct sockets that gets rid of so_uid and replaces
it with a much more useful struct pcred *so_cred. This is here to be able
to do socket-level credential checks (i.e. IPFW uid/gid support, to be added
to HEAD soon). Along with this comes an update to pidentd which greatly
simplifies the code necessary to get a uid from a socket. Soon to come:
a sysctl() interface to finding individual sockets' credentials.
1999-06-17 23:54:50 +00:00
Gary Palmer 0625ba2fc3 Add Id strings 1999-06-17 23:42:45 +00:00
Nick Hibma 6979450036 Update the comments on values than can be returned by DEVICE_PROBE.
DEVICE_PROBE can return priorities.

Reviewed by:	Doug Rabson <dfr@nlsystems.com>
1999-06-17 19:22:12 +00:00
Bruce Evans 212dfe6fc7 Fixed a missing userland dev_t to kernel dev_t conversion. 1999-06-17 07:07:55 +00:00
Julian Elischer 4e1b754078 Reformat comment to match indentation of code around it. 1999-06-17 01:25:25 +00:00
Kirk McKusick f9c8cab591 Add a vnode argument to VOP_BWRITE to get rid of the last vnode
operator special case. Delete special case code from vnode_if.sh,
vnode_if.src, umap_vnops.c, and null_vnops.c.
1999-06-16 23:27:55 +00:00
Dmitrij Tejblum 71ddfdbbd5 Make sure syscall arguments properly aligned in ktrace records.
Make syscall return value a register_t.

Based on a patch from Hidetoshi Shimokawa.
Mostly reviewed by:	Hidetoshi Shimokawa and Bruce Evans.
1999-06-16 18:37:01 +00:00
David Greenman cd3fe8d008 Changed trypbuf to a getpbuf to work around a problem where redundant writes
would occur when clustering them - caused by running out of buffers
and taking a degenerate code path as a result. It appears that waiting
instead for buffers to become available is okay.

Submitted by:	Matthew Dillon <dillon@apollo.backplane.com>
Discovered by: Craig A Soules <soules+@andrew.cmu.edu>
1999-06-16 15:54:30 +00:00
Tor Egge 01cf8ad024 If we still haven't got a sufficient number of free buffers after the
call to flushdirtybuffers() then sleep in waitfreebuffers().
PR:		11697
Reviewed by:	David Greenman, Matt Dillon
1999-06-16 03:19:04 +00:00
Kirk McKusick e4ab40bcb6 Get rid of the global variable rushjob and replace it with a function in
kern/vfs_subr.c named speedup_syncer() which handles the speedup request.
Change the various clients of rushjob to use the new function.
1999-06-15 23:37:29 +00:00
Mike Smith 79fc0bf4a0 From the submitter:
- this causes POSIX locking to use the thread group leader
   (p->p_leader) as the locking thread for all advisory locks.
   In non-kernel-threaded code p->p_leader == p, so this will have
   no effect.

   This results in (more) correct POSIX threaded flock-ing semantics.

   It also prevents the leader from exiting before any of the children.
   (so that p->p_leader will never be stale) in exit1().

   We have been running this patch for over a month now in our lab
   under load and at customer sites.

Submitted by:	John Plevyak <jplevyak@inktomi.com>
1999-06-07 20:37:29 +00:00
Archie Cobbs 05292ba234 ksprintn() may be called with base=2, so redefine MAXNBUF accordingly.
Other brucification tweaks.

Obtained from:	bde@freebsd.org
1999-06-07 18:26:26 +00:00
Archie Cobbs ad4f8dbd23 The function ksprintn(), which is used to convert numbers to ASCII, is not
reentrant because it returns a static buffer. This results in a race condition
when/if an interrupt handler calls log(), printf() etc. Fix this.
1999-06-06 02:41:55 +00:00