summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/findfp.c
Commit message (Collapse)AuthorAgeFilesLines
* Take the spinlock around clearing of the fp->_flags in fclose(3), whichkib2012-04-241-9/+7
| | | | | | | | | indicates the avaliability of FILE, to prevent possible reordering of the writes as seen by other CPUs. Reported by: Fengwei yin <yfw.bsd gmail com> Reviewed by: jhb MFC after: 1 week
* - Use an initializer macro to initialize fields in 'fake' FILE objects usedjhb2010-03-111-2/+3
| | | | | | | | | | | | by *sprintf(), etc. - Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE objects. This is currently a nop on FreeBSD, but is import for other platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply zero. PR: threads/141198 Reported by: Jeremy Huddleston @ Apple MFC after: 2 weeks
* Fix many "function declaration isn't a prototype" warnings in libc.ed2009-12-051-1/+1
| | | | | I've only fixed code that seems to be written by `us'. There are still many warnings like this present in resolv/, rpc/, stdtime/ and yp/.
* Use C99-style initializers. No functional change.das2009-03-011-4/+9
| | | | Reviewed by: md5(1)
* Next stage of stdio cleanup: Retire __sFILEX and merge the fields back intojhb2008-04-171-45/+11
| | | | | | | | | | | | | | | | | | | __sFILE. This was supposed to be done in 6.0. Some notes: - Where possible I restored the various lines to their pre-__sFILEX state. - Retire INITEXTRA() and just initialize the wchar bits (orientation and mbstate) explicitly instead. The various places that used INITEXTRA didn't need the locking fields or _up initialized. (Some places needed _up to exist and not be off the end of a NULL or garbage pointer, but they didn't require it to be initialized to a specific value.) - For now, stdio.h "knows" that pthread_t is a 'struct pthread *' to avoid namespace pollution of including all the pthread types in stdio.h. Once we remove all the inlines and make __sFILE private it can go back to using pthread_t, etc. - This does not remove any of the inlines currently and does not change any of the public ABI of 'FILE'. MFC after: 1 month Reviewed by: peter
* Per Regents of the University of Calfornia letter, remove advertisingimp2007-01-091-4/+0
| | | | | | clause. # If I've done so improperly on a file, please let me know.
* Remove alpha left-overs.ru2006-08-221-1/+1
|
* Associate a multibyte conversion state object with each stream. Reset ittjr2004-05-221-5/+1
| | | | | | | | | to the initial state when a stream is opened or seeked upon. Use the stream's conversion state object instead of a freshly-zeroed one in fgetwc(), fputwc() and ungetwc(). This is only a performance improvement for now, but it would also be required in order to support state-dependent encodings.
* bde points out that the LIBC_MAJOR macro doesn't exist and requestsimp2002-11-141-3/+6
| | | | | | | that we not use it here. In its place I've put a comment about the current state of play. Submitted by: bde
* Restore Peter's version of static __sF. There's too much pain for itimp2002-11-101-1/+4
| | | | | | | | | | | | to be static for 5.0. I may remove this for 5.1 or 5.2. No more binaries or libarires will be generated with __sF starting as of yesterday. Originally the plan had been to eliminate this for 5.0, but we didn't get the __std{in,out,err}p changes merged into -stable until yesterday (rather than in September 2001 like it should have been). Given that didn't happen on time, we can't do the other part of the scheme now. # Please do not change this without talking to me first.
* Backout "compatibility hack" for __sF.alfred2002-11-041-5/+1
| | | | Requested by: Steve Kargl <sgk@troutmask.apl.washington.edu> (submitter)
* Provide a hook to make __sF visible outside of libc for commercial appsalfred2002-11-021-1/+5
| | | | | | if WANT_COMPAT4_STDIO is defined when compiling libc. Submitted by: Steve Kargl <sgk@troutmask.apl.washington.edu>
* Make __sF static. This can not be allowed to exist in 5.x.alfred2002-10-311-1/+1
|
* Give in on the __sF stuff. I have a better fix in mind that is futurepeter2002-10-191-1/+1
| | | | proof, but this should buy me some time for now.
* Zap the early-adopter transition aid before we get into seriouspeter2002-10-111-4/+1
| | | | | 5.0-R territory, as threatened. This only affects antique 5.0 systems that have not had a 'make world' done for well over a year.
* Basic support for wide character I/O: getwc(), fgetwc(), getwchar(),tjr2002-08-131-0/+6
| | | | putwc(), fputwc(), putwchar(), ungetwc(), fwide().
* Fix the style of the SCM ID's.obrien2002-03-221-4/+2
| | | | I believe have made all of libc .c's as consistent as possible.
* Remove __P() usage.obrien2002-03-211-1/+1
|
* 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()).
* 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
* 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-161-14/+25
| | | | | | | | | | | | | 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.
* 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-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 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
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-17/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Make __sfp() (FILE allocator) thread-safe: added locking like in malloc().dt1999-11-201-0/+11
|
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Suggested by: Bruce Evans, Jeffrey Hsu, Gary Palmerjraynard1996-06-221-0/+6
| | | | | | | | | | | | | | | | | | | | | Added $Id$'s to files that were lacking them (gpalmer), made some cosmetic changes to conform to style guidelines (bde) and checked against NetBSD and Lite2 to remove unnecessary divergences (hsu, bde) One last code cleanup:- Removed spurious casts in fseek.c and stdio.c. Added missing function argument in fwalk.c. Added missing header include in flags.c and rget.c. Put in casts where int's were being passed as size_t's. Put in missing prototypes for static functions. Changed second args of __sflags() inflags.c and writehook() in vasprintf.c from char * to const char * to conform to prototypes. This directory now compiles with no warnings with -Wall under gcc-2.6.3 and with considerably less warnings than before with the ultra-pedantic script I used for testing. (Most of the remaining ones are due to const poisoning).
* Minor cleanup, #include's and unused vars.phk1995-10-221-0/+4
| | | | Added compile-time warning to an old funky function.
* BSD 4.4 Lite Lib Sourcesrgrimes1994-05-271-0/+165
OpenPOWER on IntegriCloud