summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio
Commit message (Collapse)AuthorAgeFilesLines
* Don't clear "we have offset" flag even if long is overflow for fseek(),ache2001-08-171-1/+0
| | | | there is no harm to have it, it will reduce next call efforts.
* fseek.c:ache2001-08-174-10/+36
| | | | | | | | | | | | Resulting fseek() offset must fit in long, required by POSIX (pointed by bde), so add LONG_MAX and final tests for it. rewind.c: 1) add missing __sinit() as in fseek() it pretends to be. 2) use clearerr_unlocked() since we already lock stream before _fseeko() 3) don't zero errno at the end, it explicitely required by POSIX as the only one method to test rewind() error condition. 4) don't clearerr() if error happens in _fseeko()
* Explain the relation of getchar() to getc() in less words.dd2001-08-161-5/+1
| | | | Submitted by: ru
* Use smarter overflow testsache2001-08-151-3/+6
| | | | Suggested by: bde
* 1) Disallow negative seek as POSIX require for fseek{o} (but not for lseek):ache2001-08-153-13/+45
| | | | | | | | | | | | "[EINVAL] ... The resulting file-position indicator would be set to a negative value." Moreover, in real life negative seek in stdio cause EOF indicator cleared and not set again forever even if EOF returned. 2) Catch few possible off_t overflows. Reviewed by: arch discussion
* Rip out the old __stdin/out/err stuff. It was completely 100% useless. :-(peter2001-08-131-15/+6
| | | | | | | | | | | | | | | | It was foiled because of dynamic copy relocations that caused compile-time space to be reserved in .bss and at run time a blob of data was copied to that space and everything used the .bss version.. The problem is that the space is reserved at compile time, not runtime... So we *still* could not change the size of FILE. Sigh. :-( Replace it with something that does actually work and really does let us make 'FILE' extendable. It also happens to be the same as Linux does in glibc, but has the slight cost of a pointer. Note that this is the same cost that 'fp = fopen(), fprintf(fp, ...); fclose(fp);' has. Fortunately, actual references to stdin/out/err are not all that common since we have implicit stdin/out/err-using versions of functions (printf() vs. fprintf()).
* Use .Fn, .Fa, and .Dv where appropriate.dd2001-08-101-2/+6
|
* Use the ``.Rv -std'' mdoc(7) macro in appropriate cases.yar2001-08-091-6/+1
| | | | Reviewed by: ru
* mdoc(7) police:ru2001-08-071-4/+2
| | | | | | | Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text. Not only this slows down the mdoc(7) processing significantly, but it also has an undesired (in this case) effect of disabling hyphenation within the entire enclosed block.
* Avoid any chance of being misunderstood as having libelled developerssheldonh2001-07-291-1/+1
| | | | | | | | or developers' vendors without compromising the importance of warning against bad practice. Reported by: mjacob MFC after: 1 week
* Remove whitespace at EOL.dd2001-07-159-29/+29
|
* mdoc(7) police: removed HISTORY info from the .Os call.ru2001-07-102-2/+2
|
* mdoc(7) police: remove extraneous .Pp before and/or after .Sh.dd2001-07-092-2/+0
|
* Attempt to use the environment variable TMPDIR for the temporarymikeh2001-07-072-3/+20
| | | | | | | | directory, defaulting to /tmp. PR: bin/16924 Reviewed by: dd MFC after: 2 weeks
* mdoc(7) police: fixed/simplified formatting.ru2001-07-041-130/+81
|
* (cantwrite): do not allocate memory for a NULL stringassar2001-06-181-1/+2
| | | | | | | | PR: misc/26044 MFC after: 1 week Submitted by: bde
* revert freeing of memory that gets allocated when str == NULLassar2001-06-184-8/+0
| | | | | | (this will be fixed in a better way) PR: misc/26044
* free memory that gets allocated by vfprintf when str == NULLassar2001-06-164-0/+8
| | | | | | PR: misc/26044 MFC after: 1 week
* Add description for the 'll' modifier for long long. In essence a copyschweikh2001-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
* Back out my changes describing how snprintf nul terminates. Itimp2001-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
* Minor improvements:imp2001-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.
* Properly initialize a temporary FILE that is allocated off the stack.deischen2001-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
* Correct the documentation for snprintf() and vsprintf() which actuallygshapiro2001-05-301-1/+12
| | | | | | | return the number of characters that would have been in the new string. Obtained from: OpenBSD MFC after: 3 days
* Add warnings about trusting user-supplied data.eric2001-05-251-0/+14
| | | | | | Reviewed by: ru Approved by: murray Obtained from: OpenBSD
* mdoc(7) police: fix markup.ru2001-04-181-2/+6
|
* To be consistent, use the __weak_reference macro from <sys/cdefs.h>deischen2001-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
* MAN[1-9] -> MAN.ru2001-03-271-1/+1
|
* Fix style nit.obrien2001-03-051-1/+1
|
* Fix style breakage.obrien2001-03-051-0/+1
|
* Hide the definition of struct __sFILEX and add the neededdeischen2001-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.
* .St -ansiC -> .St -isoCru2001-02-2618-22/+22
|
* Correctly handle the race itself, too (don't leave it locked).green2001-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.
* Use the right names to call pthread_mutex_{,un}lock so that thingsgreen2001-02-231-2/+2
| | | | work in both the libc only and libc/libc_r case.
* Fix the problems I (and others, undoubtedly) have been having for agreen2001-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.
* Place some hooks (__stdin, __stdout, __stderr) into libc for a futurepeter2001-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
* Extra needs to be initialized for our usual pool of FILEs. This wasimp2001-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>
* Fix the current libc breakage in current:imp2001-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.
* Remove freelists managed by Balloc/Bfree.tegge2001-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
* Commit a libc fix going by the current state of the version numberingpeter2001-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!*
* It sounded like a good idea at the time. The previous change breakspeter2001-02-121-4/+0
| | | | | FILE *buffer = stdout; so back it out for now.
* Take advantage of the current libc sizeof(FILE) breakage (__sF[]) andpeter2001-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
* libc MT-safety, part 2.deischen2001-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
* mdoc(7) police: mark LC_NUMERIC with .Dv.ru2001-02-102-2/+4
|
* Note that decimal point taken from locale (SUSv2)ache2001-02-101-0/+3
|
* Take decimal point from locale instead of hardcoded '.' (SUSv2)ache2001-02-101-9/+10
|
* Note that decimal point character taken from locale (SUSv2)ache2001-02-101-0/+3
|
* Use decimal point from localeconv() instead of hardcoded '.' (SUSv2)ache2001-02-101-6/+14
|
* Backout previous commit. Use of spinlocks was not approved.tegge2001-02-091-18/+5
| | | | PR: 15070
* Protect freelists managed by Balloc/Bfree with a spinlock.tegge2001-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
* Fix a f^Hdamn typo, which prevented to fopen() more that 17 files at once.sobomax2001-02-071-1/+1
| | | | Tested by: knu, sobomax and other #bsdcode'rs
OpenPOWER on IntegriCloud