Commit Graph

3568 Commits

Author SHA1 Message Date
jdolecek 5a9f1cf173 ksiginfo_put(): only copy what's needed of ksiginfo_t, to slightly optimize
the operation, and improve code readability at the same time
2003-10-30 16:32:58 +00:00
provos 4b425670af use a two-level bitmap as suggested by mogul and banga for fdalloc;
approved thorpej@
2003-10-30 07:27:02 +00:00
thorpej 67f69c1c63 Make callout_setfunc() a CPP macro. Suggested by enami. 2003-10-30 04:32:56 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
thorpej db71356cd1 - Change callout_setfunc() to require that the callout handle is already
initialized.  Update the txp(4) to compensate.
- Statically initialize the TCP timer callout handles in the tcpcb
  template.  We still use callout_setfunc(), but that call is now much
  less expensive.  Add a comment that the compiler is likely to unroll
  the loop (so don't sweat that it's there).
2003-10-27 16:52:01 +00:00
fvdl 404fa205d1 Fix (bogus) unitialized variable warning. 2003-10-26 20:55:57 +00:00
jdolecek ad67de5ad8 move ALLOCSYS() macro from <sys/systm.h> to kern_alloc.c - it's the
only place which uses it
2003-10-26 10:45:03 +00:00
jdolecek 2e59e9ae06 allocate virtual memory for SYSV shm, msg and semaphore structures
separately from the bufpages, so that it would be possible to eventually
make their limits changeable in runtime

make static all local variables which do not need to be exported to other
kernel parts
2003-10-26 10:32:24 +00:00
lukem f85d2d1c14 Use ${HOST_SH} instead of `sh'.
If necessary, pull in <bsd.sys.mk> to get the definition of HOST_SH;
Makefiles that pull in one of (most of) <bsd.*.mk> will get this anyway.
2003-10-26 07:25:33 +00:00
christos 2017bf9a94 Fix uninitialized variable warning 2003-10-25 18:31:59 +00:00
jdolecek 0c303462c5 modify sigtimedwait(2) to return full siginfo if available, and pass the wait
set using a pointer, to save couple bytes in struct sigctx

also fix fallout from recent lwp_wakeup() change, where we failed to properly
detect if tsleep() returned as result of lwp_wakeup() or signal outside
our wait set; could have caused problems for threaded apps using sigwait(2)
et.al.
2003-10-25 16:50:37 +00:00
yamt 01de53d5f4 don't assume the order of upcall stacks in the array from userland.
(it's reversed in the case of topdown vm.)

kern/23266 from Kouichirou Hiratsuka and tested by him.
2003-10-25 12:08:45 +00:00
christos cb02efca51 fix uninitialized variable 2003-10-25 09:06:51 +00:00
christos 9ff8e797c6 fix uninitialized variables. one of them is a compiler bug. 2003-10-25 09:03:59 +00:00
kleink 661f76699f POSIX: when attempting to fdatasync(2) a file which is not open for
writing, fail with EBADF.
2003-10-25 01:18:01 +00:00
yamt a526db13df sa_unblockyield:
don't assert that syscall arguments are sane.
return an appropriate error instead.
2003-10-24 16:11:21 +00:00
yamt 3f32c6ab70 don't use NULL as vaddr_t. 2003-10-24 00:53:43 +00:00
thorpej 4011fcfefd Cache the "adjusted" value of sb_max when sb_max is changed, in order
to avoid doing quad math in sbreserve().

Change suggested by Simon Burge, and code inspired by a similar change
in FreeBSD.
2003-10-21 22:55:47 +00:00
manu a591d65ec7 One more section type in the Mach-O format. Now /usr/X11R6/bin/quartz-wm links
and run (it aborts because the dock is not launched).
2003-10-20 22:42:40 +00:00
wiz 48f28cea9e sa_vp_faultaddr, sa_vp_ofaultaddr, sa_vp_stacks_low, and sa_vp_stacks_high
are vaddr_t (and thus unsigned long).
Initialize them with 0 instead of NULL.
Closes PR 23204 by Dheeraj Reddy.
2003-10-20 07:15:26 +00:00
manu d77ec799a5 Support Darwin static binaries (I should say: support the only Darwin
static binary: otool). Dynamic binaires have a pointer to the Mach-O
header on the top of the stack, static binaries don't have this, and
having it produced a crash.

One bugfix: the EXEC_MACHO code assumes that entry = NULL means that
the entry point has not been found in the load commands seen so far.
Therefore we need to initialized entry to NULL if we want a static binary
to discover it. (dynamic binaries were forced to iscover it because when
the intepreter load command is found, entry is updated whatever its
value was before).

One hack: Both COMPAT_MACH and COMPAT_DARWIN are willing to run Mach-O
binaries. COMPAT_MACH fails for dynamic binaries because it cannot find
the interpreter in /emul/mach. For static binaires, it will accept them
(and for Darwin static binaries, this will cause a failure). Until we
rite a test for matchinf Darwin static binaries, just swap the order of
COMPAT_MACH and COMPAT_DARWIN in the exec switch so that COMPAT_DARWIN
is tried first (this will have the advantage of speeding up program
startup). EXECSW_PRIO_{FIRST_LAST} does not seem to work...
2003-10-19 07:52:22 +00:00
simonb 59fb31d7cc Remove unreachable break after return and goto statements. 2003-10-19 01:44:48 +00:00
thorpej eea31306c8 Remove the superuser check for MNT_FORCE on new mounts. It's been
pointed out by several people that it offers no real protection.
2003-10-15 17:26:38 +00:00
hannken a3a898ff0f Add the gating of system calls that cause modifications to the underlying
file system.
The function vfs_write_suspend stops all new write operations to a file
system, allows any file system modifying system calls already in progress
to complete, then sync's the file system to disk and returns. The
function vfs_write_resume allows the suspended write operations to
complete.

From FreeBSD with slight modifications.

Approved by: Frank van der Linden <fvdl@netbsd.org>
2003-10-15 11:28:59 +00:00
dbj fe7c786886 add mnt_iflag field to struct mount for internal flags
mv MNT_GONE, MNT_UNMOUNT and MNT_WANTRDWR to this field
additonally add mnt_writeopcountupper and mnt_writeopcountlower fields
in preparation for pending write suspension support work
bump kernel version to 1.6ZD
2003-10-14 14:02:56 +00:00
thorpej a58b40631e * Shuffle some flags to make it easier to visually compare lists
of flags.
* In the new mount case, make sure to clear the mount "action" flags.
* Allow MNT_FORCE to be set by root on new mounts.
2003-10-13 18:02:20 +00:00
pk db855cea5a ksiginfo_get/exit hook: protect queue operations with splsoftclock() (noted
by Christos).
2003-10-12 20:09:50 +00:00
pk a749472593 ksiginfo_put: protect queue operation with splsoftclock(), since it can
be called from timer interrupts.
2003-10-12 14:32:05 +00:00
chs d2835f509a use "poll" as the wmesg for poll. 2003-10-10 15:24:28 +00:00
lukem 1c33b4e6a4 Overhaul MBR handling (part 1):
<sys/bootblock.h>:
    *	Added definitions for the Master Boot Record (MBR) used by
	a variety of systems (primarily i386), including the format
	of the BIOS Parameter Block (BPB).
	This information was cribbed from a variety of sources
	including <sys/disklabel_mbr.h> which this is a superset of.

	As part of this, some data structure elements and #defines
	were renamed to be more "namespace friendly" and consistent
	with other bootblocks and MBR documentation.
	Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
    *	Deprecated in favor of <sys/bootblock.h> (the latter is more
	"host tool" friendly).

amd64 & i386:
    *	Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
	be consistent with the naming convention of the msdosfs tools.

    *	Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
	and it's confusing to have two functionally equivalent bootblocks,
	especially given that "ufs" has multiple meanings (it could be
	a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

    *	Rework pbr.S (the first sector of bootxx_*):
	    +	Ensure that BPB (bytes 11..89) and the partition table
		(bytes 446..509) do not contain code.
	    +	Add support for booting from FAT partitions if BOOT_FROM_FAT
		is defined.  (Only set for bootxx_msdos).
	    +	Remove "dummy" partition 3; if people want to installboot(8)
		these to the start of the disk they can use fdisk(8) to
		create a real MBR partition table...
	    +	Compile with TERSE_ERROR so it fits because of the above.
		Whilst this is less user friendly, I feel it's important
		to have a valid partition table and BPB in the MBR/PBR.

    *	Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
	with other platforms.

    *	Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
    	we can boot off FAT partitions.

    *	Crank version of /usr/mdec/boot to 3.1, and fix some of the other
	entries in the version file.

installboot(8) (i386):
    *	Read the existing MBR of the filesystem and retain the BIOS
    	Parameter Block (BPB) in bytes 11..89 and the MBR partition
	table in bytes 446..509.  (Previously installboot(8) would
	trash those two sections of the MBR.)

mbrlabel(8):
    *	Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
	to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
2003-10-08 04:25:43 +00:00
thorpej 68723a995b * Shuffle some data structures so, and add a flags word to ksiginfo_t.
Right now the only flag is used to indicate if a ksiginfo_t is a
  result of a trap.  Add a predicate macro to test for this flag.
* Add initialization macros for ksiginfo_t's.
* Add accssor macro for ksi_trap.  Expands to 0 if the ksiginfo_t was
  not the result of a trap.  This matches the sigcontext trapcode semantics.
* In kpsendsig(), use KSI_TRAP_P() to select the lwp that gets the signal.
  Inspired by Matthias Drochner's fix to kpsendsig(), but correctly handles
  the case of non-trap-generated signals that have a > 0 si_code.

This patch fixes a signal delivery problem with threaded programs noted by
Matthias Drochner on tech-kern.

As discussed on tech-kern.  Reviewed and OK's by Christos.
2003-10-08 00:28:40 +00:00
thorpej bcf389773b Whitespace nits. 2003-10-07 00:23:17 +00:00
christos e59ff2cb68 Don't look for file descriptor matches when a process is exiting. From
Andrey Petrov.
2003-10-04 03:45:49 +00:00
itojun 98d5598feb when dropping M_PKTHDR, need to free m_tag associated with it. 2003-10-03 20:56:11 +00:00
christos 754bffb7e7 Fix problem with signal trampoline version checking that did not take into
account that emulations usually use version 0 and provide their own in kernel
trampolines.
2003-10-03 17:51:13 +00:00
christos 1f6ab188f9 If the user passes enough space, output the per cpu states instead of
aggregating them.
2003-10-03 15:33:42 +00:00
kleink cad1622bfb Need opt_posix.h for P1003_1B_SEMAPHORE. 2003-10-02 09:30:16 +00:00
itojun d104a1a89a make debug_sysctl() sysctl MIB check more strict. from smak.
attack similar to NetBSD-SA2003-014 can be mounted due to this flaw.
2003-10-01 21:45:14 +00:00
cl 1453f2ca48 make sa_vp_donate update p_nrlwps when it retires an LWP 2003-10-01 14:50:06 +00:00
christos 7bd9c302eb Regen 2003-09-30 20:36:40 +00:00
christos 4420def0dc #ifdef _LIBC the semid_t syscalls since we don't define semid_t in userland
except in the libc case.
XXX: Should we define __semid_t instead and make those visible from userland
again? Only ktrace and syscall() get affected.
2003-09-30 20:36:10 +00:00
christos a474dc2106 Keep track of which prototypes we declared already so that we don't
declare them again.
2003-09-30 20:34:28 +00:00
cb 93491c15d3 fix O_NOFOLLOW for non-O_CREAT case.
Reviewed by: christos@ (some time ago)
2003-09-29 10:04:03 +00:00
dsl eed203ed54 Simod has persuaded me to remove the 'sizeof (struct kinfo_drivers)' field. 2003-09-28 13:24:48 +00:00
mycroft ad3b20a692 A nit I ran into while copying this code for something else... 2003-09-27 23:10:47 +00:00
dsl 84577b4fe4 Add kern.root_partition (sysinst needs to know it)
Add kern.drivers - reports driver names and major numbers
Remove some redundant caddr_t casts.
2003-09-27 07:58:55 +00:00
matt 3ce59aebf3 Deal with signal trampoline being const. 2003-09-27 00:57:45 +00:00
matt 2546f51a33 Regen. 2003-09-26 23:11:16 +00:00
matt ebb8ea4c89 Constify __sigaction_sigtramp argument 'void * tramp'. 2003-09-26 23:08:24 +00:00
matt 6986092cfe Add a machine-dependent SIGTRAMP_VALID macro which is used to test whether
a trampoline version is valid or not.
2003-09-26 22:14:19 +00:00