Commit Graph

6526 Commits

Author SHA1 Message Date
Tim J. Robbins
1f4ff8506a Add implementations of wscanf() and related functions: fwscanf(), swscanf(),
vfwscanf(), vswscanf(), vwscanf(). As the name suggests, these are wide-
character versions of the scanf() family of functions.
2002-09-23 12:40:06 +00:00
Tim J. Robbins
4712aa3b59 Implement the %lc, %ls and %[ conversions, which read sequences of wide
characters, non-whitespace wide character strings and wide character
strings in a scanset.
2002-09-23 11:35:50 +00:00
Tim J. Robbins
adc106840c The character argument for __ungetwc() should be wint_t instead of wchar_t. 2002-09-23 11:31:18 +00:00
Tim J. Robbins
1302dabd28 Add the remaining C99 wide character string to integer conversion functions.
Restrict qualifiers were added to the existing prototypes in <inttypes.h>
and the typedef for wchar_t was removed.
2002-09-22 08:06:45 +00:00
Tim J. Robbins
5f147b57ac Add an unlocked version of ungetwc(), __ungetwc(), that __vfwscanf()
will need to use.
2002-09-22 05:59:00 +00:00
Jonathan Mini
dcf0aad852 Style cleanup:
- Sort local variable declarations.
- Protect a hand-formatted comment from indent(1).
- Use portable casts, even though this is machine-dependant code.
- Remove extraneous blank lines.
- Remove trailing newline.
- Use sigdelset(3), not SIGDELSET(9).

Requested by:	bde
2002-09-21 23:54:32 +00:00
Tim J. Robbins
0e2e10070d Delete stray reference to vsnprintf(). 2002-09-21 14:25:58 +00:00
Tim J. Robbins
c5604d0a50 Add implementations of the wprintf() family of functions, which perform
formatted wide-character output.
2002-09-21 13:00:30 +00:00
Garrett Wollman
0b32a813fa Initiate deorbit burn sequence for sysctl CTL_USER MIB branch.
Use the correct constants directly from sysconf() rather than calling
sysctl() to tell us the (still compiled-in) value.  Leave the CTL_POSIX1B
stuff alone for now (but I'd like to see this replaced with a single
structure returning all of the relevant information).

Implement all of the keys from 1003.1-2001 that we can.  Ensure that
the build will break if someone redefines an option constant to zero
without implementing the necessary presence-detection logic here.

(4 of 5)
2002-09-21 02:14:04 +00:00
Garrett Wollman
0d3bcc2e80 Make the threatened fts(3) ABI fix. FTSENT now avoids the use of the struct
hack, thereby allowing future extensions to the structure (e.g., for extended
attributes) without rebreaking the ABI.  FTSENT now contains a pointer to the
parent stream, which fts_compar() can then take advantage of, avoiding the
undefined behavior previously warned about.  As a consequence of this change,
the prototype of the comparison function passed to fts_open() has changed
to reflect the required amount of constness for its use.  All callers in the
tree are updated to use the correct prototype.

Comparison functions can now make use of the new parent pointer to access
the new stream-specific private data pointer, which is intended to assist
creation of reentrant library routines which use fts(3) internally.

Not objected to in spirit by: -arch
2002-09-21 01:28:41 +00:00
Tim J. Robbins
99330f8368 Remove unnecessary #include <assert.h>; it was used to bring in the
_DIAGASSERT macro on NetBSD, but we don't need it.
2002-09-21 00:29:23 +00:00
Mark Murray
7ec538840c Remove a prototype for a function that is no longer called. 2002-09-20 22:23:32 +00:00
Alfred Perlstein
a6756ecc22 Fix an infinite loop when _fetch_read() can return 0 (if the
connection is broken), take this into account and return at this
point.
2002-09-20 21:50:57 +00:00
Archie Cobbs
ae8a4b2f36 Revert previous commit to unbreak world until we figure out the
right way to do it.
2002-09-20 15:43:26 +00:00
Tim J. Robbins
7591ae56ae Lock the file once per call and use the unlocked fgetwc()/fputwc() variants. 2002-09-20 13:25:40 +00:00
Tim J. Robbins
9260341650 Lock and unlock the file once per call and use the unlocked version of
ungetc() instead of having ungetc() recurse on the lock.
2002-09-20 13:23:26 +00:00
Tim J. Robbins
8f030a44b8 Introduce unlocked versions of fputwc() and fgetwc() called __fputwc()
and __fgetwc() which can be used when we know the file is locked.
2002-09-20 13:20:41 +00:00
Mike Barcroft
883738f287 Add restrict type-qualifier. 2002-09-20 08:24:01 +00:00
Jonathan Mini
4ed3c94b61 Don't peek into MD structures from MI code. The getcontext(3) and
setcontext(3) functions check the validify of the mcontext_t structs.
2002-09-20 08:13:21 +00:00
Warner Losh
43832002d3 Expose the new kernel data structures to libdevinfo:
o Added dd_pnpinfo, dd_location, dd_devflags, dd_flags and dd_state
	o Copy/initialize these as necessary.
	o Document the changes to the interface in devinfo.3.
2002-09-20 02:16:33 +00:00
Archie Cobbs
f5f1272284 Fix a problem with the definition of HUGE_VAL causing the gcc warning
"cast increases required alignment of target type" on some platforms.

Reviewed by:	bde
2002-09-19 19:47:27 +00:00
Tim J. Robbins
b9aac30810 Implement the %ls and %lc conversions for printing wide character strings
and wide characters. These were already documented in the manual page,
with an entry mentioning that they were not implemented yet. The XSI
%S and %C synoyms have not been added.
2002-09-19 12:50:28 +00:00
Jacques Vidrine
7922d4cf1a Add forgotten newlines in debug messages. 2002-09-19 11:36:47 +00:00
Julian Elischer
0f88f8b7f9 reconnect libc_r
Hint from: deischen@freebsd.org
2002-09-19 08:06:23 +00:00
Julian Elischer
67d7ad01aa Part of a bandaid to get libc_r on air again.
Submitted by: Dan Eischen (deischen@freebsd.org)
Pointy hat for breakage just before going offline: Mini@freebsd.org
2002-09-19 07:35:39 +00:00
Garrett Wollman
4b85f43b30 Return the correct environment name for 64-bit platforms in the
_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS case.
2002-09-19 03:47:36 +00:00
Alfred Perlstein
bf4dc8772e Welcome the sem_ API to libc! 2002-09-19 01:14:08 +00:00
Alfred Perlstein
4f68734dc6 add a stub for pthread_cond_destroy. 2002-09-19 01:09:49 +00:00
Maxime Henrion
cef7a339ba Add a missing file into the CLEANFILES variable.
Approved by:	peter
2002-09-18 21:16:17 +00:00
Tim J. Robbins
0b7bc80226 Optimise the common case where no special encoding is in use (LC_CTYPE is "C"
or "POSIX", other European locales). Use __sgetc() and __sputc() where
possible to avoid a wasteful lock and unlock for each byte and to avoid
function call overhead.
2002-09-18 12:17:28 +00:00
Tim J. Robbins
bddc6280f2 Logic error in previous: don't exit the loop when an incomplete multibyte
sequence is detected.
2002-09-18 10:21:41 +00:00
Tim J. Robbins
530bb9225d Deprecate the rest of the rune interface. 2002-09-18 06:19:12 +00:00
Tim J. Robbins
7948cae0d2 Mark mbmb(), mbrune(), and mbrrune() as deprecated functions. We want to
get applications to move to the ISO C interfaces as well as have the
freedom to replace the rune interfaces with ones that support stateful
conversions some time in the future.
2002-09-18 06:11:21 +00:00
Tim J. Robbins
24990dfad0 Reimplement the functionality of fgetrune(), fputrune(), and fungetrune()
here in terms of mbrtowc(), wcrtomb(), and the single-byte I/O functions.
The rune I/O functions are about to become deprecated in favour of the
ones provided by ISO C90 Amd. 1 and C99.
2002-09-18 05:58:11 +00:00
Bruce Evans
ff5250b3e7 Fixed editing error in previous commit (*blush*). 2002-09-17 19:43:53 +00:00
Bruce Evans
803e437fb0 Fixed unsorting of SRCS. 2002-09-17 14:33:23 +00:00
Maxim Konovalov
48eaac247f Fix vsnprintf(3) memory leak for size == 0.
PR:             bin/36175
Obtained from:  OpenBSD
Reviewed by:    silence on -audit
MFC after:      5 days
2002-09-17 11:28:24 +00:00
Peter Wemm
8da4b35652 Add i386 to the list of architectures that libc_r is broken on. This
effectively removes pppctl from the build for now.  It only compiles on
alpha now (now ironic).
2002-09-17 07:32:36 +00:00
Peter Wemm
6064ca520a Bandaid to stop failing on non-i386 platforms.
Add a big ugly #warning as a reminder.
2002-09-17 06:22:51 +00:00
Bill Fenner
40cfbfd508 Make _fetch_connect() always set the error code.
Tell ftp that _fetch_connect() always sets the error code (http already knew)
2002-09-17 05:54:33 +00:00
Jonathan Mini
7630ea31ed Use a weak symbol for signalcontext(). 2002-09-17 03:15:47 +00:00
Jonathan Mini
1d6e1c66b2 Add signalcontext(), which adds a signal frame to a ucontext_t. 2002-09-17 03:11:07 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Bill Fenner
e5b04cee36 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
Jonathan Mini
255ab70cdf Make libpthread KSE aware.
Reviewed by:	deischen, julian
Approved by:	-arch
2002-09-16 19:52:52 +00:00
Jonathan Mini
cfa1f4e659 Mechanically change all libc_r references to libpthread. 2002-09-16 19:29:34 +00:00
Jonathan Mini
f990583656 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
Jonathan Mini
b3466b3fe0 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
Hajimu UMEMOTO
9832619c90 Allocate 64K recieve buffer for DNS responses. 2002-09-16 13:19:47 +00:00
Tim J. Robbins
4d783ded07 Convert eight space indents to tabs in the "*" format handling code. 2002-09-16 12:07:13 +00:00
Jonathan Mini
cc118d869b 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
Bruce Evans
f86e3350f8 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 Barcroft
52082f69a5 Don't depend on <sys/types.h> pollution in <fcntl.h>. 2002-09-16 07:18:27 +00:00
Julian Elischer
4f0db5e08c 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
Hajimu UMEMOTO
5cd588cb14 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
Jacques Vidrine
54384cf3b0 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
Tim J. Robbins
03b716c4bd 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
Tim J. Robbins
528bebffb1 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
Jacques Vidrine
7deb8a7ddd Backout the increase of MAXPACKET from 1024 to 65536: it
broke pthreads.

Reported by:	mbr, tjr
2002-09-15 04:23:20 +00:00
Thomas Moestl
6c788325fa Use the macros from machine/fsr.h; some minor cleanups. 2002-09-14 18:07:03 +00:00
Thomas Moestl
8579151e4b 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
Hajimu UMEMOTO
08c89c65eb Limit UDP payload size for EDNS0 to 0xffff, not use lower 16bit value.
Obtained from:	KAME
2002-09-14 17:28:40 +00:00
Jacques Vidrine
2e4dbbaa93 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
Thomas Moestl
f085ae60c0 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
Tim J. Robbins
3a67d8efd0 Correct type of second argument: it is wchar_t ** restrict,
not wchar_t * restrict.
2002-09-12 09:25:27 +00:00
Archie Cobbs
0990061258 Update to reflect reality.
Reviewed by:	mini
MFC after:	3 days
2002-09-11 21:40:02 +00:00
Archie Cobbs
a892767bc4 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
Jacques Vidrine
f76b74d6d7 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
Tim J. Robbins
47794211c8 Add an implementation of wcsftime() (wide character version of strftime()). 2002-09-11 08:57:11 +00:00
Julian Elischer
71fad9fdee Completely redo thread states.
Reviewed by:	davidxu@freebsd.org
2002-09-11 08:13:56 +00:00
Mike Barcroft
a4a96c8166 Add `restrict' type-qualifier. 2002-09-11 05:05:48 +00:00
Archie Cobbs
a9f615db06 Adjust to reflect reality, which is that sigaltstack() takes stack_t *'s.
MFC after:	3 days
2002-09-10 21:06:51 +00:00
Garrett Wollman
eca67d5104 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
Poul-Henning Kamp
c64685aa58 Get this file closer to style(9). 2002-09-08 15:10:04 +00:00
Tim J. Robbins
5fd1762445 Add wcstol() and wcstoul(), based on strtol() and strtoul(). 2002-09-08 13:27:26 +00:00
Tim J. Robbins
8e4365cf75 Replace a stray reference to strtok() with one to wcstok(). 2002-09-08 11:09:24 +00:00
Garrett Wollman
f882c94f2b Fix a syntax error which causes an annoying warning. 2002-09-08 04:43:28 +00:00
Tim J. Robbins
9ad391340e Add an implementation of wcstok(), based on strtok_r(). 2002-09-07 08:16:57 +00:00
Juli Mallett
1bd5f7392d 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
Tim J. Robbins
85adcfc150 Sync prototypes with <wchar.h> with respect to the restrict qualifier. 2002-09-07 04:07:00 +00:00
Tim J. Robbins
9c261371ec 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
Tim J. Robbins
91bd11ad84 Call strtok_r() via a libc private name from within strtok(). 2002-09-07 02:53:19 +00:00
Bruce A. Mah
2ca720053b 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
Garrett Wollman
2c5db8c62d Include some verbage about not calling exit() from functions registered
by atexit().
2002-09-06 19:23:28 +00:00
Tim J. Robbins
58d38e2520 Style: One space between "restrict" qualifier and "*". 2002-09-06 11:24:06 +00:00
Jake Burkholder
aa41a4bc92 Don't need to install the signal trampoline here anymore. 2002-09-03 14:59:41 +00:00
Jake Burkholder
89172e2e25 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 Wemm
b331ec93c0 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
Tim J. Robbins
f0c6c306f9 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 Burkholder
ae162f3f31 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 Drehmel
bc0ad8e7a1 - 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
Tim J. Robbins
d384a6795d Typo: refer to MB_LEN_MAX instead of MB_CHAR_MAX (which does not exist). 2002-09-01 07:21:58 +00:00
Tim J. Robbins
9771f1e24e Add restrict qualifiers to the arguments of mbstowcs, mbtowc() and
wcstombs().
2002-09-01 07:08:22 +00:00
Mike Barcroft
800563c573 Fix a memory leak. 2002-09-01 01:49:27 +00:00
Tim J. Robbins
a5f76f1911 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
Tim J. Robbins
7438fc3aa8 Split ansi.c into a separate source file for each function. 2002-08-31 11:26:55 +00:00
Andrey A. Chernov
c14170612e Use ntohl() to read cnains number in new format 2002-08-31 01:05:39 +00:00
Robert Drehmel
2f4772b37f 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 Drehmel
9abf5797a0 - 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
Andrey A. Chernov
cbc98d0541 Style fix 2002-08-30 20:39:53 +00:00