Commit Graph

2470 Commits

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