Commit Graph

185 Commits

Author SHA1 Message Date
jdolecek 85fbcb3c05 return EMSGSIZE rather than ENOMEM if it would not be possible to
allocate space for accrights within stackgap
comment the copyin() of msg.msg_control in recvmsg() is safe
2001-07-22 13:46:51 +00:00
jdolecek 588b94c0a2 Expel MSG_COMPAT/COMPAT_OLDSOCK, make the COMPAT_43 wrappers
arrange things as needed.  Unfortunately, the check in sockargs()
have to stay, since 4.3BSD bind(2), connect(2) and sendto(2) were
not versioned at the time :(

This code was tested to pass regression tests.
2001-07-17 11:49:40 +00:00
jdolecek e24cc0f4c5 compat_43_sys_send(): wrap using sys_sendto() rathen than sendit()
compat_43_sys_recv(): wrap using sys_recvfrom() rathen than recvit()
2001-07-07 14:44:45 +00:00
jdolecek 26d45c1101 Back off the sendit()/recvit() change, some have problems with it 2001-06-25 20:46:11 +00:00
jdolecek 7f7c60e827 Add 'kernsa' parameter for sendit()/recvit(); if nonzero, msg->msg_name
is supposed to point directly to struct mbuf or struct sockaddr in kernel
space as appropriate, rather than being a pointer to memory in userland.

This is to be used by compat/* when emulation needs to wrap
send{to|msg}(2)/recv{from|msg}(2) and modify the passed struct
sockaddr.
2001-06-25 19:24:02 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
mrg 6a89288a37 use _KERNEL_OPT. 2001-05-30 11:37:21 +00:00
jdolecek b6d1d4db02 Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
2001-04-09 10:22:00 +00:00
jdolecek 16b1272b3f Add new 'stat' fileop and call the stat function via f_ops rather
than directly.
For compat syscalls, also add necessary FILE_USE()/FILE_UNUSE().
Now that soo_stat() gets a proc arg, pass it on to usrreq function.
2001-04-07 09:00:57 +00:00
jdolecek c48d420625 emul_find(): actually, the emulation root vnode dance has to be done for
CHECK_ALT_SYMLINK() same way as for CHECK_ALT_EXISTS()
This fixes lossage reported on current-users and kern/12019 by Ross Harvey.
2001-02-02 21:17:45 +00:00
jdolecek 2fcd02eea0 Introduce CHECK_ALT_SYMLINK() - this checks for alternative location without
following links, hence is usable for checking of presence of a symlink.
Also slighly cleanup EXISTS and CREAT cases - use symbolic constants
instead of 0/1.
This is needed for emulation of readlink(2), lchown(2) and similar.
Addresses kern/11757.
2001-01-22 19:50:56 +00:00
jdolecek 0d8b0305c5 don't define SYSVMSG if it's already defined 2000-12-21 19:30:26 +00:00
jdolecek df68499f38 make LKM safe 2000-12-17 15:55:47 +00:00
sommerfeld 5348dfb6ac Have recursive make invocations depend on the .MAKE pseudo-target so
make knows to handle them specially.
2000-12-05 17:01:19 +00:00
jdolecek 01040d97a2 add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
2000-12-01 12:28:30 +00:00
jdolecek 73f3cd8c7e LKMify 2000-11-29 21:51:49 +00:00
jdolecek bc146d0eb0 make const the struct emul * pointers passed/used in stackgap_init(),
stackgap_alloc()
2000-11-20 20:23:07 +00:00
eeh 559cfbe78a Don't dereference NULL t_linesw. 2000-11-08 22:51:01 +00:00
itohy 486a58959c Adapt to the new line discipline scheme. 2000-11-02 11:00:53 +00:00
eeh 1ecf6779be Add support for variable end of user stacks needed to support COMPAT_NETBSD32:
`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

	PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
	from `vm_minsaddr'.

	Bump the kernel version number.
2000-09-28 19:05:06 +00:00
sommerfeld 6b88a0fc51 Emulation stackgap sanity checks, based partly on fixes from
FreeBSD-SA00:42.

Change stackgap_alloc to bounds-check the allocation vs. the stack
gap, returning NULL if there isn't room for the allocation.

Change emul_find() to check for a NULL return from stackgap_alloc()
and convert that into ENAMETOOLONG.

Reorder various emulation syscalls so that all *_CHECK_ALT_{EXIST,CREAT}
calls (which turn into emul_find() under the covers come *after* small,
fixed-size stackgap_alloc() calls.

Clean up ibcs2 {get,set}groups.
2000-08-29 14:33:25 +00:00
mrg 705b50bf32 fix LP64 warnings. 2000-07-27 14:00:56 +00:00
pk 9c601e5c64 lstat: since namei() returns an error (EISDIR) if there is no parent to lock,
retry the lookup without LOCKPARENT if that happens. This is safe, since
need to have LOCKPARENT only if the vnode is of type VLNK.
2000-07-26 11:43:07 +00:00
thorpej ba40fcada3 Sprinkle in some const. 2000-07-14 07:12:47 +00:00
mrg 13f211c52e remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 15:39:24 +00:00
mrg 89d0a3e519 remove redundant vm includes. 2000-06-26 14:38:50 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
mrg c543a66253 remove some redundant <vm/vm_xxx.h> includes 2000-06-25 13:26:19 +00:00
simonb 38cc1b3975 Add new sysctl node "KERN_SYSVIPC_INFO" with "KERN_SYSVIPC_MSG_INFO",
"KERN_SYSVIPC_SEM_INFO" and "KERN_SYSVIPC_SHM_INFO" to return the
info and data structures for the relevent SysV IPC types.  The return
structures use fixed-size types and should be compat32 safe.  All
user-visible changes are protected with
	#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)

Make all variable declarations extern in msg.h, sem.h and shm.h and
add relevent variable declarations to sysv_*.c and remove unneeded
header files from those .c files.

Make compat14 SysV IPC conversion functions and sysctl_file() static.

Change the data pointer to "void *" in sysctl_clockrate(),
sysctl_ntptime(), sysctl_file() and sysctl_doeproc().
2000-06-02 15:53:03 +00:00
chs a6d33cc1f2 add a new function vn_marktext() for exec code to let others know
that the vnode is now being used as process text.
2000-04-11 04:37:47 +00:00
augustss a82aeb5508 Kill register declarations. 2000-03-30 11:24:16 +00:00
simonb 9ff7681a33 Don't need to include <sys/conf.h> here. 2000-03-29 03:43:31 +00:00
simonb 2f1fef39b3 Centralise the declarations of cpu_model, machine, machine_arch,
osrelease, and ostype and remove "extern char foo[];" (for hostname
and domainname too).

Also delete redunctant decl of boottime in kern_info_43.c.
2000-03-28 23:57:24 +00:00
tsutsui 11c8f56d48 Revert STRIPPROG -> STRIP 2000-02-01 05:25:24 +00:00
tsutsui e61f177ab1 STRIP -> STRIPPROG 2000-01-19 16:29:54 +00:00
bouyer 52497e180a Remplace kern.shortcorename sysctl with a more flexible sheme,
core filename format, which allow to change the name of the core dump,
and to relocate it in a directory. Credits to Bill Sommerfeld for giving me
the idea :)
The default core filename format can be changed by options DEFCORENAME and/or
kern.defcorename
Create a new sysctl tree, proc, which holds per-process values (for now
the corename format, and resources limits). Process is designed by its pid
at the second level name. These values are inherited on fork, and the corename
fomat is reset to defcorename on suid/sgid exec.
Create a p_sugid() function, to take appropriate actions on suid/sgid
exec (for now set the P_SUGID flag and reset the per-proc corename).
Adjust dosetrlimit() to allow changing limits of one proc by another, with
credential controls.
1999-09-28 14:47:00 +00:00
thorpej 9244fc5b3e Add compatibility calls for the 1.4 System V IPC *ctl() calls, and
update the 1.0 compat calls.
1999-08-25 04:47:12 +00:00
drochner 192b3c733c Build libraries for kernel/standalone code from within their compilation
directories and use .PATH to lookup the source files.
(Formerly, the libs were built from the source dirs, with MAKEOBJDIR
set to the compilation directory.)
This solves 2 problems:
-"mkdep" and "make" are now consistent about the file lookup, this fixes
 bad interactions with amd reported in PR bin/7374 (Arne Juul) and
 lossage reported by Andrew Gillham ("obj" dirs and relative paths still
 don't work well together)
-kernel compile trees can be moved around without forcing a new
 "make depend" - fixing PR kern/4021 by Martin Husemann
1999-05-07 14:28:50 +00:00
thorpej e3669c3393 Add "use counting" to file entries. When closing a file, and it's reference
count is 0, wait for use count to drain before finishing the close.

This is necessary in order for multiple processes to safely share file
descriptor tables.
1999-05-05 20:01:01 +00:00
christos a38ee86714 Make ss_size something reasonable (not 0) so sigaltstack does not fail.
Pull me up plz!
1999-04-29 16:09:12 +00:00
christos b69c7692af From cgd again: pbuf == path on failure. 1999-04-27 15:42:37 +00:00
christos c4f1bab08e Make the usage consistant and document it:
if the path was given in a user buffer, return the new path in
a user buffer.
if the path was given in a kernel buffer, allocate a new kernel buffer
to return the new path; the caller is responsible for freeing the buffer
if we fail always set the new path to NULL.
This usage broke when I adde the /../ shortcut. Noted by cgd.
1999-04-27 11:36:47 +00:00
cgd 5b217baeb1 implement a simple function, emul_flags_translate() to do table-based
flags translation.
1999-04-24 02:56:06 +00:00
cgd f12f795592 a quick hack to make generating errno conversion tables from our and other
systems' headers a bit easier.  leaves much to be desired, but it's better
than nothing.
1999-04-23 05:31:33 +00:00
drochner 74768f75f4 remove unneeded <vm/*> includes 1999-04-01 18:37:33 +00:00
wrstuden eb10774f2b Explicitly mask mode returned in old stat structure to 16 bits. Also correct
comment (we're converting from a new to an old struct stat).
1999-03-30 00:13:57 +00:00
mrg d2397ac5f7 completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
1999-03-24 05:50:49 +00:00
christos 5e44086190 Provide a way for compat programs to specify files in the normal tree.
We do this using a trick similar to mach's /../; if a path is given as
/..<absolute-path-name>, then we return <absolute-path-name>
1999-02-14 14:32:02 +00:00
lukem dcab0210a0 convert from NOxxx= to MKxxx=no.
include <bsd.own.mk> if testing a MKxxx variable.
1999-02-13 02:54:17 +00:00
christos fd74051670 char * and char ** -> const char * and const char ** 1999-02-09 20:16:08 +00:00
drochner c22ef79250 solve the COMPAT_OLDSOCK/MSG_COMPAT problem differently:
The source files which need MSG_COMPAT define COMPAT_OLDSOCK.
1998-12-18 13:18:42 +00:00
mrg 776ca9e185 back out previous; it breaks when MSG_COMPAT is not defined (no compatibility modules) 1998-12-18 13:00:33 +00:00
mycroft 4a40350c5d Nuke some #ifdefs that no longer work with COMPAT_43 defopted. 1998-12-14 13:03:19 +00:00
tron ccb04baa10 Defopt SYSVMSG, SYSVSEM and SYSVSHM. 1998-10-19 22:26:39 +00:00
fvdl 192330fdc1 Assign to TNF completely. 1998-10-03 15:48:38 +00:00
pk b1a2d338c9 Fix copyout() arguments. 1998-09-14 21:03:59 +00:00
thorpej 274c8c5f24 Put the prototypes for native_sig*_to_sig*() in one place. 1998-09-13 01:41:16 +00:00
mycroft fb526e055c Substantial signal handling changes:
* Increase the size of sigset_t to accomodate 128 signals -- adding new
  versions of sys_setprocmask(), sys_sigaction(), sys_sigpending() and
  sys_sigsuspend() to handle the changed arguments.
* Abstract the guts of sys_sigaltstack(), sys_setprocmask(), sys_sigaction(),
  sys_sigpending() and sys_sigsuspend() into separate functions, and call them
  from all the emulations rather than hard-coding everything.  (Avoids uses
  the stackgap crap for these system calls.)
* Add a new flag (p_checksig) to indicate that a process may have signals
  pending and userret() needs to do the full (slow) check.
* Eliminate SAS_ALTSTACK; it's exactly the inverse of SS_DISABLE.
* Correct emulation bugs with restoring SS_ONSTACK.
* Make the signal mask in the sigcontext always use the emulated mask format.
* Store signals internally in sigaction structures, rather than maintaining a
  bunch of little sigsets for each SA_* bit.
* Keep track of where we put the signal trampoline, rather than figuring it out
  in *_sendsig().
* Issue a warning when a non-emulated sigaction bit is observed.
* Add missing emulated signals, and a native SIGPWR (currently not used).
* Implement the `not reset when caught' semantics for relevant signals.

Note: Only code touched by the i386 port has been modified.  Other ports and
emulations need to be updated.
1998-09-11 12:50:05 +00:00
lukem c9db84ecc9 distclean is a synonym for cleandir 1998-09-05 15:15:14 +00:00
christos 8fb507a3b7 Assign copyright to TNF. 1998-09-05 14:50:25 +00:00
mrg edda33e00c move <vm/vm_swap.h> to <sys/swap.h>. <vm/vm_swap.h> still works for now (goes away later) 1998-08-29 17:01:14 +00:00
mycroft 6d3d8a1350 Make copyright notices with my name consistent. 1998-08-15 03:02:31 +00:00
kleink c6ef57702d UIO_MAXIOV -> IOV_MAX 1998-08-04 12:19:15 +00:00
kleink 3d9b4a4320 Fix two off-by-one bugs, both present in each recvmsg(2) and sendmsg(2):
* the first one would cause an unnecessary malloc() of iovec storage for
  a msg_iovlen of UIO_SMALLIOV although the required amount of memory has
  been allocated on the stack.
* the second one would cause a recvmsg() or sendmsg() with a msg_iovlen of
  UIO_MAXIOV to fail with EMSGSIZE, which is also a violation of XNS5.
1998-08-03 15:15:58 +00:00
jonathan d275e56dee * defopt COMPAT_{09,10,11,12,13} and COMPAT_NOMID.
TODO: revisit interaction between native compat and emul compat usage.
1998-07-05 08:49:30 +00:00
kleink d40e7c810b Make adding new source files easier and enhance readability by ordering SRCS
items by (Net)BSD version first, then alphabetically.
1998-04-28 16:27:51 +00:00
scottb 498bb9530b Modified compat_10_sys_semsys to correctly read in a union arg (a5)
and pass a union pointer arg to sys___semctl
1998-03-05 04:26:35 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
thorpej 00fa9be52f Include the UNION option header. 1998-02-19 00:35:26 +00:00
mrg d90485202c - add defopt's for UVM, UVMHIST and PMAP_NEW.
- remove unnecessary UVMHIST_DECL's.
1998-02-10 14:08:44 +00:00
mrg 1a8c7604f4 initial import of the new virtual memory system, UVM, into -current.
UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code.  i provided some help
getting swap and paging working, and other bug fixes/ideas.  chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the rest of the MI portion changes.

this will be KNF'd shortly.  :-)
1998-02-05 07:59:28 +00:00
mycroft b77637a440 Fix an old typo that caused shmdt() to fail. 1998-01-22 17:22:52 +00:00
kleink 5d7a8f4a16 Modify the recent sigaltstack() interface change to use the __RENAME() scheme;
add __sigaltstack14().
1997-11-29 18:38:20 +00:00
kleink a255f23ee3 In XPG4.2, the ss_size member of type stack_t (struct sigaltstack) is specified
to be of type size_t; since this imposes an interface change on the Alpha
(sizeof(int) != sizeof(size_t)), allocate a new system call number and make
the previous version a compatibility system call.
1997-11-25 19:32:15 +00:00
gwr 5e82d82867 Pass down the values of: AR NM RANLIB
(Fixes PR#4426 from SAITOH Masanobu)
Also pass down LORDER TSORT.
1997-11-04 21:18:24 +00:00
thorpej 14cd99880c Fix the shared library versioning snafu caused by the recent changes
to the stat(2) family and msync(2).  This uses a primitive function
versioning scheme.

This reverts the libc shared library major version from 13 to 12, and
adds a few new interfaces to bring us to libc version 12.20.

From Frank van der Linden <fvdl@NetBSD.ORG>.
1997-10-20 22:05:06 +00:00
mycroft 62f4958011 Copy the whole timespec, not just half of it. Other minor changes. 1997-10-19 01:52:51 +00:00
christos 537eb26ac2 add stat12 compatibility calls and rename ostat to stat43 1997-10-16 23:50:36 +00:00
christos bb19445ec6 PR/4269: msync is missing MS_* 1997-10-16 23:49:38 +00:00
christos 0fdb3e720f Rename to vm_12.c 1997-10-16 23:46:52 +00:00
mycroft 2587de6af9 Adjust u_int arguments of some system calls to int, to match user-level
prototypes.
1997-10-15 17:03:52 +00:00
fvdl 93b08eefc2 u_long -> off_t, I missed the big endian case. From Juergen Hannken-Illjes 1997-10-10 13:03:32 +00:00
mrg 74f573d85d remove advertising clause from all my licenses. 1997-10-10 05:39:47 +00:00
fvdl 811fbe17b5 Add getdirentries backward compat syscall. Provide common function to
signal cookie overflow during emulated getdents and friends.
1997-10-10 01:46:59 +00:00
jonathan d8418c511e machine/psl.h is deprecated; move #include <machine/psl.h> inside #ifdef m68k. 1997-09-03 21:06:50 +00:00
thorpej 8671b8f854 Don't #ifdef compat_12_sys_swapon() so that it can be used by other compat
modules.
1997-06-13 17:28:29 +00:00
mrg 00b1926b5b put the front end into libc. 1997-06-12 22:04:50 +00:00
mrg df072ab6f9 make this sys_swapon() for now. 1997-06-12 21:55:47 +00:00
mrg bd8a2cdada bring mrg-vm-swap2 onto mainline. 1997-06-12 17:35:18 +00:00
christos ca0d389297 PR/3701: Arne H. Juul: olstat can't stat "/", because it still pretended
that symlinks don't have inodes.
1997-06-06 19:36:31 +00:00
cjs 7a66732d34 Back out BUILDDIR and NOINSTALL changes. 1997-05-31 21:21:13 +00:00
cjs 75380e08a1 Use new NOINSTALL option for libraries that are used only during the build
of a program, and not installed into the final system.
1997-05-30 01:55:09 +00:00
mycroft 185b24dd5b Use libinstall::, not install:, to prevent instaling LIB. 1997-05-07 16:20:26 +00:00
gwr 9228e630d5 s/boot/cpu_reboot/ 1997-03-26 23:44:27 +00:00
cgd 78d5e815bf clean up substantially. Transform clean, depend, cleandir targets from ::
to :, so they can be used e.g. with <bsd.prog.mk>.  Standardize variable
names used to configure kernel libraries.

Variables used by these Makefile.inc's are:

S               must be set to the top of the 'sys' tree.
${LIB}DST       may be set to the location of the directory where library
                objects are to be built.  Defaults to ${.OBJDIR}/lib/${lib}.
${LIB}_AS       may be set to 'obj' to build a object from the library's
                object files.  (Otherwise, a library will be built.)
                Defaults to 'library'.
${LIB}MISCMAKEFLAGS
                Miscellaneous flags to be passed to the library's Makefile when
                building.  See library's Makefile for more details about
                supported flags and their default values.

(where LIB is COMPAT, and lib is compat, in this case.)
1997-01-23 22:58:26 +00:00
christos 56829373e8 PR/2981: use ${VAR:Q} instead of '${VAR}' to avoid quoting problems 1996-12-26 21:30:59 +00:00
cgd ce53653783 make the namei struct members ni_dirp and ni_next, and the componentname
struct member cn_nameptr 'const', since they should never be used to
modify the path name.  (Only the pathname buffer, cn_pnbuf, should be
modified.)  Propagate the const poisoning to code that uses the namei
and componentname structs.
1996-10-25 23:13:58 +00:00
explorer 8e8c326f5d Spelling error 1996-10-22 22:28:20 +00:00
christos 53e42f3487 Backout previous kprintf change. 1996-10-13 00:46:49 +00:00
thorpej bddeb30297 Don't inline stackgap_init() and stackgap_alloc(). Doing so generates
an include file dependency graph that's much more complicated than
it needs to be, and wastes space in the kernel.
1996-10-12 02:12:55 +00:00