Commit Graph

1482 Commits

Author SHA1 Message Date
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
Philippe Charnier
125c8263d8 Convert to mdoc format. 1998-01-05 07:12:16 +00:00
Andrey A. Chernov
b250f24856 size_t -> unsigned
in arguments length INT_MAX overflow check
Suggested-by: bde
1998-01-04 22:28:47 +00:00
Alexander Langer
e69bcfc3bc Expanded cross references. 1998-01-02 19:22:52 +00:00
Andrey A. Chernov
8c6d2f42e1 1. EOF was returned when the buffer size was larger than INT_MAX. This
case has very little to do with the output size being larger than
   INT_MAX.
2. The new #include of <limits.h> was disordered.
3. The new declaration of `on' was disordered (integer types go together).
4. Testing an unsigned value for > 0 was fishy.

Submitted by: bde
1998-01-01 20:15:58 +00:00
Alexander Langer
5a5b9efe70 Drop the use of caddr_t in conjunction with mmap(2). 1997-12-31 03:15:06 +00:00
Alexander Langer
7167d5b04c Convert caddr_t --> void * for sys/mman.h functions.
mlock, mmap, mprotect, msync, munlock, and munmap are defined by
POSIX as taking void *.  The const modifier has been added to
mlock, munlock, and mprotect as the standard dictates.

minherit comes from OpenBSD and has been updated to conform with
their recent change to void *.

madvise and mincore are not defined by POSIX, but their arguments
have been modified to be consistent with the POSIX-defined functions.
mincore takes a const pointer, but madvise does not due to the
MADV_FREE case.

Discussed with:	bde
1997-12-31 01:22:01 +00:00
Alexander Langer
1948b335ba Fixed formatting of the MADV_FREE flag description.
Pointed out by:	bde
1997-12-30 05:17:33 +00:00
Alexander Langer
22d0a78532 Typo fix. 1997-12-30 04:05:47 +00:00
Alexander Langer
fd630dd1cc Document MS_SYNC. 1997-12-30 03:26:15 +00:00
Wolfram Schneider
de635b0683 The terminating character in strings is NUL', not NULL'. 1997-12-28 12:06:29 +00:00
Tim Vanderhoek
02e6c12b3c fork() checks RLIMIT_NPROC, not RLIMIT_NOFILE.
pr:		docs/5260
submitted-by:	Niall Smart [3]njs3@doc.ic.ac.uk
1997-12-26 16:11:49 +00:00
Alexander Langer
3b7c07b1f2 Removed unnecessary initialization of hp in gethostbyaddr_r. 1997-12-25 04:21:08 +00:00
Andrey A. Chernov
92e88f87b9 Add overflow checks: if output size becomes bigger than INT_MAX,
just return EOF
1997-12-25 00:32:17 +00:00
Andrey A. Chernov
fb25537fb8 Correct type of stored argument place (from previous fix) 1997-12-24 23:54:19 +00:00
Andrey A. Chernov
947d101171 1) Restore back comment about snprintf()
2) Optimize string buffer copy to call memcpy() and update pointers
only for count > 0, it makes snprintf(NULL, 0, ...) more efficient
1997-12-24 23:23:18 +00:00
Andrey A. Chernov
6e690ad4ca Return back to BSD snprintf semantics which recent C9x standard adopts
instead of Singe Unix, thanx Bruce for explaining, I am not realize
standards war was there.

But now, fix n == 0 case to not return error and fix check for too
big n.

Things left to do: check for overflow in arguments.
1997-12-24 23:02:47 +00:00
Andrey A. Chernov
e0b123f6d0 1) Oops! Insert again if (n == 0) return 0.
Final word is Bruce's quote:

C9x specifies the BSD4.4-Lite behaviour:

       [#3] ...   Thus,  the
       null-terminated  output  has  been completely written if and
       only if the returned value is less than n.

It means that if we not have any null-terminated output as for n == 0
we can't return value less than n, so we forced to return value
equal to n i.e. 0

The next good thing is glibc compatibility, of course.

2) Do check for too big n in machine-independent way.
3) Minor optimization assuming EOF is < 0
1997-12-24 20:24:08 +00:00
Andrey A. Chernov
5ebfa8de69 Back out part related to "return 0 if n == 0" and return EOF as before.
The main argument is that it is impossible to determine if %n evaluated or not
when snprintf return 0, because it can happens for both n == 0 and n == 1.
Although EOF here is good indication of the end of process, if n is
decreased in the loop...
Since it is already supposed in many places that EOF *is* negative, f.e.
from Single Unix specs for snprintf
"return ... a negative value if an output error was encountered"
this not makes situation worse.
1997-12-24 14:32:40 +00:00
Andrey A. Chernov
97adcd5ba1 Fix snprintf(...%n...)
to pass not more than buffer size to %n agrument, old variant
always assume infinite buffer.
%n is for actually transmitted characters, not for planned ones.
1997-12-24 13:47:13 +00:00
Andrey A. Chernov
a65a537cb1 Remove wrong comment about snprintf:
"return the number of bytes needed, rather the number used"

According to Single Unix specs:

Upon successful completion, these functions return the number of bytes
transmitted excluding the terminating null
1997-12-24 13:17:13 +00:00
Andrey A. Chernov
4ecaf22055 snprintf return value fixes to conform Single Unix specs:
1) if buffer size is smaller than arguments size, return buffer
size, not arguments size as before.

2) if buffer size is 0, return 0, not EOF as before.
(now it is compatible with Linux and Apache implementations too).

NOTE: Single Unix specs says:

If the value of n {buffer size} is zero on a call to snprintf(), an
unspecified value less than 1 is returned.

It means we can't return EOF since EOF can take *any* value in general
not especially < 1. Better variant will be return -1 (it is less then
1 and different with n == 1 case) but -1 value is already occuped by
EOF in our implementation, so we can't distinguish true IO error
in that case. So 0 here is only possible case still conforming
to Single Unix specs.
1997-12-24 12:31:32 +00:00
Bruce Evans
6a93659f24 Comment that long double is poorly implemented, not that it is unimplemented. 1997-12-19 21:59:22 +00:00
Bruce Evans
b86be9d1f7 Put the .PATH statement first as in all other libc Makefile.inc's. 1997-12-19 21:56:38 +00:00
Bruce Evans
b0e2424631 Format the MLINKS statement the same as in most other libc Makefile.inc's. 1997-12-19 21:53:35 +00:00
John Birrell
d5bc59bb81 Fix recursion problem which occurs when a signal is received during
a malloc. The signal handler creates a thread which requires a malloc...
For now, the only thing to do is to block signals. When we move user
pthreads to use the kernel threads, mutexes will be implemented in kernel
space and then malloc can revert.
1997-12-15 02:12:42 +00:00
Bruce Evans
22301c4b46 Fixed spelling of EACCES. 1997-11-23 17:58:55 +00:00
Bruce Evans
8fddd06099 Fixed long double formats. They were mostly not implemented except
on systems where long doubles are just doubles.  FreeBSD hasn't
been such a system since it started using gcc-2.5 many years ago.
The fix is of low quality.  It loses precision.

scanf() of long doubles doesn't seem to be used much, but gdb-4.16
uses %Lg format in its expression parser if it thinks that the
system supports printf'ing of long doubles.  The symptom was that
floating point literals were usually interpreted to be 0.0.
1997-11-23 06:02:47 +00:00
James Raynard
46eba3e8b7 Fix bit-twiddling in sigismember(3).
Note this ONLY affects the function version - the macro version is always
used unless for some reason you put #undef sigismember in your code before
calling it.
PR:		3615
Submitted by:	Nanbor Wang <nw1@cs.wustl.edu> (slightly amended patch)
1997-11-21 23:18:05 +00:00
Bruce Evans
362f4dce74 Don't check for the unlikely case of useconds == 0 here. The kernel
checks it.

Fixed a style bug.
1997-11-20 15:13:20 +00:00
Bruce Evans
70df31a627 stat() the correct file in execvp() so that the fine tuned errno handling
actually works.
1997-11-20 15:09:38 +00:00
John Polstra
3359c58c41 Add cross-references to rfork(2). 1997-11-18 03:59:30 +00:00
Bill Paul
d9cc92f584 Close PR #4867: improve _listmatch() to avoid returning false positives.
PR: 4867
1997-11-16 03:02:39 +00:00
Julian Elischer
52bf64c787 Reviewed by: hackers@freebsd.org in general
Obtained from: Whistle Communications tree

Add an option to the way UFS works dependent on the SUID bit of directories
This changes makes things a whole lot simpler on systems running as
fileservers for PCs and MACS. to enable the new code you must
1/ enable option SUIDDIR on the kernel.
2/ mount the filesystem with option suiddir.
hopefully this makes it difficult enough for people to
do this accidentally.
see the new chmod(2) man page for detailed info.
1997-11-13 00:28:51 +00:00
Julian Elischer
b1f4a44b03 Reviewed by: various.
Ever since I first say the way the mount flags were used I've hated the
fact that modes, and events, internal and exported, and short-term
and long term flags are all thrown together. Finally it's annoyed me enough..
This patch to the entire FreeBSD tree adds a second mount flag word
to the mount struct. it is not exported to userspace. I have moved
some of the non exported flags over to this word. this means that we now
have 8 free bits in the mount flags. There are another two that might
well move over, but which I'm not sure about.
The only user visible change would have been in pstat -v, except
that davidg has disabled it anyhow.
I'd still like to move the state flags and the 'command' flags
apart from each other.. e.g. MNT_FORCE really doesn't have the
same semantics as MNT_RDONLY, but that's left  for another day.
1997-11-12 05:42:33 +00:00
KATO Takenori
45d4f12362 Describe MNT_NOCLUSTER{R,W} flags.
Pointed out by:		bde
1997-11-09 03:36:26 +00:00
John-Mark Gurney
f668085d2d changed prototype to match text
changed sysctl to lsvfs as "sysctl vfs" doesn't return a listing of
possible filesystem names
1997-11-05 10:09:33 +00:00
Steve Price
0ce1971c2a Correct description of which runes are encoded as two bytes.
PR:		4555
Submitted by:	Dmitrij Tejblum <tejblum@arc.hq.cti.ru>

[0x0400 - 0xffff] [bbbbbbbb.bbbbbbbb] -> 1110bbbb, 10bbbbbb, 10bbbbbb
.Ed
.Pp
If more than a single representation of a value exists (for example,
0x00; 0xC0 0x80; 0xE0 0x80 0x80) the shortest representation is always
used (but the longer ones will be correctly decoded).
.Pp
The final three encodings provided by X-Open:
.Bd -literal
[00000000.000bbbbb.bbbbbbbb.bbbbbbbb] ->
	11110bbb, 10bbbbbb, 10bbbbbb, 10bbbbbb

[000000bb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
	111110bb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb

[0bbbbbbb.bbbbbbbb.bbbbbbbb.bbbbbbbb] ->
	1111110b, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb, 10bbbbbb
.Ed
.Pp
which provides for the entire proposed ISO-10646 31 bit standard are currently
not implemented.
.Sh "SEE ALSO"
.Xr mklocale 1 ,
.Xr setlocale 3
@


1.4
log
@Don't use hardcoded *roff font change requests.  Do it
via mdoc macros instead.
@
text
@d37 1
a37 1
.Dd "June 4, 1993"
@


1.3
log
@Very minor mdoc cleanup.
@
text
@d44 2
a45 1
\fBENCODING "UTF2"\fP
@


1.2
log
@Another round of various man page cleanups.
@
text
@d65 1
a65 1
.sp
d81 1
a81 1
.sp
@


1.2.2.1
log
@YAMFC:

Commit all of the -current changes that apply to 2.2.  These fall into
several categories:

- Cosmetic/mdoc changes.  They don't really afect the output
  at all, but having them in 2.2 will make it easier to diff the man
  pages later when looking for real changes.
- Update some man pages to reflect the current 2.2 header files.
- Sort xrefs.
- A few typo fixes.
- And a few changes that actualy added text to the man page that should
  be reflected in 2.2.
- Add some missing MLINKS.

Requested by: bde
@
text
@d44 1
a44 2
.Nm ENCODING
.Qq UTF2
d65 1
a65 1
.Pp
d81 1
a81 1
.Pp
@


1.2.2.2
log
@MFC:  Just the locale fixes (small doc tweaks for the most part)
and the new strptime(3) call.  Having added something, does this
require a version bump?  Haven't we bumped once already?

There are a *LOT* of additional 3.0 changes to be merged but I'm not
entirely comfortable with some of them so I'll take the conservative
(read: cowardly :) way out and just merge this much.
@
text
@d37 1
a37 1
.Dd June 4, 1993
@


1.1
log
@Initial revision
@
text
@d41 1
a41 1
.Nm UTF2
@


1.1.1.1
log
@BSD 4.4 Lite Lib Sources
@
text
@@


1.1.1.1.6.1
log
@Phase 2 of merge - also fix things broken in phase 1.
Watch out for falling rock until phase 3 is over!

libc completely merged except for phkmalloc & rfork (don't know if David
wants that).

Some include files in sys/ had to be updated in order to bring in libc.
@
text
@d41 1
a41 1
.Nm utf2
@


1.1.1.1.6.2
log
@This 3rd mega-commit should hopefully bring us back to where we were.
I can get it to `make world' succesfully, anyway!
@
text
@d41 1
a41 1
.Nm UTF2
@
1997-11-05 04:18:42 +00:00
Bill Paul
acbf996600 In clntudp_call(), it is possible that xdr_replymsg() might fail
partway through its attempt to decode the result structure sent by
the server. If this happens, it can leave the result partially
populated with dynamically allocated memory. In this event, the
xdr_replymsg() failure is detected and RPC_CANTDECODERES is returned,
but the memory in the partially populated result struct is not
free()d.

The end result is that memory is leaked when an RPC_CANTDECODERES
error occurs. (This condition can occur if a CLIENT * handle is created
using clntudp_bufcreate() with a receive buffer size that is too small
to handle the result sent by the server.)

Fixed by setting reply_xdrs.x_op to XDR_FREE and calling
xdr_replymsg() again to free the memory if an RPC_CANTDECODERES error
is detected.

I suspect that the clnt_tcp.c, clnt_unix.c and clnt_raw.c modules
may ha a similar problem, but I haven't duplicated the condition with
those yet.

Found by: dbmalloc
1997-10-26 18:47:31 +00:00
Wolfgang Helbig
60152ec531 Typo. 1997-10-26 10:37:35 +00:00
John Polstra
11ea2762eb Change L_SET to SEEK_SET for POSIX compliance.
Submitted by:	Dean Gaudet <dgaudet@arctic.org>
1997-10-26 00:41:51 +00:00
Andrey A. Chernov
7a54ede12f Back out part of OpenGroup specs about limiting max arg since it may break
compatibility.
1997-10-22 12:04:49 +00:00
Andrey A. Chernov
45ea5f3053 Reflect usleep code changes:
Limit max arg
Change return type to int
1997-10-22 11:27:20 +00:00
Andrey A. Chernov
9a9098177b Changes in spirit of OpenGroup Singe Unix specs:
1) Limit max allowed argument to 1000000
2) Change return type from void to int to indicate premature termination
(by signal)
1997-10-22 10:55:49 +00:00
Joerg Wunsch
56728a2905 Document EINVAL as a possible return value from open(2). 1997-10-22 07:29:13 +00:00
Bruce Evans
b966cc2394 Sorted lists. 1997-10-21 08:41:15 +00:00
Bruce Evans
7280dd1a3b Removed unused file. It just forces a return value of 0 on success
(no carry), but mount() in the kernel has returned 0 on success since
prehistoric times.
1997-10-18 13:59:48 +00:00
Andrey A. Chernov
c717c2d74c Add $Id 1997-10-17 09:40:08 +00:00
Andrey A. Chernov
8cfedef0e6 Fix LONG_MAX overflowing
Return seconds if errno other than EINTR
Add $Id
Submitted by: bde with minor optimization by me
1997-10-17 09:35:50 +00:00
John Polstra
7019f59e32 Fix two bugs which caused various RPC programs (mountd, nfsd, ...)
to fail under certain circumstances.

1. In one spot, the ifr_flags member was being examined in the
wrong structure, thus it contained garbage.  On a machine in which
only the loopback interface was up, this caused everything that
wanted to talk to the portmapper to fail -- a particular problem
with laptops, where the pccard ethernet interface is likely to come
up long after the attempt to start mountd, nfsd, amd, etc.

2. Compounding the above problem, get_myaddress() returned a
successful status even though it failed to find an address that it
considered good enough.
1997-10-17 04:59:56 +00:00
Andrey A. Chernov
855a496c94 Copy time_to_sleep to time_remaining since it can be left
uninitialized if nanosleep returns early with agr error
1997-10-16 21:31:43 +00:00
Bruce Evans
a461908da4 Handle machine-dependent (stdlib) sources more automatically.
This fixes bugs in the manual handling.  abs.[cS] was handled too
specially and the wrong (.c) variant for each of div.[cS], labs.[cS]
and ldiv.[cS] was added to SRCS.  This caused the .c variant to be
used if `depend' was made and the .S version to be used otherwise.
1997-10-16 14:58:30 +00:00
Bruce Evans
1cbbb1ba4b Removed bogus .PATH statement. 1997-10-16 14:41:25 +00:00
Bruce Evans
da16ae8684 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-16 14:26:13 +00:00
Bruce Evans
ae80efa54f Handle machine-dependent (m-d) (string) sources more automatically.
The names of m-d variants are now added (manually) to MDSRCS instead
of to SRCS, and the names of all machine-independent (m-i) variants
that can reasonably be replaced by an m-d variant are now added
(manually) to MISRCS instead of to SRCS, so that a simple substitution
can be used to discard the unused m-i variants.  MISRCS is potentially
all m-i sources, but the substitution is too simple to be fast, so
MISRCS should be kept reasonably small.

libc/Makefile.inc:
Do the substitution.

libc/i386/string/Makefile.inc:
Add to MDSRCS instead of to SRCS.  Add the names of all sources in this
directory, but no others.

libc/string/Makefile.inc
Add to MISRCS instead of to SRCS.  Add the names of all sources in this
directory.  Don't use (broken) explicit rules for special cases.
1997-10-16 13:46:50 +00:00
Andrey A. Chernov
74dcc37aef Reflect current sleep/usleep implementations state 1997-10-16 13:42:03 +00:00
Andrey A. Chernov
49620c896c Cleanup #includes 1997-10-16 13:35:25 +00:00
Masafumi Max NAKANE
d39b43a399 Proper spacing in the Synopsis. 1997-10-16 01:19:15 +00:00
Bruce Evans
c81c89b410 Include the machine-dependent Makefile.inc for sys in the correct place. 1997-10-15 16:29:14 +00:00
Bruce Evans
2bc3b4d735 Removed the subdirectory paths from the definitions of MAN[1-9]. They
were a workaround for limitations in bsd.man.mk that were fixed about
2 years ago.
1997-10-15 16:16:41 +00:00
Bruce Evans
e94b7ef033 Added some 2-line source files to get a direct correspondence
between sources and objects.  This will be used to avoid messy
special cases in Makefile.inc.
1997-10-15 15:27:19 +00:00
Peter Wemm
6173688707 Remove old SIGALRM absorbing back-compat code. It wasn't working at all
for the entire time that it was there, so obviously nothing needs it
anymore.

Note, unix98/single-unix spec v2 says that usleep() returns an int rather
than a void, to indicate whether the entire time period elapsed (0) or an
error (eg: signal handler) interrupted it (returns -1, errno = EINTR)
It is probably useful to make this change but I'll test it locally first
to see if this will break userland programs [much]...

Reviewed by: ache, bde
1997-10-15 14:11:08 +00:00
Peter Wemm
9f375c3252 Give up on the "try and compensate for broken programs" cruft and revert
back to the original single nanosleep() implementation.  This is POSIX and
Unix98 (aka single-unix spec v2) compliant behavior.  If a program sets
alarm(2) or an interval timer (setitimer(2)) without a SIGALRM handler
being active, sleep(3) will no longer absorb it, and the program will get
what it asked for..... :-]

The original reason for this in the first place (apache) doesn't seem to
need it anymore, according to Andrey.

Reviewed by: ache, bde
1997-10-15 14:06:15 +00:00
Bill Paul
4c45fb08aa Correct a bug in the 'allow arbitrary number of socket descriptors' changes
made to the RPC code some months ago. The value of __svc_fdsetsize is being
calculated incorrectly.

Logically, one would assume that __svc_fdsetsize is being used as a
substitute for FD_SETSIZE, with the difference being that __svc_fdsetsize
can be expanded on the fly to accomodate more descriptors if need be.
There are two problems: first, __svc_fdsetsize is not initialized to 0.
Second, __svc_fdsetsize is being calculated in svc.c:xprt_registere() as:

                __svc_fdsetsize = howmany(sock+1, NFDBITS);

This is wrong. If we are adding a socket with index value 4 to the
descriptor set, then __svc_fdsetsize will be 1 (since fds_bits is
an unsigned long, it can support any descriptor from 0 to 31, so we
only need one of them). In order for this to make sense with the
rest of the code though, it should be:

                __svc_fdsetsize = howmany(sock+1, NFDBITS) * NFDBITS;

Now if sock == 4, __svc_fdsetsize will be 32.

This bug causes 2 errors to occur. First, in xprt_register(), it
causes the __svc_fdset descriptor array to be freed and reallocated
unnecessarily. The code checks if it needs to expand the array using
the test: if (sock + 1 > __svc_fdsetsize). The very first time through,
__svc_fdsetsize is 0, which is fine: an array has to be allocated the
first time out. However __svc_fdsetsize is incorrectly set to 1, so
on the second time through, the test (sock + 1 > __svc_fdsetsize)
will still succeed, and the __svc_fdset array will be destroyed and
reallocated for no reason.

Second, the code in svc_run.c:svc_run() can become hopelessly confused.
The svc_run() routine malloc()s its own fd_set array using the value
of __svc_fdsetsize to decide how much memory to allocate. Once the
xprt_register() function expands the __svc_fdset array the first time,
the value for __svc_fdsetsize becomes 2, which is too small: the resulting
calculation causes the code to allocate an array that's only 32 bits wide
when it actually needs 64 bits. It also uses the valuse of __svc_fdsetsize
when copying the contents of the __svc_fdset array into the new array.
The end result is that all but the first 32 file descriptors get lost.

Note: from what I can tell, this bug originated in OpenBSD and was
brought over to us when the code was merged. The bug is still there
in the OpenBSD source.

Total nervous breakdown averted by: Electric Fence 2.0.5
1997-10-14 21:50:17 +00:00
Bruce Evans
b2fad8ae7a Moved `SRCS+= frexp.c' to the correct Makefile.inc.
Sorted SRCS.
1997-10-14 07:43:33 +00:00
Bruce Evans
9386dc4deb Moved `SRCS+= frexp.c' to the correct Makefile.inc. 1997-10-14 07:43:18 +00:00
Bruce Evans
1df595f25d Fixed searching of $PATH in execvp(). Do what sh(1) should do according
to POSIX.2.  In particular:

- don't retry for ETXTBSY.  This matches what sh(1) does.  The retry code
  was broken anyway.  It only slept for several seconds for the first few
  retries.  Then it retried without sleeping.
- don't abort the search for errors related to the path prefix, in
  particular for ENAMETOOLONG, ENOTDIR, ELOOP.  This fixes PR1487.  sh(1)
  gets this wrong in the opposite direction by never aborting the search.
- don't confuse EACCES for errors related to the path prefix with EACCES
  for errors related to the file.  sh(1) gets this wrong.
- don't return a stale errno when the search terminates normally without
  finding anything.  The errno for the last unsuccessful execve() was
  usually returned.  This gave too much precedence to pathologies in the
  last component of $PATH.  This bug is irrelevant for sh(1).

The implementation still uses the optimization/race-inhibitor of trying
to execve() things first.  POSIX.2 seems to require looking at file
permissions using stat().  We now use stat() after execve() if execve()
fails with an ambiguous error.  Trying execve() first may actually be a
pessimization, since failing execve()s are fundamentally a little slower
than stat(), and are significantly slower when a file is found but has
unsuitable permissions or points to an unsuitable interpreter.

PR:		1487
1997-10-14 07:23:16 +00:00
Bill Paul
e882d43eca Improve the innetgr() NIS+ compat kludge. We should only fail over to the
'slow' lookup if we get a YPERR_MAP (no such map in server's domain) error
instead of failing over on any error. In the latter case, if the 'fast'
search fails legitimately (i.e. the user or host really isn't a member
of the specified netgroup) then we end up doing the 'slow' search and
failing all over again. The result is still correct, but cycles are
consumed for no good reason.

Also removed the #ifdef CHARITABLE since the compat kludge is no longer
optional.
1997-10-13 17:09:15 +00:00
Bill Paul
c17942ca57 NIS+ compatibility kludge. A long time ago, I set up innetgr() so
that if searching through the special netgroup.byhost or netgroup.byuser
maps didn't work, we would roll over to the 'slow' method of grovelling
though the netgroup map and working out the dependencies on the fly.
But I left this option hidden inside an #ifdef CHARITABLE since I
didn't think I'd ever need it.

Well, the Sun rpc.nisd NIS+ server in YP compat mode doesn't support
the .byhost and .byuser reverse maps, so the  failover is necessary
in order to be compatible. *sigh*

This closes PR #3891, and should be merged into RELENG_2_2.
1997-10-11 00:03:25 +00:00
Philippe Charnier
8b76e1d7a8 Staticize usage(). Cosmetics. 1997-10-10 06:27:07 +00:00
John Dyson
44f203cb96 Add the AIO/LIO to libc. They aren't fully done yet, but have been in the
kernel for a few months.
1997-10-10 05:48:16 +00:00
Wolfgang Helbig
b9b51fb731 Merged in better support of ISO 8601 from elsie.nci.nih.gov.
Added the conversion specifiers %g and %G, that are replaced
by the year which contains the greater part of the week in question.
1997-10-03 19:06:57 +00:00
Wolfram Schneider
bf5cbf3551 Sort cross refereces in section SEE ALSO. 1997-09-29 19:11:55 +00:00
Mike Smith
af35b9ccb0 Revert the previous prototype un-typo. Add a brief comment warning that
"fixing" it is not a good idea.
1997-09-28 17:11:31 +00:00
Mike Smith
378a2883fe Typo fix 1997-09-28 03:28:34 +00:00
Mike Smith
27c729f066 Fix typo in signal() prototype 1997-09-28 03:28:09 +00:00
Andrey A. Chernov
46dba712f1 Use revived __maskrune for digittoint
Minor formatting
1997-09-27 04:34:35 +00:00
Andrey A. Chernov
3f2fd98c12 Move it under XPG4 define 1997-09-25 23:20:26 +00:00
Andrey A. Chernov
bed2de7d4c Move MSKanji under XPG4 define 1997-09-25 23:18:10 +00:00
Andrey A. Chernov
1284c1ad08 __maskrune --> __istype 1997-09-25 23:10:38 +00:00
Julian Elischer
16f76e6f06 Submitted by: Sin'ichiro MIYATANI / Phase One, Inc <siu@phaseone.co.jp>
Basic support for the Shift JIS encoding of japanese.
(and one tiny typo fixed in a comment)
1997-09-24 20:38:12 +00:00
Peter Wemm
42396e05cf Apply fts() fix from PR#4593
Submitted by:  Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
1997-09-22 12:48:40 +00:00
Bill Paul
0e710e8f95 Make selection logic more strict. Only select AF_INET loopback interfaces
that are up on second (loopback only) pass, and only select non-loopback
AF_INET interfaces that are up on first pass.
1997-09-21 23:04:51 +00:00
Poul-Henning Kamp
d030d2d2ae Many places in the code NULL is used in integer context, where
plain 0 should be used.  This happens to work because we #define
NULL to 0, but is stylistically wrong and can cause problems
for people trying to port bits of code to other environments.

PR:		2752
Submitted by:	Arne Henrik Juul <arnej@imf.unit.no>
1997-09-18 14:08:40 +00:00
Philippe Charnier
34384756cd environmental -> environment. 1997-09-18 06:55:21 +00:00
Peter Wemm
9e06e6da51 Some adjustments for the resolver use of poll(). For some reason I thought
an unimplemented syscall returned ENOSYS, rather than EINVAL.  I have run
statically linked code with this wrapper and it does appear to work fine
on 2.2-stable which doesn't have poll().  ktrace shows the poll syscall fail
once and the fallback to select() working.
1997-09-16 06:03:54 +00:00
Peter Wemm
b7ecb08afa Put a system call not present checking wrapper around the call to
__getcwd().  I've got this libc code running on one of my machines
at the moment without the __getcwd() syscall being present.
1997-09-16 06:00:50 +00:00
Wolfram Schneider
211fed7e35 Fix yet a minor stylistic nit from Bruce.
(`cvs diff -ib' print one new char ;-).
1997-09-15 19:37:23 +00:00
Poul-Henning Kamp
36dff60096 Fix yet a minor stylistic nit from Bruce (Doesn't he have more
important things to do ?? :-)

Prepare for the likely case of a change in kernel algorithm.
1997-09-15 17:40:15 +00:00
Poul-Henning Kamp
9c2d6fcf05 Fix a buglet and a couple of stylistic nits from Bruce. 1997-09-15 08:25:14 +00:00
Wolfram Schneider
8be26e5d0f Potential bufferflow in getpwent(), getpwnam() and getpwuid()
PR: bin/4134
Submitted by:	nick@foobar.org
1997-09-14 18:16:11 +00:00
Poul-Henning Kamp
27262cac33 Add __getcwd() syscall, and have getcwd() take a shot at it.
If your kernel doesn't support __getcwd() or if __getcwd() cannot
deliver because of cache expiry, it does the canonical thing.
1997-09-14 16:57:27 +00:00
Peter Wemm
535db1806c Call poll(2) from within the resolver but adapt to older kernels without it
if necessary.  This removes the need to malloc large fd_set's for selecting
on high fd's (larger than FD_SETSIZE at libc compile time).

The syscall adaptive stuff only happens on the very first call.  SIGSYS
is masked, and if the call to poll fails with ENOSYS, then we use select
for the life of the program.  If poll does not fail with ENOSYS, then we
always use poll and skip the once-off signal masking gunk.

This may be overkill, but it saved my neck a few times while working on
multiple different sets of kernel sources, some with poll, some without.
1997-09-14 09:44:34 +00:00
Peter Wemm
16115af153 A poll(2) manpage.
Obtained from: NetBSD
1997-09-14 05:44:35 +00:00
Peter Wemm
b52c91dd7e Generate poll syscall stub 1997-09-14 03:29:55 +00:00
Joerg Wunsch
dbf4898f6c Document SA_NOCLDWAIT.
Make all the SA_* flags go into a tagged list, to improve readability.
1997-09-13 19:43:24 +00:00
Bruce Evans
065bebee55 Removed superfluous quoting of function args. 1997-09-07 04:10:35 +00:00
Bruce Evans
f12d1f0bf6 Fixed style bug in pseudocode. 1997-09-07 04:01:27 +00:00
Bruce Evans
853aa1faf3 Fixed synopsis. The envp arg for execle() can't be given in the prototype.
Fortunately, the man page doesn't refer to "envp" so just deleting it is OK.
1997-09-03 03:25:35 +00:00
Brian Somers
a367bd9e25 Add "options no_tld_query" to resolv.conf.
Mention the capability in resolver(5).
Mention that RES_OPTIONS can be used in resolver(5).
Discussed with: -hackers
1997-09-01 01:19:23 +00:00
Bruce Evans
4447a79bf7 Fixed inclomplete function type in synopsis. 1997-08-31 21:54:10 +00:00
Poul-Henning Kamp
188891873e Another 32bits of 64bits conformance.
Reviewed by:	phk
Submitted by:	jdp
1997-08-31 05:59:39 +00:00
Peter Wemm
77909f5978 Initial elf nlist support, mostly stolen from OpenBSD (they use standard
#defines that are compatable with ours).  I made some some minor tweaks
to the leading '_' tests.

Again, this is off by default for the moment.  This probably should be
split into seperate files (like some of our other libc files that could
do with some splitting).

Obtained from: OpenBSD (plus some minor tweaks)
1997-08-31 00:08:35 +00:00
KATO Takenori
01f770e87c Added HW_MACHINE_ARCH. 1997-08-30 02:26:36 +00:00