Rewrite of crypt library to be more modular, and addition of the
Secure Hashing Algorithm - 1 (SHA-1), along with the further
refinement of what $x$salt$hash means. With this new crypt the
following are all acceptable:
$1$
$MD5$
$SHA1$
Note: $2$ is used by OpenBSD's Blowfish, which I considered adding
as $BF$, but there is no actual need for it with SHA-1. However,
somebody wishing to add OpenBSD password support could easilly add
it in now.
There is also a malloc_crypt() available in the library now, which
behaves exactly the same as crypt(), but it uses a malloced buffer
instead of a static buffer. However, this is not standard so will
likely not be used much (at all).
Also, for those interested I did a brief speed test Pentium 166/MMX,
which shows the DES crypt to do approximately 2640 crypts a CPU second,
MD5 to do about 62 crypts a CPU second and SHA1 to do about 18 crypts
a CPU second.
Matthew Dillon [Thu, 21 Jan 1999 10:17:12 +0000 (10:17 +0000)]
Mainly changes to support the new swapper. The big adjustment is that
swap blocks are now in PAGE_SIZE'd increments instead of DEV_BSIZE'd
increments. We still convert to DEV_BSIZE'd increments for the
backing store I/O, but everything else is in PAGE_SIZE increments.
Matthew Dillon [Thu, 21 Jan 1999 10:15:24 +0000 (10:15 +0000)]
Move many of the vm_pager_*() functions from vm_pager.c to inlines in
vm_pager.h
Added argument to getpbuf() and relpbuf() to allow each subsystem to
specify a different hard limit on the number of simultanious physical
bufferes that said subsystem may allocate. Without this feature, one
subsystem ( e.g. the vfs clustering code ) could hog *ALL* the pbufs,
causing a deadlock in the pager in a low memory situation.
Matthew Dillon [Thu, 21 Jan 1999 10:12:54 +0000 (10:12 +0000)]
Reorganized some of the low memory testing code to make it more useful.
Removed call to vm_object_collapse(), which can block. This was being
called without the pageout code holding any sort of reference on the
vm_object or vm_page_t structures being manipulated. Since this code
can block, it was possible for other kernel code to shred the state
the pageout code was assuming remained intact.
Fixed potential blocking condition in vm_pageout_page_free() ( which
could cause a deadlock in a low-memory situation ).
Currently there is a hack in-place to deal with clean filesystem meta-data
polluting the inactive page queue. John doesn't like the hack, and neither
do I.
Revamped and commented a portion of the pageout loop.
Added protection against potential memory deadlocks with OBJT_VNODE
when using VOP_ISLOCKED(). The problem is that vp->v_data can be NULL
which causes VOP_ISLOCKED() to return a less informed answer.
remove vm_pager_sync() -- none of the pagers use it any more ( the old
swapper used to. The new one does not ).
Matthew Dillon [Thu, 21 Jan 1999 10:06:24 +0000 (10:06 +0000)]
The TAILQ hashq has been turned into a singly-linked=list link,
reducing the size of vm_page_t.
SWAPBLK_NONE and SWAPBLK_MASK are defined here. These actually are
more generalized then their names imply, but their placement is somewhat
of a legacy issue from a prior test version of this code that put
the swapblk in the vm_page_t structure. That test code was eventually
thrown away. The legacy remains.
Added vm_page_flash() inline. Similar to vm_page_wakeup() except that
it does not clear PG_BUSY ( one assumes that PG_BUSY is already clear ).
Used by a number of routines to wakeup waiters.
Collapsed some of the code in inline calls to make other inline calls.
GCC will optimize this well and it reduces duplication.
vm_page_free() and vm_page_free_zero() inlines added to convert to
the proper vm_page_free_toq() call.
vm_page_sleep_busy() inline added, replacing vm_page_sleep() ( which has
been removed ). This implements a much more optimizable page-waiting
function.
Matthew Dillon [Thu, 21 Jan 1999 10:01:49 +0000 (10:01 +0000)]
The hash table used to be a table of doubly-link list headers ( two
pointers per entry ). The table has been changed to a singly linked
list of vm_page_t pointers. The table has been doubled in size, but
the entries only take half the space so a net-zero change in memory use.
The hash function has been changed, hopefully for the better. The
combination of the larger hash table size of changed function should
keep the chain length down to a reasonable number (0-3, average 1).
vm_object->page_hint has been removed. This 'optimization' was not
only never needed, but costs as much as a hash chain link to implement.
While having page_hint in vm_object might result in better locality
of reference, the cost is not worth the space in vm_object or the
extra instructions in my view.
vm_page_alloc*() functions have been inlined and call a generalized
non-inlined vm_page_alloc_toq() which combines the standard alloc
and zero-page alloc functions together, reducing code size and the L1
cache footprint. Some reordering has been done... not much. The
delinking code should be faster ( because unlinking a doubly-linked list
requires four memory ops and unlinking a singly linked list only requires
two ), and we get a hash consistancy check for free.
vm_page_rename() now automatically sets the page's dirty bits.
vm_page_alloc() does not try to manually inline freeing a cache page.
Instead, it now properly calls vm_page_free(m) ... vm_page_free() is
really too complex to manually inline.
Matthew Dillon [Thu, 21 Jan 1999 09:51:21 +0000 (09:51 +0000)]
The vm_object structure is now somewhat smaller due to the removal
of most of the swap-pager-specific fields, the removal of the id,
and the removal of paging_offset.
A new inline, vm_object_pip_wakeupn() has been added to subtract an
arbitrary number n from the paging_in_progress count and then wakeup
waiters as necessary. n may be 0, resulting in a 'flash'.
Matthew Dillon [Thu, 21 Jan 1999 09:46:55 +0000 (09:46 +0000)]
object->id was badly implemented. It has simply been removed.
object->paging_offset has been removed - it was used to optimize a
single OBJT_SWAP collapse case yet introduced massive confusion throughout
vm_object.c. The optimization was inconsequential except for the
claim that it didn't have to allocate any memory. The optimization
has been removed.
madvise() has been fixed. The old madvise() could be made to operate
on shared objects which is a big no-no. The new one is much more careful
in what it modifies. MADV_FREE was totally broken and has now been fixed.
vm_page_rename() now automatically dirties a page, so explicit dirtying
of the page prior to calling vm_page_rename() has been removed.
Matthew Dillon [Thu, 21 Jan 1999 09:41:52 +0000 (09:41 +0000)]
Objects associated with raw devices are no longer counted in the VM stats
total because they may contain absurd numbers ( like the size of all
of physical memory if you mmap() /dev/mem ).
Matthew Dillon [Thu, 21 Jan 1999 09:40:48 +0000 (09:40 +0000)]
General cleanup related to the new pager. We no longer have to worry
about conversions of objects to OBJT_SWAP, it is done automatically
now.
Replaced manually inserted code with inline calls for busy waiting on
pages, which also incidently fixes a potential PG_BUSY race due to
the code not running at splvm().
vm_objects no longer have a paging_offset field ( see vm/vm_object.c )
Matthew Dillon [Thu, 21 Jan 1999 09:35:38 +0000 (09:35 +0000)]
Mainly cleanup. Removed some inappropriate low-memory handling code
and added lots of comments. Add tie-in to vm_pager ( and thus the
new swapper ) to deallocate backing swap for dirtied pages on the fly.
Matthew Dillon [Thu, 21 Jan 1999 09:33:07 +0000 (09:33 +0000)]
The default_pager's interaction with the swap_pager has been reorganized,
and the swap_pager has been completely replaced.
The new swap pager uses the new blist radix-tree based bitmap allocator
for low level swap allocation and deallocation. The new allocator
is effectively O(5) while the old one was O(N), and the new allocator
allocates all required memory at init time rather then at allocate
memory on the fly at run time.
Swap metadata is allocated in clusters and stored in a hash table,
eliminating linearly allocated structures.
Many, many features have been rewritten or added. Swap space is now
reallocated on the fly providing a poor-mans auto defragmentation of
swap space. Swap space that is no longer needed is freed on a timely
basis so no garbage collection is necessary.
Swap I/O is marked B_ASYNC and NFS has been fixed to do the right
thing with it, so NFS-based paging now has around 10x the performance
as it did before ( previously NFS enforced synchronous I/O for paging ).
Matthew Dillon [Thu, 21 Jan 1999 09:27:03 +0000 (09:27 +0000)]
Added support for VOP_FREEBLKS(), reducing MFS's impact on swap and
increasing performance by deallocating at least some of the backing
store when files are removed.
Matthew Dillon [Thu, 21 Jan 1999 09:19:33 +0000 (09:19 +0000)]
The main operational changes are in getblk()'s handling of the
B_DELWRI and B_CACHE flags, fixing a bug that showed up with NFS.
Also, a number of cases where manually inserted code has been removed
and replaced with an inline function call giving us better functional
isolation in the source.
Matthew Dillon [Thu, 21 Jan 1999 09:02:18 +0000 (09:02 +0000)]
The code that reclaims descriptors from in-transit unix domain
descriptor-passing messages was calling sorflush() without checking
to see if the descriptor was actually a socket. This can cause a
crash by exiting programs that use the mechanism under certain
circumstances.
Matthew Dillon [Thu, 21 Jan 1999 09:00:26 +0000 (09:00 +0000)]
Fixed a potential bug ( but maybe not ), where sendfile() clears PG_BUSY
on a page without testing for waiters. Also collapsed busy wait into
new vm_page_sleep_busy() inline ( see vm/vm_page.h )
Matthew Dillon [Thu, 21 Jan 1999 08:29:12 +0000 (08:29 +0000)]
This is a rather large commit that encompasses the new swapper,
changes to the VM system to support the new swapper, VM bug
fixes, several VM optimizations, and some additional revamping of the
VM code. The specific bug fixes will be documented with additional
forced commits. This commit is somewhat rough in regards to code
cleanup issues.
Reviewed by: "John S. Dyson" <root@dyson.iquest.net>, "David Greenman" <dg@root.com>
Greg Lehey [Thu, 21 Jan 1999 00:55:28 +0000 (00:55 +0000)]
Update to reflect changes in kernel module
Remove references to LKMs
Change descriptions on read command (HEADS UP: this command has changed
in an incompatible manner)
Greg Lehey [Thu, 21 Jan 1999 00:41:31 +0000 (00:41 +0000)]
Retain some of the RAID5 texts even in the non-RAID5 versions.
Previously, accidentally starting the wrong version could corrupt
the RAID5 configuration.
Add functions Volno, Plexno and Sdno to replace the old defines
VOLNO, PLEXNO and SDNO.
Greg Lehey [Thu, 21 Jan 1999 00:40:32 +0000 (00:40 +0000)]
Include Peter Wemm's renaming and restructuring
Change from lkm to kld
Serious rewrite. No longer call set_<foo>_state to set the state
based only on other objects; instead, add functions
update_<foo>_state, which determine what the state should be by
themselves. This allows the set_<foo>_state functions to shrink
enough to be almost intelligible.
Remove flags setstate_recurse and setstate_recursing.
Remove plex defective regions and unmapped regions, which were
maintained but not used.
Change code to allow daemon to perform operations formerly kludged
into an interrupt context. Remove the DIRTYCONFIG kludge.
Greg Lehey [Thu, 21 Jan 1999 00:39:36 +0000 (00:39 +0000)]
Include Peter Wemm's renaming and restructuring
Change from lkm to kld
Remove #ifdefs for FreeBSD 2.c
vinumstrategy:
Support anonymous (`raw') subdisks and plexes.
Change code to allow daemon to perform operations formerly kludged
into an interrupt context. Remove the DIRTYCONFIG kludge.
No longer set B_ORDERED for reviving subdisks. I suspect this
wouldn't work correctly, and it should be done in a different manner
in vinumrevive.c
sdio: set subdisk state correctly on error
start to remove code that doesn't make any sense any more.
drive VOP functions: use the PID of the original opener to fool the
lock manager.
open_drive: be quiet about failures (they're normal when scanning the
partitions).
close_drive: lock drive before closing.
remove_drive: lock drive before deallocating.
read_drive_label: set drive up when all is OK
check_drive:
Complete rewrite. Offload most of the code to the new
vinum_scandisk
format_config:
use snprintf and %qd options to make much less emetic.
Remove old supporting functions.
vinum_scandisk:
Moved here from vinum.c
Almost complete rewrite, incorporating much of what was check_drive.
We still don't have a general way to find the drives on a system, so
get the user to supply the names via the `read' command. For each
device, try each possible compatibility slice name (there's a danger
of finding both /dev/da1h and /dev/da0s1h otherwise). Sort the
partitions found in reverse order of last update time and read them
in, setting the `update' parameter to parse_config and descendents.
save_config: rename to daemon_save_config, since the function is now
called by the daemon. Create a new function save_config which queues
the request with the daemon.
daemon_save_config: some mods to allow for the unfamiliar
environment.
John Polstra [Wed, 20 Jan 1999 21:48:56 +0000 (21:48 +0000)]
Change the definition of LIBPAM to support the static PAM library.
When linking statically, LIBPAM is augmented with the extra libraries
that the PAM modules require. The idea is to centralize this
information rather than scattering it about in the Makefiles of
all the applications that use (OK, will use) PAM.
There is a new variable MINUSLPAM that should be used instead of
"-lpam". In the static case, it gets -l flags for the extra required
libraries.
This approach was suggested by <bde>, but he didn't actually review
my changes.
John Polstra [Wed, 20 Jan 1999 21:42:40 +0000 (21:42 +0000)]
Add some capabilities to <bsd.lib.mk> so that it can be used for
building dlopen-able modules, and add features needed to build a
static PAM library. I think I cleaned it up some, too, but beauty
is in the eye of the beholder.
You can now build a shared library without version numbers, by
defining SHLIB_NAME to something like "pam_unix.so". If SHLIB_MAJOR
and/or SHLIB_MINOR are set, SHLIB_NAME gets the usual default value,
but it can be overridden if desired. If none of these symbols are
set, no shared library is built.
SHLIB_LINK controls the name of the symbolic link that points to
the library. If it is unset, no link is made. In the usual case,
it gets the right default: e.g., "libc.so" for ELF, nothing for
a.out. This can be overridden.
STATICOBJS can be set to a list of extra object files that should
be added to the static library but not to the shared library.
These objects are added to the profiled library too.
These changes should make it easy to use <bsd.lib.mk> for building
things such as PAM modules and dynamic linkers, for which <bsd.prog.mk>
has been abused until now.
Nik Clayton [Wed, 20 Jan 1999 19:46:42 +0000 (19:46 +0000)]
iso639 is the ISO two letter codes for the representation of the names of
languages (en = English, de = German, zn = Chinese, and so on). This
complements the existing iso3166 file, which maps codes to countries.
Country code != language code.
I ran this past -core. No one voiced any objections, jkh said "fine".
Peter Wemm [Wed, 20 Jan 1999 19:22:24 +0000 (19:22 +0000)]
*blush*. As a quick fix, move configure()'s SYSINIT back a little to allow
CAM's xpt_init() to get in first. I hope this will fix the build again,
sorry guys. :-(
XXX configure_start() and configure_end() seem to be a bit excessive.. both
here and in the i386 code.
Mike Spengler [Wed, 20 Jan 1999 18:36:58 +0000 (18:36 +0000)]
Clarify the number of network interfaces per physical interface available with
each type of signalling manager and bring the atm command into agreement with
the man page.
Brian Somers [Wed, 20 Jan 1999 18:06:52 +0000 (18:06 +0000)]
Recurse when we've switched state via LoginDone(). If we've
got an open link, we want it to be select()d on - otherwise
we get a freeze when ``openmode'' is passive.
Bill Fenner [Wed, 20 Jan 1999 17:32:01 +0000 (17:32 +0000)]
Add a flag, passed to pru_send routines, PRUS_MORETOCOME. This
flag means that there is more data to be put into the socket buffer.
Use it in TCP to reduce the interaction between mbuf sizes and the
Nagle algorithm.
Based on: "Justin C. Walker" <justin@apple.com>'s description of Apple's
fix for this problem.
Eivind Eklund [Wed, 20 Jan 1999 14:49:12 +0000 (14:49 +0000)]
Add 'options DEBUG_LOCKS', which stores extra information in struct
lock, and add some macros and function parameters to make sure that
the information get to the point where it can be put in the lock
structure.
Put back this wholly innocent victim of Mike's drive-by shooting on alog;
it belongs to the labpc driver. Mike will be in the corner wearing
the pointed hat, should anyone be looking for him.
Remove obsolete dset code. It's an ELF/3-stage boot world now and there
are cleaner ways of doing this that don't involve stomping on kernel
binaries directly.
Bill Fenner [Wed, 20 Jan 1999 07:55:57 +0000 (07:55 +0000)]
Merge conflicts from 3.9-beta3+IOS12. The conflicts were huge; cvs's
merge algorithm failed on several files, and the translation of the
mrouted man page to mdoc didn't help...