Commit Graph

1485 Commits

Author SHA1 Message Date
Peter Wemm
2f92c56cc3 preserve errno across the readlink() calls. There is no value in trashing
errno during a successful malloc() call.
1998-06-18 09:13:16 +00:00
Peter Wemm
02a93d74e0 Don't compile in the use of poll() when building libc_r. This isn't
so much a "fix", rather a bandaid to buy time to fix it properly
within the thread engine.
1998-06-14 11:25:46 +00:00
Bruce Evans
ef2e5f62e3 Document EINVAL return value. 1998-06-14 08:22:05 +00:00
Peter Wemm
f3f4b57ac9 Make nlist() understand elf unconditionally 1998-06-12 15:02:03 +00:00
Peter Wemm
14b93edab3 Update the resolver parts to bind-8.1.2 level. I have not touched the
getXXXXbyYYYY() interfaces yet.

Obtained from: diff relative to bind-8.1.2 sources
1998-06-11 09:03:02 +00:00
John Polstra
63b7c21cc3 Move ftok() from libcompat to libc, so that it can be closer to its
friend shmget().

PR:		closes misc/6763
1998-06-10 16:20:21 +00:00
Daniel O'Callaghan
9b0662e646 Fix grammar, "null" -> "NUL" 1998-06-10 12:37:45 +00:00
John Polstra
363e8996d7 This is a null commit to log the fact that I have done a repository
copy to bring these files into libc from libcompat.  I will enable
them and kill off the libcompat versions on the main branch soon.

PR:		step one toward closing misc/6763
1998-06-10 04:24:21 +00:00
John Birrell
4bc711423a Remove __NETBSD_SYSCALLS from CFLAGS now that it is set in sys.mk. 1998-06-09 22:59:16 +00:00
John Birrell
0b0ae157f8 Rename calls when building libc_r. 1998-06-09 22:57:34 +00:00
John Birrell
f4086bc0cb Make this thread-safe in both libc as well as libc_r. 1998-06-09 22:56:24 +00:00
John Birrell
9e0370f742 Rename when building libc_r. 1998-06-09 22:45:39 +00:00
John Birrell
929140ffab Add rename support for libc_r. 1998-06-09 22:43:34 +00:00
Bill Paul
55e07e869f Fix potential resource leak: when call to des_crypt_1() fails, remember
to destroy the RPC CLIENT handle before returning.
1998-06-09 17:38:33 +00:00
John Birrell
6fe173c87b Implement compile time thread lock debug. 1998-06-09 08:37:35 +00:00
John Birrell
bc99dd746b Rename fstat as _thread_sys_fstat if being built into libc_r. 1998-06-09 08:35:42 +00:00
John Birrell
3b6533a024 Implement thread support for libc_r. Make the lseek syscall directly
to avoid recursive locking.
1998-06-09 08:34:35 +00:00
John Birrell
86af3ff9b0 Implement compile time debug mode for thread locks. 1998-06-09 08:32:23 +00:00
John Birrell
3d853e107e Add support for thread lock debug. No impact of the malloc code. 1998-06-09 08:30:32 +00:00
John Birrell
f374bfcd3c Implement compile time debug support for spinlocks.
Simplify the atomic lock prototype, removing the lock value.

Delete the unlock prototypes that are not required.
1998-06-09 08:28:49 +00:00
Steve Price
e110cb41dd Fix this so that it compiles in the !__STDC__ case.
Also be consistent about usage of #if ...

Pointed out by:	bde
1998-06-06 18:52:43 +00:00
Joseph Koshy
9c727d2ca9 Spelling corrections.
PR: 6868
Submitted by: Josh Gilliam <josh@quick.net>
1998-06-06 05:50:53 +00:00
Joseph Koshy
aae2142e5f Spelling nits.
Pointed out by: Sue Blake <sue@welearn.com.au>
1998-06-06 04:56:13 +00:00
Andrey A. Chernov
0ea569ff6f Fix handling more than 1 char with non-C locale
Misc. cleanup
PR: 6825
Submitted by: Sergey Gershtein <sg@mplik.ru>
1998-06-05 09:49:51 +00:00
Joseph Koshy
5239c0a5dd Mention that tftpd(8) also uses syslog(3). 1998-06-05 09:20:19 +00:00
Steve Price
32c2131395 Fix a bunch of spelling errors.
PR:		6856
Submitted by:	Josh Gilliam <josh@quick.net>
1998-06-04 21:06:07 +00:00
Joseph Koshy
70e8940332 Correct wrong claim about `telldir()' cookie lifetimes.
PR: 4043
Submitted by: Joe Orthoefer <j_orthoefer@tia.net>
1998-06-03 06:54:24 +00:00
Mike Smith
d4a7e4ca5d Add a trivial mechanism for returning a useful default value if one is
available and the kernel MIB setting is zero.

Return the result from getpagesize() if the p1003_1b.pagesize MIB
value is zero.

Suggested by:		Joerg Schilling <schilling@fokus.gmd.de>
1998-06-01 20:58:03 +00:00
Steve Price
3f58cad638 Several sources including Unix98 say that semctl's fourth
parameter is optional except where:
	cmd == {IPC_SET || IPC_STAT || GETALL || SETVAL || SETALL}

PR:		2448
Reviewed by:	bde
Submitted by:	Tim Singletary <tsingle@sunland.gsfc.nasa.gov>
Minor tweaks by: steve
1998-05-31 04:09:09 +00:00
Steve Price
5b32180784 Remove references to getvfsbytype. Also remove getvfsbyname
as it has its own manpage.

Discussed with:	bde
1998-05-30 18:20:37 +00:00
Steve Price
14d8151513 Remove a couple style bugs from the code snippet that
slipped in on the previous commit.

Submitted by:	bde
1998-05-26 02:53:06 +00:00
Steve Price
de285a13cc Update code example to reflect current practice. 1998-05-25 21:42:51 +00:00
Bill Paul
65923d6bff The incorrect select() timeout calculation that I fixed in svc_tcp.c
also exists here (the timeout can expire much sooner than it's supposed
to).
1998-05-21 15:22:39 +00:00
Bill Paul
1ce4aec2b4 Change the sanity test here. It's not correct to assume that the record
size we receive here should fit into the receive buffer. Unfortunately,
there's no 100% foolproof way to distinguish a ridiculously large record
size that a client actually meant to send us from a ridiculously large
record size that was sent as a spoof attempt.

The one value that we can positively identify as bogus is zero. A
zero-sized record makes absolutely no sense, and sending an endless
supply of zeroes will cause the server to loop forever trying to
fill its receive buffer.

Note that the changes made to readtcp() make it okay to revert this
sanity test since the deadlock case where a client can keep the server
occupied forever in the readtcp() select() loop can't happen anymore.
This solution is not ideal, but is relatively easy to implement. The
ideal solution would be to re-arrange the way dispatching is handled
so that the select() loop in readtcp() can be eliminated, but this is
difficult to implement. I do plan to implement the complete solution
eventually but in the meantime I don't want to leave the RPC library
totally vulnerable.

That you very much Sun, may I have another.
1998-05-20 15:56:11 +00:00
Bill Paul
14afd12e8c Replace the getpublickey() stub with the real thing. 1998-05-18 21:59:15 +00:00
Bill Paul
a6e95b4420 Improve DoS avoidance in RPC stream oriented transports. The TCP transport
uses readtcp() to gather data from the network; readtcp() uses select(),
with a timeout of 35 seconds. The problem with this is that if you
connect to a TCP server, send two bytes of data, then just pause, the
server will remain blocked in readtcp() for up to 35 seconds, which is
sort of a long time. If you keep doing this every 35 seconds, you can
keep the server occupied indefinitely.

To fix this, I modified readtcp() (and its cousin, readunix() in svc_unix.c)
to monitor all service transport handles instead of just the current socket.
This allows the server to keep handling new connections that arrive while
readtcp() is running. This prevents one client from potentially monopolizing
a server.

Also, while I was here, I fixed a bug in the timeout calculations. Someone
attempted to adjust the timeout so that if select() returned EINTR and the
loop was restarted, the timeout would be reduced so that rather than waiting
for another 35 seconds, you could never wait for more than 35 seconds total.
Unfortunately, the calculation was wrong, and the timeout could expire much
sooner than 35 seconds.
1998-05-18 16:12:13 +00:00
Joseph Koshy
c38eceafa4 kill.1: Remove reference to obsolete sigvec(2) man page. Removed
self reference in sigaction(2) man page.

Submitted by: Josh Gilliam <josh@quick.net>
PR: 6617
1998-05-18 03:33:11 +00:00
Bill Paul
a9352e90f0 Patch RPC library to avoid possible denial of service attacks as described
recently in BUGTRAQ. The set_input_fragment() routine in the XDR record
marking code blindly trusts that the first two bytes it sees will in fact
be an actual record header and that the specified size will be sane. In
fact, if you just telnet to a listening port of an RPC service and send a
few carriage returns, set_input_fragment() will obtain a ridiculously large
record size and sit there for a long time trying to read from the network.

A sanity test is required: if the record size is larger than the receive
buffer, punt.
1998-05-15 22:57:31 +00:00
Bill Paul
9c69f26836 Patch RPC library to avoid possible denial of service attacks as described
recently in BUGTRAQ. If a stream oriented transport fails to properly decode
an RPC message header structure where there should be one, it should mark
the stream as dead so that the connection will be dropped.
1998-05-15 22:53:47 +00:00
John Birrell
4bf15af17e Remove a big hack after adding a small one to libc/gen/getcwd.c to
handle the lack of __getcwd syscall in NetBSD.
1998-05-15 12:01:06 +00:00
John Birrell
efda37108b NetBSD doesn't have a __getcwd syscall, so set have__getcwd to `no'
when building libc with NetBSD syscalls.
1998-05-15 11:59:00 +00:00
John Birrell
cfc1614a48 int -> long changes that reduce the diffs with the NetBSD version to
work in a 64-bit environment.
1998-05-14 21:45:18 +00:00
Andrey A. Chernov
01929df9e0 Remove reference to signanosleep 1998-05-14 14:39:58 +00:00
Peter Wemm
f202e67dfe Nuke signanosleep() 1998-05-14 11:36:16 +00:00
John Birrell
9a6a1cbee4 Cast a pointer to a long, not an int and make the arg passed to the function
a long too (it does have a proper prototype).
1998-05-11 09:10:38 +00:00
John Birrell
adaa81ba92 Cast a pointer to a long, not an int before masking it. 1998-05-10 21:22:47 +00:00
John Birrell
cc4473c104 Remove 'of type long' from a sentence talking about four 4-byte values
because that is wrong on alpha.
1998-05-10 21:21:01 +00:00
Bruce Evans
881b7b471b Fixed the usual missing dependencies on headers generated by rpcgen. 1998-05-10 15:54:22 +00:00
Bruce Evans
ee4b699da3 Fixed the usual missing dependencies on headers generated by rpcgen.
Use rpcgen's -C option, although using it for non-headers breaks K&R
support.  A local copy of yp.h is built to avoid adding
-I/usr/include/rpcsvc to CFLAGS.  This version of yp.h differed from
<rpcsvc/yp.h> only in not declaring prototypes.

Fixed style bugs.
1998-05-09 15:10:53 +00:00
Brian Somers
ec791cadb1 Add a BUGS section and describe a problem I've been having for
a few weeks now.
1998-05-09 14:45:06 +00:00
John Birrell
184fcab826 This is a hack to workaround source that is coded to use long variables
but also assumes that they are 32-bits. This is one place where I don't
think it is appropriate to change 'long' to 'int'. I don't see why the
code couldn't be fixed so that using natural long variables does the
right thing. It's spaggetti code so it'll take some effort. Obviously
NetBSD thought so too because they change 'long' to 'int32_t' etc
and left it at that. As a temporary measure FreeBSD/Alpha can use the
NetBSD code and put this on the list of things to fix.
1998-05-08 05:41:57 +00:00
John Birrell
f9a8e5fafb Remote the NetBSD kludge for vfprintf.c 1998-05-08 05:17:11 +00:00
John Birrell
77af5d1ac8 Don't assign the va_list variable 'ap' directly to the argtable because
va_list is not a pointer on alpha. Instead, use the va_arg() macro
to return the address that is stored in the argtable.
1998-05-08 05:10:32 +00:00
John Birrell
b2dd537249 Use the thread-aware errno definition all the time. 1998-05-05 22:07:02 +00:00
John Birrell
75831c5b8f Build the syscalls (in libc, not libc_r) with weak symbols so that
libpthread can override them as required.
1998-05-05 22:06:16 +00:00
John Birrell
e659da100d Remove extern int errno and #include <errno.h> to get the proper definition. 1998-05-05 22:04:13 +00:00
John Birrell
e095485cdb Remove leading underscores from the FILE lock functions that POSIX
specifies.
1998-05-05 22:02:29 +00:00
John Birrell
4c717fd74d Remove leading underscores for the functions (weak symbols here) that
POSIX defines.
1998-05-05 21:56:42 +00:00
John Birrell
f1daac6f22 In a threaded library, expect the lock field to be declared volatile,
so provide function prototypes that respect that, avoiding a gcc
warning that `volatile' is being thrown away.
1998-05-05 21:46:30 +00:00
Robert Nordier
a55fccb456 Fix a few nits in quoted code fragments and elsewhere. 1998-05-04 23:16:50 +00:00
James Raynard
b92f77cae9 Typo fix. 1998-05-03 22:50:14 +00:00
James Raynard
66c15901aa Pedantry (NULL -> NUL). 1998-05-03 22:42:45 +00:00
James Raynard
e6488a0f2f Don't imply sigset_t == int. 1998-05-03 22:27:29 +00:00
Peter Wemm
9e39714518 Resolve some unexpected differences when comparing with the 2.2 version.
One bug was relatively harmless (select's timeout had an uninitialized
tv_usec), the other I'm not so sure.. (neglected to catch select returns
less than zero).  Both of these were irrelevant on kernels with poll().
1998-05-02 15:51:54 +00:00
Peter Wemm
c8d2fd6da8 Update libc dns code to 4.9.7-T1B level. This involved chopping out large
chunks of res_comp.c and replacing it with chunks of bind-8.1.1's resolver
code.  (There are no interface changes though)
The other parts are better bounds checking related.
1998-05-02 13:11:02 +00:00
Brian Somers
8d41a9efa3 Go back to version 1.16 - it was correct the way it was.
Pointed out by:	bde
1998-05-01 19:41:12 +00:00
Bruce Evans
daf5eba573 Fixed disordering and other style bugs in rev.1.50. 1998-05-01 15:46:06 +00:00
Brian Somers
e79dc52bbf connect() returns -1 on error - not 0. 1998-05-01 01:16:39 +00:00
Andrey A. Chernov
d1793ae420 Add reference to setlocale(3) 1998-04-30 16:11:50 +00:00
Andrey A. Chernov
271632b02b Add reference to catopen(3) 1998-04-30 16:07:54 +00:00
Andrey A. Chernov
e3b0c2a695 Return -1 for invalid descriptor in catclose 1998-04-30 13:15:31 +00:00
Andrey A. Chernov
e97ef24c18 If passed catgets descriptor is NULL or -1, return default string immediately 1998-04-30 12:25:05 +00:00
Andrey A. Chernov
9ad256ad65 Force loadType to 0 1998-04-30 11:39:08 +00:00
Andrey A. Chernov
c897062234 Implement NL_CAT_LOCALE
Manpages cleanup
1998-04-30 11:06:12 +00:00
Andrey A. Chernov
1adba262d7 Prototypes/typedefs cleanup
Fix error return codes
1998-04-30 10:14:55 +00:00
John Birrell
9b7c9bc4f8 Oops, backout the previous change having confused my underscores.
__thread_create is a syscall that uses the default asm. It is
_thread_create that contains specific asm code, but that lives in
libpthread.
1998-04-30 10:02:44 +00:00
John Birrell
26dac90648 Change the description of errno to match the thread-aware implementation
from 3.0 on. With 3.0 being a major release, now is a good time to do
this.
1998-04-30 09:49:59 +00:00
John Birrell
3fece7a1aa Make cerror thread aware by calling __error() to get a pointer to the
thread-specific error variable. This change make libc use the same cerror
code that libc_r has been using.
1998-04-30 09:32:48 +00:00
John Birrell
68f87034f2 The syscall that creates a kernel thread is coming, but it doesn't use the
default syscall asm, so add it to NOASM. The other syscalls that manipulate
kernel threads use the default asm code, so they just get built
automatically.
1998-04-30 09:30:50 +00:00
John Birrell
cf6229a854 Build __error.c into libc, but not libc_r. The weak symbol in the
file works with libpthread, but when built into libc_r which has a non-weak
symbol of the same name, the linker behaves unpredicatably and sometimes
links the wrong symbol. The linker behaviour is a byproduct of what
the program calls from object to object so it is like winning a lottery
if the program actually works. The odds are quite good - 95:1, I think.
We need a sure thing, though, so weak symbols can't be used instead
of renaming things.
1998-04-30 09:13:48 +00:00
Andrey A. Chernov
0b5e953b91 Basic support for LC_MESSAGES 1998-04-29 22:39:56 +00:00
John Birrell
5178bcd1cf Stop renaming these in libc_r because wrappered versions don't make sense.
PR: i386/4826, bin/5953
1998-04-29 09:14:35 +00:00
John Birrell
72b42edfd4 Replace the threaded locking with spinlock calls for both threaded
and non-threaded programs. This makes malloc thread safe for linking
with libpthread and kernel threads.

Reviewed by: phk
1998-04-29 09:10:58 +00:00
John Birrell
96c76d66db Reference an external variable in threaded programs so that the
autoinitialiser gets linked in and therefore called before main().
1998-04-29 09:08:43 +00:00
John Birrell
7317e6b1fd Use signal() in both the threaded and non-threaded cases. 1998-04-29 09:06:13 +00:00
John Birrell
f0f62729ee Stubs are required in libc so that it can be used with libpthread
(and kernel threads), but weak symbols and non-weak symbols of the
same name built into libc_r result in unpredictable linking.
1998-04-29 09:02:16 +00:00
David Greenman
ec3a3b4594 Oops, revert part of a diff that wasn't supposed to have been committed. 1998-04-28 07:02:33 +00:00
David Greenman
214bed53a2 Cache the results of the ps_strings sysctl so that it doesn't have to be
redone for every call of setproctitle().
1998-04-28 06:59:14 +00:00
Poul-Henning Kamp
b37727fff9 sigprocmask()' man page references sigmask()' in synopsis.
Note odd `sigmask()' line in synopsis.  `sigsetops(3)' is better suited
for `sigprocmask' and is already referenced from the manual page.
(`sigmask()' is useful for the older (& deprecated) `sigsetmask()' API).
PR:		6395
Reviewed by:	phk
Submitted by:	Joseph Koshy <koshy@india.hp.com>
1998-04-26 06:19:24 +00:00
Andrey A. Chernov
1e0b4d8238 Make asctime_r static if !_THREAD_SAFE to prevent namespace pollution and
prototype mismatch
1998-04-25 00:00:57 +00:00
Robert Nordier
ac51e2822d Improve description.
Submitted by: Arne Henrik Juul <arnej@imf.unit.no>
1998-04-22 19:59:55 +00:00
Dima Ruban
b4d829b84f indent 1998-04-20 22:13:50 +00:00
Poul-Henning Kamp
4f6eb9ceed Add a #ifdef _THREAD_SAFE around ctime_r 1998-04-20 10:09:37 +00:00
Andrey A. Chernov
53b8d408ff Describe timegm() 1998-04-20 00:52:32 +00:00
Dag-Erling Smørgrav
59bad7c53b Backed out lseek changes. 1998-04-19 22:20:32 +00:00
Poul-Henning Kamp
3f643d87bb ctime_r and asctime_r are not implemented.
prototypes in time.h do not match POSIX.

PR:		6345
Reviewed by:	phk
Submitted by:	Dmitry Khrustalev <dima@xyzzy.machaon.ru>
1998-04-19 06:47:25 +00:00
Dag-Erling Smørgrav
9db4b478d6 Return EINVAL and do not changefile pointer if resulting offset is negative.
PR:		kern/6184
1998-04-18 19:24:22 +00:00
Brian Somers
5c570787fc Typo police 1998-04-17 00:59:15 +00:00
Peter Wemm
4fea76f539 Fix a nasty flaw as a result of using the arc4random() pre-seeding of
leading XXX's.  It could wrap an uppercase character through chars
like:  [ \ ] ^ _ `  in between Z and a.  The backslash and back tick
might be particularly nasty in a shell script context.  Also, since
we've been using upper-case generated values for a while now, go with
the flow and use them in the pathname search rotation.
1998-04-14 07:25:05 +00:00
John Birrell
ec216c2634 Add FILE locking stubs for libc.
Change the FILE locking to support kernel threads when linked with
libpthread (which you haven't see yet). This requires that libc become
thread-safe and thread-aware, testing __isthreaded before attempting
to do lock/unlock calls. The impact on non-threaded programs is minor.
This change works with libc_r, so it's the best compromise.
1998-04-11 07:40:47 +00:00
Poul-Henning Kamp
af3c7c8d85 Remove a nolonger implented "BUGS" description.
PR:		6240
Reviewed by:	phk
Submitted by:	Niall Smart rotel@indigo.ie
1998-04-11 07:37:44 +00:00
John Birrell
f901bc2795 Add a global variable called __isthreaded that can be tested throughout
libc to determine if locking is required. This is needed in libc
for use with kernel threads, but until a thread is created, we don't
really want to bother locking things. The variable was added here
because the crt code calls exit(main()) so all programs will get the
variable.
1998-04-11 07:02:58 +00:00
John Birrell
01c70c0055 Add a private header file for libc/libc_r/libpthread to contain
definitions for things like locking etc.
1998-04-11 06:57:33 +00:00
John Birrell
5a2f1fed77 Change in name of the static initializer define. 1998-04-04 11:03:07 +00:00
Peter Dufault
8a6472b723 Finish _POSIX_PRIORITY_SCHEDULING. Needs P1003_1B and
_KPOSIX_PRIORITY_SCHEDULING options to work.  Changes:

Change all "posix4" to "p1003_1b".  Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;

Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;

Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;

Add options to LINT;

Minor fixes to P1003_1B code during testing.
1998-03-28 11:51:01 +00:00
John Birrell
20219d9a7b For 1.3, NetBSD replaced the swapon() syscall with swapctl() and moved
the only call to compat_12 which isn't there by default. Provide
a wrapper.
1998-03-23 21:04:06 +00:00
Bruce Evans
c7091c3117 (Ab)use .Vt instead of .Fd for a variable declaration. 1998-03-23 13:05:07 +00:00
Bruce Evans
73de262e04 Fixed bitrot in synopsis. Didn't fix bitrot elsewhere. 1998-03-23 13:02:37 +00:00
John Birrell
a145fea480 For 1.3, NetBSD walloped the msync syscall and replaced it with
__msync13. The old one got moved to compat_12. Wrap __msync13 up
to look like FreeBSD's msync and be careful to respect the fact that
MS_SYNC is 0x0000 on FreeBSD, but 0x0004 on NetBSD.
1998-03-23 06:58:06 +00:00
Philippe Charnier
a5941fc2aa .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
Eivind Eklund
38b22f2b1f <sys/errno.h> -> <errno.h> 1998-03-16 18:00:18 +00:00
Bruce Evans
034abff918 Fixed disordering and inconsistent style in previous commit. 1998-03-12 12:05:14 +00:00
John Birrell
0db2fac06a Nearly missed this one.
List non-default asm sources in MDASM so that they replace the defaults.

For funny or incomplete syscalls, list them in NOASM to stop them
from getting built as defaults.
1998-03-09 07:36:56 +00:00
John Birrell
45dd718425 Add #include <unistd.h> to get the prototype for __syscall().
Cast to long before casting to a void ptr to shut up gcc.
1998-03-09 07:27:58 +00:00
John Birrell
abd529ceba Yikes, this is the worst of the lot. Bruce suggested doing this (!).
Include the architecture specific sys makefile like previously, but
what this contains differs. It defines MDASM which list architecture
specific asm code that *replaces* syscalls of the same name defined
in MIASM (which gets defined by the syscall.mk or netbsd_syscall.mk
dependent of NETBSD_SYSCALLS being defined). If a syscall has a
C source implementation or something funny done to it, or just doesn't
need default asm source generated for it, then it is listed in NOASM.

syscall.mk is generated by makesyscalls.sh with other syscall files.
netbsd_syscall.mk is a hand-generated equivalent. So if a new syscall
is added and no other makefiles are edited, it will automatically have
the default asm source generated for it (whether you want it or not).

Anything listed in MDASM gets added to SRCS and gets built. For
each syscall name in MIASM, if it doesn't exist in MDASM or NOASM,
it gets added to the ASM or ASMR lists to have code generated for it.
If the syscall name was listed in HIDDEN_SYSCALLS (intended for use
by libc_r, not libc which has it defined, but empty), then the name
is added to the ASMR list and gets renamed before being built;
otherwise it is added to the ASM list and gets built with the same
name.

I wonder if this is too complicated. But it works on both i386 and alpha.
1998-03-09 07:22:12 +00:00
John Birrell
8258119519 Function to return a pointer to the non-threaded errno. This is declared
with a weak symbol so that it won't be linked when linking against
libc_r or libpthread.
1998-03-09 07:09:55 +00:00
John Birrell
e2e5d981b7 Compatibility functions for use when __NETBSD_SYSCALLS is defined. 1998-03-09 07:07:21 +00:00
John Birrell
c995d3ba90 Oops, we don't need NetBSD's malloc 'cause we can turn off utrace
in phk's malloc.
1998-03-09 07:03:06 +00:00
John Birrell
e4193688da NetBSD doesn't have a utrace syscall, so don't define that if
__NETBSD_SYSCALLS is defined.
1998-03-09 07:00:38 +00:00
John Birrell
e7b6782c39 Added #include <string.h> to get prototypes. 1998-03-09 06:51:23 +00:00
John Birrell
196c0ee373 Change MACHINE to MACHINE_ARCH.
Add _spinlock.c (stubs) to sources.

Nuke tahoe and vax.
1998-03-09 06:48:25 +00:00
John Birrell
1b5fef40c7 Stub functions for thread locking with weak symbols so that they are
only linked when not linking an application against libc_r or libpthread.
1998-03-09 06:46:21 +00:00
John Birrell
03fcbeae91 Import sources from NetBSD, tweaked for building in FreeBSD. 1998-03-09 06:34:43 +00:00
John Birrell
3d46539c46 MACHINE -> MACHINE_ARCH 1998-03-09 06:24:02 +00:00
John Birrell
98617a2c12 Define empty variables in case no names are added to them. This avoids
substitution errors for variables that don't exist.

If a machine architecture dependent makefile exists, include it
to discover if libc or libc_r is being built with NetBSD syscalls
instead of FreeBSD ones.

Put a NO_QUAD thingy around the quad makefile so that 64-bit
architectures can ignore that sh*t.

In the test for MDSRCS being empty, add all MISRCS to SRCS, rather
than just ignoring them.
1998-03-09 06:21:41 +00:00
John Birrell
fdee84c996 Add an include path to private linc/libc_r/libpthread header files.
Define the HIDDEN_SYSCALLS macro as empty because libc doesn't have
renamed syscalls. This avoids an undefined macro error when
libc/sys/Makefile.inc goes to look though it. HIDDEN_SYSCALLS is
used by the equivalent makefile to this one in lib/libc_r to list
those syscalls that it needs to rename so that libc_r can provide
replacement functions.
1998-03-09 06:16:38 +00:00
John Birrell
0a31d34120 Add a private (to libc, libc_r and libpthread) header file containing
prototypes for the spinlock functions that will be used for thread locks.
libc will have stubs declared with weak symbols. libpthread and libc_r
will have functions that really do something.
1998-03-09 05:05:32 +00:00
John Birrell
30ac8b16e2 These files are very specific to FreeBSD kernels, so silently compile
no code when building a library with __NETBSD_SYSCALLS defined.
1998-03-09 04:42:19 +00:00
John Birrell
e91bce7ac7 NetBSD implements semctl using a __semctl syscall instead of the
semsys syscall that FreeBSD kernels use. Grumble. So make the call
dependent on if __NETBSD_SYSCALLS is defined.
1998-03-09 04:39:13 +00:00
John Birrell
ee51c92b78 getvfsbyname() doesn't existing NetBSD, so return ENOSYS if compiled
into a library with __NETBSD_SYSCALLS defined.
1998-03-09 04:36:07 +00:00
John Birrell
59fe2e5fd0 Change a variable to type size_t to suit the sysctl prototype.
Add #include <string.h> to get prototypes.
1998-03-09 04:34:16 +00:00
John Birrell
84d6500535 Cast pointer to a long instead of an int to keep a 64-bit compiler
happy. The code works either way, but I like a clean compile.
1998-03-09 04:29:00 +00:00
Peter Dufault
aac4ad2c99 Reviewed by: bde
Changes to support building with _POSIX_SOURCE set to 199309L:

1. Add sys/_posix.h to handle those preprocessor defs that POSIX
says have effects when defined before including any header files;

2. Change POSIX4_VISIBLE back to _POSIX4_VISIBLE

3. Add _POSIX4_VISIBLE_HISTORICALLY for pre-existing BSD features now
defined in POSIX.  These show up when:

_POSIX_SOURCE and _POSIX_C_SOURCE are not set or
_POSIX_C_SOURCE is set >= 199309L

and vanish when:

_POSIX_SOURCE is set or _POSIX_C_SOURCE is < 199309L.

4. Explain these in man 9 posix4;

5. Include _posix.h and conditionalize on new feature test.
1998-03-08 17:25:38 +00:00
Stephen McKay
b8e5e42d0f Fixed a few ancient typos, added a little missing stuff, and updated
references to abort() in light of POSIX mandated behaviour.  I'm
still not 100% happy with much of the wording, but it's better
than it was.
1998-03-08 15:15:33 +00:00
John Polstra
1ab7c6cc77 Add support for ELF.
Switch to ANSI-style function definitions.
1998-03-07 19:57:05 +00:00
Bill Paul
4e6ace0853 Fix resource allocation problems:
- Completely recoded the ypmatch cache code. The old code could leak
  memory: it would allow the cache to grow, but never
  shrink. The new code imposes the following limits:

	o The cache is capped at a limit of 5 entries.
	o Each entry expires after five seconds, at which point
	  its slot is freed.
	o If an insertion is to be done and all five slots
	  are filled, the oldest entry is forcibly expired
	  to release its slot.

  Also, the cache is implemented on a per-binding basis rather than
  having a global cache covering all bindings. This means that each
  bound domain has its own 5 slot cache.

- Changed clntudp_create() to clntudp_bufcreate() so that the
  xmit/recv message buffer sizes can be set explicitly. NIS transactions
  are rarely much larger than 1024 bytes since YPMAXRECORD is 1024.
  The defaults chosen by clntudb_create() are actually much larger
  than needed. I set the xmit buffer to a little over 1024 and the
  recv buffer to a little over 2048. This saves a few Kbytes for each
  NIS binding.

- Add my name to the copyright. I think I've made enough changes to
  this file to merit it. :)

Note: these changes should go into the 2.2.x branch, but I'm waiting
on feedback from a tester to see if the cache fixes solve the reported
memory leak problem.
1998-03-07 05:06:10 +00:00
Brian Somers
0b3b961e55 We don't need to NUL terminate our sun_path.
Pointed out by: Garrett Wollman <wollman@khavrinen.lcs.mit.edu>
1998-03-06 03:10:49 +00:00
Brian Somers
0d41e7b820 Nul terminate sockaddr_un::sun_path
Suggested by: Theo de Raadt <deraadt@openbsd.org>
1998-03-06 02:12:02 +00:00
Brian Somers
d584948ecd Make SyslogAddr a sockaddr_un rather than a sockaddr.
This wasn't a problem in practice as PATH_LOG and PATH_OLDLOG
are both < sizeof sockaddr::sa_data.
1998-03-05 22:17:59 +00:00
Peter Dufault
917e476dad Reviewed by: msmith, bde long ago
POSIX.4 headers and sysctl variables.  Nothing should change
unless POSIX4 is defined or _POSIX_VERSION is set to 199309.
1998-03-04 10:27:00 +00:00
Bruce Evans
87ad126763 Fixed uninitialized pointer in previous commit. mktemp() was broken.
I noticed cvs core dumps and uncleaned cvs temporary files in /tmp.

Fixed ANSIisms.
1998-03-03 14:38:36 +00:00
Steve Price
f48bc66239 Replace previous commit with a check disallowing ptr from running
off the end of the list variable.

PR:		5345, 5610
Submitted by:	nagao@cs.titech.ac.jp
1998-03-01 18:49:37 +00:00
James Raynard
df37b71c14 Strings are terminated by NUL, not NULL. 1998-02-28 18:05:42 +00:00
Steve Price
f2328ab40a Remove the config_* routines with permission from Poul-Henning Kamp,
the original author.

PR:		5834
Discussed with:	phk, jkh
1998-02-28 03:57:05 +00:00
Bruce Evans
3ee49aeb72 Don't add OBJS to CLEANFILES. bsd.obj.mk does it. Some objects were
duplicated.
1998-02-25 01:20:27 +00:00
John Birrell
6af88557f9 Change MACHINE references to MACHINE_ARCH. 1998-02-20 08:41:46 +00:00
John Birrell
0107877e04 Change MACHINE references to MACHINE_ARCH. 1998-02-20 08:23:55 +00:00
John Birrell
4439d165b7 Add #include <string.h> to get prototypes. 1998-02-20 08:13:51 +00:00
John Birrell
dc2c8572e9 The NetBSD getlogin syscall has a different name. 1998-02-20 08:07:40 +00:00
John Birrell
6abbaf17ac Fix a bogus cast for a bogus pointer check. This only checks if the
pointer is 4-byte aligned. On a 64-bit machine it probably should
check that the pointer is 8-byte aligned (eh, Bruce?) 8-)
1998-02-20 08:00:01 +00:00
John Birrell
9fcbcd0217 NetBSD kernels don't have issetugid(), so #ifdef this out when
building FreeBSD's libc to run with a NetBSD kernel. We'll get to
the alpha kernel later, I promise. 8-)
1998-02-20 07:54:56 +00:00
Steve Price
1cd25b46da Need to #include <unistd.h> for nice(3).
PR:		5782
Submitted by:	David Malone <dwmalone@maths.tcd.ie>
1998-02-18 18:34:17 +00:00
Julian Elischer
39a9295edc Submitted by: Jeremy Allison (jallison@whistle.com)
fix a slight confusion about which draft of threads we are supporting.
this allows something as big and ugly as samba to be compiled with libc_r
and still work!  our user-level pthreads seems amazingly robust!
1998-02-18 01:20:33 +00:00
Jordan K. Hubbard
934fb1c520 correct a typo I just noticed. 1998-02-17 19:41:53 +00:00
Jordan K. Hubbard
a414d6056c Mention when bidirectional features first appeared. 1998-02-17 16:36:48 +00:00
John Birrell
c86afb6bc0 signal() returns SIG_ERR, not just -1. The sys/signal.h header file
provides the cast from -1 to the signal() return type, so no further
casting by programmers should be required.

Pointed out by: bde (of course).
1998-02-15 00:46:47 +00:00
Steve Price
0f4b8423e1 Note that '+' and '?' are not special characters in basic REs but they
can be simulated using bounds.

PR:		5708
Submitted by:	Oliver Fromme <oliver.fromme@heim3.tu-clausthal.de>
1998-02-14 18:26:29 +00:00
Bruce Evans
768950348d Describe signal handling. Don't describe the old implementation. Don't
define `microsecond'.  Cleaned up English.

Obtained from:	mostly from sleep.3
1998-02-13 04:44:49 +00:00
Bruce Evans
fb364c6d7d Describe signal handling. Don't describe the old implementation. Cleaned
up English.

Obtained from:	mostly from NetBSD
1998-02-13 03:34:11 +00:00
Warner Losh
2f253e75c8 Many security improvements from OpenBSD:
implement mkdtemp
	improve man page for mk*temp
	use arc4random to seed extra XXX's randomly
	Optionally warn of unsafe mktemp uses
From various commits by theo de raadt and Todd Miller.
Obtained from: OpenBSD

This should go into 2.2 after a testing period.
1998-02-13 02:13:24 +00:00
Bruce Evans
237ca38d86 Fixed disordering of MLINKS in previous commit. Fixed old disorder in
MLINKS.
1998-02-12 23:52:23 +00:00
Bill Paul
12228287c1 Fix _listmatch() again so that it works with group lists containing only
one group. Thanks to Dirk Froemberg for supplying a patch for this. I will
be closing out the PR and moving this to the 2.2.5 branch later: my login
sessions to freefall from Columbia are ridiculously spotty today.

PR:	5610
Submitted by:	Dirk Froemberg <ibex@physik.TU-Berlin.DE>
1998-02-12 19:29:05 +00:00
Nate Williams
6629ddfc54 - Bump the minor # due to the addition of the stringlist functions.
Reviewed by:	asami
1998-02-12 01:44:53 +00:00
Guido van Rooij
3ff9c00752 Do signal handlig he Posix way
Obtained from: NetBSD (after complains from Bruce)
1998-02-10 20:05:15 +00:00
John Polstra
645c4be38a Move the trampolines for dlopen and related functions from crt0.o
into libc.  This reduces the size of every dynamically linked
executable by 248 bytes, and it reduces the size of static executables
by a lesser amount.  It also eliminates some global namespace
pollution.

With this change in place, the source for dlfcn.h should probably
be moved to "/usr/src/include".  I'll save that for another day.

Compatibility note:  Programs which use dlopen, if compiled on
systems with this change, will not run on systems with a libc from
prior to this change.  Very few programs use dlopen, so I think
that is OK.
1998-02-09 06:05:25 +00:00
Jonathan Lemon
4f36d4ac99 Document the fpgetprec/fpsetprec functions in their man page.
Add cross-references to the elusive fpsetmask() function to various other
man pages.
Reviewed by:	bde
1998-02-04 22:30:20 +00:00
Steve Price
f63999476c Cleanup the manpage now that setpwent has a void return type. 1998-02-01 17:13:12 +00:00
Steve Price
2e645a20cb XOpen says the void setpwent(void) is correct. Also call setpassent(0)
instead of duplicating code, albeit trivial (inspired by NetBSD).

PR:		5524
1998-02-01 06:16:08 +00:00
Warner Losh
52dbfb5c0f Kill lfs files that were causing make world to fail. 1998-01-31 05:53:57 +00:00
Daniel O'Callaghan
38ce39bde5 PR: 5573
Submitted by:	garbanzo@hooked.net
Add strncasecmp, strncmp to NAME field.
1998-01-27 07:01:09 +00:00
John Birrell
2b3f4eadb0 Fix a cast from a pointer to a long instead of an int which was enough
to ruin a 64-bit day.
1998-01-24 20:57:38 +00:00
Warner Losh
9f6c32362c Eliminate sprintf
Obtained from:OpenBSD (theo de raadt)
1998-01-21 21:46:36 +00:00
Bruce Evans
c7b367098d Fixed #includes in the synopsis and in an example. <sys/socket.h>
isn't a prerequisite, since it isn't required for the prototypes
and isn't always needed to call the functions (the address family
might be a variable).
1998-01-20 11:03:15 +00:00
Bruce Evans
2aeb5561dd Moved most of the (source-level) compatibility hacks for the vfsconf
interface from sys/mount.h to libc/getvfsent.c  The new interface is
now the default.
1998-01-20 10:36:24 +00:00
Alexander Langer
2768e0c4b5 Added cross references to mincore(2) and minherit(2).
Obtained from:	OpenBSD
1998-01-20 03:59:07 +00:00
Alexander Langer
891d6e5881 Added #include <sys/types.h> to synopsis.
Obtained from:	OpenBSD
1998-01-20 03:52:49 +00:00
Bruce Evans
1e69872de7 Started getting rid of the compatibility cruft for the Lite1 mount()
and the pre-Lite2 vfsconf interfaces.

For getvfsent.c, just define _OLD_VFSCONF.  This will give the
current default macro hacks in <sys/mount.h> when the default is
reversed.  This is an intermediate step.
1998-01-17 16:32:14 +00:00
Bruce Evans
c8b6b31f15 Fixed missing #include in synopsis. 1998-01-16 13:41:28 +00:00
Bruce Evans
a182428346 Fixed wrong prototype for clock_getres(). 1998-01-16 13:39:49 +00:00
Bruce Evans
d142a33b7f Fixed wrong prototypes. Most of the prototypes had missing return types,
or missing const's or `short *' instead of `[ug]id_t *' in argument types.
1998-01-16 13:33:09 +00:00
Bruce Evans
04b7c9479b Fixed missing return type in a prototype. 1998-01-16 13:10:18 +00:00
Stephen McKay
4773010d2f Return the correct errno from getcwd() even if free() or closedir()
overwrites it.  This actually showed up when running under an old
kernel when free() called the madvise() stub which set errno, causing
getcwd() to return EOPNOTSUPP instead of ERANGE.
1998-01-15 13:52:55 +00:00
John Birrell
c61e516832 Add #ifndef __NETBSD_SYSCALLS around calls to issetugid() which
do not exist in NetBSD 1.3.
1998-01-15 09:58:08 +00:00
Alexander Langer
cbc3778c2f Typo fix.
Added EOPNOTSUPP and EMLINK to errors section.
Added symlink(2) xref.

Obtained from:	OpenBSD
1998-01-15 04:31:28 +00:00
John Birrell
da8a9b61c7 Include string.h for memcpy function prototype. 1998-01-14 08:14:56 +00:00
Alexander Langer
4d1b2e67ae Consistently reference init as .Xr init 8.
Obtained from:	OpenBSD
1998-01-13 05:09:16 +00:00
Alexander Langer
e3abfc8253 Return type and argument to sleep are unsigned int. 1998-01-13 04:32:00 +00:00
Alexander Langer
26db1da8a9 Dump the constant NGROUPS in favor of the POSIX way:
sysconf(_SC_NGROUPS_MAX).

Submitted by:	bde
1998-01-13 01:30:17 +00:00
Alexander Langer
e4a6f1ad1f Use .Fn for sysconf(_SC_CLOCK_TCK) reference.
Added $Id$.
1998-01-13 01:21:19 +00:00
Alexander Langer
73a8c56ec1 Formatting fix & improved comment for struct timeval.
Obtained from:	OpenBSD
1998-01-11 22:28:56 +00:00
Alexander Langer
d4b1275d66 Fixed brk(2) xref.
Obtained from:	OpenBSD
1998-01-11 22:22:50 +00:00
Alexander Langer
21bcb535ea Added sys/types.h to synopsis as per POSIX.
Obtained from:	OpenBSD
1998-01-11 22:16:11 +00:00
Alexander Langer
7ea0dca625 Replace sys/param.h with sys/types.h as per POSIX.
Document the special case of gidsetlen == 0.

Partially obtained from: OpenBSD
1998-01-11 22:01:20 +00:00
Alexander Langer
6eba99b0db Document that arg max is controllable via sysctl. 1998-01-11 21:43:38 +00:00
Alexander Langer
92d7687ee6 Formatting fix.
Obtained from:	OpenBSD
1998-01-11 17:49:51 +00:00
Alexander Langer
fa70846939 Added EMFILE and ENFILE to errors section.
Obtained from:	OpenBSD
1998-01-11 17:07:20 +00:00
Alexander Langer
5e8b84b628 .Xr sigvec --> sigaction
Obtained from:	OpenBSD
1998-01-11 16:56:01 +00:00
Alexander Langer
a5c3b32774 Add <sys/types.h> to synopsis.
Correct a grammatical error.
Add cross-reference to setrlimit(2).

Obtained from:	OpenBSD
1998-01-11 16:51:49 +00:00
John Birrell
f1d896d117 Make a couple of the stat flags dependent on the sys/stat.h header file
that this source is compiled against. This source is referenced by
install which is needed as a build tool and must be able to compile
against NetBSD headers and libraries if we have a hope of supporting
another architecture.

With this change, that's two working programs down and 3945 (?) to go.
The other one was make, but that didn't need any changes to work under
FreeBSD/Alpha. 8-)
1998-01-09 06:14:59 +00:00
Warner Losh
3c8e19e155 handle long usernames more carefully
Reviewed by:	guido
Obtained from:	OpenBSD (Theo de Raadt)
1998-01-07 00:28:36 +00:00