Commit Graph

69 Commits

Author SHA1 Message Date
Jacques Vidrine
d05090827f Back out the `hiding' of strlcpy and strlcat. Several people
vocally objected to this safety belt.
2003-05-01 19:03:14 +00:00
Jacques Vidrine
5723e501ab `Hide' strlcpy and strlcat (using the namespace.h / __weak_reference
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
2003-04-29 21:13:50 +00:00
Ruslan Ermilov
c51d717f0c libc_r wasn't so tied to libc for 22 months. 2002-11-18 09:50:57 +00:00
Garrett Wollman
688dfe4533 Do not include <sys/syslimits.h> directly; it is not intended for general
consumption.
2002-10-27 17:44:33 +00:00
Andrey A. Chernov
7e3c1a3cb7 Now, malloc is fixed, remove ENOMEM hardcode 2002-08-12 11:47:19 +00:00
Andrey A. Chernov
315009a483 Set errno to ENOMEM for strdup too (due to malloc errno bug) 2002-08-07 23:52:28 +00:00
Andrey A. Chernov
cb9772d882 Always set errno to ENOMEM after malloc failed (as workaround).
Our malloc sometimes forget to set errno, f.e. for size overflow case.
2002-08-07 22:03:46 +00:00
Andrey A. Chernov
dfb18183be Close descriptor, if error happens in loadCat() 2002-08-07 07:02:37 +00:00
Andrey A. Chernov
97c54f7797 Try harder to check lang as path component (".", "..", / inside).
Try harder to not overwrite failure errno.
style(9) whitespace reformatting for code readability.
2002-08-04 14:03:59 +00:00
David E. O'Brien
333fc21e3c Fix the style of the SCM ID's.
I believe have made all of libc .c's as consistent as possible.
2002-03-22 21:53:29 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Ruslan Ermilov
8af1452cf8 Removed duplicate VCS ID tags, as per style(9). 2001-08-13 14:06:34 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Alexey Zelkin
331cc8974c Use .Rv macro instead of hardcoded message 2001-02-12 08:42:56 +00:00
Daniel Eischen
d201fe46e3 Remove _THREAD_SAFE and make libc thread-safe by default by
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
2001-01-24 13:01:12 +00:00
Ruslan Ermilov
4263595653 Prepare for mdoc(7)NG. 2000-12-29 14:08:20 +00:00
Ruslan Ermilov
251c176f41 mdoc(7) police: use certified section headers wherever possible. 2000-11-17 11:44:16 +00:00
Alexey Zelkin
e3950d8e0e Fix typo
PR:		misc/21596
Submitted by:	TOGAWA Satoshi <toga@puyo.org>
2000-09-27 18:24:31 +00:00
Andrey A. Chernov
86797bf956 Prevent buffer overflow if NLSPATH is too long 2000-09-08 11:42:37 +00:00
Andrey A. Chernov
60cff0a75c Add .El 2000-09-06 16:52:01 +00:00
Andrey A. Chernov
89817a4122 Document %-macros and NLSPATH better. 2000-09-05 19:14:34 +00:00
Andrey A. Chernov
f3ed913592 Fully implement NLSPATH processing as described in SUSv2 2000-09-05 14:04:21 +00:00
Alexey Zelkin
316321ebdf Oops! don't set errno to ENOMEM explicitly if malloc() failed.
Found by:	ache
2000-09-05 12:23:08 +00:00
Alexey Zelkin
7dc5eb443d * move $FreeBSD$ tag to its usual place (bottom of copyright)
* mdoc cleanup
* document missing errno values (ERRORS section)

Reviewed by:	sheldonh
2000-09-04 13:20:56 +00:00
Alexey Zelkin
49b8dd0db5 Finaly cleanup libc/nls code:
* 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
2000-09-04 12:09:40 +00:00
Andrey A. Chernov
08ba69b8a4 Rewrite using stdio. It cause program speedup since eliminates lots of small
read() syscalls.  It not cause static binary size increasing because stdio
already picked via setlocale() called from catopen()
2000-09-03 21:05:10 +00:00
Andrey A. Chernov
56338d5acb Treat empty lang as "C" lang too 2000-09-01 13:19:18 +00:00
Alexey Zelkin
a8a87cc61b Set rcsid to correct value
Resort #include files
Remove SYSV compatibility chunks
2000-09-01 12:19:00 +00:00
Alexey Zelkin
2873532b59 protect .h file contents correctly. 2000-09-01 12:13:33 +00:00
Alexey Zelkin
6b9175e062 Remove unused indirect references to cat* functions. 2000-09-01 12:10:59 +00:00
Alexey Zelkin
a367b9700f Fix memory leak introduced by kris in rev 1.22 2000-09-01 11:56:31 +00:00
Andrey A. Chernov
460b926285 setlocale may return NULL, handle this case too by resetting to "C" 2000-09-01 11:13:38 +00:00
Andrey A. Chernov
016de69d9e Move protection code down to handle NL_CAT_LOCALE case too. 2000-09-01 11:09:34 +00:00
Andrey A. Chernov
53d620a5fb Protect from badly formed LANG variable 2000-09-01 10:54:04 +00:00
Andrey A. Chernov
b9b68e50dc catgets: detect if fd becomes invalid after exec and return default response
cosmetique, use NULL for pointers comparison
2000-08-30 11:44:44 +00:00
Andrey A. Chernov
d8283f6866 Explicetely describe catalog descriptor lifetime 2000-08-30 10:22:23 +00:00
Kris Kennaway
84b578d562 Prevent internal buffer overflow due to expansion of $LANG and/or name
argument in catopen().

Reviewed by:	chris, -audit
2000-08-05 04:56:43 +00:00
Alexey Zelkin
25bb73e063 Introduce ".Lb" macro to libc manpages.
More libraries manpages updates following.
2000-04-21 09:42:15 +00:00
Sheldon Hearn
c6ff3a1bf7 Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.
2000-03-02 09:14:21 +00:00
Jason Evans
9233c4d942 Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
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
2000-01-27 23:07:25 +00:00
Jason Evans
929273386f Add three-tier symbol naming in support of POSIX thread cancellation
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().
2000-01-12 09:23:48 +00:00
Alexey Zelkin
466d6dc43b Add gencat(1) to SEE ALSO section.
PR:		docs/13658
Submitted by:	Zahemszky Gabor <zgabor@code.hu>
1999-09-22 22:44:42 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Andrey A. Chernov
dfb1b7aea6 Provide meaningful errno value on error return 1998-07-14 18:27:43 +00:00
Andrey A. Chernov
d1793ae420 Add reference to setlocale(3) 1998-04-30 16:11:50 +00:00
Andrey A. Chernov
e3b0c2a695 Return -1 for invalid descriptor in catclose 1998-04-30 13:15:31 +00:00
Andrey A. Chernov
e97ef24c18 If passed catgets descriptor is NULL or -1, return default string immediately 1998-04-30 12:25:05 +00:00
Andrey A. Chernov
9ad256ad65 Force loadType to 0 1998-04-30 11:39:08 +00:00
Andrey A. Chernov
c897062234 Implement NL_CAT_LOCALE
Manpages cleanup
1998-04-30 11:06:12 +00:00