mirror of
https://gitlab.freedesktop.org/libbsd/libbsd.git
synced 2025-10-19 21:16:55 +02:00
Compare commits
19 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
084911ce87 | ||
![]() |
3538d38fe7 | ||
![]() |
03fccd1505 | ||
![]() |
6b6e686b23 | ||
![]() |
da1f45ac71 | ||
![]() |
2f9eddc277 | ||
![]() |
28298ac037 | ||
![]() |
ef981f930b | ||
![]() |
6928d7895e | ||
![]() |
d5865759f8 | ||
![]() |
be327c6ebe | ||
![]() |
a14612d968 | ||
![]() |
f4baceb82c | ||
![]() |
f35c545847 | ||
![]() |
b466b14afb | ||
![]() |
1f6a48b209 | ||
![]() |
873639ebb5 | ||
![]() |
c9c78fdfd0 | ||
![]() |
5f21307570 |
35
COPYING
35
COPYING
@@ -37,39 +37,6 @@ License: BSD-4-clause-Niels-Provos
|
|||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
Files:
|
|
||||||
man/getprogname.3bsd
|
|
||||||
Copyright:
|
|
||||||
Copyright © 2001 Christopher G. Demetriou
|
|
||||||
All rights reserved.
|
|
||||||
License: BSD-4-clause-Christopher-G-Demetriou
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions
|
|
||||||
are met:
|
|
||||||
1. Redistributions of source code must retain the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer.
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
notice, this list of conditions and the following disclaimer in the
|
|
||||||
documentation and/or other materials provided with the distribution.
|
|
||||||
3. All advertising materials mentioning features or use of this software
|
|
||||||
must display the following acknowledgement:
|
|
||||||
This product includes software developed for the
|
|
||||||
NetBSD Project. See http://www.netbsd.org/ for
|
|
||||||
information about NetBSD.
|
|
||||||
4. The name of the author may not be used to endorse or promote products
|
|
||||||
derived from this software without specific prior written permission.
|
|
||||||
.
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
||||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
||||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
Files:
|
Files:
|
||||||
include/bsd/err.h
|
include/bsd/err.h
|
||||||
include/bsd/stdlib.h
|
include/bsd/stdlib.h
|
||||||
@@ -402,7 +369,7 @@ Copyright:
|
|||||||
Copyright © 2014 Theo de Raadt <deraadt@openbsd.org>
|
Copyright © 2014 Theo de Raadt <deraadt@openbsd.org>
|
||||||
Copyright © 2014 Google Inc.
|
Copyright © 2014 Google Inc.
|
||||||
Copyright © 2015 Michael Felt <aixtools@gmail.com>
|
Copyright © 2015 Michael Felt <aixtools@gmail.com>
|
||||||
Copyright © 2015 Guillem Jover <guillem@hadrons.org>
|
Copyright © 2015, 2022 Guillem Jover <guillem@hadrons.org>
|
||||||
License: ISC
|
License: ISC
|
||||||
Permission to use, copy, modify, and distribute this software for any
|
Permission to use, copy, modify, and distribute this software for any
|
||||||
purpose with or without fee is hereby granted, provided that the above
|
purpose with or without fee is hereby granted, provided that the above
|
||||||
|
5
README
5
README
@@ -9,6 +9,7 @@ A BSD compatible message-digest library is required, on systems where
|
|||||||
this is not provided by its libc or libmd libraries, the canonical
|
this is not provided by its libc or libmd libraries, the canonical
|
||||||
implementation to use is <https://www.hadrons.org/software/libmd/>.
|
implementation to use is <https://www.hadrons.org/software/libmd/>.
|
||||||
|
|
||||||
|
|
||||||
Releases
|
Releases
|
||||||
--------
|
--------
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ The mail address is:
|
|||||||
Source Repository
|
Source Repository
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
The master repository can be browsed at:
|
The primary repository can be browsed at:
|
||||||
|
|
||||||
<https://cgit.freedesktop.org/libbsd>
|
<https://cgit.freedesktop.org/libbsd>
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ and cloned from:
|
|||||||
|
|
||||||
<https://anongit.freedesktop.org/git/libbsd>
|
<https://anongit.freedesktop.org/git/libbsd>
|
||||||
|
|
||||||
|
|
||||||
Building from git source
|
Building from git source
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
@@ -55,6 +57,7 @@ the git tree:
|
|||||||
|
|
||||||
the source should be roughly equivalent to the distributed tar source.
|
the source should be roughly equivalent to the distributed tar source.
|
||||||
|
|
||||||
|
|
||||||
Building from tar source
|
Building from tar source
|
||||||
------------------------
|
------------------------
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])],
|
|||||||
|
|
||||||
LIBBSD_ABI_MAJOR=0
|
LIBBSD_ABI_MAJOR=0
|
||||||
LIBBSD_ABI_MINOR=11
|
LIBBSD_ABI_MINOR=11
|
||||||
LIBBSD_ABI_PATCH=6
|
LIBBSD_ABI_PATCH=7
|
||||||
|
|
||||||
LIBBSD_ABI="$LIBBSD_ABI_MAJOR:$LIBBSD_ABI_MINOR:$LIBBSD_ABI_PATCH"
|
LIBBSD_ABI="$LIBBSD_ABI_MAJOR:$LIBBSD_ABI_MINOR:$LIBBSD_ABI_PATCH"
|
||||||
AC_SUBST([LIBBSD_ABI])
|
AC_SUBST([LIBBSD_ABI])
|
||||||
|
@@ -51,11 +51,15 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
#if !defined(__GLIBC__) || \
|
||||||
|
!__GLIBC_PREREQ(2, 36) || \
|
||||||
|
!defined(_DEFAULT_SOURCE)
|
||||||
uint32_t arc4random(void);
|
uint32_t arc4random(void);
|
||||||
void arc4random_stir(void);
|
|
||||||
void arc4random_addrandom(unsigned char *dat, int datlen);
|
|
||||||
void arc4random_buf(void *_buf, size_t n);
|
void arc4random_buf(void *_buf, size_t n);
|
||||||
uint32_t arc4random_uniform(uint32_t upper_bound);
|
uint32_t arc4random_uniform(uint32_t upper_bound);
|
||||||
|
#endif
|
||||||
|
void arc4random_stir(void);
|
||||||
|
void arc4random_addrandom(unsigned char *dat, int datlen);
|
||||||
|
|
||||||
int dehumanize_number(const char *str, int64_t *size);
|
int dehumanize_number(const char *str, int64_t *size);
|
||||||
|
|
||||||
@@ -72,7 +76,9 @@ int sradixsort(const unsigned char **base, int nmemb,
|
|||||||
|
|
||||||
void *reallocf(void *ptr, size_t size);
|
void *reallocf(void *ptr, size_t size);
|
||||||
#if !defined(__GLIBC__) || \
|
#if !defined(__GLIBC__) || \
|
||||||
(defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 26) || !defined(_GNU_SOURCE)))
|
!__GLIBC_PREREQ(2, 26) || \
|
||||||
|
(__GLIBC_PREREQ(2, 26) && !__GLIBC_PREREQ(2, 29) && !defined(_GNU_SOURCE)) || \
|
||||||
|
(__GLIBC_PREREQ(2, 29) && !defined(_DEFAULT_SOURCE))
|
||||||
void *reallocarray(void *ptr, size_t nmemb, size_t size);
|
void *reallocarray(void *ptr, size_t nmemb, size_t size);
|
||||||
#endif
|
#endif
|
||||||
void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
|
void *recallocarray(void *ptr, size_t oldnmemb, size_t nmemb, size_t size);
|
||||||
|
@@ -47,7 +47,8 @@ char *strnstr(const char *str, const char *find, size_t str_len);
|
|||||||
void strmode(mode_t mode, char *str);
|
void strmode(mode_t mode, char *str);
|
||||||
|
|
||||||
#if !defined(__GLIBC__) || \
|
#if !defined(__GLIBC__) || \
|
||||||
(defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 25) || !defined(_GNU_SOURCE)))
|
!__GLIBC_PREREQ(2, 25) || \
|
||||||
|
!defined(_DEFAULT_SOURCE)
|
||||||
void explicit_bzero(void *buf, size_t len);
|
void explicit_bzero(void *buf, size_t len);
|
||||||
#endif
|
#endif
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
.\" $OpenBSD: arc4random.3,v 1.34 2014/07/19 16:11:16 naddy Exp $
|
.\" $OpenBSD: arc4random.3,v 1.37 2019/09/29 16:30:35 jmc Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
.\" Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
|
||||||
.\" All rights reserved.
|
.\" All rights reserved.
|
||||||
@@ -30,8 +30,8 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" Manual page, using -mandoc macros
|
.\" Manual page, using -mandoc macros
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: July 19 2014 $
|
.Dd $Mdocdate: September 29 2019 $
|
||||||
.Dt ARC4RANDOM 3bsd
|
.Dt arc4random 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm arc4random ,
|
.Nm arc4random ,
|
||||||
@@ -39,7 +39,7 @@
|
|||||||
.Nm arc4random_uniform ,
|
.Nm arc4random_uniform ,
|
||||||
.Nm arc4random_stir ,
|
.Nm arc4random_stir ,
|
||||||
.Nm arc4random_addrandom
|
.Nm arc4random_addrandom
|
||||||
.Nd arc4 random number generator
|
.Nd random number generator
|
||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
|
.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
|
||||||
.ds doc-str-Lb-libbsd \*[str-Lb-libbsd]
|
.ds doc-str-Lb-libbsd \*[str-Lb-libbsd]
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd July 19, 1993
|
.Dd July 19, 1993
|
||||||
.Dt BITSTRING 3bsd
|
.Dt bitstring 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm bit_alloc ,
|
.Nm bit_alloc ,
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd April 29, 2002
|
.Dd April 29, 2002
|
||||||
.Dt BYTEORDER 3bsd
|
.Dt byteorder 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm be16enc , be16dec , be32enc , be32dec , be64enc , be64dec ,
|
.Nm be16enc , be16dec , be32enc , be32dec , be64enc , be64dec ,
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd June 12, 2009
|
.Dd June 12, 2009
|
||||||
.Dt CLOSEFROM 3bsd
|
.Dt closefrom 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm closefrom
|
.Nm closefrom
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: April 23 2014 $
|
.Dd $Mdocdate: April 23 2014 $
|
||||||
.Dt ERRC 3bsd
|
.Dt errc 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm errc ,
|
.Nm errc ,
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd August 15, 2010
|
.Dd August 15, 2010
|
||||||
.Dt EXPAND_NUMBER 3bsd
|
.Dt expand_number 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm expand_number
|
.Nm expand_number
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
.\" $OpenBSD: bzero.3,v 1.10 2014/01/22 21:06:45 tedu Exp $
|
.\" $OpenBSD: bzero.3,v 1.10 2014/01/22 21:06:45 tedu Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: January 22 2014 $
|
.Dd $Mdocdate: January 22 2014 $
|
||||||
.Dt EXPLICIT_BZERO 3bsd
|
.Dt explicit_bzero 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm explicit_bzero
|
.Nm explicit_bzero
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/stdio/fgetln.3,v 1.8 2004/07/16 06:07:12 tjr Exp $
|
.\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/stdio/fgetln.3,v 1.8 2004/07/16 06:07:12 tjr Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd April 19, 1994
|
.Dd April 19, 1994
|
||||||
.Dt FGETLN 3bsd
|
.Dt fgetln 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm fgetln
|
.Nm fgetln
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd July 16, 2004
|
.Dd July 16, 2004
|
||||||
.Dt FGETWLN 3bsd
|
.Dt fgetwln 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm fgetwln
|
.Nm fgetwln
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd July 28, 2017
|
.Dd July 28, 2017
|
||||||
.Dt FLOPEN 3bsd
|
.Dt flopen 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm flopen ,
|
.Nm flopen ,
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd June 14, 2014
|
.Dd June 14, 2014
|
||||||
.Dt FMTCHECK 3bsd
|
.Dt fmtcheck 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm fmtcheck
|
.Nm fmtcheck
|
||||||
|
@@ -23,7 +23,7 @@
|
|||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd November 30, 2002
|
.Dd November 30, 2002
|
||||||
.Dt FPARSELN 3bsd
|
.Dt fparseln 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm fparseln
|
.Nm fparseln
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: November 4 2015 $
|
.Dd $Mdocdate: November 4 2015 $
|
||||||
.Dt FPURGE 3bsd
|
.Dt fpurge 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm fpurge
|
.Nm fpurge
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 19, 2004
|
.Dd March 19, 2004
|
||||||
.Dt FUNOPEN 3bsd
|
.Dt funopen 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm funopen ,
|
.Nm funopen ,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd November 16, 2012
|
.Dd November 16, 2012
|
||||||
.Dt GETBSIZE 3bsd
|
.Dt getbsize 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm getbsize
|
.Nm getbsize
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd July 15, 2001
|
.Dd July 15, 2001
|
||||||
.Dt GETPEEREID 3bsd
|
.Dt getpeereid 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm getpeereid
|
.Nm getpeereid
|
||||||
|
@@ -1,6 +1,4 @@
|
|||||||
.\"
|
.\" Copyright (c) 2022 Guillem Jover <guillem@hadrons.org>
|
||||||
.\" Copyright (c) 2001 Christopher G. Demetriou
|
|
||||||
.\" All rights reserved.
|
|
||||||
.\"
|
.\"
|
||||||
.\" Redistribution and use in source and binary forms, with or without
|
.\" Redistribution and use in source and binary forms, with or without
|
||||||
.\" modification, are permitted provided that the following conditions
|
.\" modification, are permitted provided that the following conditions
|
||||||
@@ -10,34 +8,27 @@
|
|||||||
.\" 2. Redistributions in binary form must reproduce the above copyright
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
||||||
.\" notice, this list of conditions and the following disclaimer in the
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\" 3. All advertising materials mentioning features or use of this software
|
.\" 3. The name of the author may not be used to endorse or promote products
|
||||||
.\" must display the following acknowledgement:
|
|
||||||
.\" This product includes software developed for the
|
|
||||||
.\" NetBSD Project. See http://www.netbsd.org/ for
|
|
||||||
.\" information about NetBSD.
|
|
||||||
.\" 4. The name of the author may not be used to endorse or promote products
|
|
||||||
.\" derived from this software without specific prior written permission.
|
.\" derived from this software without specific prior written permission.
|
||||||
|
.\" .
|
||||||
|
.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
|
.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||||
|
.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||||
|
.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||||
|
.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||||
|
.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
|
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
.Dd August 03, 2022
|
||||||
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
.Dt getprogname 3bsd
|
||||||
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
||||||
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
||||||
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
||||||
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
||||||
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
||||||
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
||||||
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
.\"
|
|
||||||
.\" $FreeBSD$
|
|
||||||
.\"
|
|
||||||
.Dd May 1, 2001
|
|
||||||
.Dt GETPROGNAME 3bsd
|
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm getprogname ,
|
.Nm getprogname ,
|
||||||
.Nm setprogname
|
.Nm setprogname
|
||||||
.Nd get or set the program name
|
.Nd get and set program name
|
||||||
.Sh LIBRARY
|
.Sh LIBRARY
|
||||||
.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
|
.ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
|
||||||
.ds doc-str-Lb-libbsd \*[str-Lb-libbsd]
|
.ds doc-str-Lb-libbsd \*[str-Lb-libbsd]
|
||||||
@@ -54,46 +45,39 @@ for include usage.)
|
|||||||
.Sh DESCRIPTION
|
.Sh DESCRIPTION
|
||||||
The
|
The
|
||||||
.Fn getprogname
|
.Fn getprogname
|
||||||
and
|
returns a string with the current program name,
|
||||||
.Fn setprogname
|
excluding any directory component.
|
||||||
functions manipulate the name of the current program.
|
The function will return
|
||||||
They are used by error-reporting routines to produce
|
.Dv NULL
|
||||||
consistent output.
|
if it was unable to get the program name from any known source.
|
||||||
.Pp
|
|
||||||
The
|
|
||||||
.Fn getprogname
|
|
||||||
function returns the name of the program.
|
|
||||||
If the name has not been set yet, it will return
|
|
||||||
.Dv NULL .
|
|
||||||
.Pp
|
.Pp
|
||||||
The
|
The
|
||||||
.Fn setprogname
|
.Fn setprogname
|
||||||
function sets the name of the program to be the last component of the
|
function sets the current program name,
|
||||||
.Fa progname
|
stripping any directory component prefix.
|
||||||
argument.
|
The function will keep a reference to the passed string pointer,
|
||||||
Since a pointer to the given string is kept as the program name,
|
so it must not be freed or modified while these functions might
|
||||||
it should not be modified for the rest of the program's lifetime.
|
be called.
|
||||||
.Pp
|
.Pp
|
||||||
In
|
The implementations on most BSDs will try to initialize the program name
|
||||||
.Fx ,
|
at program startup time, and
|
||||||
the name of the program is set by the start-up code that is run before
|
.Nm libbsd
|
||||||
.Fn main ;
|
will try to infer it from various known sources depending on the
|
||||||
thus,
|
target system.
|
||||||
running
|
But it is not a portable assumption that the program name will be set
|
||||||
.Fn setprogname
|
without calling
|
||||||
is not necessary.
|
.Fn setprogname ,
|
||||||
Programs that desire maximum portability should still call it;
|
so portable programs should always call it after starting up.
|
||||||
on another operating system,
|
|
||||||
these functions may be implemented in a portability library.
|
|
||||||
Calling
|
|
||||||
.Fn setprogname
|
|
||||||
allows the aforementioned library to learn the program name without
|
|
||||||
modifications to the start-up code.
|
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr err 3 ,
|
.Xr setproctitle 3bsd .
|
||||||
.Xr setproctitle 3bsd
|
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
These functions first appeared in
|
The
|
||||||
|
.Fn setprogname
|
||||||
|
and
|
||||||
|
.Fn getprogname
|
||||||
|
functions first appeared in
|
||||||
.Nx 1.6 ,
|
.Nx 1.6 ,
|
||||||
and made their way into
|
.Fx 4.4 ,
|
||||||
.Fx 4.4 .
|
.Dx 2.1
|
||||||
|
and
|
||||||
|
.Ox 5.4 .
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd September 30, 2003
|
.Dd September 30, 2003
|
||||||
.Dt HEAPSORT 3bsd
|
.Dt heapsort 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm heapsort , mergesort
|
.Nm heapsort , mergesort
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd February 9, 2008
|
.Dd February 9, 2008
|
||||||
.Dt HUMANIZE_NUMBER 3bsd
|
.Dt humanize_number 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm dehumanize_number ,
|
.Nm dehumanize_number ,
|
||||||
|
26
man/libbsd.7
26
man/libbsd.7
@@ -24,8 +24,8 @@
|
|||||||
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||||
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd Mar 30, 2022
|
.Dd August 3, 2022
|
||||||
.Dt LIBBSD 7
|
.Dt libbsd 7
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm libbsd
|
.Nm libbsd
|
||||||
@@ -42,7 +42,7 @@ The library can be used in an overlay mode, which is the preferred way, so
|
|||||||
that the code is portable and requires no modification to the original BSD
|
that the code is portable and requires no modification to the original BSD
|
||||||
code.
|
code.
|
||||||
This can be done easily with the
|
This can be done easily with the
|
||||||
.Xr pkg-config 1
|
.Xr pkgconf 1
|
||||||
library named
|
library named
|
||||||
.Pa libbsd-overlay .
|
.Pa libbsd-overlay .
|
||||||
Or by adding the system-specific include directory with the
|
Or by adding the system-specific include directory with the
|
||||||
@@ -59,12 +59,12 @@ The includes in this case should be the usual system ones, such as
|
|||||||
.In unistd.h .
|
.In unistd.h .
|
||||||
.Pp
|
.Pp
|
||||||
The other way to use the library is to use the namespaced headers,
|
The other way to use the library is to use the namespaced headers,
|
||||||
this is less portable as it makes using
|
which is a discouraged way, being less portable as it makes using
|
||||||
.Nm libbsd
|
.Nm libbsd
|
||||||
mandatory and it will not work on BSD-based systems, and requires
|
mandatory and it will not work on BSD-based systems, and requires
|
||||||
modifying original BSD code.
|
modifying original BSD code.
|
||||||
This can be done with the
|
This can be done with the
|
||||||
.Xr pkg-config 1
|
.Xr pkgconf 1
|
||||||
library named
|
library named
|
||||||
.Pa libbsd .
|
.Pa libbsd .
|
||||||
The includes in this case should be namespaced with
|
The includes in this case should be namespaced with
|
||||||
@@ -79,7 +79,7 @@ program so that the
|
|||||||
.Fn setproctitle_init 3
|
.Fn setproctitle_init 3
|
||||||
function gets invoked automatically at startup time.
|
function gets invoked automatically at startup time.
|
||||||
This can be done with the
|
This can be done with the
|
||||||
.Xr pkg-config 1
|
.Xr pkgconf 1
|
||||||
library named
|
library named
|
||||||
.Pa libbsd-ctor .
|
.Pa libbsd-ctor .
|
||||||
.Sh HEADERS
|
.Sh HEADERS
|
||||||
@@ -134,7 +134,8 @@ originated from, and these various implementations provided are selectable
|
|||||||
at build-time.
|
at build-time.
|
||||||
.Pp
|
.Pp
|
||||||
This is the list of functions that provide multiple implementations:
|
This is the list of functions that provide multiple implementations:
|
||||||
.Bl -tag -width 4m
|
.Pp
|
||||||
|
.Bl -tag -width 4m -compact
|
||||||
.It Fn strnvis 3
|
.It Fn strnvis 3
|
||||||
.It Fn strnunvis 3
|
.It Fn strnunvis 3
|
||||||
.Nx
|
.Nx
|
||||||
@@ -239,6 +240,17 @@ This function is provided by
|
|||||||
2.26, and
|
2.26, and
|
||||||
.Nm musl
|
.Nm musl
|
||||||
1.2.2.
|
1.2.2.
|
||||||
|
.It Fn arc4random 3
|
||||||
|
.It Fn arc4random_buf 3
|
||||||
|
.It Fn arc4random_uniform 3
|
||||||
|
These functions are provided by
|
||||||
|
.Nm glibc
|
||||||
|
2.36.
|
||||||
|
Note that it does not provide the
|
||||||
|
.Fn arc4random_stir 3
|
||||||
|
and
|
||||||
|
.Fn arc4random_addrandom 3
|
||||||
|
functions.
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr arc4random 3bsd ,
|
.Xr arc4random 3bsd ,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/nlist.3,v 1.7 2001/10/01 16:08:51 ru Exp $
|
.\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/gen/nlist.3,v 1.7 2001/10/01 16:08:51 ru Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd April 19, 1994
|
.Dd April 19, 1994
|
||||||
.Dt NLIST 3bsd
|
.Dt nlist 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm nlist
|
.Nm nlist
|
||||||
|
@@ -25,7 +25,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd February 8, 2012
|
.Dd February 8, 2012
|
||||||
.Dt PIDFILE 3bsd
|
.Dt pidfile 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm pidfile_open ,
|
.Nm pidfile_open ,
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
.\" SUCH DAMAGE.
|
.\" SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: September 13 2018 $
|
.Dd $Mdocdate: September 13 2018 $
|
||||||
.Dt USER_FROM_UID 3
|
.Dt user_from_uid 3
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm user_from_uid ,
|
.Nm user_from_uid ,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd September 8, 2016
|
.Dd September 8, 2016
|
||||||
.Dt QUEUE 3bsd
|
.Dt queue 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm SLIST_CLASS_ENTRY ,
|
.Nm SLIST_CLASS_ENTRY ,
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
.\" from: @(#)radixsort.3 8.2 (Berkeley) 1/27/94
|
.\" from: @(#)radixsort.3 8.2 (Berkeley) 1/27/94
|
||||||
.\"
|
.\"
|
||||||
.Dd January 27, 1994
|
.Dd January 27, 1994
|
||||||
.Dt RADIXSORT 3bsd
|
.Dt radixsort 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm radixsort ,
|
.Nm radixsort ,
|
||||||
|
@@ -19,7 +19,7 @@
|
|||||||
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: March 6 2014 $
|
.Dd $Mdocdate: March 6 2014 $
|
||||||
.Dt READPASSPHRASE 3bsd
|
.Dt readpassphrase 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm readpassphrase
|
.Nm readpassphrase
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
.\" $OpenBSD: malloc.3,v 1.126 2019/09/14 13:16:50 otto Exp $
|
.\" $OpenBSD: malloc.3,v 1.126 2019/09/14 13:16:50 otto Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: September 14 2019 $
|
.Dd $Mdocdate: September 14 2019 $
|
||||||
.Dt REALLOCARRAY 3bsd
|
.Dt reallocarray 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm reallocarray ,
|
.Nm reallocarray ,
|
||||||
|
@@ -33,7 +33,7 @@
|
|||||||
.\" $FreeBSD: src/lib/libc/stdlib/malloc.3,v 1.80.2.2.2.1 2010/06/14 02:09:06 kensmith Exp $
|
.\" $FreeBSD: src/lib/libc/stdlib/malloc.3,v 1.80.2.2.2.1 2010/06/14 02:09:06 kensmith Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd September 26, 2009
|
.Dd September 26, 2009
|
||||||
.Dt REALLOCF 3bsd
|
.Dt reallocf 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm reallocf
|
.Nm reallocf
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
.\" $FreeBSD: src/lib/libc/gen/setmode.3,v 1.12 2007/01/09 00:27:55 imp Exp $
|
.\" $FreeBSD: src/lib/libc/gen/setmode.3,v 1.12 2007/01/09 00:27:55 imp Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd January 4, 2009
|
.Dd January 4, 2009
|
||||||
.Dt SETMODE 3bsd
|
.Dt setmode 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm getmode ,
|
.Nm getmode ,
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
.\"
|
.\"
|
||||||
.\" The following requests are required for all man pages.
|
.\" The following requests are required for all man pages.
|
||||||
.Dd December 16, 1995
|
.Dd December 16, 1995
|
||||||
.Dt SETPROCTITLE 3bsd
|
.Dt setproctitle 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm setproctitle
|
.Nm setproctitle
|
||||||
@@ -54,7 +54,7 @@ library routine only needs to be called (before any call to
|
|||||||
and with
|
and with
|
||||||
.Fn main
|
.Fn main
|
||||||
arguments), if the automatic constructor support has not
|
arguments), if the automatic constructor support has not
|
||||||
been linked in through the libbsd-ctor pkg-config file.
|
been linked in through the libbsd-ctor pkgconf file.
|
||||||
.Pp
|
.Pp
|
||||||
The title is set from the executable's name, followed by the
|
The title is set from the executable's name, followed by the
|
||||||
result of a
|
result of a
|
||||||
|
@@ -27,7 +27,7 @@
|
|||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd May 6, 2010
|
.Dd May 6, 2010
|
||||||
.Dt STRINGLIST 3bsd
|
.Dt stringlist 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm stringlist ,
|
.Nm stringlist ,
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: May 31 2007 $
|
.Dd $Mdocdate: May 31 2007 $
|
||||||
.Dt STRLCPY 3bsd
|
.Dt strlcpy 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strlcpy ,
|
.Nm strlcpy ,
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
.\" $FreeBSD: src/lib/libc/string/strmode.3,v 1.9 2003/07/01 15:28:05 maxim Exp $
|
.\" $FreeBSD: src/lib/libc/string/strmode.3,v 1.9 2003/07/01 15:28:05 maxim Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd July 28, 1994
|
.Dd July 28, 1994
|
||||||
.Dt STRMODE 3bsd
|
.Dt strmode 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strmode
|
.Nm strmode
|
||||||
|
@@ -34,7 +34,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd October 11, 2001
|
.Dd October 11, 2001
|
||||||
.Dt STRSTR 3bsd
|
.Dt strstr 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strnstr
|
.Nm strnstr
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
.\" NetBSD: strtol.3,v 1.31 2015/03/11 09:57:35 wiz Exp
|
.\" NetBSD: strtol.3,v 1.31 2015/03/11 09:57:35 wiz Exp
|
||||||
.\"
|
.\"
|
||||||
.Dd November 13, 2015
|
.Dd November 13, 2015
|
||||||
.Dt STRTOI 3bsd
|
.Dt strtoi 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strtoi
|
.Nm strtoi
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd January 18, 2015
|
.Dd January 18, 2015
|
||||||
.Dt STRTONUM 3bsd
|
.Dt strtonum 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strtonum
|
.Nm strtonum
|
||||||
|
@@ -37,7 +37,7 @@
|
|||||||
.\" NetBSD: strtoul.3,v 1.29 2015/03/10 13:00:58 christos Exp
|
.\" NetBSD: strtoul.3,v 1.29 2015/03/10 13:00:58 christos Exp
|
||||||
.\"
|
.\"
|
||||||
.Dd November 13, 2015
|
.Dd November 13, 2015
|
||||||
.Dt STRTOU 3bsd
|
.Dt strtou 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm strtou
|
.Nm strtou
|
||||||
|
@@ -31,7 +31,7 @@
|
|||||||
.\" $FreeBSD: src/share/man/man3/timeradd.3,v 1.3 2003/09/08 19:57:19 ru Exp $
|
.\" $FreeBSD: src/share/man/man3/timeradd.3,v 1.3 2003/09/08 19:57:19 ru Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd June 7, 2010
|
.Dd June 7, 2010
|
||||||
.Dt TIMERADD 3bsd
|
.Dt timeradd 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm timeradd ,
|
.Nm timeradd ,
|
||||||
|
@@ -28,7 +28,7 @@
|
|||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.Dd April 12, 2011
|
.Dd April 12, 2011
|
||||||
.Dt TIMEVAL 3bsd
|
.Dt timeval 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm timeval ,
|
.Nm timeval ,
|
||||||
|
@@ -24,7 +24,7 @@
|
|||||||
.\" * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
.\" * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\" */
|
.\" */
|
||||||
.Dd May 10, 2019
|
.Dd May 10, 2019
|
||||||
.Dt TREE 3bsd
|
.Dt tree 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm SPLAY_PROTOTYPE ,
|
.Nm SPLAY_PROTOTYPE ,
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
.\" @(#)unvis.3 8.2 (Berkeley) 12/11/93
|
.\" @(#)unvis.3 8.2 (Berkeley) 12/11/93
|
||||||
.\"
|
.\"
|
||||||
.Dd March 12, 2011
|
.Dd March 12, 2011
|
||||||
.Dt UNVIS 3bsd
|
.Dt unvis 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm unvis ,
|
.Nm unvis ,
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
.\" @(#)vis.3 8.1 (Berkeley) 6/9/93
|
.\" @(#)vis.3 8.1 (Berkeley) 6/9/93
|
||||||
.\"
|
.\"
|
||||||
.Dd April 22, 2017
|
.Dd April 22, 2017
|
||||||
.Dt VIS 3bsd
|
.Dt vis 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm vis ,
|
.Nm vis ,
|
||||||
|
@@ -36,7 +36,7 @@
|
|||||||
.\" $FreeBSD$
|
.\" $FreeBSD$
|
||||||
.\"
|
.\"
|
||||||
.Dd March 4, 2009
|
.Dd March 4, 2009
|
||||||
.Dt WCSLCPY 3bsd
|
.Dt wcslcpy 3bsd
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
.Nm wcslcat ,
|
.Nm wcslcat ,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/* $OpenBSD: arc4random.c,v 1.53 2015/09/10 18:53:50 bcook Exp $ */
|
/* $OpenBSD: arc4random.c,v 1.58 2022/07/31 13:41:45 tb Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
* Copyright (c) 1996, David Mazieres <dm@uun.org>
|
||||||
@@ -50,6 +50,8 @@
|
|||||||
#define BLOCKSZ 64
|
#define BLOCKSZ 64
|
||||||
#define RSBUFSZ (16*BLOCKSZ)
|
#define RSBUFSZ (16*BLOCKSZ)
|
||||||
|
|
||||||
|
#define REKEY_BASE (1024*1024) /* NB. should be a power of 2 */
|
||||||
|
|
||||||
/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
|
/* Marked MAP_INHERIT_ZERO, so zero'd out in fork children. */
|
||||||
static struct _rs {
|
static struct _rs {
|
||||||
size_t rs_have; /* valid bytes at end of rs_buf */
|
size_t rs_have; /* valid bytes at end of rs_buf */
|
||||||
@@ -74,10 +76,10 @@ _rs_init(unsigned char *buf, size_t n)
|
|||||||
|
|
||||||
if (rs == NULL) {
|
if (rs == NULL) {
|
||||||
if (_rs_allocate(&rs, &rsx) == -1)
|
if (_rs_allocate(&rs, &rsx) == -1)
|
||||||
abort();
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8, 0);
|
chacha_keysetup(&rsx->rs_chacha, buf, KEYSZ * 8);
|
||||||
chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
|
chacha_ivsetup(&rsx->rs_chacha, buf + KEYSZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,6 +110,7 @@ static void
|
|||||||
_rs_stir(void)
|
_rs_stir(void)
|
||||||
{
|
{
|
||||||
unsigned char rnd[KEYSZ + IVSZ];
|
unsigned char rnd[KEYSZ + IVSZ];
|
||||||
|
uint32_t rekey_fuzz = 0;
|
||||||
|
|
||||||
if (getentropy(rnd, sizeof rnd) == -1)
|
if (getentropy(rnd, sizeof rnd) == -1)
|
||||||
_getentropy_fail();
|
_getentropy_fail();
|
||||||
@@ -122,7 +125,10 @@ _rs_stir(void)
|
|||||||
rs->rs_have = 0;
|
rs->rs_have = 0;
|
||||||
memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
|
memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf));
|
||||||
|
|
||||||
rs->rs_count = 1600000;
|
/* rekey interval should not be predictable */
|
||||||
|
chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz,
|
||||||
|
(uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz));
|
||||||
|
rs->rs_count = REKEY_BASE + (rekey_fuzz % REKEY_BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
@@ -4,7 +4,7 @@ D. J. Bernstein
|
|||||||
Public domain.
|
Public domain.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $OpenBSD: chacha_private.h,v 1.2 2013/10/04 07:02:27 djm Exp $ */
|
/* $OpenBSD: chacha_private.h,v 1.3 2022/02/28 21:56:29 dtucker Exp $ */
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
typedef unsigned int u32;
|
typedef unsigned int u32;
|
||||||
@@ -52,7 +52,7 @@ static const char sigma[16] = "expand 32-byte k";
|
|||||||
static const char tau[16] = "expand 16-byte k";
|
static const char tau[16] = "expand 16-byte k";
|
||||||
|
|
||||||
static void
|
static void
|
||||||
chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits,u32 ivbits)
|
chacha_keysetup(chacha_ctx *x,const u8 *k,u32 kbits)
|
||||||
{
|
{
|
||||||
const char *constants;
|
const char *constants;
|
||||||
|
|
||||||
|
@@ -87,6 +87,9 @@ fgetwln(FILE *stream, size_t *lenp)
|
|||||||
*lenp = wused;
|
*lenp = wused;
|
||||||
return wused ? fb->wbuf : NULL;
|
return wused ? fb->wbuf : NULL;
|
||||||
}
|
}
|
||||||
|
/* XXX: Ideally we'd recommend getwline(3), but unfortunately even though it
|
||||||
|
* was part of the ISO/IEC TR 24731-2:2010 draft, it did not make it into C11
|
||||||
|
* and is not widely implemented. */
|
||||||
libbsd_link_warning(fgetwln,
|
libbsd_link_warning(fgetwln,
|
||||||
"The fgetwln() function cannot be safely ported, use fgetwc(3) "
|
"The fgetwln() function cannot be safely ported, use fgetwc(3) "
|
||||||
"instead, as it is supported by C99 and POSIX.1-2001.");
|
"instead, as it is supported by C99 and POSIX.1-2001.");
|
||||||
|
@@ -415,17 +415,17 @@ getentropy_fallback(void *buf, size_t len)
|
|||||||
#ifdef HAVE_GETAUXVAL
|
#ifdef HAVE_GETAUXVAL
|
||||||
#ifdef AT_RANDOM
|
#ifdef AT_RANDOM
|
||||||
/* Not as random as you think but we take what we are given */
|
/* Not as random as you think but we take what we are given */
|
||||||
p = (char *) getauxval(AT_RANDOM);
|
p = (char *) ((intptr_t) getauxval(AT_RANDOM));
|
||||||
if (p)
|
if (p)
|
||||||
HR(p, 16);
|
HR(p, 16);
|
||||||
#endif
|
#endif
|
||||||
#ifdef AT_SYSINFO_EHDR
|
#ifdef AT_SYSINFO_EHDR
|
||||||
p = (char *) getauxval(AT_SYSINFO_EHDR);
|
p = (char *) ((intptr_t) getauxval(AT_SYSINFO_EHDR));
|
||||||
if (p)
|
if (p)
|
||||||
HR(p, pgs);
|
HR(p, pgs);
|
||||||
#endif
|
#endif
|
||||||
#ifdef AT_BASE
|
#ifdef AT_BASE
|
||||||
p = (char *) getauxval(AT_BASE);
|
p = (char *) ((intptr_t) getauxval(AT_BASE));
|
||||||
if (p)
|
if (p)
|
||||||
HD(p);
|
HD(p);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -230,7 +230,7 @@
|
|||||||
#if defined(__LITTLE_ENDIAN__)
|
#if defined(__LITTLE_ENDIAN__)
|
||||||
#define ELF_TARG_DATA ELFDATA2LSB
|
#define ELF_TARG_DATA ELFDATA2LSB
|
||||||
#elif defined(__BIG_ENDIAN__)
|
#elif defined(__BIG_ENDIAN__)
|
||||||
#define ELF_TARG_DATA ELFDATA2LMSB
|
#define ELF_TARG_DATA ELFDATA2MSB
|
||||||
#else
|
#else
|
||||||
#error Unknown SH endianness
|
#error Unknown SH endianness
|
||||||
#endif
|
#endif
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
@@ -144,12 +145,13 @@ common: if (set->cmd2 & CMD2_CLR) {
|
|||||||
|
|
||||||
#define ADDCMD(a, b, c, d) do { \
|
#define ADDCMD(a, b, c, d) do { \
|
||||||
if (set >= endset) { \
|
if (set >= endset) { \
|
||||||
|
ptrdiff_t setdiff = set - saveset; \
|
||||||
BITCMD *newset; \
|
BITCMD *newset; \
|
||||||
setlen += SET_LEN_INCR; \
|
setlen += SET_LEN_INCR; \
|
||||||
newset = reallocarray(saveset, setlen, sizeof(BITCMD)); \
|
newset = reallocarray(saveset, setlen, sizeof(BITCMD)); \
|
||||||
if (newset == NULL) \
|
if (newset == NULL) \
|
||||||
goto out; \
|
goto out; \
|
||||||
set = newset + (set - saveset); \
|
set = newset + setdiff; \
|
||||||
saveset = newset; \
|
saveset = newset; \
|
||||||
endset = newset + (setlen - 2); \
|
endset = newset + (setlen - 2); \
|
||||||
} \
|
} \
|
||||||
|
@@ -38,7 +38,7 @@
|
|||||||
*
|
*
|
||||||
* To avoid any other possible fallout, the constructor is split into a
|
* To avoid any other possible fallout, the constructor is split into a
|
||||||
* new static library that needs to be linked explicitly into programs
|
* new static library that needs to be linked explicitly into programs
|
||||||
* using setproctitle(). As an additional safety measure the pkg-config
|
* using setproctitle(). As an additional safety measure the pkgconf(1)
|
||||||
* linker flags will mark the program as not allowing to be dlopen()ed
|
* linker flags will mark the program as not allowing to be dlopen()ed
|
||||||
* so that we make sure to avoid the problem described above.
|
* so that we make sure to avoid the problem described above.
|
||||||
*/
|
*/
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* $OpenBSD: explicit_bzero.c,v 1.7 2021/03/27 11:17:58 bcook Exp $ */
|
/* $OpenBSD: explicit_bzero.c,v 1.7 2021/03/27 11:17:58 bcook Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2014 Google Inc.
|
* Copyright (c) 2014 Google Inc.
|
||||||
|
* Copyright (c) 2022 Guillem Jover <guillem@hadrons.org>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
@@ -123,6 +124,18 @@ populate_secret(char *buf, ssize_t len)
|
|||||||
ASSERT_EQ(0, close(fds[0]));
|
ASSERT_EQ(0, close(fds[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void __attribute__((__noinline__))
|
||||||
|
blank_stack_side_effects(char *buf, size_t len)
|
||||||
|
{
|
||||||
|
char scratch[SECRETBYTES * 4];
|
||||||
|
|
||||||
|
/* If the read(3) in populate_secret() wrote into the stack, as it
|
||||||
|
* might happen on the Hurd for small data, then we might incorrectly
|
||||||
|
* detect the wrong secret on the stack. */
|
||||||
|
memset(scratch, 0xFF, sizeof(scratch));
|
||||||
|
ASSERT_EQ(NULL, memmem(scratch, sizeof(scratch), buf, len));
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
count_secrets(const char *buf)
|
count_secrets(const char *buf)
|
||||||
{
|
{
|
||||||
@@ -143,6 +156,7 @@ test_without_bzero(void)
|
|||||||
char *res;
|
char *res;
|
||||||
assert_on_stack();
|
assert_on_stack();
|
||||||
populate_secret(buf, sizeof(buf));
|
populate_secret(buf, sizeof(buf));
|
||||||
|
blank_stack_side_effects(buf, sizeof(buf));
|
||||||
res = memmem(altstack, ALTSTACK_SIZE, buf, sizeof(buf));
|
res = memmem(altstack, ALTSTACK_SIZE, buf, sizeof(buf));
|
||||||
ASSERT_NE(NULL, res);
|
ASSERT_NE(NULL, res);
|
||||||
return (res);
|
return (res);
|
||||||
@@ -155,6 +169,7 @@ test_with_bzero(void)
|
|||||||
char *res;
|
char *res;
|
||||||
assert_on_stack();
|
assert_on_stack();
|
||||||
populate_secret(buf, sizeof(buf));
|
populate_secret(buf, sizeof(buf));
|
||||||
|
blank_stack_side_effects(buf, sizeof(buf));
|
||||||
res = memmem(altstack, ALTSTACK_SIZE, buf, sizeof(buf));
|
res = memmem(altstack, ALTSTACK_SIZE, buf, sizeof(buf));
|
||||||
ASSERT_NE(NULL, res);
|
ASSERT_NE(NULL, res);
|
||||||
explicit_bzero(buf, sizeof(buf));
|
explicit_bzero(buf, sizeof(buf));
|
||||||
|
Reference in New Issue
Block a user