Commit graph

139 commits

Author SHA1 Message Date
Brooks Davis 1ca63a8219 libc: Remove empty comments in Symbol.map
These were left over from $FreeBSD$ removal.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42612
2023-11-15 17:51:03 +00:00
Warner Losh 559a218c9b libc: Purge unneeded cdefs.h
These sys/cdefs.h are not needed. Purge them. They are mostly left-over
from the $FreeBSD$ removal. A few in libc are still required for macros
that cdefs.h defines. Keep those.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D42385
2023-11-01 16:44:30 -06:00
Warner Losh ae992a336e Remove $FreeBSD$: one-line catalog
Remove /^\s*\$\s*\$FreeBSD\$$\n/
2023-08-16 11:55:26 -06:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Mark Johnston 68ca8363c7 libc: Use secure_getenv(3) where appropriate
No functional change intended.

Reviewed by:	mjg, imp, kib
Differential Revision:	https://reviews.freebsd.org/D39278
2023-03-27 08:56:22 -04:00
Konstantin Belousov 675079b1ea Implement strerror_l().
Only for the arches that provide user-mode TLS.

PR: 251651
Requested by:	yuri
Discussed with:	emaste, jilles, tijl
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D27495
MFC after:	2 weeks
2020-12-16 09:02:09 +00:00
Stefan Eßer 1f474190fc Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26942
2020-10-27 11:29:11 +00:00
Xin LI 4188ba1a3b Fix race condition in catopen(3).
The current code uses a rwlock to protect the cached list, which
in turn holds a list of catentry objects, and increments reference
count while holding only read lock.

Fix this by converting the reference counter to use atomic operations.

While I'm there, also perform some clean ups around memory operations.

PR:		202636
Reported by:	Henry Hu <henry.hu.sh@gmail.com>
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D24095
2020-03-19 06:33:06 +00:00
Kirk McKusick 88640c0e8b Create new EINTEGRITY error with message "Integrity check failed".
An integrity check such as a check-hash or a cross-correlation failed.
The integrity error falls between EINVAL that identifies errors in
parameters to a system call and EIO that identifies errors with the
underlying storage media. EINTEGRITY is typically raised by intermediate
kernel layers such as a filesystem or an in-kernel GEOM subsystem when
they detect inconsistencies. Uses include allowing the mount(8) command
to return a different exit value to automate the running of fsck(8)
during a system boot.

These changes make no use of the new error, they just add it. Later
commits will be made for the use of the new error number and it will
be added to additional manual pages as appropriate.

Reviewed by:    gnn, dim, brueffer, imp
Discussed with: kib, cem, emaste, ed, jilles
Differential Revision: https://reviews.freebsd.org/D18765
2019-01-17 06:35:45 +00:00
Andrey A. Chernov 95f9709424 Use current locale (f.e. set by thread). It was global locale always
previously.

MFC after:      7 days
2016-08-24 16:44:27 +00:00
Bryan Drewery b231dc0a9f Move logic to destroy a struct catentry to its own function.
This will be used later for memory leak handling.

Obtained from:	OneFS
Sponsored by:	EMC / Isilon Storage Division
2016-02-02 23:33:58 +00:00
Baptiste Daroussin 272a3bb29b Use mdoc(7) macros to handle parenthesis 2015-04-26 10:54:52 +00:00
Bryan Drewery 1bb3a25f07 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. There is work in progress to support
freeing the cache which requires this change to avoid a memory leak.

MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2015-02-10 20:45:40 +00:00
Marcel Moolenaar 8876613dc5 Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}
if not already defined. This allows building libc from outside of
lib/libc using a reach-over makefile.

A typical use-case is to build a standard ILP32 version and a COMPAT32
version in a single iteration by building the COMPAT32 version using a
reach-over makefile.

Obtained from:	Juniper Networks, Inc.
2014-03-04 02:19:39 +00:00
Sergey Kandaurov e0906c9a0d POSIX 1003.1-2008: add ENOTRECOVERABLE, EOWNERDEAD errnos. 2013-05-04 19:07:22 +00:00
Sergey Kandaurov c951cd462f Add entry for errno ECAPMODE.
MFC after:	3 days
2013-05-04 12:57:21 +00:00
Jilles Tjoelker c9e57bf8be libc: Fix typo in French translation.
PR:		kern/177704
Submitted by:	martymac
MFC after:	1 week
2013-04-14 11:44:47 +00:00
Xin LI 5625bb0c36 Add derived versions for common Simplified Chinese encodings.
MFC after:	2 weeks
2012-12-28 01:23:12 +00:00
Xin LI 190fb357ca Add zh_CN.UTF-8 catalog.
Reviewed by:	alphachi <alphachi mediaspirit.org>
MFC after:	2 weeks
2012-12-28 01:09:30 +00:00
Eitan Adler 49a8f2aa6c Fix warning from valgrind when a failed entry is tested.
PR:		kern/173008
Submitted by:	Zhihao Yuan <lichray@gmail.com>
Reviewed by:	gabor
Approved by:	cperciva (implicit)
MFC after:	1 week
2012-12-17 12:57:36 +00:00
Jilles Tjoelker 05eb11cbc4 libc: Use O_CLOEXEC for various internal file descriptors.
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.
2012-09-29 11:54:34 +00:00
Maxim Konovalov 03678e1179 Merge from English r198040: add C message catalogue entries for newer
errnos: EBADMSG, EMULTIHOP, ENOLINK, EPROTO, ENOTCAPABLE.

PR:		docs/147983
Submitted by:	pluknet
MFC after:	1 week
2010-06-20 06:52:10 +00:00
Gabor Kovesdan 29c271590e - More style(9) fixups
Approved by:	delphij (mentor)
2010-02-20 08:19:19 +00:00
Gabor Kovesdan fe0aca73ed - Deal with some special cases [1]
- style(9) nits

Pointed out by:	jilles [1]
Approved by:	delphij (mentor)
2010-02-09 19:37:12 +00:00
Gabor Kovesdan 336831f034 - Fix some style(9) bugs
Pointed out by:	bde
2010-01-29 18:33:59 +00:00
Gabor Kovesdan fe1ee31bc8 - style(9)
Approved by:	delphij
2010-01-25 23:44:00 +00:00
Gabor Kovesdan f978ef9381 Cache failing and opened catalogs in catopen() and related functions.
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
2010-01-25 23:37:49 +00:00
Gabor Kovesdan 124493a1de - Update Galician catalog 2010-01-21 11:36:40 +00:00
Gabor Kovesdan 208a6d2eb0 - Update the Spanish NLS catalog
Reviewed by:	carvay,
		the.infamous.paul@gmail.com,
		Joan Picanyol i Puig <lists-freebsd-es@biaix.org>,
		Ing . Marcos Luis Ortiz Valmaseda <mlortiz@uci.cu>,
		eskanete@gmail.com,
		Jose M Rodriguez <josemi@freebsd.jazztel.es>,
		Guillermo Hernandez <guillermo@QuerySoft.es>,
		dani.doni@gmail.com
2009-12-03 19:27:12 +00:00
Gabor Kovesdan 50497e556b - Update Hungarian libc catalog 2009-11-17 18:57:44 +00:00
Jung-uk Kim 853ab1b70d Sync with C.msg r199083. 2009-11-16 19:10:09 +00:00
Rene Ladan 6c2af98cee Synchronize with C.msg revision 199083 and improve some existing messages.
Reviewed by:	remko
Approved by:	remko
2009-11-11 18:28:12 +00:00
Hajimu UMEMOTO 1789887000 Add Japanese catalogue entries for newer errnos: EBADMSG, EMULTIHOP,
ENOLINK, EPROTO, ENOTCAPABLE.
2009-11-10 03:56:51 +00:00
Hajimu UMEMOTO 9020e36353 Add gai_strerror() catalog for ja_JP.UTF-8 and ja_JP.eucJP. 2009-11-09 17:26:16 +00:00
Hajimu UMEMOTO 0d384326cd Add NLS catalogs support to gai_strerror(3).
Controlled by NLS define.
2009-11-09 12:46:59 +00:00
Hajimu UMEMOTO 42f4692f52 Fix comment.
Pointed out by:	nyan
MFC after:	1 week
2009-11-09 12:38:13 +00:00
Hajimu UMEMOTO be77e7423c Add ja_JP.eucJP catalog.
Reviewed by:	hrs, nork, takawata
MFC after:	1 week
2009-11-09 12:33:47 +00:00
Hajimu UMEMOTO 6bf41ac159 Add ja_JP.UTF-8 catalog.
Reviewed by:	hrs, nork, takawata
MFC after:	1 week
2009-11-09 12:28:59 +00:00
Gabor Kovesdan f93a16d57d - Strip trailing CRs
Requested by:	Alex Kozlov <spam@rm-rf.kiev.ua> (via private mail)
2009-11-08 11:55:03 +00:00
Gabor Kovesdan 88260ae614 - Update Ukranian catalog
Submitted by:	Alex Kozlov <spam@rm-rf.kiev.ua> (via private mail)
2009-11-08 11:32:39 +00:00
Robert Watson 8c8ee3d3b8 Add C message catalogue entries for newer errnos: EBADMSG, EMULTIHOP,
ENOLINK, EPROTO, ENOTCAPABLE.

Submitted by:	Alan R. S. Bueno <alan.bsd at gmail.com>
MFC after:	3 days (most)
2009-10-13 17:57:06 +00:00
Gabor Kovesdan bc65e45307 - Add Galician NLS catalog 2009-09-27 13:16:38 +00:00
Alexander Leidinger c5f562d25a Improve the German translation.
Some parts (ERANGE, ETXTBSY) triggered by Christoph Mallon.

Discussed with:	brueffer, gabor (previous version)
2009-03-25 12:36:37 +00:00
Gabor Kovesdan fa332705da - Add Belarusian catalog
PR:		conf/133004
Submitted by:	Tatsiana Elavaya <t.elavaya@gmail.com>
2009-03-24 23:31:41 +00:00
Maxim Konovalov 30905e0ffc o Spell. 2009-03-21 10:10:33 +00:00
Gabor Kovesdan abc2df4ae4 - Add Ukranian catalog
Submitted by:	Alex Kozlov <spam@rm-rf.kiev.ua> (via private mail)
2009-03-20 23:55:01 +00:00
Gabor Kovesdan e5470fee62 - Fix typo
PR:		kern/132773
Reported by:	Alan R. S. Bueno <alan.bsd@gmail.com>
Submitted by:	Murilo Opsfelder <mopsfelder@gmail.com>
2009-03-18 14:33:10 +00:00