Commit Graph

6627 Commits

Author SHA1 Message Date
fenner
06e2d46968 Fix documentation of clnt_control()'s CL{GET|SET}_{VERS|XID} to
reflect that they actually require a u_int32_t *, which is not
 necessarily the same as an unsigned long *.
2002-09-16 21:45:37 +00:00
mini
6077cee242 Make libpthread KSE aware.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:52:52 +00:00
mini
4726269c93 Mechanically change all libc_r references to libpthread. 2002-09-16 19:29:34 +00:00
mini
94a57caeb2 Save and restore FPU state properly in ucontext_t's.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:24:31 +00:00
mini
1fe838905f Add signalcontext(), which lays down a signal frame onto a ucontext_t.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:23:35 +00:00
ume
c18a6ce242 Allocate 64K recieve buffer for DNS responses. 2002-09-16 13:19:47 +00:00
tjr
155577bd7a Convert eight space indents to tabs in the "*" format handling code. 2002-09-16 12:07:13 +00:00
mini
a116d71409 Make the changes needed for libpthread to compile in its new home.
The new libpthread will provide POSIX threading support using KSE.
These files were previously repo-copied from src/lib/libc_r.

Reviewed by:	deischen
Approved by:	-arch
2002-09-16 08:45:36 +00:00
bde
b73776ee68 Fixed messes involving $FreeBSD$ starting with one left in the copyright
after adding __FBSDID().

Garbage-collected kvm_readswap().  This was once used by kvm_uread(), but
kvm_uread() now just reads /proc/<pid>/mem and procfs hopefully handles
swapped out pages.
2002-09-16 08:22:57 +00:00
mike
92ef138f6d Don't depend on <sys/types.h> pollution in <fcntl.h>. 2002-09-16 07:18:27 +00:00
julian
c7e9e7e892 Allocate KSEs and KSEGRPs separatly and remove them from the proc structure.
next step is to allow > 1 to be allocated per process. This would give
multi-processor threads. (when the rest of the infrastructure is
in place)

While doing this I noticed libkvm and sys/kern/kern_proc.c:fill_kinfo_proc
are diverging more than they should.. corrective action needed soon.
2002-09-15 23:52:25 +00:00
ume
9c29b64177 Allocate 64K recieve buffer for DNS responses.
KAME did the modification only to _dns_getaddrinfo().  However,
it is not sufficient, and res_queryN() should be modified, too.
So, I did same modification to res_queryN().

Obtained from:	KAME
2002-09-15 20:36:38 +00:00
nectar
b44001f0c3 Check for truncation in calls to res_send/res_query/res_search.
Fail when it is detected.
2002-09-15 16:51:09 +00:00
tjr
8569d04e14 Add wcstod() as a wrapper around strtod(). It does not handle any characters
that strtod() does not (alternate digit characters, etc. are not handled).
2002-09-15 08:38:51 +00:00
tjr
b2a34e6f87 Use the heap instead of the stack to store temporary multibyte string
buffers; this is slower but safer for threaded programs where threads
often have relatively low stack size limits.
2002-09-15 08:06:17 +00:00
nectar
a0732e9360 Backout the increase of MAXPACKET from 1024 to 65536: it
broke pthreads.

Reported by:	mbr, tjr
2002-09-15 04:23:20 +00:00
tmm
c14b63a0b9 Use the macros from machine/fsr.h; some minor cleanups. 2002-09-14 18:07:03 +00:00
tmm
6bea77d590 Add implementations of fpgetmask(), fpgetround(), fpgetsticky(),
fpsetround(), fpsetsticky(), obtained from NetBSD and tweaked a little
to use definitions from machine/fsr.h instead of magic numbers.
2002-09-14 18:06:21 +00:00
ume
db96f2a540 Limit UDP payload size for EDNS0 to 0xffff, not use lower 16bit value.
Obtained from:	KAME
2002-09-14 17:28:40 +00:00
nectar
57c8809640 When using res_send/res_query/res_search, the caller must either
insure enough space is available for the response, or be prepared
to resize the buffer and retry as necessary.

Do the conservative thing and make sure enough space is available.

Reviewed by:	silence on freebsd-audit
2002-09-13 20:31:29 +00:00
tmm
c568640675 Add an implementation of fabs() (which is quite trivial).
When it is called directly, gcc is smart enough to generate inline
code for it, which is why it wasn't noticed before that it was missing.

fabs() would probably better fit into libm, but it has traditionally been
in libc on FreeBSD, so there is probably software around that makes
assumptions about this by now.
2002-09-13 16:01:26 +00:00
tjr
4448ddb047 Correct type of second argument: it is wchar_t ** restrict,
not wchar_t * restrict.
2002-09-12 09:25:27 +00:00
archie
57de4fb945 Update to reflect reality.
Reviewed by:	mini
MFC after:	3 days
2002-09-11 21:40:02 +00:00
archie
b2c4f4ae74 Add man pages for getcontext()/setcontext(), makecontext()/swapcontext(),
and ucontext_t.

Reviewed by:	mini
MFC after:	3 days
2002-09-11 21:39:21 +00:00
nectar
c9164bea19 In kvm_openfiles/kvm_open, mark the file descriptors as close-on-exec.
Applications can not do this themselves, as the descriptors are hidden
behind the opaque `kvm_t' type.
2002-09-11 16:41:39 +00:00
tjr
5f5cd9d0b8 Add an implementation of wcsftime() (wide character version of strftime()). 2002-09-11 08:57:11 +00:00
julian
5702a380a5 Completely redo thread states.
Reviewed by:	davidxu@freebsd.org
2002-09-11 08:13:56 +00:00
mike
57d52b441f Add `restrict' type-qualifier. 2002-09-11 05:05:48 +00:00
archie
02e28a1d0c Adjust to reflect reality, which is that sigaltstack() takes stack_t *'s.
MFC after:	3 days
2002-09-10 21:06:51 +00:00
wollman
ab723a2a1b Implement C99's _Exit() interface.
Implement a version of qsort that provides a thunk to the comparison function.

Update manual pages.
2002-09-10 02:04:49 +00:00
phk
3a164c2a89 Get this file closer to style(9). 2002-09-08 15:10:04 +00:00
tjr
7c848d9cfd Add wcstol() and wcstoul(), based on strtol() and strtoul(). 2002-09-08 13:27:26 +00:00
tjr
0e0fb98538 Replace a stray reference to strtok() with one to wcstok(). 2002-09-08 11:09:24 +00:00
wollman
d849ac7403 Fix a syntax error which causes an annoying warning. 2002-09-08 04:43:28 +00:00
tjr
9445b1b57c Add an implementation of wcstok(), based on strtok_r(). 2002-09-07 08:16:57 +00:00
jmallett
4cb9c36cfd Two arrays were born from the same seeds, both grew into complementary sets
of pointers to strings.  These two arrays were fixed to the same size, but one
had an implicit zeroed trailer element, which was unused because the size was
used up by the ones before said zeroed trailer element.  So the unused limb was
chopped off the over-sized-but-not-over-sized array, and everyone lived happily
ever after.
2002-09-07 08:14:19 +00:00
tjr
64f61942de Sync prototypes with <wchar.h> with respect to the restrict qualifier. 2002-09-07 04:07:00 +00:00
tjr
ad5ac67c75 Add restrict qualifiers where C99 permits them. All of these already had
restrict qualifiers on their prototypes in <wchar.h>.
2002-09-07 04:03:28 +00:00
tjr
91c2f6f1aa Call strtok_r() via a libc private name from within strtok(). 2002-09-07 02:53:19 +00:00
bmah
5419354c9f Fix a bug where calling MD5File(3) with a zero-length file generated an
error, due to an uninitialized variable.

Reviewed by:	phk, archie
2002-09-06 19:51:58 +00:00
wollman
7c1e59f51d Include some verbage about not calling exit() from functions registered
by atexit().
2002-09-06 19:23:28 +00:00
tjr
cd5ca96599 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
jake
d602f01d31 Don't need to install the signal trampoline here anymore. 2002-09-03 14:59:41 +00:00
jake
c73a7dbd84 Install the userland signal trampoline when sigaction is first called,
instead of on startup.  This fixes binary compatibility of dynamically
linked binaries from before the signal code move.

Suggested by:	wollman (a long time ago)
2002-09-03 14:55:29 +00:00
peter
2dc22e4926 Fix a nasty bug exposed by mktime() when time_t is significantly bigger
than 32 bits.  It was trying to figure out things like the day of week
of when time_t is roughly 2^62 etc.  Make a better guess for the starting
point for the binary search that works on both 32 and 64 bit types.  I have
been using this for a while now.
2002-09-03 04:34:10 +00:00
tjr
573a3e8e5e Set errno to EILSEQ when invalid multibyte sequences are detected
(XSI extension to 1003.1-2001).
2002-09-03 01:09:47 +00:00
jake
1359c1017e Use FOO(a) for macros with variadic args, instead of FOO(a,) or FOO(a, ).
Submitted by:	gcc3.2
2002-09-02 02:30:20 +00:00
robert
27ec88afb5 - Let their manual pages show the reader that the bzero(3) and
bcopy(3) functions are prototyped in <strings.h> and not in
   <string.h> anymore.
 - Add a sentence about that to the respective HISTORY sections.
In the C source files:
 - Include <string.h> or <strings.h> depending on what function
   is to be compiled.
 - Use ANSI-C function definitions.
2002-09-01 21:53:46 +00:00
tjr
3c7d05d837 Typo: refer to MB_LEN_MAX instead of MB_CHAR_MAX (which does not exist). 2002-09-01 07:21:58 +00:00
tjr
2e5584e864 Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
wcstombs().
2002-09-01 07:08:22 +00:00
mike
02b206400e Fix a memory leak. 2002-09-01 01:49:27 +00:00
tjr
ca719015df Implement the XSI extension which allows the destination string to be
NULL, and returns the number of bytes that would be required to store
the result of the conversion without storing anything.

PR:		17694
2002-08-31 14:16:12 +00:00
tjr
4a4fda0f86 Split ansi.c into a separate source file for each function. 2002-08-31 11:26:55 +00:00
ache
323528b137 Use ntohl() to read cnains number in new format 2002-08-31 01:05:39 +00:00
robert
5652ad2ba1 Add the 'restrict' type qualifier to the function prototype
of the swab(3) function in its manual page to match the
standardization by POSIX.1-2001.
2002-08-30 21:18:39 +00:00
robert
ee01389795 - Update the manual page of bcmp(3) by replacing
.In string.h
   with
     .In strings.h
   and adding a sentence to the HISTORY section.
 - Use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h>.
 - Apply style(9): Put a space after return keywords.
2002-08-30 21:07:40 +00:00
ache
cc37572108 Style fix 2002-08-30 20:39:53 +00:00
robert
9920d9cacd - Convert the function definition to declare its arguments
in the ANSI-C format.
 - Change the code a bit to hopefully save some cycles.
   I.e. (simplified) change

     a = b + 1;
     while (--b & 0x7)
	/* ... */
   to
     a = b;
     for (; b & 0x7; b--)
	/* ... */
   and
     while (--a >= 0)
	/* ... */
   to
     for (; a > 0; a--)
	/* ... */
 - Equip two function arguments of swab() with the 'restrict'
   type qualifier in form of the '__restrict' macro.  This is
   specified by POSIX.1-2001.
2002-08-30 20:33:05 +00:00
ache
1286c989d6 Prepare for switching to unlimited chains format.
Optimize chains lookup a bit.
2002-08-30 20:26:02 +00:00
robert
ac79a8c0eb - Update the manual pages of index() and rindex() to show
<strings.h> as the associated header file.
   The prototypes have been moved there from <string.h> because
   POSIX.1-2001 said so.
 - Conditionally include either <strings.h> or <string.h> based
   on whether the [r]index() or str[r]chr() functions are
   compiled, respectively.
 - Style(9) tells us to
    - put a space after the return keyword
    - to check for a NUL character without using the ! operator.
    - use NULL instead of (type *)NULL where the compiler knows
      the type.
   Apply these rules.
 - Rather use ANSI-C function definitions than K&R ones.
 - For index(3), correct second function argument's type; it was
   declared to be a `const char' before and is now an `int'.
2002-08-30 19:42:07 +00:00
robert
6700ee6cc9 - Update the manual page to show that the associated header file
is <strings.h> and not <string.h> anymore.
 - Tell the reader about this change in the HISTORY section.
 - Switch to use an ANSI-C function definition.
 - Include <strings.h> instead of <string.h> in the source file.
2002-08-30 19:08:53 +00:00
robert
3d9398c00e - Update strcasecmp(3)/strncasecmp(3) to reflect the fact that
the prototypes for both functions are now in the <strings.h>
   header, as required by IEEE Std 1003.1-2001.
 - Add one sentence about that in the HISTORY section.
 - Include <strings.h> in the source file to have the prototypes
   in scope when the _ANSI_SOURCE macro is defined.
2002-08-30 15:40:01 +00:00
peter
2f3c7ba63d Hopefully unbreak world. ke_slptime is gone. It should really have been
looking at p_ksegrp.kg_slptime anyway.
2002-08-30 02:18:38 +00:00
deischen
8347fcb52d Remove much of the dereferencing of the fd table entries to look
at file flags and replace it with functions that will avoid null
pointer checks.

MFC to be done by archie ;-)

PR:		42100
Reviewed by:	archie, robert
MFC after:	3 days
2002-08-29 23:06:07 +00:00
archie
af2ae1a6ea Make the libc_r version of select() set the readable or writable
file descriptor bit if poll() returns POLLERR, POLLHUP, or POLLNVAL.
Othewise, it's possible for select() to return successfully but
with no bits set.

Reviewed by:	deischen
MFC after:	3 days
PR:		bin/42175
2002-08-29 21:39:19 +00:00
archie
18b0669383 When poll(2)'ing for readability or writability of a file descriptor
on behalf of a thread, we should check the POLLERR, POLLHUP, and
POLLNVAL flags as well to wake up the thread in these cases.

Suggested by:	deischen
MFC after:	3 days
2002-08-29 00:44:11 +00:00
alfred
30d3848aee Allow one to grab the definition of struct ucred by defining _WANT_UCRED
instead of forcing _KERNEL.

Move the include of sys/_label.h in ucred.h under the
_KERNEL || _WANT_UCRED case.
2002-08-28 20:39:48 +00:00
schweikh
57bf7bbe3f Print a '-' sign for negative zero. Tested with
#include <stdio.h>
	int main(void)
	{
		printf("%+f\n", -0.0);
		printf("%+f\n", +0.0);
		printf("%+f\n",  0.0);
		return 0;
	}

to output
-0.000000
+0.000000
+0.000000

PR:		bin/41823
Submitted by:	GOTO Kentaro <gotoken@notwork.org>
Liked by:	bde
MFC after:	3 weeks
2002-08-27 20:11:08 +00:00
charnier
4966efff7b Replace various spelling with FALLTHROUGH which is lint()able 2002-08-25 13:10:45 +00:00
jdp
5e4153d486 Fix a bug in __ivaliduser_sa() which caused some rsh/rlogin attempts
to fail needlessly if a reverse DNS lookup of the IP address didn't
come up with a hostname.  As a comment in the code clearly stated,
the "damn hostname" was looked up only for the purpose of netgroup
matching.  But if that lookup failed, the function bailed out
immediately even though in many cases netgroup matching would not
be used.

This change marks the hostname as unknown but continues.  Where
netgroup matching is performed, an unknown hostname is handled
conservatively.  I.e., for "+@netgroup" (accept) entries an unknown
hostname never matches, and for "-@netgroup" (reject) entries an
unknown hostname always matches.

In the lines affected (only), I also fixed a few bogus casts.  There
are others, and in fact this entire file would be a good candidate
for a cleanup sweep.

Reviewed by:	imp (wearing his flourescent yellow Security Team cap)
MFC after:	2 days
2002-08-24 17:37:42 +00:00
kris
3f7bd9e0a1 &x is not a format string 2002-08-24 07:15:55 +00:00
mike
3b412a9b84 Note that <sys/types.h> in no longer a prerequisite for <utime.h> and
<sys/mman.h>.
2002-08-24 00:39:43 +00:00
marcel
e1124db23a We cannot use an alloc with only inputs and/or locals. The kernel
assumes that the parameters are passed in output registers. Remove
the alloc entirely, but don't depend on the kernel not trashing
our registers.
2002-08-23 03:47:50 +00:00
jmallett
47cda62462 Wrap the header to prevent multiple inclusion, and mark the DECLS section.
Reminded by:	Rachel Hestilow <hestilow@ximian.com>
2002-08-22 23:35:35 +00:00
pirzyk
ee1c2cc721 Fixed getaddrinfo to honor sortlist in /etc/resolv.conf
PR:		bin/27939
Reviewed by:	ru, sheldonh (about a year ago)
Obtained from:	ume (via KAME, I think)
MFC after:	1 month
2002-08-21 19:57:53 +00:00
phk
34ae8fe537 s/EDOFUS/EDOOFUS/
Persuaded by:	Google
2002-08-21 17:11:00 +00:00
mike
9e6f796b0d o Merge <machine/ansi.h> and <machine/types.h> into a new header
called <machine/_types.h>.
o <machine/ansi.h> will continue to live so it can define MD clock
  macros, which are only MD because of gratuitous differences between
  architectures.
o Change all headers to make use of this.  This mainly involves
  changing:
    #ifdef _BSD_FOO_T_
    typedef	_BSD_FOO_T_	foo_t;
    #undef _BSD_FOO_T_
    #endif
  to:
    #ifndef _FOO_T_DECLARED
    typedef	__foo_t	foo_t;
    #define	_FOO_T_DECLARED
    #endif

Concept by:	bde
Reviewed by:	jake, obrien
2002-08-21 16:20:02 +00:00
scottl
2d2341a634 Fix a typo in #if 0 code 2002-08-21 09:30:45 +00:00
tjr
6a5533e938 Add a manual page for wcwidth(). 2002-08-20 03:42:21 +00:00
tjr
fa072443b4 Add a manual page for wcswidth(). 2002-08-20 03:40:45 +00:00
ache
a2d28129a1 Move just committed version of wcswidth.c here (from "locale"),
a bit optimized now.
2002-08-20 02:06:28 +00:00
ache
87f08c9cbb Remove wcswidth.c from here (and move it to "string") 2002-08-20 01:59:26 +00:00
ache
178f85ae98 Remove space at the end of continuation line in prev. commit 2002-08-20 01:16:06 +00:00
bde
f8ad2e529c xdr.3 is added to MAN in ../xdr/Makefile.inc where it belongs, so don't
add it here.
2002-08-19 23:06:00 +00:00
ache
d3fa9cb263 Implement wcswidth() 2002-08-19 20:46:10 +00:00
ache
0923ef5388 Use modern-style arguments declaration 2002-08-19 20:32:27 +00:00
ache
53166ba7d8 Write null wide-character as L'\0' like in other places 2002-08-19 20:12:38 +00:00
ache
34e5c81b71 According to SUSv2, always return 0 for null wide-character code 2002-08-19 18:06:18 +00:00
jmallett
209b6366d9 s/trailing NULL/trailing NUL/ 2002-08-19 17:14:58 +00:00
ache
2094c32437 Move internal defines from ctype.h here 2002-08-19 09:02:49 +00:00
jmallett
77aebb609a Leave room for a trailing NUL not a NULL, that's not an ASCII character. 2002-08-19 03:52:36 +00:00
tjr
a87152b560 Implement the ISO C90 Amd.1 restartable wide and multibyte character
manipulation functions mbrlen(), mbrtowc(), mbsinit(), mbsrtowcs(),
wcrtomb(), wcsrtombs().
2002-08-18 06:30:10 +00:00
ache
31acbd553d Move wcwidth() to separate file, it doesn't belong to iswctype.c at all 2002-08-17 20:30:34 +00:00
ache
75de318dfb According to SUSv2, wcwidth() should return -1 for non-printing characters 2002-08-17 20:11:31 +00:00
ache
3737348a03 Cosmetic - remove unneded brackets and #undef 2002-08-17 20:03:44 +00:00
ache
1a00890ca4 wcwidth: fix espression to work correctly with SWIDTH0 2002-08-17 14:16:14 +00:00
bmilekic
79f77ec38a Fix libc build breakage by defining FSTYPENAMES before including
disklabel.h; broken originally by 1.87 of sys/disklabel.h, which
made the split between DKTYPENAMES and FSTYPENAMES.
Someone who knows disklabel.c: do we still need DKTYPENAMES to be
defined here now?
2002-08-16 15:33:20 +00:00
keichii
99fd6cbd41 Add iswctype wcwidth function code
Submitted by:	clkao@clkao.org
Reviewed by:	keichii
Obtained from:	NetBSD
MFC after:	1 month
2002-08-16 13:45:23 +00:00
alfred
997e76e7c0 Hide 'struct ucred' behind '#ifdef _KERNEL', this should stop userland
from attempting to use it for good.  There is a catch, kvm_proc.c needs
to '#define _KERNEL' to get at the ucred.

Requested by: rwatson
2002-08-16 07:01:43 +00:00
rwatson
672aa78ecb Add LOGIN_SETMAC, which will indicate to the user context management code
that it should also set the user's default MAC label, if available and
permitted.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-16 02:14:21 +00:00
robert
fe770f50bf - Fix a bug that wrote one char behind the end of the
supplied buffer in case the size of it was equal to
   the number of characters the converted address consumed.
   The bug occurred when converting an AF_INET address.
 - Remove the SPRINTF macro and use sprintf instead.
 - Do not do string formatting using sprintf(3) and a
   temporary buffer which is copied when the supplied
   buffer provides enough space.  Instead, use snprintf(3)
   and the real destination buffer, thus avoid the copy.

Reported by:	Stefan Farfeleder <e0026813@stud3.tuwien.ac.at> (1)
PR:		misc/41289
2002-08-15 21:19:31 +00:00
robert
62a0b60a38 Put each function argument on its own line to keep lines shorter
than 80 columns.
2002-08-15 20:33:44 +00:00
robert
d57d160b95 Use one line for each function argument to keep the line
width smaller than 80 columns.

Thanks to Ruslan for an explanation of multiple ways to
achieve this.
2002-08-15 18:57:57 +00:00
bde
6869d406ec Removed duplicated MLINKS which make(1) recently started warning about. 2002-08-15 12:31:01 +00:00
robert
247b8ccb6b Include <stdlib.h> to have abort() and exit() declared. 2002-08-15 11:58:24 +00:00
robert
eef3b2f04b - For compliance with IEEE Std 1003.1-2001, add the 'restrict'
qualifier to function prototypes and definitions where
   appropriate using the '__restrict' macro.
 - Update the manual page.
2002-08-15 10:28:52 +00:00
robert
4accb821f1 - Introduce the 'restrict' qualifier to function prototypes and
definitions to comply with IEEE Std 1003.1-2001.
 - Update the manual pages.
2002-08-15 09:47:10 +00:00
robert
043ed1f581 - Add the 'restrict' qualifier to the function prototypes and
definitions of the functions that convert strings to numbers
   and are defined by IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions for all of the functions
   mentioned above plus strtouq and strtoq.
 - Update the prototypes in the manual pages.
2002-08-15 09:25:04 +00:00
robert
4b64f84a43 - Add the 'restrict' qualifier to the function definitions and
public prototypes of setbuf(3) and setvbuf(3) using the
   '__restrict' macro from <sys/cdefs.h> to be compliant with
   IEEE Std 1003.1-2001.
 - Replace the K&R with ANSI-C function definitions.
 - Bring the manual page up-to-date.
2002-08-14 23:45:42 +00:00
robert
f0abd50e99 - Add the 'restrict' qualifier to the function definition of
strftime(3) for IEEE Std 1003.1-2001 compliance and remove
   excessive usage of the 'const' qualifier that was neither
   present in the prototype in the publice header, nor in the
   local prototype just above the function definition.
 - Replace the K&R function definition with a ANSI-C one.
 - Update the prototype of strftime(3) in its manual page.
2002-08-14 23:20:48 +00:00
robert
698d5a31a4 - Add the 'restrict' qualifier to the definitions of the string
concatenation and copy functions using the '__restrict' macro.
   This is to satisfy IEEE Std 1003-1.2001.
 - Use ANSI-C function definitions.
 - Add the 'restrict' keyword to the manual pages, too.
2002-08-14 22:59:22 +00:00
robert
6e77bfc7bd - Add the C99 'restrict' qualifier using the '__restrict' macro to
function prototype and definition of strptime(3).
 - Update the manual page.
2002-08-14 22:36:22 +00:00
rwatson
476f71cec5 Use "ugidfw.h" rather than <ugidfw.h> so that mkdep can find it.
Suggested by:	mike
2002-08-14 22:30:07 +00:00
robert
d02311a4f8 - Add the 'restrict' qualifier to match the IEEE Std 1003.1-2001
prototype of the tdelete(3) function.
 - Remove duplicated space.
 - Use an ANSI-C function definition for tdelete(3).
 - Update the manual page.
2002-08-14 21:16:41 +00:00
robert
c892b99281 - Add the 'restrict' qualifier required by IEEE Std 1003.1-2001
to the function definition of strxfrm(3) in form of our
   '__restrict' macro.
 - Use an ANSI-C function definition for strxfrm(3).
 - Change the manual page accordingly.
2002-08-14 21:01:04 +00:00
robert
af770662f5 -Add the restrict required by IEEE Std 1003.1-2001 in form
of our __restrict macro to the prototypes and function
   definitions of inet_pton and inet_ntop.
 - Use ANSI-C function argument lists.
 - Adjust the prototypes in the manual page.
2002-08-14 20:40:35 +00:00
phk
3a04055091 Unbreak one of the most confusing breaks of the tree I've seen.
The last commit cannot possibly have been tested.
2002-08-13 18:55:51 +00:00
ache
eb76ea8d87 Reduce BSS size for programs which not load collate by eliminating
static buffer.
2002-08-13 14:55:17 +00:00
dwmalone
f67a15f38e Use a union to access the words of a double as this is less likely
to cause bugs when gcc is more aggressively optimising things.

There are still problems with dtoa mentioned in the PR - maybe
Dan could suggest a patch.

PR:		40209
Submitted by:	Dan Lukes <dan@obluda.cz>
Approved by:	bde
MFC after:	2 weeks
2002-08-13 14:17:39 +00:00
ru
dfc3706596 can not -> cannot. 2002-08-13 14:10:36 +00:00
tjr
66feacf2b7 Tidy up SRCS and MAN assignments. 2002-08-13 11:56:02 +00:00
tjr
5c84d680a1 Remove the Bugs section, which is not relevant to FreeBSD: there is no
one-character ungetwc(3) buffer limit.
2002-08-13 10:50:22 +00:00
tjr
f37d7a7354 FreeBSD-ify: use In macro for header files in Synopsis, St C-99 instead of
St C99 in Standards section.
2002-08-13 10:47:17 +00:00
tjr
294097ed71 Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),
putwc(), fputwc(), putwchar(), ungetwc(), fwide().
2002-08-13 09:30:41 +00:00
ru
705964161c Handle the escaped colon \: in a capability.
PR:		bin/30778
Reviewed by:	ache, peter
MFC after:	3 days
2002-08-12 19:13:22 +00:00
ache
5e3f4acbd9 Now malloc() is fixed, remove errno hardcoding to ENOMEM 2002-08-12 17:14:04 +00:00
tjr
772773c74c Manual pages for fwide(), getwc(), fgetwc(), getwchar(), putwc(), fputwc(),
putwchar(), ungetwc() from NetBSD and Citrus Project, unmodified except
for the addition of $FreeBSD$.

Obtained from:	NetBSD, Citrus Project
2002-08-12 13:23:12 +00:00
ache
08eb533d34 Now, malloc is fixed, remove ENOMEM hardcode 2002-08-12 11:47:19 +00:00
dwmalone
70705c0312 Add a missing copyright for Doug. There are other files missing this
copyright in -stable.

PR:		41397
Submitted by:	dfr
2002-08-11 19:31:02 +00:00
jmallett
9313936769 Initialise disk->d_ufs so that in sblock.c it's always initialised
(unless someone tries to use libufs support functions without using
	_fillout or _ctor to construct a uufsd.)

Obtained from:	jmallett_libufs Perforce branch.
2002-08-11 15:37:10 +00:00
schweikh
b2bb39b1eb Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by:	bde
MFC after:	3 days
2002-08-11 13:05:30 +00:00
rwatson
c455dcde64 Whitespace cleanup--it's not style(9), but it is consistent. Prep
for MAC-related commits to the login infrastructure.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-11 01:48:43 +00:00
jake
c154930f19 Auto size available kernel virtual address space based on phsyical memory
size.  This avoids blowing out kva in kmeminit() on large memory machines
(4 gigs or more).

Reviewed by:	tmm
2002-08-10 22:14:16 +00:00
mux
f43070c325 - Introduce a new struct xvfsconf, the userland version of struct vfsconf.
- Make getvfsbyname() take a struct xvfsconf *.
- Convert several consumers of getvfsbyname() to use struct xvfsconf.
- Correct the getvfsbyname.3 manpage.
- Create a new vfs.conflist sysctl to dump all the struct xvfsconf in the
  kernel, and rewrite getvfsbyname() to use this instead of the weird
  existing API.
- Convert some {set,get,end}vfsent() consumers to use the new vfs.conflist
  sysctl.
- Convert a vfsload() call in nfsiod.c to kldload() and remove the useless
  vfsisloadable() and endvfsent() calls.
- Add a warning printf() in vfs_sysctl() to tell people they are using
  an old userland.

After these changes, it's possible to modify struct vfsconf without
breaking the binary compatibility.  Please note that these changes don't
break this compatibility either.

When bp will have updated mount_smbfs(8) with the patch I sent him, there
will be no more consumers of the {set,get,end}vfsent(), vfsisloadable()
and vfsload() API, and I will promptly delete it.
2002-08-10 20:19:04 +00:00
phk
bf2b63272d Update with new error return code.
Reminded by:	rwatson
2002-08-09 13:22:21 +00:00
ru
dd72b72c9a mdoc(7) police: spelling. 2002-08-09 12:08:47 +00:00
ru
026a74a7c6 mdoc(7) police: tidy up the formatting. 2002-08-09 12:07:17 +00:00
ru
990a65aff6 mdoc(7) police: punctuation. 2002-08-09 11:36:48 +00:00
ru
a800085f6c mdoc(7) police: sort xrefs. 2002-08-09 11:33:23 +00:00
ru
daff9f5ae7 mdoc(7) police: punctuation. 2002-08-09 11:24:21 +00:00
ru
e9d452579d mdoc(7) police: whitespace nits. 2002-08-09 11:17:56 +00:00
ru
6d9dd3b557 mdoc(7) police: laundry. 2002-08-09 11:15:49 +00:00
ru
e54851cdbe mdoc(7) police: laundry. 2002-08-09 11:06:03 +00:00
phk
95cd15c43d Make sure we set errno sensibly in case of failure.
Spotted by:	ache
2002-08-09 10:16:24 +00:00
phk
ade75a9d08 Introduce a new error return code:
#define EDOFUS          88              /* Programming error */
This can be used to signal error situations which indicate that the
program logic or assumptions is deficient.
2002-08-09 10:15:48 +00:00
ache
9d73d0dd12 Add safeguards to never use errno == 0 as setrunelocale() error return code 2002-08-09 08:22:29 +00:00
rwatson
96dbcef3fc Update TE policy and MAC text conversion routines to support partial
label updates.  Biba and MLS already supported this.  This permits the
userland library to submit relative updates on MAC labels, rather
than submitting an entire label to replace the current label.  This
also requires changes to the MAC modules, which are forthcoming.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-09 03:09:38 +00:00
rwatson
a44e8dc0f7 X-ref mac.3. 2002-08-09 03:03:08 +00:00
kan
c1490b1966 Use '_end' symbol instead of 'end' to initialize minbrk and curbrk
variables. Both symbols are set to the same value by the linker,
and _end symbol has less chances to clash with application defined
global symbols.

alpha, ia64 and sparc64 ports already use _end, i386 is now
consistent with them.

Reviewed by:	bde
Approved by:	obrien
Reported by:	pirzyk
2002-08-08 17:28:07 +00:00
ache
3b0ddae36e Rewrite locale loading procedures, so any load failure will not affect
currently cached data.  It allows a number of nice things, like: removing
fallback code from single locale loading, remove memory leak when LC_CTYPE
data loaded again and again, efficient cache use, not only for
setlocale(locale1); setlocale(locale1), but for setlocale(locale1);
setlocale("C"); setlocale(locale1) too (i.e.  data file loaded only once).
2002-08-08 05:51:54 +00:00
mike
a72d8585b7 Implement POSIX.1-2001 (XSI)'s ulimit(3).
Submitted by:	Kyle Martin <mkm@ieee.org>
2002-08-08 04:50:36 +00:00
ache
586a522666 Set errno to ENOMEM for strdup too (due to malloc errno bug) 2002-08-07 23:52:28 +00:00
ache
99fbabc1a4 Always set errno to ENOMEM after malloc failed (as workaround).
Our malloc sometimes forget to set errno, f.e. for size overflow case.
2002-08-07 22:03:46 +00:00
ache
f158c10436 Reset __mb_cur_max to 1 when "C" or "POSIX" locales loaded after multibyte one 2002-08-07 20:49:25 +00:00
ache
1994aec49d Fix wrong address when EucInfo > "variable" size 2002-08-07 20:20:56 +00:00
archie
13ab1d7641 Correct an inaccuracy in this man page regarding detecting empty fields.
MFC after:	2 days
2002-08-07 20:08:50 +00:00
wollman
227736bae6 Document file descriptor reopening and current standardization status. 2002-08-07 18:03:30 +00:00
ache
2a67a29f21 Style fixes in preparation for rewritting 2002-08-07 18:02:45 +00:00
ache
919d00b113 Style fixes 2002-08-07 16:49:20 +00:00
ache
5695ea6363 Style fixes in preparation of code rewritting 2002-08-07 16:45:23 +00:00
ache
fcb62c0916 Close descriptor, if error happens in loadCat() 2002-08-07 07:02:37 +00:00
tjr
af54199404 Build iswctype.c and manual pages for the functions it defines. 2002-08-06 00:49:59 +00:00
mike
d79b2f269b o Fix a memory leak.
o Rewrite validmsgverb() so that it works (I'm not sure how it escaped
  my original testing).
o Document nextcomp().
2002-08-05 19:36:09 +00:00
tjr
37b8722dac Add missing prototypes for extension functions to the SYNOPSIS. 2002-08-05 11:02:04 +00:00
tjr
d1b9f84ace Use In macro instead of Fd. Add crossref to wctype(3). Refer to 1003.1-2001
in STANDARDS section. Document functions which are extensions to the standard.
2002-08-05 10:50:39 +00:00
tjr
780474c4a7 Use the In macro instead of Fd. Add crossref to wctrans(3). Refer to
1003.1-2001 in STANDARDS section.
2002-08-05 10:48:05 +00:00
tjr
5b91013415 Implement the missing <wctype.h> functions: isw*() (iswalnum() etc.),
towlower() and towupper() required by ISO C90 Amd. 1.

iswascii(), iswhexnumber(), iswideogram(), iswnumber(), iswphonogram(),
iswrune() and iswspecial() have also been implemented for consistency
with the BSD extensions in <ctype.h>.
2002-08-05 10:45:23 +00:00
ache
bb7a785bc8 Reject encoding > ENCODING_LEN at early stage instead of truncating it.
Use ptr == NULL instead of !ptr in few places.
Move saverr declaration to global section.
2002-08-05 09:58:45 +00:00
tjr
cd51ebdaaf Manual pages for wide character classification (isw*) and case conversion
(tow*) functions from NetBSD, unmodified except for the addition of $FreeBSD$.

Obtained from:	NetBSD
2002-08-05 08:04:58 +00:00
mike
6173b2ee76 Implement POSIX.1-2001 (XSI)'s fmtmsg(3). 2002-08-05 06:49:58 +00:00
ache
fe9a9d5bc5 Try harder to check lang as path component (".", "..", / inside).
Try harder to not overwrite failure errno.
style(9) whitespace reformatting for code readability.
2002-08-04 14:03:59 +00:00
tjr
2e02b2970d Change wctype_t to an unsigned type to avoid warnings. 2002-08-04 12:43:53 +00:00
tjr
c7dfca65ec Add the ISO C90 Amd. 1 wctrans(3) and towctrans(3) functions. 2002-08-04 12:09:08 +00:00
tjr
fd6d1078a9 Add btowc(3) to SEE ALSO section. 2002-08-04 11:02:21 +00:00
ache
a03ca02ee9 Use errno to indicate failure reason.
Remove incomplete checks for 'name' and 'PatchLocale', they must be
already checked at this point.
2002-08-04 09:37:28 +00:00
bde
d22ac4de6c Fixed some style bugs (unsorting of MLINKS, and more than 1 assignment to
MAN per section).
2002-08-04 07:54:41 +00:00
obrien
86ac440fa1 Updated libc/libc_r that fixes the FreeBSD-SA-02:28.resolv resolver bug.
Submitted by:	Trevor Johnson <trevor@jpj.net>
2002-08-04 05:51:05 +00:00
ache
c41f494e5b Rewrite loadlocale() to eliminate LOAD_CATEGORY macro to save space. 2002-08-04 04:29:54 +00:00
ache
9c3f31fb8e Nonexistent SIZE_MAX -> SIZE_T_MAX 2002-08-04 04:11:48 +00:00
tjr
79a3f64da0 Signal an error instead of giving the caller less memory than they asked
for when num * size would cause integer overflow.

MFC after:	1 week
2002-08-04 02:52:11 +00:00
ache
abb8c5771b Add ERRORS section according to POSIX (no errors) 2002-08-03 17:20:45 +00:00
ache
8212322c62 Catch empty encoding name too 2002-08-03 17:09:21 +00:00
ache
b5b73d0ae1 Fix return codes to match what setrunelocale() returns 2002-08-03 16:26:47 +00:00
ache
3b6651b983 Preserve errno in fallback code 2002-08-03 15:56:25 +00:00
tjr
eefed45007 Add ISO C90 Amd. 1 btowc(3) and wctob(3) functions. 2002-08-03 13:49:55 +00:00
tjr
dc1c7f3152 Correct use of Nm macro in NAME section and a broken cross reference. 2002-08-03 12:39:41 +00:00
ache
c7371a8702 Return errno provided by fopen, not always ENOENT.
Return EFTYPE instead of EINVAL for wrong locale file format.
Whitespaces.
2002-08-03 11:55:19 +00:00
ache
5e42992e96 Check encoding for ".", ".." and / inside 2002-08-03 10:23:06 +00:00
ache
b6a6d004ff Return EINVAL for NULL or too long encoding, not EFAULT 2002-08-03 09:10:31 +00:00
ache
3b1f16ca2d Return ENAMETOOLONG for long PATH_LOCALE, not EFAULT 2002-08-03 09:07:27 +00:00
ache
a585ff9d4b 1) Use errno to indicate faulure reason.
2) Move incomplete check for / in locale name from env section to
loadlocale(), add check for "." and ".." too.
It allows to check any argument, not env only.
3) Redesing LOAD_CATEGORY macro to eliminate code duplication.
4) Try harder in fallback code: if old locale can't be restored,
load "C" locale
5) White space formatting, long lines, etc.
2002-08-03 09:04:44 +00:00
tjr
2ddf585cad Add ISO C90 Amd. 1 wctype(3) and iswctype(3) functions. 2002-08-03 04:18:40 +00:00
rwatson
a203c58900 Introduce support for Mandatory Access Control and extensible
kernel access control.

Extensions to libc to provide basic MAC label manipulation facilities
for userland.  These interface will be replaced in the next month
or two with more flexible interfaces, but provide sufficient support
to allow use of the Biba and MLS policies for user applications.

libc_r wrappers to follow.

Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-02 21:14:42 +00:00
ache
59ee93ea1e Sligtly modify previous out-of-bounds fix: just break instead of
return(NULL) for upward compatibility with more LC_* categories may be
implemented in future.
2002-08-02 13:36:54 +00:00
rwatson
2e2c35ec82 De-gccize CFLAGS by removing it.
NOMAN is no longer required when a man page is not yet present.

Submitted by:	ru
2002-08-02 13:33:17 +00:00
mux
08d325ca81 Remove an #include <syslog.h>. It's already included conditionally
above, as it should be.

Submitted by:	Olivier Houchard <cognet@ci0.org>
2002-08-02 11:58:48 +00:00
rwatson
a50b0e38d3 Hook up libugidfw to the build.
Obtained from:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-02 07:09:53 +00:00
rwatson
b7b34f0249 Introduce support for Mandatory Access Control and extensible
kernel access control.

Provide a library to manage user file system firewall-like rules
supported by the mac_bsdextended.ko security model.  The kernel
module exports the current rule set using sysctl, and this
library provides a front end that includes support for retrieving
and setting rules, as well as printing and parsing them.

Note: as with other userland components, this is a WIP.  However,
when used in combination with the soon-to-be-committed ugidfw,
it can actually be quite useful in multi-user environments to
allow the administrator to limit inter-user file operations without
resorting to heavier weight labeled security policies.

Obtained form:	TrustedBSD Project
Sponsored by:	DARPA, NAI Labs
2002-08-02 07:07:35 +00:00
ache
fcd05421a1 Prevent out of bounds writting for too many slashes case.
Replace strnpy + ='\0' with strlcpy

MFC after:	1 day
2002-08-02 01:04:49 +00:00
nectar
292ee3bd86 The fix applied to the XDR decoder in revision 1.11 was incorrect. 2002-08-01 12:23:04 +00:00