summaryrefslogtreecommitdiffstats
path: root/lib/libc/nls/msgcat.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r304703, r304755ache2016-08-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | 1) _locale.h LC_*_MASK bit shifting order was partially broken from the initial commit time at year 2012. Only LC_COLLATE_MASK and LC_CTYPE_MASK are in the right order. The order here should match XLC_* from "xlocale_private.h" which, in turn, match LC_* publicly visible order from <locale.h> which determines how locale components are stored in the structure. LC_*_MASK -> XLC_* translation done as "ffs(mask) - 1" in the querylocale() and equivalent shift loop in the newlocale(), so mapped to some wrong components (excluding two mentioned above). Formally the fix is ABI breakage, but old code using those masks never works properly in any case. Only newlocale() and querylocale() are affected. 2) msgcat.c Use current locale (f.e. set by thread). It was global locale always previously. PR: 211743
* MFC r278530:bdrewery2015-04-031-0/+1
| | | | | | | | When catopen(3) returns an error, it caches the result of that error from r202992. The refcount on the cache entry is not initialized, so any attempt to clean the cache will skip over this item since it likely has a >0 value. This change is currently a NOP.
* Fix warning from valgrind when a failed entry is tested.eadler2012-12-171-0/+1
| | | | | | | | PR: kern/173008 Submitted by: Zhihao Yuan <lichray@gmail.com> Reviewed by: gabor Approved by: cperciva (implicit) MFC after: 1 week
* libc: Use O_CLOEXEC for various internal file descriptors.jilles2012-09-291-1/+1
| | | | | | | | | This fixes a race condition where another thread may fork() before CLOEXEC is set, unintentionally passing the descriptor to the child process. This commit only adds O_CLOEXEC flags to open() or openat() calls where no fcntl(fd, F_SETFD, FD_CLOEXEC) follows. The separate fcntl() call still leaves a race window so it should be fixed later.
* - More style(9) fixupsgabor2010-02-201-26/+29
| | | | Approved by: delphij (mentor)
* - Deal with some special cases [1]gabor2010-02-091-30/+54
| | | | | | | - style(9) nits Pointed out by: jilles [1] Approved by: delphij (mentor)
* - Fix some style(9) bugsgabor2010-01-291-17/+16
| | | | Pointed out by: bde
* - style(9)gabor2010-01-251-25/+25
| | | | Approved by: delphij
* Cache failing and opened catalogs in catopen() and related functions.gabor2010-01-251-17/+131
| | | | | | | | | | | | | Continuous catopen() calls cause 4 failig stat(2) each, which means a lot of overhead. It is also a good idea to keep the opened catalogs in the memory to speed up further catopen() calls to the same catalog since these catalogs are not big at all. In this case, we count references and only free() the allocated space when the reference count reaches 0. The reads and writes to the cache are syncronized with an rwlock when these functions are called from a threaded program. Requested by: kib Approved by: delphij
* Bring in NetBSD's improvements and cleanups to NLS subsystem, makingphantom2005-02-271-250/+96
| | | | | | | | | | | it type and endian clean and removing of stdio dependency from NLS functions (catalog files now are processed via mmap()) Also following changes were done (against NetBSD version): . If mmap() failed, set errno to EINVAL and do not try to munmap() file Obtained from: NetBSD
* Cleanup prototypes and remove dead codephantom2005-02-011-54/+16
| | | | MFC After: 3 days
* Remove incomplete support for running FreeBSD userland on old NetBSD kernelstjr2003-10-291-5/+1
| | | | lacking the issetugid() and utrace() syscalls.
* Back out the `hiding' of strlcpy and strlcat. Several peoplenectar2003-05-011-1/+1
| | | | vocally objected to this safety belt.
* `Hide' strlcpy and strlcat (using the namespace.h / __weak_referencenectar2003-04-291-1/+1
| | | | | | | technique) so that we don't wind up calling into an application's version if the application defines them. Inspired by: qpopper's interfering and buggy version of strlcpy
* Do not include <sys/syslimits.h> directly; it is not intended for generalwollman2002-10-271-1/+2
| | | | consumption.
* Now, malloc is fixed, remove ENOMEM hardcodeache2002-08-121-12/+11
|
* Set errno to ENOMEM for strdup too (due to malloc errno bug)ache2002-08-071-3/+4
|
* Always set errno to ENOMEM after malloc failed (as workaround).ache2002-08-071-8/+8
| | | | Our malloc sometimes forget to set errno, f.e. for size overflow case.
* Close descriptor, if error happens in loadCat()ache2002-08-071-0/+6
|
* Try harder to check lang as path component (".", "..", / inside).ache2002-08-041-307/+345
| | | | | Try harder to not overwrite failure errno. style(9) whitespace reformatting for code readability.
* 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.
* Removed duplicate VCS ID tags, as per style(9).ru2001-08-131-3/+2
|
* Remove _THREAD_SAFE and make libc thread-safe by default bydeischen2001-01-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix typophantom2000-09-271-1/+1
| | | | | PR: misc/21596 Submitted by: TOGAWA Satoshi <toga@puyo.org>
* Prevent buffer overflow if NLSPATH is too longache2000-09-081-1/+7
|
* Fully implement NLSPATH processing as described in SUSv2ache2000-09-051-8/+45
|
* Oops! don't set errno to ENOMEM explicitly if malloc() failed.phantom2000-09-051-6/+10
| | | | Found by: ache
* Finaly cleanup libc/nls code:phantom2000-09-041-196/+163
| | | | | | | | | | | | | * rewrite catopen() to remove duplicate code chunks and optimize * if empty string is passed to catopen() as name argument then catopen() will set errno to ENOENT (File not found), not EINVAL * move search code to LOOKUP() macro to shrink amount of duplicated code * move common resource freeing actions to __nls_free_resources() function * exclude from build code related to MCLoadAll defintion since it is not using at all * style(9) related whitespace changes Reviewed by: ache
* Rewrite using stdio. It cause program speedup since eliminates lots of smallache2000-09-031-13/+14
| | | | | read() syscalls. It not cause static binary size increasing because stdio already picked via setlocale() called from catopen()
* Treat empty lang as "C" lang tooache2000-09-011-1/+1
|
* Set rcsid to correct valuephantom2000-09-011-24/+6
| | | | | Resort #include files Remove SYSV compatibility chunks
* Remove unused indirect references to cat* functions.phantom2000-09-011-3/+3
|
* Fix memory leak introduced by kris in rev 1.22phantom2000-09-011-0/+2
|
* setlocale may return NULL, handle this case too by resetting to "C"ache2000-09-011-5/+3
|
* Move protection code down to handle NL_CAT_LOCALE case too.ache2000-09-011-2/+3
|
* Protect from badly formed LANG variableache2000-09-011-1/+2
|
* catgets: detect if fd becomes invalid after exec and return default responseache2000-08-301-6/+6
| | | | cosmetique, use NULL for pointers comparison
* Prevent internal buffer overflow due to expansion of $LANG and/or namekris2000-08-051-3/+11
| | | | | | argument in catopen(). Reviewed by: chris, -audit
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),jasone2000-01-271-8/+8
| | | | | | | | | | | | | | | | | 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
* Add three-tier symbol naming in support of POSIX thread cancellationjasone2000-01-121-8/+9
| | | | | | 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().
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Provide meaningful errno value on error returnache1998-07-141-5/+17
|
* Return -1 for invalid descriptor in catcloseache1998-04-301-2/+2
|
* If passed catgets descriptor is NULL or -1, return default string immediatelyache1998-04-301-1/+3
|
* Force loadType to 0ache1998-04-301-5/+4
|
* Implement NL_CAT_LOCALEache1998-04-301-3/+8
| | | | Manpages cleanup
* Prototypes/typedefs cleanupache1998-04-301-18/+19
| | | | Fix error return codes
* Add #ifndef __NETBSD_SYSCALLS around calls to issetugid() whichjb1998-01-151-2/+6
| | | | do not exist in NetBSD 1.3.
* Plug even more failure memory leaksache1997-05-101-6/+32
|
* Cleanupache1997-05-101-21/+26
| | | | | | Plug failure memory leaks Use issetugid now PR: 3492
OpenPOWER on IntegriCloud