Commit e088d6d0 authored by Shawn Webb's avatar Shawn Webb
Browse files

Merge remote-tracking branch 'origin/hardened/current/master' into hardened/current/autoinit

parents 7b9f1f02 6ec76337
......@@ -52,6 +52,10 @@
# xargs -n1 | sort | uniq -d;
# done
 
# 20220318: snd_ds1 and snd_maestro drivers removed
OLD_FILES+=usr/share/man/man4/snd_ds1.4.gz
OLD_FILES+=usr/share/man/man4/snd_maestro.4.gz
# 20220307: remove 330.news
OLD_FILES+=etc/periodic/daily/330.news
 
......
......@@ -69,7 +69,12 @@
* progress). The bit to use depends on the byte order of the target.
*
* On many 32-bit platforms, 64-bit atomics are unavailable (or slow) and so we
* treat the two halves of the 64-bit word as independent values and
* treat the two halves of the 64-bit word as independent values and establish
* an ordering on them such that the guard word is never modified unless the
* lock word is in the locked state. This means that we can do double-checked
* locking by loading the guard word and, if it is not initialised, trying to
* transition the lock word from the unlocked to locked state, and then
* manipulate the guard word.
*/
namespace
{
......@@ -227,7 +232,7 @@ namespace
// If another thread did manage to initialise this, release
// the lock and notify the caller that initialisation is
// done.
lock_word.store(initialised, memory_order::release);
lock_word.store(0, memory_order::release);
return GuardState::InitDone;
}
return GuardState::InitLockSucceeded;
......
......@@ -190,12 +190,14 @@ bool GEPOperator::collectOffset(
if (STy || ScalableType)
return false;
// Insert an initial offset of 0 for V iff none exists already, then
// increment the offset by IndexedSize.
VariableOffsets.insert({V, APInt(BitWidth, 0)});
APInt IndexedSize =
APInt(BitWidth, DL.getTypeAllocSize(GTI.getIndexedType()));
VariableOffsets[V] += IndexedSize;
// Insert an initial offset of 0 for V iff none exists already, then
// increment the offset by IndexedSize.
if (!IndexedSize.isNullValue()) {
VariableOffsets.insert({V, APInt(BitWidth, 0)});
VariableOffsets[V] += IndexedSize;
}
}
return true;
}
......
......@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd September 8, 2016
.Dd March 17, 2022
.Dt GMULTIPATH 8
.Os
.Sh NAME
......@@ -338,7 +338,7 @@ GEOM provider named
.Ar FRED .
.Bd -literal -offset indent
gmultipath label -v FRED /dev/da0 /dev/da2
disklabel -Brw /dev/multipath/FRED auto
disklabel -Bw /dev/multipath/FRED auto
newfs /dev/multipath/FREDa
mount /dev/multipath/FREDa /mnt....
.Ed
......
......@@ -275,8 +275,7 @@ fileargs_cinitnv(cap_channel_t *cas, nvlist_t *limits)
{
cap_channel_t *chann;
fileargs_t *fa;
int serrno, ret;
int flags, operations;
int flags, ret, serrno;
assert(cas != NULL);
......@@ -294,7 +293,7 @@ fileargs_cinitnv(cap_channel_t *cas, nvlist_t *limits)
}
flags = nvlist_get_number(limits, "flags");
operations = nvlist_get_number(limits, "operations");
(void)nvlist_get_number(limits, "operations");
/* Limits are consumed no need to free them. */
ret = cap_limit_set(chann, limits);
......
......@@ -94,15 +94,10 @@ static uint64_t cpu_tick_frequency;
static uint64_t
cputick2usec(uint64_t tick)
{
if (cpu_tick_frequency == 0)
return (0);
if (tick > 18446744073709551) /* floor(2^64 / 1000) */
return (tick / (cpu_tick_frequency / 1000000));
else if (tick > 18446744073709) /* floor(2^64 / 1000000) */
return ((tick * 1000) / (cpu_tick_frequency / 1000));
else
return ((tick * 1000000) / cpu_tick_frequency);
return ((tick / cpu_tick_frequency) * 1000000ULL) +
((tick % cpu_tick_frequency) * 1000000ULL) / cpu_tick_frequency;
}
/*
......
.\"-
.\" Copyright (c) 2021 Christos Margiolis <christos@FreeBSD.org>
.\" Copyright (c) 2021-2022 Christos Margiolis <christos@FreeBSD.org>
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a copy
.\" of this software and associated documentation files (the "Software"), to deal
......@@ -22,7 +22,7 @@
.\" $FreeBSD$
.\"
.Dd September 22, 2021
.Dd March 19, 2022
.Dt MIXER 3
.Os
.Sh NAME
......@@ -40,7 +40,7 @@
.Nm mixer_mod_recsrc ,
.Nm mixer_get_dunit ,
.Nm mixer_set_dunit ,
.Nm mixer_get_mode,
.Nm mixer_get_mode ,
.Nm mixer_get_nmixers ,
.Nm MIX_ISDEV ,
.Nm MIX_ISMUTE ,
......@@ -64,7 +64,7 @@ Mixer library (libmixer, -lmixer)
.Ft int
.Fn mixer_add_ctl "struct mix_dev *parent" "int id" "const char *name" \
"int (*mod)(struct mix_dev *d, void *p)" \
"int (*print)(struct mix_dev *d, void *p)
"int (*print)(struct mix_dev *d, void *p)"
.Ft int
.Fn mixer_add_ctl_s "mix_ctl_t *ctl"
.Ft int
......@@ -105,7 +105,6 @@ The
library allows userspace programs to access and manipulate OSS sound mixers in
a simple way.
.Ss Mixer
.Pp
A mixer is described by the following structure:
.Bd -literal
struct mixer {
......@@ -141,16 +140,19 @@ The fields are follows:
.It Fa devs
A tail queue structure containing all supported mixer devices.
.It Fa dev
A pointer to the currently selected device. The device is one of the elements in
A pointer to the currently selected device.
The device is one of the elements in
.Ar devs .
.It Fa mi
OSS information about the mixer. Look at the definition of the
OSS information about the mixer.
Look at the definition of the
.Ft oss_mixerinfo
structure in
.In sys/soundcard.h
to see its fields.
.It Fa ci
OSS audio card information. This structure is also defined in
OSS audio card information.
This structure is also defined in
.In sys/soundcard.h .
.It Fa name
Path to the mixer (e.g /dev/mixer0).
......@@ -158,40 +160,43 @@ Path to the mixer (e.g /dev/mixer0).
File descriptor returned when the mixer is opened in
.Fn mixer_open .
.It Fa unit
Audio card unit. Since each mixer device maps to a pcmX device,
Audio card unit.
Since each mixer device maps to a pcmX device,
.Ar unit
is always equal to the number of that pcmX device. For example, if the audio
device's number is 0 (i.e pcm0), then
is always equal to the number of that pcmX device.
For example, if the audio device's number is 0 (i.e pcm0), then
.Ar unit
is 0 as well. This number is useful when checking if the mixer's audio
card is the default one.
is 0 as well.
This number is useful when checking if the mixer's audio card is the default one.
.It Fa ndev
Number of devices in
.Ar devs .
.It Fa devmask
Bit mask containing all supported devices for the mixer. For example
if device 10 is supported, then the 10th bit in the mask will be set. By default,
Bit mask containing all supported devices for the mixer.
For example, if device 10 is supported, then the 10th bit in the mask will be set.
By default,
.Fn mixer_open
stores only the supported devices in devs, so it's very unlikely this mask will
stores only the supported devices in devs, so it is very unlikely this mask will
be needed.
.It Fa mutemask
Bit mask containing all muted devices. The logic is the same as with
Bit mask containing all muted devices.
The logic is the same as with
.Ar devmask .
.It Fa recmask
Bit mask containing all recording devices. Again, same logic as with the
other masks.
Bit mask containing all recording devices.
Again, same logic as with the other masks.
.It Fa recsrc
Bit mask containing all recording sources. Yes, same logic again.
Bit mask containing all recording sources.
Yes, same logic again.
.It Fa mode
Bit mask containing the supported modes for this audio device. It holds the value
of the
Bit mask containing the supported modes for this audio device.
It holds the value of the
.Ar dev.pcm.X.mode
sysctl.
.It Fa f_default
Flag which tells whether the mixer's audio card is the default one.
.El
.Ss Mixer device
.Pp
Each mixer device stored in a mixer is described as follows:
.Bd -literal
struct mix_dev {
......@@ -217,7 +222,8 @@ The fields are follows:
.It Fa parent_mixer
Pointer to the mixer the device is attached to.
.It Fa name
Device name given by the OSS API. Devices can have one of the following names:
Device name given by the OSS API.
Devices can have one of the following names:
.Bd -ragged
vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix,
pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3,
......@@ -229,10 +235,11 @@ Device's index in the SOUND_MIXER_NRDEVICES macro defined in
This number is used to check against the masks defined in the
.Ar mixer
structure.
.It Fa left, right
Left and right-ear volumes. Although the OSS API stores volumes in integers from
0-100, we normalize them to 32-bit floating point numbers. However, the volumes
can be denormalized using the
.It Fa left right
Left and right-ear volumes.
Although the OSS API stores volumes in integers from 0-100, \
we normalize them to 32-bit floating point numbers.
However, the volumes can be denormalized using the
.Ar MIX_VOLDENORM
macro if needed.
.It Fa nctl
......@@ -241,9 +248,8 @@ Number of user-defined mixer controls associated with the device.
A tail queue containing user-defined mixer controls.
.El
.Ss User-defined mixer controls
.Pp
Each mixer device can have user-defined controls. The control structure
is defined as follows:
Each mixer device can have user-defined controls.
The control structure is defined as follows:
.Bd -literal
struct mix_ctl {
struct mix_dev *parent_dev; /* parent device */
......@@ -260,75 +266,80 @@ The fields are follows:
.It Fa parent_dev
Pointer to the device the control is attached to.
.It Fa id
Control ID assigned by the caller. Even though the library will
report it, care has to be taken to not give a control the same ID in case
the caller has to choose controls using their ID.
Control ID assigned by the caller.
Even though the library will report it, care has to be taken to not give \
a control the same ID in case the caller has to choose controls using their ID.
.It Fa name
Control name. As with
Control name.
As with
.Ar id ,
the caller has to make sure the same name is not used more than once.
.It Fa mod
Function pointer to a control modification function. As in
Function pointer to a control modification function.
As in
.Xr mixer 8 ,
each mixer control's values can be modified. For example, if we have a
volume control, the
each mixer control's values can be modified.
For example, if we have a volume control, the
.Ar mod
function will be responsible for handling volume changes.
.It Fa print
Function pointer to a control print function.
.El
.Ss Opening and closing the mixer
.Pp
The application must first call the
.Fn mixer_open
function to obtain a handle to the device, which is used as an argument
in most other functions and macros. The parameter
function to obtain a handle to the device, which is used as an argument \
in most other functions and macros.
The parameter
.Ar name
specifies the path to the mixer. OSS mixers are stored under
specifies the path to the mixer.
OSS mixers are stored under
.Ar /dev/mixerN
where
.Ar N
is the number of the mixer device. Each device maps to an actual
is the number of the mixer device.
Each device maps to an actual
.Ar pcm
audio card, so
.Ar /dev/mixer0
is the mixer for
.Ar pcm0 ,
and so on. If
and so on.
If
.Ar name
is
.Ar NULL
or
.Ar /dev/mixer ,
.Fn mixer_open
opens the default mixer (hw.snd.defaul_unit).
opens the default mixer (hw.snd.default_unit).
.Pp
The
.Fn mixer_close
function frees resources and closes the mixer device. It's a good practice to
always call it when the application is done using the mixer.
function frees resources and closes the mixer device.
It is a good practice to always call it when the application is done using the mixer.
.Ss Manipulating the mixer
.Pp
The
.Fn mixer_get_dev
and
.Fn mixer_get_dev_byname
functions select a mixer device, either by its number or by its name
respectively. The mixer structure keeps a list of all the devices, but only
one can be manipulated at a time. Each time a new device is to be manipulated,
one of the two functions has to be called.
functions select a mixer device, either by its number or by its name respectively.
The mixer structure keeps a list of all the devices, but only \
one can be manipulated at a time.
Each time a new device is to be manipulated, one of the two functions has to be called.
.Pp
The
.Fn mixer_set_vol
function changes the volume of the selected mixer device. The
function changes the volume of the selected mixer device.
The
.Ar vol
parameter is a structure that stores the left and right volumes of a given
device. The allowed volume values are between MIX_VOLMIN (0.0) and
MIX_VOLMAX (1.0).
parameter is a structure that stores the left and right volumes of a given device.
The allowed volume values are between MIX_VOLMIN (0.0) and MIX_VOLMAX (1.0).
.Pp
The
.Fn mixer_set_mute
function modifies the mute of a selected device. The
function modifies the mute of a selected device.
The
.Ar opt
parameter has to be one of the following options:
.Bl -tag -width MIX_TOGGLEMUTE -offset indent
......@@ -342,8 +353,9 @@ Toggle the device's mute (e.g mute if unmuted and unmute if muted).
.Pp
The
.Fn mixer_mod_recsrc
function modifies a recording device. The selected device has to be
a recording device, otherwise the function will fail. The
function modifies a recording device.
The selected device has to be a recording device, otherwise the function will fail.
The
.Ar opt
parameter has to be one of the following options:
.Bl -tag -width MIX_REMOVERECSRC -offset indent
......@@ -361,16 +373,17 @@ The
.Fn mixer_get_dunit
and
.Fn mixer_set_dunit
functions get and set the default audio card in the system. Although this is
not really a mixer feature, it's useful to have instead of having to use
the
functions get and set the default audio card in the system.
Although this is not really a mixer feature, it is useful to have instead of \
having to use the
.Xr sysctl 3
controls.
.Pp
The
.Fn mixer_get_mode
function returns the playback/recording mode of the audio device the mixer
belongs to. The available values are the following:
function returns the playback/recording mode of the audio device the mixer \
belongs to.
The available values are the following:
.Bl -tag -width "MIX_STATUS_PLAY | MIX_STATUS_REC" -offset indent
.It Dv MIX_STATUS_NONE
Neither playback nor recording.
......@@ -388,9 +401,9 @@ function returns the total number of mixer devices in the system.
.Pp
The
.Fn MIX_ISDEV
macro checks if a device is actually a valid device for a given mixer. It's very
unlikely that this macro will ever be needed since the library stores only
valid devices by default.
macro checks if a device is actually a valid device for a given mixer.
It is very unlikely that this macro will ever be needed since the library \
stores only valid devices by default.
.Pp
The
.Fn MIX_ISMUTE
......@@ -406,8 +419,8 @@ macro checks if a device is a recording source.
.Pp
The
.Fn MIX_VOLNORM
macro normalizes a value to 32-bit floating point number. It's used
to normalize the volumes read from the OSS API.
macro normalizes a value to 32-bit floating point number.
It is used to normalize the volumes read from the OSS API.
.Pp
The
.Fn MIX_VOLDENORM
......@@ -415,7 +428,6 @@ macro denormalizes the left and right volumes stores in the
.Ft mix_dev
structure.
.Ss Defining and using mixer controls
.Pp
The
.Fn mix_add_ctl
function creates a control and attaches it to the device specified in the
......@@ -428,7 +440,7 @@ function does the same thing as with
.Fn mix_add_ctl
but the caller passes a
.Ft mix_ctl_t *
structure instead of each field as a seperate argument.
structure instead of each field as a separate argument.
.Pp
The
.Fn mixer_remove_ctl
......@@ -438,7 +450,8 @@ The
.Fn mixer_get_ctl
function searches for a control in the device specified in the
.Ar d
argument and returns a pointer to it. The search is done using the control's ID.
argument and returns a pointer to it.
The search is done using the control's ID.
.Pp
The
.Fn mixer_get_ctl_byname
......@@ -446,7 +459,6 @@ function is the same as with
.Fn mixer_get_ctl
but the search is done using the control's name.
.Sh RETURN VALUES
.Pp
The
.Fn mixer_open
function returns the newly created handle on success and NULL on failure.
......@@ -530,10 +542,10 @@ TAILQ_FOREACH(dp, &m->devs, devs) {
(void)mixer_close(m);
.Ed
.Sh SEE ALSO
.Xr mixer 8 ,
.Xr sound 4 ,
.Xr queue 3 ,
.Xr sysctl 3 ,
.Xr queue 3
.Xr sound 4 ,
.Xr mixer 8
and
.Xr errno 2
.Sh AUTHORS
......
......@@ -496,14 +496,11 @@ vm_rev_map_gpa(struct vmctx *ctx, void *addr)
return ((vm_paddr_t)-1);
}
/* TODO: maximum size for vmname */
int
vm_get_name(struct vmctx *ctx, char *buf, size_t max_len)
const char *
vm_get_name(struct vmctx *ctx)
{
if (strlcpy(buf, ctx->name, max_len) >= max_len)
return (EINVAL);
return (0);
return (ctx->name);
}
size_t
......
......@@ -133,7 +133,7 @@ uint32_t vm_get_lowmem_limit(struct vmctx *ctx);
void vm_set_lowmem_limit(struct vmctx *ctx, uint32_t limit);
void vm_set_memflags(struct vmctx *ctx, int flags);
int vm_get_memflags(struct vmctx *ctx);
int vm_get_name(struct vmctx *ctx, char *buffer, size_t max_len);
const char *vm_get_name(struct vmctx *ctx);
size_t vm_get_lowmem_size(struct vmctx *ctx);
size_t vm_get_highmem_size(struct vmctx *ctx);
int vm_set_desc(struct vmctx *ctx, int vcpu, int reg,
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -13,6 +13,7 @@ name="zfs"
desc="Mount and share ZFS datasets"
rcvar="zfs_enable"
start_cmd="zfs_start"
start_postcmd="zfs_poststart"
stop_cmd="zfs_stop"
required_modules="zfs"
......@@ -41,6 +42,17 @@ zfs_start()
fi
}
zfs_poststart()
{
# Some of the keys to decrypt datasets are potentially stored on ZFS
# datasets that just got mounted. Let's try to load those keys and
# mount the datasets.
if checkyesno zfskeys_enable; then
/etc/rc.d/zfskeys start
zfs_start
fi
}
zfs_stop_jail()
{
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
......
File mode changed from 100644 to 100755
......@@ -9,7 +9,7 @@
#
# To make a filesystem on a floppy:
# fdformat [-f <size>] fd<drive>[.<size>]
# disklabel -B -r -w fd<drive>[.<size>] fd<size>
# disklabel -B -w fd<drive>[.<size>] fd<size>
# newfs <opts> fd<drive>[.<size>]
#
# with <opts>:
......
......@@ -28,7 +28,7 @@
.\" $NetBSD: ccdconfig.8,v 1.4 1996/02/28 01:01:17 thorpej Exp $
.\" $FreeBSD$
.\"
.Dd October 3, 2016
.Dd March 17, 2022
.Dt CCDCONFIG 8
.Os
.Sh NAME
......@@ -204,7 +204,7 @@ you have A ccd disk with 10000 sectors you might create a 'd' partition
with offset 16 and size 9984.
.Bd -literal
# disklabel ccd0 > /tmp/disklabel.ccd0
# disklabel -Rr ccd0 /tmp/disklabel.ccd0
# disklabel -R ccd0 /tmp/disklabel.ccd0
# disklabel -e ccd0
.Ed
.Pp
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment