History log of /src/lib/libutil/libutil.h (Results 1 – 25 of 367)
Revision Date Author Comments
# 7e70589b 03-Mar-2026 Kyle Evans <kevans@FreeBSD.org>

libutil: take a size_t in trimdomain()

INT_MAX is already larger than a reasonable hostname might be, but
size_t makes some of this easier to reason about as we do arithmetic
with it. This would ma

libutil: take a size_t in trimdomain()

INT_MAX is already larger than a reasonable hostname might be, but
size_t makes some of this easier to reason about as we do arithmetic
with it. This would maybe not be worth it if we had to bump the
soversion because of it, but libutil does symbol versioning now so we
can provide a compat shim.

While we're here, fix some inconsistencies in argument names in the
manpage.

Reviewed by: des
Obtained from: https://github.com/apple-oss-distributions/libutil
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D54622

show more ...


# ab1c6874 06-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Backward compatibility for expand_number()

Reimplement expand_number() in terms of expand_unsigned(), which takes
a pointer to uint64_t like expand_number() did before. Provide a macro
tha

libutil: Backward compatibility for expand_number()

Reimplement expand_number() in terms of expand_unsigned(), which takes
a pointer to uint64_t like expand_number() did before. Provide a macro
that picks the correct version based on the type of the argument.

Fixes: 2e0caa7c7e14
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D51723

show more ...


# 8d8a745c 02-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Drop auth_getval()

This function has been an empty stub for years; now that we're bumping
the library version, we can finally get rid of it.

Fixes: 0c381b7f0570
Reviewed by: kib, emaste
D

libutil: Drop auth_getval()

This function has been an empty stub for years; now that we're bumping
the library version, we can finally get rid of it.

Fixes: 0c381b7f0570
Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D51704

show more ...


# 2e0caa7c 02-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Really fix expand_number(3)

It is unclear whether this function was originally intended to support
negative numbers. The original implementation used signed integers,
but actually giving i

libutil: Really fix expand_number(3)

It is unclear whether this function was originally intended to support
negative numbers. The original implementation used signed integers,
but actually giving it a negative number as input would have invoked
undefined behavior, and the comments (since removed) only mentioned
positive numbers. Fifteen years ago, I “fixed” this by changing the
type from signed to unsigned. However, it would still have accepted
an input with a leading minus sign (though it would have returned its
absolute value). Fifteen years on, change the type back to signed and
fix the logic so it correctly handles both positive and negative
numbers without invoking undefined behavior. This makes it a better
match for humanize_number(3), which it is supposed to complement.

Fixes: bbb2703b4f46
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D51542

show more ...


# aae23170 08-Sep-2024 Bojan Novković <bnovkov@FreeBSD.org>

libutil: Move cpuset(1) domain policy parsing code into libutil

cpuset(1) implements a domainset(9) policy parser that is used to
translate a <policy>:<domain_list> string into a domainset_t mask
an

libutil: Move cpuset(1) domain policy parsing code into libutil

cpuset(1) implements a domainset(9) policy parser that is used to
translate a <policy>:<domain_list> string into a domainset_t mask
and a valid domainset policy. This change moves the domainset parsing
code into a new cpuset.c function - 'domainset_parselist'.

The existing cpuset.c code was refactored into a generalized list
parsing function which is now used to parse both CPU sets and domain
sets. This is the same approach used in cpuset(1).

Reviewed by: markj, ziaee (manpages)
Differential Revision: https://reviews.freebsd.org/D46607

show more ...


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 04eeb364 01-Jun-2023 Baptiste Daroussin <bapt@FreeBSD.org>

cpuset(3): Move cpuset's parselist function into libutil

In order to allow to add cpuset(2) functionality to more utilities than just
cpuset(1) move the parselist code into libutil

While here, mak

cpuset(3): Move cpuset's parselist function into libutil

In order to allow to add cpuset(2) functionality to more utilities than just
cpuset(1) move the parselist code into libutil

While here, make the code a little more "library" friendly, by returning a range
of various errors so that the consumer can check for them and report appropriate
error message to the users

(One of the planed usage is the jail(8) utility)

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D12873

show more ...


# 287451fd 11-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

pidfile: add pidfile_signal

Differential Revision: https://reviews.freebsd.org/D34681


# f2069331 26-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

libutil: add kinfo_getswapvmobject(3)

which is the wrapper around the vm.swap_objects sysctl, same as
kinfo_getvmobject(3) wraps vm.objects.

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differenti

libutil: add kinfo_getswapvmobject(3)

which is the wrapper around the vm.swap_objects sysctl, same as
kinfo_getvmobject(3) wraps vm.objects.

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29754

show more ...


# 30d21d27 18-Nov-2020 Stefan Eßer <se@FreeBSD.org>

Add function getlocalbase() to libutil.

This function returns the path to the local software base directory, by
default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h
when building

Add function getlocalbase() to libutil.

This function returns the path to the local software base directory, by
default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h
when building the world).

The value returned can be overridden by 2 methods:

- the LOCALBASE environment variable (ignored by SUID programs)
- else a non-default user.localbase sysctl value

Reviewed by: hps (earlier version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27236

show more ...


# 8e103108 15-Nov-2020 Scott Long <scottl@FreeBSD.org>

Revert the whole getlocalbase() set of changes while a different design is
hashed out.


# bcf9ae27 14-Nov-2020 Scott Long <scottl@FreeBSD.org>

Fix a problem with r367686 related to the use of ssize_t. Not sure how this
escaped prior testing, but it should be better now.

Reported by: lots


# 98b76d22 14-Nov-2020 Scott Long <scottl@FreeBSD.org>

Add the library function getlocalbase and its manual page. This helps to
unify the retrieval of the various ways that the local software base directory,
typically "/usr/local", is expressed in the s

Add the library function getlocalbase and its manual page. This helps to
unify the retrieval of the various ways that the local software base directory,
typically "/usr/local", is expressed in the system.

Reviewed by: se
Differential Revision: https://reviews.freebsd.org/D27022

show more ...


# ab1c6874 06-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Backward compatibility for expand_number()

Reimplement expand_number() in terms of expand_unsigned(), which takes
a pointer to uint64_t like expand_number() did before. Provide a macro
tha

libutil: Backward compatibility for expand_number()

Reimplement expand_number() in terms of expand_unsigned(), which takes
a pointer to uint64_t like expand_number() did before. Provide a macro
that picks the correct version based on the type of the argument.

Fixes: 2e0caa7c7e14
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D51723

show more ...


# 8d8a745c 02-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Drop auth_getval()

This function has been an empty stub for years; now that we're bumping
the library version, we can finally get rid of it.

Fixes: 0c381b7f0570
Reviewed by: kib, emaste
D

libutil: Drop auth_getval()

This function has been an empty stub for years; now that we're bumping
the library version, we can finally get rid of it.

Fixes: 0c381b7f0570
Reviewed by: kib, emaste
Differential Revision: https://reviews.freebsd.org/D51704

show more ...


# 2e0caa7c 02-Aug-2025 Dag-Erling Smørgrav <des@FreeBSD.org>

libutil: Really fix expand_number(3)

It is unclear whether this function was originally intended to support
negative numbers. The original implementation used signed integers,
but actually giving i

libutil: Really fix expand_number(3)

It is unclear whether this function was originally intended to support
negative numbers. The original implementation used signed integers,
but actually giving it a negative number as input would have invoked
undefined behavior, and the comments (since removed) only mentioned
positive numbers. Fifteen years ago, I “fixed” this by changing the
type from signed to unsigned. However, it would still have accepted
an input with a leading minus sign (though it would have returned its
absolute value). Fifteen years on, change the type back to signed and
fix the logic so it correctly handles both positive and negative
numbers without invoking undefined behavior. This makes it a better
match for humanize_number(3), which it is supposed to complement.

Fixes: bbb2703b4f46
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D51542

show more ...


# aae23170 08-Sep-2024 Bojan Novković <bnovkov@FreeBSD.org>

libutil: Move cpuset(1) domain policy parsing code into libutil

cpuset(1) implements a domainset(9) policy parser that is used to
translate a <policy>:<domain_list> string into a domainset_t mask
an

libutil: Move cpuset(1) domain policy parsing code into libutil

cpuset(1) implements a domainset(9) policy parser that is used to
translate a <policy>:<domain_list> string into a domainset_t mask
and a valid domainset policy. This change moves the domainset parsing
code into a new cpuset.c function - 'domainset_parselist'.

The existing cpuset.c code was refactored into a generalized list
parsing function which is now used to parse both CPU sets and domain
sets. This is the same approach used in cpuset(1).

Reviewed by: markj, ziaee (manpages)
Differential Revision: https://reviews.freebsd.org/D46607

show more ...


# b3e76948 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 04eeb364 01-Jun-2023 Baptiste Daroussin <bapt@FreeBSD.org>

cpuset(3): Move cpuset's parselist function into libutil

In order to allow to add cpuset(2) functionality to more utilities than just
cpuset(1) move the parselist code into libutil

While here, mak

cpuset(3): Move cpuset's parselist function into libutil

In order to allow to add cpuset(2) functionality to more utilities than just
cpuset(1) move the parselist code into libutil

While here, make the code a little more "library" friendly, by returning a range
of various errors so that the consumer can check for them and report appropriate
error message to the users

(One of the planed usage is the jail(8) utility)

Reviewed by: jilles
Differential Revision: https://reviews.freebsd.org/D12873

show more ...


# 287451fd 11-Mar-2022 Mateusz Guzik <mjg@FreeBSD.org>

pidfile: add pidfile_signal

Differential Revision: https://reviews.freebsd.org/D34681


# f2069331 26-Oct-2021 Konstantin Belousov <kib@FreeBSD.org>

libutil: add kinfo_getswapvmobject(3)

which is the wrapper around the vm.swap_objects sysctl, same as
kinfo_getvmobject(3) wraps vm.objects.

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differenti

libutil: add kinfo_getswapvmobject(3)

which is the wrapper around the vm.swap_objects sysctl, same as
kinfo_getvmobject(3) wraps vm.objects.

Submitted by: Yoshihiro Ota
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29754

show more ...


# 30d21d27 18-Nov-2020 Stefan Eßer <se@FreeBSD.org>

Add function getlocalbase() to libutil.

This function returns the path to the local software base directory, by
default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h
when building

Add function getlocalbase() to libutil.

This function returns the path to the local software base directory, by
default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h
when building the world).

The value returned can be overridden by 2 methods:

- the LOCALBASE environment variable (ignored by SUID programs)
- else a non-default user.localbase sysctl value

Reviewed by: hps (earlier version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27236

show more ...


# 8e103108 15-Nov-2020 Scott Long <scottl@FreeBSD.org>

Revert the whole getlocalbase() set of changes while a different design is
hashed out.


# bcf9ae27 14-Nov-2020 Scott Long <scottl@FreeBSD.org>

Fix a problem with r367686 related to the use of ssize_t. Not sure how this
escaped prior testing, but it should be better now.

Reported by: lots


# 98b76d22 14-Nov-2020 Scott Long <scottl@FreeBSD.org>

Add the library function getlocalbase and its manual page. This helps to
unify the retrieval of the various ways that the local software base directory,
typically "/usr/local", is expressed in the s

Add the library function getlocalbase and its manual page. This helps to
unify the retrieval of the various ways that the local software base directory,
typically "/usr/local", is expressed in the system.

Reviewed by: se
Differential Revision: https://reviews.freebsd.org/D27022

show more ...


12345678910>>...15