|
|
1.1 root 1: .\" Copyright (c) 1986 Regents of the University of California.
2: .\" All rights reserved. The Berkeley software License Agreement
3: .\" specifies the terms and conditions for redistribution.
4: .\"
5: .\" @(#)sys.kern.t 1.7 (Berkeley) 4/11/86
6: .\"
7: .EQ
8: delim $$
9: .EN
10: .ne 1i
11: .NH 2
12: Changes in initialization and kernel-level support
13: .PP
14: This section describes changes in the kernel files in \fB/sys/sys\fP
15: with prefixes
16: \fIinit_\fP or \fIkern_\fP.
17: .XP init_main.c
18: Several subsystems have new or renamed initialization routines that are called
19: by \fImain\fP.
20: These include \fIpqinit\fP for process queues,
21: \fIxinit\fP for the text table handling routines,
22: and \fInchinit\fP for the name translation cache.
23: The virtual memory startup \fIsetupclock\fP has been replaced by \fIvminit\fP,
24: that also sets the initial virtual memory limits for process 0 and its
25: descendants.
26: Process 1, \fIinit\fP, is now created before process 2, \fIpagedaemon\fP.
27: .XP init_sysent.c
28: In addition to entries for the two system calls new in 4.3BSD,
29: the system call table specifies a range of system call numbers
30: that are reserved for redistributors of 4.3BSD. Other unused slots
31: in earlier parts of the table should be reserved for future Berkeley use.
32: Syscall 63 is no longer special.
33: .XP kern_acct.c
34: The process time accounting file in 4.2BSD stored times in seconds
35: rather than clock ticks.
36: This made accounting independent of the clock rate, but was too large
37: a granularity to be useful.
38: Therefore, 4.3BSD uses a smaller but unvarying unit for accounting times,
39: 1/64 second, specified in \fIacct.h\fP as its reciprocal AHZ.
40: The \fIcompress\fP function converts seconds and microseconds
41: to these new units, expressed as before in 16-bit pseudo-floating point numbers.
42: .XP kern_clock.c
43: The hardware clock handler implements the new time-correction primitive
44: \fIadjtime\fP by skewing the rate at which time increases until a specified
45: correction has been achieved.
46: The \fIbumptime\fP routine used to increment the time has been changed into
47: a macro.
48: The overhead of software interrupts used to schedule the \fIsoftclock\fP
49: handler has been reduced
50: by noting whether any profiling or timeout activity requires it to run,
51: and by calling \fIsoftclock\fP directly from \fIhardclock\fP
52: (with reduced processor priority) if the previous
53: priority was sufficiently low.
54: .XP kern_descrip.c
55: Most uses of the \fIgetf()\fP function have been replaced by the
56: GETF macro form.
57: The \fIdup\fP calls (including that from \fIfcntl\fP\^) no longer copy
58: the close-on-exec flag from the original file descriptor.
59: Most of the changes to support the open file descriptor high-water mark,
60: \fIu.u_lastfile\fP, are in this file.
61: The \fIflock\fP system call has had several bugs fixed.
62: Unix-domain file descriptor garbage collection is no longer triggered
63: from \fIclosef\fP, but when a socket is torn down.
64: .XP kern_exec.c
65: The \fIa.out\fP header used in the course of \fIexec\fP is no longer in the user
66: structure, but is local to \fIexec\fP.
67: Argument and environment strings are copied to and from the user address space
68: a string at a time using the new \fIcopyinstr\fP and \fIcopyoutstr\fP
69: primitives.
70: When invoking an executable script, the first argument is now the name
71: of the interpreter rather than the file name; the file name appears only
72: after the interpreter name and optional argument.
73: An \fIiput\fP was moved to avoid a deadlock when the executable image
74: had been opened and marked close-on-exec.
75: The \fIsetregs\fP routine has been split;
76: machine-independent parts such as signal action modification are done
77: in \fIexecve\fP directly, and the remaining machine-dependent routine
78: was moved to \fImachdep.c\fP.
79: Image size verification using \fIchksize\fP checks data and bss sizes
80: separately to avoid overflow on their addition.
81: .XP kern_exit.c
82: Instead of looping at location 0x13 in user mode if \fI/etc/init\fP cannot
83: be executed, the system now prints a message and pauses.
84: This is done by \fIexit\fP if process 1 could not run.
85: The search for child processes in \fIexit\fP uses the child and sibling
86: linkage in the \fIproc\fP entry
87: instead of a linear search of the \fIproc\fP table.
88: Failures when copying out resource usage information from \fIwait\fP
89: are now reflected to the caller.
90: .XP kern_fork.c
91: One of the two linear searches of the proc table during process creation
92: has been eliminated, the other looks only at active processes.
93: As the first scan is needed only to count the number of processes
94: for this user, it is bypassed for root.
95: A comment dating to version 7 (``Partially simulate the environment
96: so that when it is actually created (by copying) it will look right.'')
97: has finally been removed; it relates only to PDP-11 code.
98: .XP kern_mman.c
99: \fIChksize\fP takes an extra argument so that data and bss expansion
100: can be checked separately to avoid problems with overflow.
101: .XP kern_proc.c
102: The \fIspgrp\fP routine has been corrected.
103: An attempt to optimize its $ O ( n sup 2 ) $ algorithm
104: (multiple scans of the process table)
105: did so incorrectly; it now uses the child and sibling pointers in the proc
106: table to find all descendents in linear time.
107: \fIPqinit\fP is called at initialization time to set up the process
108: queues and free all process slots.
109: .XP kern_prot.c
110: A number of changes were needed to reflect the type changes
111: of the user and group ID's.
112: The \fIgetgroups\fP and \fIsetgroups\fP routines pass groups as arrays
113: of integers and thus must convert.
114: All scans of the groups array look for an explicit NOGROUP terminator
115: rather than any negative group.
116: For consistency, the \fIsetreuid\fP call sets the process \fIp_uid\fP
117: to the new effective user ID instead of the real ID as before.
118: This prevents the anomaly of a process not being
119: allowed to send signals to itself.
120: .XP kern_resource.c
121: Attempts to change resource limits for process sizes are checked
122: against the maximum segment size that the swap map supports, \fImaxdmap\fP.
123: The error returned when attempting to change another user's priority
124: was changed from EACCESS to EPERM.
125: .XP kern_sig.c
126: The \fIsigmask\fP macro is now used throughout the kernel.
127: The treatment of the \fIsigvec\fP flag has
128: been expanded to include the SV_INTERRUPT
129: option.
130: \fIKill\fP and \fIkillpg\fP have been rewritten, and the errors returned
131: are now closer to those of System V.
132: In particular, unprivileged users may broadcast signals with no error
133: if they managed to kill something,
134: and an attempt to signal process group 0 (one's own group) when no group
135: is set receives an ESRCH instead of an EINVAL.
136: SIGWINCH joins the class of signals whose default action is to ignore.
137: When a process stops under \fIptrace\fP, its parent now receives a SIGCHLD.
138: .XP kern_synch.c
139: The CPU overhead of \fIschedcpu\fP has been reduced as much as possible
140: by removing loop invariants
141: and by ignoring processes that have not run since the last calculation.
142: When long-sleeping processes are awakened, their priority is recomputed
143: to consider their sleep time.
144: \fISchedcpu\fP need not remove processes with new priorities
145: from their run queues and reinsert them unless they are moving to a new queue.
146: The sleep queues are now treated as circular (FIFO) lists,
147: as the old LIFO behavior caused problems for some programs queued
148: for locks.
149: \fISleep\fP no longer allows context switches after a panic,
150: but simply drops the processor priority momentarily then returns;
151: this converts sleeps during the filesystem update into busy-waits.
152: .XP kern_time.c
153: \fIGettimeofday\fP returns the microsecond time on hardware supporting
154: it, including the VAX.
155: It is now possible to set the timezone as well as the time
156: with \fIsettimeofday\fP.
157: A system call, \fIadjtime\fP,
158: has been added to correct the time by a small amount
159: using gradual skew rather than discontinuous jumps forward or backward.
160: .XP kern_xxx.c
161: The 4.1-compatible \fIsignal\fP entry sets the signal SV_INTERRUPT option
162: as well as the per-process SOUSIG, which now controls only the resetting
163: of signal action to default upon invocation of a caught signal.
164: .XP subr_log.c
165: This new file contains routines that implement a kernel error
166: log device.
167: Kernel messages are placed in the message buffer as before,
168: and can be read from there through the log device \fI/dev/klog\fP.
169: .XP subr_mcount.c
170: The kernel profiling buffers are allocated with \fIcalloc\fP instead
171: of \fIwmemall\fP
172: to avoid the dramatic decrease in user virtual memory that could be supported
173: after allocation of a large section of \fIusrpt\fP.
174: .XP subr_prf.c
175: Support was added for the kernel error log.
176: The \fIlog\fP routine is similar to \fIprintf\fP
177: but does not print on the console, thereby suspending system operation.
178: \fILog\fP takes a priority as well as a format, both of which are read from
179: the log device by the system error logger \fIsyslogd\fP.
180: \fIUprintf\fP was modified to check its terminal output queue
181: and to block rather than to use all of the system clists;
182: it is now even less appropriate for use from interrupt level.
183: \fITprintf\fP is similar to \fIuprintf\fP but prints to the tty specified
184: as an argument rather than to that of the current user.
185: \fITprintf\fP does not block if the output queue is overfull, but logs only
186: to the error log;
187: it may thus be used from interrupt level.
188: Because of these changes, \fIputchar\fP and \fIprintn\fP require
189: an additional argument
190: specifying the destination(s) of the character.
191: The \fItablefull\fP error routine was changed to use \fIlog\fP rather than
192: \fIprintf\fP.
193: .XP subr_rmap.c
194: An off-by-one error in \fIrmget\fP was corrected.
195: .XP sys_generic.c
196: The \fIselect\fP call may now be used with more than 32 file descriptors,
197: requiring that the masks be treated as arrays.
198: The result masks are returned to the user if and only if no error (including
199: EINTR) occurs.
200: A select bug that caused processes to disappear was fixed;
201: \fIselwakeup\fP needed to handle stopped processes differently
202: than sleeping processes.
203: .XP sys_inode.c
204: Problems occurring after an interrupted close were corrected
205: by forcing \fIino_close\fP to return to \fIclosef\fP even after an interrupt;
206: otherwise, \fIf_count\fP could be cleared too early or twice.
207: The code to unhash text pages being overwritten needed to be protected
208: from memory allocations at interrupt level to avoid a bogus ``panic: munhash.''
209: The internal routine implementing \fIflock\fP was reworked to avoid several
210: bad assumptions and to allow restarts after an interruption.
211: .XP sys_process.c
212: \fIProcxmt\fP uses the new \fIptrace.h\fP header file;
213: hopefully, the next release will have neither \fIptrace\fP nor \fIprocxmt\fP.
214: The text XTRC flag is set when modifying a pure text image,
215: protecting it from sharing and overwriting.
216: .XP sys_socket.c
217: The socket involved in an interface \fIioctl\fP is passed to \fIifioctl\fP
218: so that it can call the protocol if necessary, as when setting the interface
219: address for the protocol.
220: It is now possible to be notified of pending out-of-band data by selecting
221: for exceptional conditions.
222: .XP syscalls.c
223: The system call names here have been made to agree with reality.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.