Commit Graph

2478 Commits

Author SHA1 Message Date
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