Commit Graph

4011 Commits

Author SHA1 Message Date
Matthew N. Dodd
196f440aa2 Bump the date. 2003-04-07 22:59:12 +00:00
Matthew N. Dodd
564b641ef9 Clarify the behavior of PATH_FSTAB with regard to 'tainted' execution.
Requested by:	 ru
2003-04-07 14:21:14 +00:00
Matthew N. Dodd
134dbc4c32 - Add setfstab() and getfstab().
- Use the environment variable 'PATH_FSTAB' if set rather than the
  hardcoded '/etc/fstab' (fstab.h:_PATH_FSTAB)
2003-04-07 12:55:00 +00:00
Tim J. Robbins
adfd6b312d Catch up with recent vfprintf.c changes. 2003-04-07 06:36:49 +00:00
Andrey A. Chernov
6f098a4811 __wcsconv(): free(convbuf) before returning NULL 2003-04-07 03:17:39 +00:00
David Schultz
d890afb84d Today just isn't my day. Remove some old commented out code that snuck
into the last commit.

Noticed by:	mike
2003-04-07 01:07:48 +00:00
David Schultz
3b204b7d09 - %e conversions with precision 0 should not cause a decimal point to
be printed.
- Fix %f conversions where the number of significant digits is < expt.
  This would be a one-line change were it not for thousands separators.
  Noticed by tjr.
- Remove some unnecessary code in the parsing of precision specifiers.
2003-04-07 00:42:19 +00:00
David Schultz
ebbad5ec5c Rework the floating point code in printf(). Significant changes:
- We used to round long double arguments to double.  Now we print
  them properly.

- Bugs involving '%F', corner cases of '#' and 'g' format
  specifiers, and the '.*' precision specifier have been
  fixed.

- Added support for the "'" specifier to print thousands' grouping
  characters in a locale-dependent manner.

- Implement the __vfprintf() side of hexadecimal floating point
  support.  All that is still needed is a routine to convert the
  mantissa to hex digits one nibble at a time in the style of ultoa().

Reviewed by:	silence on standards@
2003-04-05 22:11:42 +00:00
David Schultz
92b93b37c0 Add __ldtoa(), a wrapper around gdtoa() to make it look like dtoa().
In support of this, add some MD macros to assist in converting long
doubles to the format expected by gdtoa().

Reviewed by:	silence on standards@
2003-04-05 22:10:13 +00:00
David Schultz
b936664e72 Add missing #include to unbreak previous commit. 2003-04-05 22:08:53 +00:00
David Schultz
38cac8f88b Correct some buffer sizes.
- __vfprintf()'s 'buf' has never been used for floating point, so
  don't define it in terms of (incorrect) constants describing
  floating point numbers.  The actual size needed depends on
  sizeof(uintmax_t) and locale details, so I slightly overestimated.

- We don't need a 308-character buffer to store the string "308".
  With long doubles and %a we need more than three characters, though.
2003-04-05 22:03:43 +00:00
Tim J. Robbins
63e6ca586e MFp4: Link strtof.3 and strtold.3 to strtod.3. 2003-04-05 07:33:46 +00:00
Mike Makonnen
f23f149866 Zero out the struct tm supplied by the caller. Otherwise,
strange things might happen when garbage values in the struct
get passed in to localtime_r() and family.

Noticed by:	marcus
Approved by:	markm (mentor)(implicit)
2003-04-05 05:46:43 +00:00
Tim J. Robbins
799d93559b MFp4: Pentium/Athlon-optimised implementation of wcschr(). 2003-04-05 04:17:05 +00:00
Jake Burkholder
9f5a511863 Implement makecontext. 2003-04-01 23:28:50 +00:00
Ceri Davies
d5882f3f58 [1] - Document EHOSTUNREACH as a possible error
[2]	- Remove a contraction

PR:		docs/50401
Submitted by:	[1] Slaven Rezic <slaven@rezic.de>
MFC after:	1 week
2003-04-01 20:25:46 +00:00
Wes Peters
f4cf2141f6 Add a facility allowing processes to inform the VM subsystem they are
critical and should not be killed when pageout is looking for more
memory pages in all the wrong places.

Reviewed by:	arch@
Sponsored by:	St. Bernard Software
2003-03-31 21:09:57 +00:00
Max Khon
839e119ec8 BDE'ify 2003-03-29 21:56:59 +00:00
Max Khon
057e4034dd fix truncation check and buffer overflow check 2003-03-29 21:34:13 +00:00
Daniel Eischen
67aba1c6a4 Align signal frame placed on stack to 16 bytes so that SSE FPU register
restores can work.  Also correct allocation for signal frame size.

Reviewed by:	mini
2003-03-29 16:38:15 +00:00
Mike Makonnen
764628c056 Fill in the rest of the fields in the resulting struct tm
from strptime(3). Previously, they would get filled only
for the %s specifier and as a side effect of using the
the %Z specifier with a GMT time zone.

PR:		misc/48993
Approved by:	markm (mentor)
Silence on:	-standards
2003-03-29 11:55:37 +00:00
Max Khon
be6a158e0f - MAXPATHLEN -> PATH_MAX (pass correct buffer size to readlink as well)
Requested by:		bde
2003-03-28 12:05:45 +00:00
Max Khon
226a0f0f8b Make realpath() thread-safe. New implementation does not use chdir(2) at all.
Submitted by:	Constantin S. Svintsoff <kostik (at) iclub.nsu.ru>
2003-03-27 20:48:53 +00:00
Jeff Roberson
cc3521d660 - Define a _spinunlock() function so that threading implementations may do
more complicated things than just setting the lock to 0.
 - Implement stubs for this function in libc and the two threading libraries
   that are currently in the tree.
2003-03-26 04:02:24 +00:00
Philippe Charnier
b43dc21149 The .Fn function
The ... 2 system call
2003-03-24 16:07:19 +00:00
Philippe Charnier
9d09157a0f The .Fn function. Use .Xr where appropriate. 2003-03-24 16:05:24 +00:00
Andrey A. Chernov
85bebbc156 According to C99 decimal_point can't be empty 2003-03-20 08:18:55 +00:00
Andrey A. Chernov
cfcd9a45b5 According to C99 decimal_point can't be the empty string, mention it. 2003-03-20 08:13:34 +00:00
Andrey A. Chernov
befb332a6b decimal_point can't be "" according to C99, so set it to standard "."
in that case.
2003-03-20 08:05:20 +00:00
Robert Drehmel
0d74f328ae - Revamp the function _nis_initshells() to make getusershell() backed
by NIS work, like nsswitch.conf(5) promises to be able to.
   (These modifications will be fed back to NetBSD, of course)
 - In endusershell(), do not set `sl' to NULL if we know it already has
   that value.
2003-03-19 14:17:24 +00:00
Robert Drehmel
916560b152 If realloc(3) fails in copyline(), do not make matters worse by
leaving without deallocating `data' thereby creating a memory leak.
2003-03-19 14:01:35 +00:00
David Schultz
e31c9eb10b The gdtoa import apparently hasn't caused anything or anyone to
explode, so nix the old strtod() / dtoa().  This change is part
of the gdtoa patches reviewed on standards@.
2003-03-15 09:47:05 +00:00
Tim J. Robbins
564529ff1a MFp4: Pentium/Athlon-optimised implementation of wcslen(). 2003-03-14 11:01:12 +00:00
Tim J. Robbins
ce7be15190 Merge vfprintf.c revision 1.52. 2003-03-14 08:50:43 +00:00
David Schultz
3ba6b6dd9d Kludge around a bug that results from printf() assuming that
dtoa() is buggy.  The bug would cause incorrect output to be
generated when format strings such as '%5.0f' were used with
nonzero numbers whose magnitude is less than 1.

Reported by:	df(1) by way of periodic(8)
Reviewed by:	mike
2003-03-14 04:48:09 +00:00
Tim J. Robbins
15a66d2798 Unexpand RCS tag. 2003-03-14 04:46:02 +00:00
David E. O'Brien
120a95cb50 Clean up the way gdtoa sources are found.
OK'ed by:	das
2003-03-13 18:55:14 +00:00
Tim J. Robbins
be074a2dd8 Document return type of wordfree() (void). Reduce the space between
struct member names and the corresponding comments so the lines don't
wrap on 80-column terminals.
2003-03-13 11:18:53 +00:00
Tim J. Robbins
542bd65fcb MFp4: Implementations of the wcstof() and wcstold() functions. 2003-03-13 06:29:53 +00:00
Tim J. Robbins
48755f216d MFp4: Catch up to recent __dtoa() interface changes and removal of cvt()'s
last argument.
2003-03-13 05:49:09 +00:00
David Schultz
703d65601d Document strtof() and strtold(). Update vendor license.
Reviewed by:	bde (briefly), mike (mentor), obrien
2003-03-12 20:31:05 +00:00
David Schultz
6a66acb565 Replace our ancient dtoa/strtod implementation with the gdtoa
package, a more recent, generalized set of routines.  Among the
changes:
- Declare strtof() and strtold() in stdlib.h.
- Add glue to libc to support these routines for all kinds
  of ``long double''.
- Update printf() to reflect the fact that dtoa works slightly
  differently now.

As soon as I see that nothing has blown up, I will kill
src/lib/libc/stdlib/strtod.c.  Soon printf() will be able
to use the new routines to output long doubles without loss
of precision, but numerous bugs in the existing code must
be addressed first.

Reviewed by:	bde (briefly), mike (mentor), obrien
2003-03-12 20:30:00 +00:00
Mike Makonnen
fe71e0b83d Ditch a static global and the mutex that protected it. Achieve the
desired strptime(3) reentrancy by adding an extra argument to _strptime()
instead.

Approved by:	markm (mentor)
MFC:		4 weeks
2003-03-12 19:22:57 +00:00
David Malone
5560a5abb3 Document the fact that hdestory calls free on the keys added with
hsearch(.., ENTER). Make the example reflect this.

PR:		49951
Submitted by:	Peter Jeremy <peterjeremy@optushome.com.au>
2003-03-12 14:18:14 +00:00
Sean Chittenden
99c24e2b2c Update sendfile.2 to include a TUNING section that documents the
various tunables that are applicable to sendfile(2).  Update tuning.7
to mention a reference to sendfile.2.

Approved by:	keramida
2003-03-12 09:28:44 +00:00
Tim J. Robbins
1609edca75 MFp4: Reduce code size by 26 bytes by only aligning the jump targets that
are at the top of loops.
2003-03-12 06:46:16 +00:00
Tim J. Robbins
07648c8bb8 MFp4: Make `spanp' const. 2003-03-12 06:41:49 +00:00
Tim J. Robbins
34d4e9132c MFp4: Pentium/Athlon-optimised implementation of wmemchr(). 2003-03-12 03:55:01 +00:00
Tim J. Robbins
00d7d210f5 MFp4: Pentium-optimised implementation of wcscmp(). Performs significantly
better than the code generated by gcc in many cases.
2003-03-10 10:54:36 +00:00
Tim J. Robbins
be0ccb6800 MFp4: Add the standard "the {fgetws,fputws} function will fail if" text
to the Errors section.
2003-03-09 02:56:54 +00:00
Jacques Vidrine
d7f15c948f Clean up some signed/unsigned issues in the XDR code.
Obtained from:	OpenBSD
2003-03-07 13:19:40 +00:00
Peter Wemm
e3220e017a Remove NS and ISO stuff. 2003-03-05 19:16:41 +00:00
Marcel Moolenaar
cafd6dbd76 Fix threaded applications on ia64 that are linked dynamicly. We did
not save (restore) the global pointer (GP) in the jmpbuf in setjmp
(longjmp) because it's not needed in general. GP is considered a
scratch register at callsites and hence is always restored after a
call (when it's possible that the call resolves to a symbol in a
different loadmodule; otherwise GP does not have to be saved and
restored at all), including calls to setjmp/longjmp. There's just
one problem with this now that we use setjmp/longjmp for context
switching: A new context must have GP defined properly for the
thread's entry point. This means that we need to put GP in the
jmpbuf and consequently that we have to restore is in longjmp.
This automaticly requires us to save it as well.

When setjmp/longjmp isn't used for context switching, this can be
reverted again.
2003-03-05 04:39:24 +00:00
Marcel Moolenaar
a402169a8e ABI breaker: Move the J_SIGMASK field in the jmpbuf before
the J_SIG0 field. While here, rename J_SIG0 to J_SIGSET and
remove J_SIG1. The main reason for this change is that the
128-bit sigset_t is now aligned on a 16-byte boundary, which
allows us to use 16-byte atomic loads and stores on CPUs that
support it. The removal of J_SIG1 is done to avoid confusion:
it is never accessed and should not be. Renaming J_SIG0 to
J_SIGSET is the icing on the cake that's better done now than
later.
2003-03-05 03:30:54 +00:00
David E. O'Brien
c492fac741 Restore vendor ID. 2003-03-03 01:12:24 +00:00
David E. O'Brien
9c904fcdbc Use __FBSDID. 2003-03-03 01:09:46 +00:00
Jacques Vidrine
2bbd7cf820 Eliminate 19 warnings in libc (at level WARNS=2) of the
`implicit declaration of function' variety.
2003-02-27 13:40:01 +00:00
Mike Barcroft
ef4a12d2d7 ia64 actually uses 80-bit long doubles and must support big and little
endian at compile-time.

Reviewed by:	das
2003-02-26 16:04:34 +00:00
Robert Drehmel
9eddd2bf34 Fix typo. 2003-02-25 21:59:36 +00:00
Julian Elischer
f4a8661b2f Catch up with change to kse_release syscall.
The background info in this man page needs rewriting
in some parts since the last major changes
to the code, however it still accuratly reflects how to use the
API.
2003-02-25 09:49:46 +00:00
Ruslan Ermilov
5b58c5a0d5 Fixed copyright.
Tidy up the markup.
Only describe the new, post-2.0 behavior.
Added the RETURN VALUES and ERRORS sections.
2003-02-24 22:55:33 +00:00
Ruslan Ermilov
ace5be682d mdoc(7) police: Scheduled sweep. 2003-02-24 22:53:26 +00:00
Poul-Henning Kamp
aefdeea603 Mention CLOCK_MONOTONIC. 2003-02-23 10:20:23 +00:00
Ruslan Ermilov
522ccf3f35 mdoc(7) police: markup laundry. 2003-02-23 01:47:49 +00:00
Ruslan Ermilov
0213c21b44 mdoc(7) police: kill self-xref. 2003-02-23 01:45:25 +00:00
Ruslan Ermilov
66d8bae40a Punctuation. 2003-02-23 01:44:59 +00:00
Ruslan Ermilov
02d753ca73 Typo. 2003-02-23 01:44:37 +00:00
Ruslan Ermilov
8b6eff89b0 Grammar. 2003-02-23 01:43:45 +00:00
Mike Heffner
ad4f17067f More changes from NetBSD:
* use correct error detection of realloc failure
     * strtol negative return check
     * use strtol to validate string instead of rolling our own
       validation code
     * terminate the command sequence correctly
2003-02-23 00:24:03 +00:00
Mike Heffner
215d1a9eb1 Grab some changes from NetBSD:
fix const poisoning
     add cast to silence warning
     pull in unistd.h
2003-02-23 00:06:35 +00:00
Dave Zarzycki
a23c6aee4d Apple PR-2449102: getdomainname() doesn't document that it is NIS/YP specific 2003-02-22 19:02:23 +00:00
Johan Karlsson
484251e7c4 Use strlcpy instead of strncpy.
Submitted by:	imp
Reviewed by:	silence on -audit
2003-02-22 18:08:34 +00:00
Tim J. Robbins
60bf07bd33 Fix a bad free() call that would occur if some #if 0'd code was used. 2003-02-22 00:06:05 +00:00
Alexey Zelkin
e859833529 Mention that dlerror() is also applicable to retrieve error message after
dladdr() and dlinfo() functions calls.
2003-02-21 13:43:41 +00:00
Gregory Neil Shapiro
8f3e32c2b6 Fix the description for mkdtemp(), which creates directories, not files.
Submitted by:	Murray S. Kucherawy <msk@blackops.org>
X-MFC after:	re approval
2003-02-19 04:40:30 +00:00
Tom Rhodes
7d0cb93886 Update errors.
PR:		48125
Submitted by:	Per Hedeland <per@hedeland.org> (original version)
2003-02-18 22:54:42 +00:00
Jacques Vidrine
6d7bd75a4e Whack 28 unused variables. 2003-02-18 13:39:52 +00:00
Daniel Eischen
cd7be69206 Remove these from libc; they are now system calls.
Prompted by:	mini
2003-02-18 12:31:57 +00:00
Jonathan Mini
2129373618 Call the weak symbol for sigprocmask, so that it can be overridden. 2003-02-17 07:47:13 +00:00
Andrey A. Chernov
49abb2a4f8 Back out "drop first N values" method of removing monotonically increased
seed->first value correlation. It breaks rand_r()... Other possible methods
like shuffling inside aray will breaks rand_r() too, because it assumes
only one word state, i.e. nothing extra can be added after seed assignment
in srand().

BTW, for old formulae seed->first value correlation is not so monotonically
increased as with other Linear Congruential Generators of this type only
becase arithmetic overflow happens. But overflow affects distribution
and lower bits very badly, as many articles says, such type of overflow
not improves PRNG.

So, monotonically increased seed->first value correlation problem remains...
2003-02-17 03:52:35 +00:00
Jacques Vidrine
e0554a531f Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).
Only warnings that could be fixed without changing the generated object
code and without restructuring the source code have been handled.

Reviewed by:	/sbin/md5
2003-02-16 17:29:11 +00:00
Alexey Zelkin
02e6893b9c Add dlinfo(3) manual page to the rank of base system manpages 2003-02-15 10:52:46 +00:00
Alexey Zelkin
f734492604 Add examples of dlinfo() usage to manual page. 2003-02-15 10:51:05 +00:00
Alexey Zelkin
7ec37597d3 o Document that dlsym()'s behaviour with new special handle RTLD_SELF
o Add cross reference to dlinfo(3)
o Minor mdoc nits
2003-02-14 10:57:20 +00:00
Alexey Zelkin
6bc55edb4c Follow Solaris's manual page and describe Link_map structure here 2003-02-14 10:54:37 +00:00
Alexey Zelkin
8647a1ed45 Add manual page for dlinfo(3). It's still need some work and add
examples, but it's better than nothing already.
2003-02-14 10:07:43 +00:00
Alexander Kabaev
42d206e975 Implement dlinfo() function.
Introdice RTLD_SELF special handle and properly process it within
dlsym() and dlinfo() functions.

The intention is to improve our compatibility with Solaris and
to make a Java port easier.

Partially submitted by:	phantom
2003-02-13 17:47:44 +00:00
Mike Barcroft
5d62092f94 o Implement C99 classification macros isfinite(), isinf(), isnan(),
isnormal().  The current isinf() and isnan() are perserved for
  binary compatibility with 5.0, but new programs will use the macros.
o Implement C99 comparison macros isgreater(), isgreaterequal(),
  isless(), islessequal(), islessgreater(), isunordered().

Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
2003-02-12 20:03:41 +00:00
Mike Barcroft
1006f448b7 This manual is called SIGNBIT(3) not FPCLASSIFY(3). 2003-02-12 03:29:39 +00:00
Mike Barcroft
8e9b28311e Implement C99's signbit() macro. 2003-02-11 21:56:21 +00:00
Alfred Perlstein
e6cfb1ccd3 Handle %%m properly in syslog format string. Previously it would expand
the %m into the errno and then vfprintf would expand the % and the first
character of the strerror(3) return causing possible data corruption.
2003-02-10 08:31:28 +00:00
Mike Barcroft
8cf5ed5125 Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
  contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
  contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
  storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
  double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
  HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
  <math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
  <machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
  on the size of its argument.  __fpclassifyl() is never called on
  alpha because (sizeof(long double) == sizeof(double)), which is good
  since __fpclassifyl() can't deal with such a small `long double'.

This was developed by David Schultz and myself with input from bde and
fenner.

PR:		23103
Submitted by:	David Schultz <dschultz@uclink.Berkeley.EDU>
		(significant portions)
Reviewed by:	bde, fenner (earlier versions)
2003-02-08 20:37:55 +00:00
Philippe Charnier
d649825182 The .Fn function 2003-02-06 11:04:47 +00:00
Mike Makonnen
e5b9245bfa Fix use of an uninitialized pointer introduced in a previous revision.
Approved by:	markm (mentor)(implicit)
2003-02-06 01:08:19 +00:00
Andrey A. Chernov
f3047249d4 Since we drop NSHUFF values now, set default seed to what it becomes
after srand(1)
2003-02-05 21:25:50 +00:00
Philippe Charnier
efe2778852 Prevent uppercase after .Xr by adding ``The ... utility/system call''. 2003-02-05 13:36:13 +00:00
Tim J. Robbins
e25cc93fa6 Mention that the CLOCK_VIRTUAL and CLOCK_PROF clocks are not implemented.
PR:		8376
2003-02-05 09:17:32 +00:00
Mike Heffner
5a63c107db Grammer fix. 2003-02-04 16:28:04 +00:00
Andrey A. Chernov
ddd972a9bd For rand(3) and random(3) TYPE_0 drop NSHUFF values right after srand{om}()
to remove part of seed -> 1st value correlation. Correlation still remains
because of algorithm limits. Note that old algorithm have even stronger
correlation, especially in the lower bits area, but not eye-visible, as
current one.
2003-02-04 11:24:08 +00:00
Andrey A. Chernov
2f5ef51de2 Park & Miller PRNG can be safely initialized with any value but 0 and stuck
at 0 as designed. Its BSD adaptation tries to fight it by mapping 0 to
2147483647 after calculation, but this method not works since 2147483647
seed returns to 0 again on the next interation. Instead of after calculation
mapping, map 0 to another value _before_ calculation, so it never stucks.
2003-02-03 10:22:12 +00:00