opnsense-src/lib/libc
Robert Clausecker 903cb811ff lib/libc/amd64/string: add strlcpy scalar, baseline implementation
Somewhat similar to stpncpy, but different in that we need to compute
the full source length even if the buffer is shorter than the source.

strlcat is implemented as a simple wrapper around strlcpy.  The scalar
implementation of strlcpy just calls into strlen() and memcpy() to do
the job.

Perf-wise we're very close to stpncpy.  The code is slightly slower as
it needs to carry on with finding the source string length even if the
buffer ends before the string.

Sponsored by:	The FreeBSD Foundation
Tested by:	developers@, exp-run
Approved by:	mjg
MFC after:	1 month
MFC to:		stable/14
PR:		275785
Differential Revision: https://reviews.freebsd.org/D42863

(cherry picked from commit 74d6cfad54d676299ee5e4695139461876dfd757)
2024-01-24 20:39:28 +01:00
..
aarch64 libc: don't needlessly add vfork.o to NOASM 2024-01-02 16:58:54 +00:00
amd64 lib/libc/amd64/string: add strlcpy scalar, baseline implementation 2024-01-24 20:39:28 +01:00
arm libc: rename arm and i386 Ovfork.S to vfork.S 2024-01-02 16:58:42 +00:00
capability libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
compat-43 libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
csu libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
db libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
gdtoa libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
gen Fix "version introduced" in numerous manual pages 2024-01-15 10:20:56 -05:00
gmon libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
i386 libc: rename arm and i386 Ovfork.S to vfork.S 2024-01-02 16:58:42 +00:00
iconv libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
include libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
inet libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
isc libc: Purge unneeded cdefs.h 2023-11-26 21:20:09 -07:00
locale libc: remove some obsolete VCS data 2023-12-13 23:08:50 +00:00
md Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
nameser libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
net resolv: Add a required include to resolv.h 2024-01-15 19:33:59 +09:00
nls libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
posix1e libc: correct some memory leaks in acl_to_text(3) and acl_to_text_np(3) 2023-12-20 10:29:55 +02:00
powerpc libc: centralize a few numeric symbols 2023-12-13 22:08:14 +00:00
powerpc64 libc: centralize a few numeric symbols 2023-12-13 22:08:14 +00:00
powerpcspe libc/<arch>/sys/Makefile.inc: remove cruft 2023-12-13 22:08:13 +00:00
quad libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
regex libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
resolv libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
riscv libc: don't needlessly add vfork.o to NOASM 2024-01-02 16:58:54 +00:00
rpc libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
secure libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
softfloat libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
stdio libc: remove some obsolete VCS data 2023-12-13 23:08:50 +00:00
stdlib strfmon.c: Use the restrict keyword directly 2023-12-16 06:17:51 +02:00
stdtime libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
string libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
sys sigfastblock.2: Fix a typo in the manual page 2024-01-23 07:43:27 +01:00
tests lib/libc/tests/string: add unit test for strlcpy 2024-01-24 20:39:28 +01:00
uuid libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
x86 pkru.3: Fix a typo in the manual page 2024-01-23 07:43:42 +01:00
xdr libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
yp libc: Remove empty comments in Symbol.map 2023-12-13 22:08:13 +00:00
libc.ldscript Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:29 -06:00
libc_nossp.ldscript Remove $FreeBSD$: one-line .c comment pattern 2023-08-16 11:54:29 -06:00
Makefile lib{c,lzma,z}: remove -DSYMBOL_VERSIONING from CFLAGS 2023-12-13 22:08:13 +00:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Makefile.depend.options Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00
Versions.def Remove $FreeBSD$: one-line sh pattern 2023-08-16 11:55:03 -06:00