summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* Remove whitespace at EOL.Dima Dorfman2001-07-159-29/+29
| | | | Notes: svn path=/head/; revision=79754
* mdoc(7) police: removed HISTORY info from the .Os call.Ruslan Ermilov2001-07-102-2/+2
| | | | Notes: svn path=/head/; revision=79531
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.Dima Dorfman2001-07-092-2/+0
| | | | Notes: svn path=/head/; revision=79454
* Attempt to use the environment variable TMPDIR for the temporaryMike Heffner2001-07-072-3/+20
| | | | | | | | | | | directory, defaulting to /tmp. PR: bin/16924 Reviewed by: dd MFC after: 2 weeks Notes: svn path=/head/; revision=79379
* mdoc(7) police: fixed/simplified formatting.Ruslan Ermilov2001-07-041-130/+81
| | | | Notes: svn path=/head/; revision=79199
* (cantwrite): do not allocate memory for a NULL stringAssar Westerlund2001-06-181-1/+2
| | | | | | | | | | | PR: misc/26044 MFC after: 1 week Submitted by: bde Notes: svn path=/head/; revision=78400
* revert freeing of memory that gets allocated when str == NULLAssar Westerlund2001-06-184-8/+0
| | | | | | | | | (this will be fixed in a better way) PR: misc/26044 Notes: svn path=/head/; revision=78399
* free memory that gets allocated by vfprintf when str == NULLAssar Westerlund2001-06-164-0/+8
| | | | | | | | | PR: misc/26044 MFC after: 1 week Notes: svn path=/head/; revision=78325
* Add description for the 'll' modifier for long long. In essence a copyJens Schweikhardt2001-06-131-4/+24
| | | | | | | | | | | from the 'l' description with s/long/long long/g. PR: 27017 Submitted by: Guy Harris <guy@alum.mit.edu> MFC after: 2 weeks Notes: svn path=/head/; revision=78180
* Back out my changes describing how snprintf nul terminates. ItWarner Losh2001-06-051-9/+11
| | | | | | | | | | was from the iso standard. Keep the sentence that says it is always NUL terminated to make sure that people understand that. Requested by: bde Notes: svn path=/head/; revision=77794
* Minor improvements:Warner Losh2001-06-051-15/+29
| | | | | | | | | o Explain snprintf's return value better. o Document snprintf, et al, were defined in C-99 o Warn against %n. Notes: svn path=/head/; revision=77744
* Properly initialize a temporary FILE that is allocated off the stack.Daniel Eischen2001-06-042-0/+10
| | | | | | | | | | The change to reuse _up from FILE (to allow FILE to grow without changing size) overlooked FILE being allocated off the stack. Approved by: sobomax Notes: svn path=/head/; revision=77686
* Correct the documentation for snprintf() and vsprintf() which actuallyGregory Neil Shapiro2001-05-301-1/+12
| | | | | | | | | | return the number of characters that would have been in the new string. Obtained from: OpenBSD MFC after: 3 days Notes: svn path=/head/; revision=77510
* Add warnings about trusting user-supplied data.Eric Melville2001-05-251-0/+14
| | | | | | | | | Reviewed by: ru Approved by: murray Obtained from: OpenBSD Notes: svn path=/head/; revision=77200
* mdoc(7) police: fix markup.Ruslan Ermilov2001-04-181-2/+6
| | | | Notes: svn path=/head/; revision=75661
* To be consistent, use the __weak_reference macro from <sys/cdefs.h>Daniel Eischen2001-04-101-4/+4
| | | | | | | | | | | instead of #pragma weak to create weak definitions. This macro is improperly named, though, since a weak definition is not the same thing as a weak reference. Suggested by: bde Notes: svn path=/head/; revision=75368
* MAN[1-9] -> MAN.Ruslan Ermilov2001-03-271-1/+1
| | | | Notes: svn path=/head/; revision=74870
* Fix style nit.David E. O'Brien2001-03-051-1/+1
| | | | Notes: svn path=/head/; revision=73690
* Fix style breakage.David E. O'Brien2001-03-051-0/+1
| | | | Notes: svn path=/head/; revision=73689
* Hide the definition of struct __sFILEX and add the neededDaniel Eischen2001-03-012-81/+33
| | | | | | | | | | lock definitions to it. flockfile state is now allocated along with the rest of FILE. This eliminates the need for a separate allocation of flockfile state as well as eliminating the mutex/lock used to serialize its allocation. Notes: svn path=/head/; revision=73254
* .St -ansiC -> .St -isoCRuslan Ermilov2001-02-2618-22/+22
| | | | Notes: svn path=/head/; revision=73088
* Correctly handle the race itself, too (don't leave it locked).Brian Feldman2001-02-231-0/+1
| | | | | | | | | This is about to be replaced anyway by initialization explicitly instead of lazily, and reducing the complexity of it. As it is now, this will work fine, however. Notes: svn path=/head/; revision=72947
* Use the right names to call pthread_mutex_{,un}lock so that thingsBrian Feldman2001-02-231-2/+2
| | | | | | | work in both the libc only and libc/libc_r case. Notes: svn path=/head/; revision=72939
* Fix the problems I (and others, undoubtedly) have been having for aBrian Feldman2001-02-231-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | while with threaded software in -CURRENT acting very "weird". It has seemed, for example, in Mozilla that threads attempting to do host lookups have been locking up. That's exactly the case. There was a race condition in the implementation of the initialization of the mutex used to protect FILE operations, first of all: multiple instances of FLOCKFILE() in libc could occur on the same FILE at the same time and cause strange behavior by overwriting eachothers' creation of the mutex and the rest of the file lock. Secondly, it's not appropriate to test the "validity" of the file descriptor referenced by the FILE; if the code is calling FLOCKFILE() or FUNLOCKFILE(), it wants the FILE to be locked or unlocked, not to be locked or unlocked on the condition that _file is >= 0. This also could quite easily cause leaks by failing to perform the lock or unlock operation when it actually is needed. Mozilla now works again on -CURRENT when linked to libc_r.so.5 and libc.so.5. Notes: svn path=/head/; revision=72937
* Place some hooks (__stdin, __stdout, __stderr) into libc for a futurePeter Wemm2001-02-201-0/+23
| | | | | | | | | | | | | | ABI change. There is some serious evilness here to work around some gcc weaknesses. We need to know the sizeof(FILE) manually until __sF goes away in the next major bump. We have the size for Alpha and i386, missing is ia64, ppc and sparc* (and i386 with 64 bit longs). At some point down the track we can change the stdin etc #defines to stop hard coding the size of FILE into application binaries. Lots of head scratching and ideas and testing by: green, imp Notes: svn path=/head/; revision=72732
* Extra needs to be initialized for our usual pool of FILEs. This wasWarner Losh2001-02-161-3/+14
| | | | | | | | | | | causing some versions of as to dump core. This survived make buildworld/installworld and the building gettext port afterwards. Submitted by: <nnd@mail.nsk.ru> "N.Dudorov" Reviewed by: "Daniel M. Eischen" <eischen@vigrid.com> Notes: svn path=/head/; revision=72550
* Fix the current libc breakage in current:Warner Losh2001-02-165-17/+38
| | | | | | | | | | | | | | | | o Back out the __std* stuff. Can't figure out how to do this right now, so we'll save it for late. o use _up as a pointer for extra fields that we need to access. o back out the libc major version bump. Submitted by: green reviewed by: peter, imp, green, obrien (to varying degrees). We'll fix the "how do we stop encoding sizeof(FILE) in binaries" part later. Notes: svn path=/head/; revision=72529
* Remove freelists managed by Balloc/Bfree.Tor Egge2001-02-151-5/+18
| | | | | | | | | | | Change __dtoa to not free the string it allocated the previous time it was called. The caller now frees the string after usage if appropiate. PR: 15070 Reviewed by: deischen Notes: svn path=/head/; revision=72523
* Commit a libc fix going by the current state of the version numberingPeter Wemm2001-02-141-9/+10
| | | | | | | | | | | | | | | | | | | bikeshed in -arch. It isn't quite over, but it has been well established that this can be adjusted or refined. But we do seem to have consensis on a major bump of some sort. After this, it should reasonably safe to build world again. This change is to get rid of __sF[] and use seperate __stdin/out/err handles. This means we can pad on extra bits onto the end of FILE at will without going through this all over again. __sF[] was evil because it compiled the sizeof(FILE) into every stdio using program. Asbestos suit on: check! Peril sensitive sunglasses on: check! *gulp!* Notes: svn path=/head/; revision=72472
* It sounded like a good idea at the time. The previous change breaksPeter Wemm2001-02-121-4/+0
| | | | | | | | FILE *buffer = stdout; so back it out for now. Notes: svn path=/head/; revision=72394
* Take advantage of the current libc sizeof(FILE) breakage (__sF[]) andPeter Wemm2001-02-121-0/+4
| | | | | | | | | | | | | try a hopefully more robust stdin/stdout/stderr. This costs an indirect pointer fetch, but saves us from changes in 'FILE'. The __stdin stuff is there to not pollute application name space if the application does not use <stdio.h> and also in case something depended on the current behavior where stdin etc was a #define. Reviewed by: eischen, dillon Notes: svn path=/head/; revision=72391
* libc MT-safety, part 2.Daniel Eischen2001-02-1119-102/+247
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a lock to FILE. flockfile and friends are now implemented (for the most part) in libc. flockfile_debug is implemented in libc_r; I suppose it's about time to kill it but will do it in a future commit. Fix a potential deadlock in _fwalk in a threaded environment. A file flag (__SIGN) was added to stdio.h that, when set, tells _fwalk to ignore it in its walk. This seemed to be needed in refill.c because each file needs to be locked when flushing. Add a stub for pthread_self in libc. This is needed by flockfile which is allowed by POSIX to be recursive. Make fgetpos() error return value (-1) match man page. Remove recursive calls to locked functions (stdio); I think I've got them all, but I may have missed a couple. A few K&R -> ANSI conversions along with removal of a few instances of "register". $Id$ -> $FreeBSD$ in libc/stdio/rget.c Not objected to: -arch, a few months ago Notes: svn path=/head/; revision=72373
* mdoc(7) police: mark LC_NUMERIC with .Dv.Ruslan Ermilov2001-02-102-2/+4
| | | | Notes: svn path=/head/; revision=72313
* Note that decimal point taken from locale (SUSv2)Andrey A. Chernov2001-02-101-0/+3
| | | | Notes: svn path=/head/; revision=72297
* Take decimal point from locale instead of hardcoded '.' (SUSv2)Andrey A. Chernov2001-02-101-9/+10
| | | | Notes: svn path=/head/; revision=72291
* Note that decimal point character taken from locale (SUSv2)Andrey A. Chernov2001-02-101-0/+3
| | | | Notes: svn path=/head/; revision=72290
* Use decimal point from localeconv() instead of hardcoded '.' (SUSv2)Andrey A. Chernov2001-02-101-6/+14
| | | | Notes: svn path=/head/; revision=72289
* Backout previous commit. Use of spinlocks was not approved.Tor Egge2001-02-091-18/+5
| | | | | | | PR: 15070 Notes: svn path=/head/; revision=72254
* Protect freelists managed by Balloc/Bfree with a spinlock.Tor Egge2001-02-081-5/+18
| | | | | | | | | | Change __dtoa to not free the string it allocated the previous time it was called. The caller now frees the string after usage if appropiate. PR: 15070 Notes: svn path=/head/; revision=72179
* Fix a f^Hdamn typo, which prevented to fopen() more that 17 files at once.Maxim Sobolev2001-02-071-1/+1
| | | | | | | Tested by: knu, sobomax and other #bsdcode'rs Notes: svn path=/head/; revision=72128
* mdoc(7) police: split punctuation characters + misc fixes.Ruslan Ermilov2001-02-012-6/+6
| | | | Notes: svn path=/head/; revision=71895
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-01-2448-190/+351
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch Notes: svn path=/head/; revision=71579
* Fix bugs in the handling of > 8 positional arguments:Archie Cobbs2001-01-061-14/+18
| | | | | | | | | | | - The stack was getting smashed by __grow_type_table() - reallocf() was being called with the wrong pointer - The maximum argument number was being incorrectly computed PR: misc/23521 Notes: svn path=/head/; revision=70725
* Make it a bit clearer that asprintf doesn't actually "return" a pointer inBen Smithurst2001-01-011-4/+3
| | | | | | | | | | | the normal sense of the word, but does it through one of its arguments which is a pointer to a pointer. PR: 23717 Submitted by: phk Notes: svn path=/head/; revision=70553
* Prepare for mdoc(7)NG.Ruslan Ermilov2000-12-292-67/+67
| | | | Notes: svn path=/head/; revision=70481
* mdoc(7) police: use canonical form of .Dd macro.Ruslan Ermilov2000-12-111-1/+1
| | | | Notes: svn path=/head/; revision=69857
* mdoc(7) police: use the new features of the Nm macro.Ruslan Ermilov2000-11-201-2/+2
| | | | Notes: svn path=/head/; revision=68945
* Update the documentation to describe the new mktemp() family behaviour.Kris Kennaway2000-11-191-8/+33
| | | | | | | | | | Also notes that mkstemp() first appeared in 4.4BSD (change obtained from OpenBSD) Reviewed by: sheldonh Notes: svn path=/head/; revision=68892
* Use Fx macro wherever possible.Ruslan Ermilov2000-11-141-1/+3
| | | | Notes: svn path=/head/; revision=68716
* Increase the size of the mktemp() filename space by dropping the PID fromKris Kennaway2000-11-101-25/+17
| | | | | | | | | | | | | | | | the encoding and using the character set [a-zA-Z0-9]. This gives a total of 62^6 = 56800235584 possible temporary filenames for the usual default invocation of 6 X's (compared to as few as 52 possibilities for the previous algorithm where up to 5 characters were wasted by the PID). Update some apparently bitrotten comments to reflect reality. Audited by: eivind, freebsd-audit Reviewed by: freebsd-current (a while ago) Originally submitted by: Peter Jeremy <Peter.Jeremy@alcatel.com.au> Notes: svn path=/head/; revision=68590