Import a my own little ypxfrd protocol. Note that this protocol is
_NOT_ the same as Sun's, which is proprietary.
This basically impliments an RPC-based file transfer protocol which
lets a slave server suck over a raw map database file from the master.
This is many times faster than the normal method, which requires reading
the records from ypserv via yp_all() and then creating a new database
on the fly, particularly when you have many tens of thousands of
records in a map (e.g. a huge passwd database).
The protocol number I chose falls within the 'user-specified' range.
Maybe we should register it with Sun so we can get an official vendor
number for it. :)
not based on gpl'ed code, just prototype and usage. I'm not 100% certain
they behave the same while the system is in trouble (eg: malloc() failing)
but in those circumstances all bets would be off anyway.
These routines work like sprintf() and vsprintf(), except that instead of
using a fixed buffer, they allocate memory and return it to the user
and it's the user's responsibility to free() it. They have allocate as
much memory as they need (and can get), so the size of strings it can deal
with is limited only by the amount of memory it can malloc() on your
behalf.
There are a few gpl'ed programs starting to use this interface, and it's
becoming more common with the scares about security risks with sprintf().
I dont like the look of the code that the various programs (including
cvs, gdb, libg++, etc) provide if configure can't find it on the system.
It should be possible to modify the stdio core code to provide this
interface more efficiently, I was more worried about having something
that worked and was secure. :-) (I noticed that there was once intended
to be a smprintf() routine when our stdio was written for 4.4BSD, but it
looks pretty stillborn, and it's intended interface is not clear). Since
Linux and gnu libc have this interface, it seemed silly to bring yet
another one onto the scene.
If _ANSI_SOURCE or _POSIX_SOURCE is defined, then <ctype.h> had to
be included before <stddef.h> or <stdlib.h> to get rune_t declared.
Now rune_t is declared perfectly bogusly in all cases when <ctype.h>
is included.
This change breaks similar (but more convoluted) convolutions in the
stddef.h in gcc distributions. Ports of gcc should avoid using the
gcc headers.
getnetgrent.c:
- Catch one bogon that snuck by: in _listmatch(), check for '\0'
rather than '\n'; strings returned from yp_match() are terminated
with a nul, not a newline.
getpwent.c:
- Rip out all of the +inclusion/-exclusion stuff from before and
replace it with something a little less grotty. The main problem
with the old mechanism was that it wasted many cycles processing
NIS entries even after it already knew they were to be exlcuded
(or not included, depending on your pointof view). The highlights
of these changes include:
o Uses an in-memory hash database table to keep track of all the
-@netgroup, -user, and -@group exclusions.
o Tries harder to duplicate the behavior normally obtained when using
NIS inclusions/exclusions on a flat /etc/passwd file (meaning things
come out in much the same order).
o Uses seperate methods for handling getpwent() and getpwnam()/getpwuid()
operations instead of trying to do everything with one general
function, which didn't work as well as I thought it would.
o Uses both getnetgrent() and innetgr() to try to save time where
possible.
o Use only one special token in the local password database
(_PW_KEYYPBYNUM) instead of seperate tokens to mark + and -
entries (and stop using the counter tokens too). If this new
token doesn't exist, the code will make due with the standard
_PW_KEYBYNUM token in order to support older databases that
won't have the new token in them.
All this is an attempt to make this stuff work better in environments
with large NIS passwd databases.
and real life. YPPUSHPROC_XFRRESP is supposed to return void and take
an argument of type yppushresp_xfr, not the other way around as yp.x seems
to imply. (I spent two hours today staring intensely at my prototype ypxfr
code and scratching my head before I finally figured this out.)
taking an argument of type ypresp_key. This is incorrect: it should be
ypresp_nokey. (yp_first() is supposed to return the first key in a
given map; the server doesn't need any client-specified key to handle
such a request.)
No, not really. There are just a couple of long-standing bogosities here
that I feel compelled to fix. :)
There are two small changes here:
1) yp.x actually contains _three_ protocol definitions: YPPROG (standard
NIS client/server procedures), YPPUSH_XFRRESPPROG (callback handler
for the YPPROC_XFR service, aka ypxfr/yppush) and YPBINDPROG (for ypbind,
ypset & friends). The problem is that when you run yp.x through rpcgen(1),
it generates client and server stubs with hooks for all three services.
This makes it impossible to actually use the rpcgen-erated code in a
program that only deals with _one_ of these services (ypserv, ypbind,
etc...) without manually removing the unneeded stubs (either by hand
editing or by committing unspeakable horrors with sed). This defeats
the whole purpose of using rpcgen and is generally annoying.
What I've done is to insert a few #ifndefs and #endifs to allow a
programmer to selectively blot out those functions that aren't needed
for a particular program. For instance, if you do 'rpcgen -DYPSERV_ONLY',
you'll get only the necessary client/server stubs to implement the
standard yp client and server functions. If you do 'rpcgen -DYPBIND_ONLY',
you get only what you need for ypbind. If you don't #define anything,
you get the whole mess, just like before, so existing programs won't
notice the difference. (Note that the -D flag is not supported by our
existing crufty version of rpcgen, but I intend to update it soon.)
2) The definition for the ypresp_key_val structure is actually incorrect
with respect to reality: the key and val members are specified in the
wrong order. It should be val/key rather than key/val. For whatever
the reason, Sun's actual NIS implementation contradicts the protocol
definition in this case. Again, accounting for this bogosity here is
cleaner and easier than mangling the output from rpcgen.
Note: this was done by selective patching from diffs by hand, in order
to not conflict with the 4.4BSD base code. Beta9 was done the same way.
Obtained from: Paul Vixie <paul@vix.com>
specified in the top level Makefiles.
Previously I missed dozens of Makefiles that skip the install after
using `cmp -s' to decide that the install isn't necessary.
- Don't do mkdir/chown/chmod
- Do `cmp -s' before attempting to install a header
This should fix the obnoxious problem of yp programs wanting to
rebuild every time.
include/signal.h:
There was massive namespace pollution from including <sys/types.h>.
POSIX functions were declared even when _ANSI_SOURCE is defined.
sys.sys/signal.h:
NSIG was declared even if _ANSI_SOURCE or _POSIX_SOURCE is defined.
sig_atomic_t wasn't declared if _POSIX_SOURCE is defined.
Declare a typedef for signal handling functions and use it to
unobfuscate declarations and to avoid half-baked function types
that cause unwanted compiler warnings at certain warning levels.
Fix confusing comment about SA_RESTART.
sys/i386/include/signal.h:
This has to be included to get the declaration of sig_atomic_t even
when _ANSI_SOURCE is defined, so be more careful about polluting
the ANSI namespace.
Uniformize idempotency ifdefs.
The version 2 support has been tested (client+server) against FreeBSD-2.0,
IRIX 5.3 and FreeBSD-current (using a loopback mount). The version 2 support
is stable AFAIK.
The version 3 support has been tested with a loopback mount and minimally
against an IRIX 5.3 server. It needs more testing and may have problems.
I have patched amd to support the new variable length filehandles although
it will still only use version 2 of the protocol.
Before booting a kernel with these changes, nfs clients will need to at least
build and install /usr/sbin/mount_nfs. Servers will need to build and
install /usr/sbin/mountd.
NFS diskless support is untested.
Obtained from: Rick Macklem <rick@snowhite.cis.uoguelph.ca>
on dlclose. Also correctly call constructors and destructors for libraries
linked with /usr/lib/c++rt0.o.
Change interpretation of dlopen manpage to call _init() rather than init()
for dlopened objects.
Change c++rt0.o to avoid using atexit to call destructors, allowing dlclose to
call destructors when an object is unloaded.
Change interface between crt0 and ld.so to allow crt0 to call a function on
exit to call destructors for shared libraries explicitly.
These changes are backwards compatible. Old binaries will work with the new
ld.so and new binaries will work with the old ld.so. A version number has
been introduced in the crt0-ld.so interface to allow for future changes.
Reviewed by: GAWollman, Craig Struble <cstruble@singularity.bevc.blacksburg.va.us>
Previously they were only guarded by `#ifndef _ANSI_SOURCE'. They are
neither ANSI nor POSIX nor std and should never have been declared here.
Declare functions like abs() as having attribute `__pure2'. Declaring them
as having type `__pure' has been a no-op for some time.
Delete obsolete comment about stub locale functions.
Use consistent formatting for the rand48 functions. These and about 30
other functions should never have been declared here either.
Fix numerous ANSI conformance bugs and other nits.
ctype.h:
o There were no prototypes behind the macros (conformance bug).
o isascii() didn't have enough parentheses (plain bug).
o tolower() and toupper were always static inline (conformance
bug? You could undef them and take their address, but this
gave different addresses in different modules. You couldn't
undef them and declare them (correctly) again). <stdio.h>'s
treatment of putc() shows one way to handle this problem,
but it only works because the putc() macro is allowed to
reevaluate its args. I used a hack controlled by
_EXTERNALIZE_CTYPE_INLINES_ to get <ctype.h> to generate the
code (the previous hack involving _ANSI_LIBRARY_ goes away).
This has the advantage that the core of the functions is only
written down once and the disadvantage that another layer of
functions is required. The extra layer goes away if inline
functions are used, leaving only the problem of understanding
why there are functions named toupper(), __toupper and
___toupper() as well as a macro named toupper.
o Nothing seems to define _USE_CTYPE_LIBRARY_. Eliminate it
o Let the user set _USE_CTYPE_INLINE_ and _DONT_USE_CTYPE_INLINE_
for full control over inlining.
o The args for the inline functions didn't have enough
underscores (conformance bug).
o The formatting and ordering was inconsistent (style bug).
o TODO: fix conformance bugs brought by including <runetype.h>.
password databases:
#define _PW_KEYPLUSBYNUM '5' /* special +@netgroup entries */
#define _PW_KEYMINUSBYNUM '6' /* special -@netgroup entries */
#define _PW_KEYPLUSCNT '7' /* number of +@netgroup entries */
#define _PW_KEYMINUSCNT '8' /* number of -@netgroup entries */
This is to help getpwent.c in libc build the +@netgroup/-@netgroup
caches.
NetBSD ld code except for local changes for dlopen() and friends and
the hashing on the minor value of the shlibs. We should be binary
compatible now with all their libraries.
Obtained from: NetBSD
to properly resolve some definitions in <nfs/nfs.h>. I suppose nobody noticed
this before because no one's tried to build bootparamd in FreeBSD until
now.
(Yes, you read that right: I've got bootparamd ready to go. And
rarpd is on the way. :)
Define CLK_TCK only if _ANSI_SOURCE is not defined.
Don't include <machine/limits.h> to get the definition of CLK_TCK.
CLK_TCK should never have been defined there, and the inclusion
polluted the namespace.
Reduce _JBLEN for the i386 to what is actually used.
Encapsulate jmp_buf and sigjmp_buf in structs.
Enlarge jmp_buf to the same size as sigjmp_buf.
Declare *longjmp as non-returning.
Remove stale comments about sig*jmp not being implemented.
DANGER WILL ROBINSON!
_PATH_UNIX is currently defined as the literal string "don't use this".
I am of two minds about this myself, but wanted to get something into the
tree as quickly as possible.
something in them, and which ones were left blank. This will be used
for YP support in a few minutes, and for user login classes if anyone cares
to implement them.
created at install time and not compared with the current version, so
it can't be installed using install and the timestamp of the target gets
clobbered.
are running under. Here's how to bootstrap (order is important):
1) Re-compile gcc (just the driver is all you need).
2) Re-compile libc.
3) Re-compile your kernel. Reboot.
4) cd /usr/src/include; make install
You can now detect the compilation environment with the following code:
#if !defined(__FreeBSD__)
#define __FreeBSD_version 199401
#elif __FreeBSD__ == 1
#define __FreeBSD_version 199405
#else
#include <osreldate.h>
#endif
You can determine the run-time environment by calling the new C library
function getosreldate(), or by examining the MIB variable kern.osreldate.
For the time being, the release date is defined as 199409, which we have
already established as our target.
/usr/include.
Make comment about mp.h missing and remove it from the list of files.
Fix installation of ufs include files as this is now a tree ufs/{ffs,lfs,
mfs,ufs}.
Make setting of SHARED optional by makeing it SHARED?=.
Comment out installation of X11 includes since it does not work
for XFree86 until we get XFree86 to install as /usr/X11.
Update _PATH_UNIX to be /kernel. Remove /usr/{contrib,old}/bin from
_PATH_STDPATH.
idea considering the old version (but I haven't time for attic surgery - this
is just a caution). This is part of (and the major reason for) the new ld
changes.