summaryrefslogtreecommitdiff
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* 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
* Avoid use of direct troff requests in mdoc(7) manual pages.Ruslan Ermilov2000-11-101-1/+0
| | | | Notes: svn path=/head/; revision=68575
* Better documentation of append mode. This should have gone in -currentEivind Eklund2000-09-221-0/+8
| | | | | | | | | directly. Now also .Xr fseek reference. Prodded by: sheldonh Notes: svn path=/head/; revision=66249
* According to the susv2 man pages I have, remove(3) should act asDavid Malone2000-08-282-7/+26
| | | | | | | | | | | | rmdir(2) on directories and unlink(2) otherwise. This modification, and most of the man page update has been obtined from OpenBSD. This was spotted by someone on a mailing lists a few months ago, but I've lost their mail. Reviewed by: sheldonh Notes: svn path=/head/; revision=65164
* Use `Er' variable to define first column width in ERRORS section.Alexey Zelkin2000-05-068-8/+8
| | | | Notes: svn path=/head/; revision=60078
* Introduce ".Lb" macro to libc manpages.Alexey Zelkin2000-04-2120-0/+40
| | | | | | | More libraries manpages updates following. Notes: svn path=/head/; revision=59460
* Fix typo, reported by George Cox.Jeroen Ruigrok van der Werven2000-04-121-8/+8
| | | | | | | | | Fix hard sentence breaks. Submitted by: George Cox <gjvc@sophos.com> Notes: svn path=/head/; revision=59176
* Remove more single-space hard sentence breaks.Sheldon Hearn2000-03-021-1/+2
| | | | Notes: svn path=/head/; revision=57695
* Remove single-space hard sentence breaks. These degrade the qualitySheldon Hearn2000-03-024-7/+14
| | | | | | | | of the typeset output, tend to make diffs harder to read and provide bad examples for new-comers to mdoc. Notes: svn path=/head/; revision=57686
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),Jason Evans2000-01-277-11/+11
| | | | | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen Notes: svn path=/head/; revision=56698
* Improve the explanation on the (in)security of mktemp(3).Sheldon Hearn2000-01-251-3/+6
| | | | Notes: svn path=/head/; revision=56589
* We no longer care about the VAX and Tahoe compilers :-)Kris Kennaway2000-01-171-6/+1
| | | | Notes: svn path=/head/; revision=56131
* Add three-tier symbol naming in support of POSIX thread cancellationJason Evans2000-01-127-11/+17
| | | | | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read(). Notes: svn path=/head/; revision=55837
* Correct discrepancy between definition of argument to tempnam() andKris Kennaway2000-01-091-2/+2
| | | | | | | the name by which it is referenced in the text. Notes: svn path=/head/; revision=55649
* While comparing this with OpenBSD (ie: trying to figure out what mkstemps()Peter Wemm1999-12-111-2/+2
| | | | | | | | | | | is good for... :-)), I discovered that part of the change when mkstemps() was brought in was missed - it was missing the termination case to make sure it doesn't walk into the suffix. This isn't the same code OpenBSD has, I think this is a little better as we terminate the loop in a better spot. Notes: svn path=/head/; revision=54439
* Make __sfp() even more thread-safe.Dmitrij Tejblum1999-11-211-1/+1
| | | | Notes: svn path=/head/; revision=53529
* Add (FILE *) locking.Dmitrij Tejblum1999-11-201-0/+9
| | | | Notes: svn path=/head/; revision=53460
* Make __sfp() (FILE allocator) thread-safe: added locking like in malloc().Dmitrij Tejblum1999-11-201-0/+11
| | | | Notes: svn path=/head/; revision=53459