Commit Graph

1311 Commits

Author SHA1 Message Date
Goran Mekić 3524d4ebbe sound examples: Add mmap example
This example opens separate OSS capture and playback channels in mmap
mode, places them into a sync group, and starts them together so both
ring buffers advance on the same device timeline. It then monitors the
capture mmap pointer with SNDCTL_DSP_GETIPTR, converts that pointer into
monotonic absolute progress using the reported block count, and copies
newly recorded audio from the input ring to the matching region of the
output ring.

The main loop is driven by an absolute monotonic frame clock rather than
a fixed relative usleep delay. Wakeups are scheduled from the sample
rate using a small frame step similar to the SOSSO timing model, while
the audio path itself stays intentionally simple: just copy input to
output, with no explicit xrun recovery or processing beyond ring
wraparound handling.

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D53749
2026-04-14 12:59:14 +02:00
Devin Teske 8e68f940c1 New version of jng (2.0)
Changes for jng 1.0 -> 2.0 include:

+ Add experimental MSS clamping
+ Add support for ng_bridge(4) NGM_BRIDGE_GET_STATS (getstats)
+ Add JSON formatted ng_bridge(4) statistics (see above) via "jng stats -j <name>"
+ Add error messages
+ Minor refactoring for code readability (read: quietly() function)
+ Rename eiface variables to jiface to clarify as-for jail interface (not ng_eiface(4))
+ Fix missing description for alternate form of "jng show" usage
+ Update "jng show <name>" to accept multiple names (now "jng show <name> …" is allowed)
+ Update "jng shutdown <name>" to accept multiple names (now "jng shutdown <name> …" is allowed)
+ Add "-a" option to "jng stats" (as-in "jng stats -a") to show all ng_bridge(4) stats
+ Update "jng stats <name>" to accept any kind of name (make it easier to use)
+ Add version ident
+ Remove extraneous line in LICENSE section
+ Add -h to usage statements
+ Bump copyright

Reviewed by:	jlduran
Differential Revision:	https://reviews.freebsd.org/D43516
2026-04-04 19:39:22 +00:00
Dag-Erling Smørgrav d4f6cb7542 build: Move all of lp under LPR option
* Tag related directories with package=lp

* Make the examples/printing directory conditional on MK_LPR

* Make the hosts.lpd(5) manual page conditional on MK_LPR

MFC after:	3 days
2026-02-21 22:25:49 +01:00
David Marker 525d00dcf4 vmrun.sh: add option for sharing directory via p9fs to bhyve
Reviewed by:	markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D55100
2026-02-07 21:29:04 +00:00
Lexi Winter 665ac052aa powerpc: Update CPUTYPE options in make.conf
Document the supported PPC/POWER CPUTYPEs in the example make.conf.

Update bsd.cpu.mk to handle CPUs newer than POWER9, and remove
32-bit CPUTYPEs since we no longer support those at all.

Reviewed by:	imp, jhibbits
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D54257
2026-01-06 04:22:20 +00:00
Alexander Ziaee 3527e7e9f7 example.3: Show updated library macro usage
The LIBRARY section has been deprecated by upstream.
Show the updated usage of the Lb macro in SYNOPSIS.

Fixes:	4c07abdbac (mandoc: Vendor import of upstream at 2025-06-13)
2025-12-17 12:27:39 -05:00
Alexander Ziaee 067b62bd58 examples/mdoc: Remove document description quotes
Quotes in roff do not work the way quotes in shell do,
remove them from the examples to hopefully lead less people astray.

MFC after:	3 days
2025-12-17 12:25:19 -05:00
Maxim Konovalov 27554189e5 khelp: make the module compile again
PR:		291165
MFC after:	1 week
2025-12-16 05:48:58 +00:00
Goran Mekić ebe7b24166 sound examples: Check if setting property was successful
MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D54038
2025-12-08 18:21:30 +01:00
Goran Mekić ebf1d98d60 sound examples: Fix buffer mapping/allocation
The buffer in struct config should be allocated or mmap'ed. The code
without this patch allocates the buffer unconditionally, even for mmap
configs.

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D53939
2025-11-26 20:33:05 +01:00
Ed Maste bf2dc446d1 example.4: Bump deprecation example to FreeBSD 17
The deprecation notice should indicate that the driver or feature will
be removed in a future release, not one that's nearly EOL.

Sponsored by:	The FreeBSD Foundation
2025-11-17 10:13:17 -05:00
Goran Mekić 6a56966686 sound examples: Extend and clean up
- Simplify directory and file structure.
- Clean up and improve code. Add more comments.
- Add polling examples.

MFC after:	1 week
Reviewed by:	christos
Differential Revision:	https://reviews.freebsd.org/D53353
2025-11-12 21:15:59 +01:00
David E. O'Brien 4b6700f345 Document the DEPRECATION NOTICE section for kernel interfaces 2025-10-28 23:51:26 -07:00
Mateusz Piotrowski 83ac79599f examples/mdoc: Remove text of BSD-2-Clause from mdoc examples
We live in the SPDX world now and our example manual pages should
reflect that.

Also, fix the order of the SPDX and copyright lines as per style(9).

Reviewed by:	ziaee
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D53335
2025-10-24 22:17:37 +02:00
Mark Johnston f19f17b3af vmrun.sh: Don't require firmware on amd64 unless -E was specified
PR:		290232
Reported by:	David Marker <dave@freedave.net>
Fixes:		aa34b1d20e ("vmrun.sh: Add arm64 support")
MFC after:	3 days
2025-10-16 14:50:33 +00:00
Lexi Winter 614c8750ce Remove ftpd(8)
This was previously deprecated and is slated for removal in 15.0.
Users who still need ftpd(8) can install the ftp/freebsd-ftpd port.

Retain the ftp(d) PAM services since other FTP daemons use them.

Update /etc/inetd.conf to point to /usr/local.

Add ftpd to ObsoleteFiles, but do not list configuration files since
users may want to preserve these to use with the freebsd-ftpd port.

There is still some language in the manual referring to ftpd(8)
which is relevant to the port, which has been retained but updated
to reference the port.

MFC after:	3 days
Relnotes:	yes
Reviewed by:	cperciva
Differential Revision:	https://reviews.freebsd.org/D52739
2025-09-29 22:53:34 +01:00
Doug Rabson 0fbe9f8ef9 share/examples/oci: Run 'pkg update' with IGNORE_OSVERSION set
This allows the image build to work even if the host's OSVERSION doesn't
match the pkgbase OSVERSION which happens if the host's patch level or
release version isn't the same as pkgbase.

Also fix the image name so that Podman/Buildah will fetch it
automatically, removing the need for users to pull an image and retag it
before using this example.

Reviewed by:		dch
MFC after:		3 days
Differential Revision:	https://reviews.freebsd.org/D50596
2025-07-22 11:46:01 +01:00
Jessica Clarke 8f0a6a9aad share: Delete bitrotted make_*_driver.sh scripts
These scripts have not seen the necessary changes to keep them up to
date with current KPIs and coding practices. They use I/O ports directly
rather than any bus abstractions, use i386 (which is on the way out for
kernel configs) as the architecture of choice for generated kernel
configs, use ISA KPIs, use INTR_TYPE_FAST (renamed in 2000 to INTR_FAST
and removed in 2011), and likely have other issues too that render them
more harm than good for the uninitiated developer looking for a driver
template. If anyone wants to invest time in modernising them they can do
so and bring them back, but for now delete them.

Reviewed by:	cperciva, imp, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50468
2025-07-10 20:36:08 +01:00
Mark Johnston 97452b097a examples/inotify: Handle a zero-length name
Reported by:	jlduran
Fixes:		1d8664d690 ("examples: Add a demo program for inotify")
2025-07-07 13:51:41 +00:00
Mark Johnston 1d8664d690 examples: Add a demo program for inotify
MFC after:	3 months
Sponsored by:	Klara, Inc.
2025-07-04 14:42:34 +00:00
Ahmad Khalifa b670c9bafc newbus: replace leftover device unit wildcards
Reviewed by:	imp, jhb
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50913
2025-06-21 05:57:45 +03:00
Lexi Winter adef3618b8 packages: move smbfs examples to the smbutils package
Reviewed by:	manu, des
Approved by:	des (mentor)
Differential Revision:	https://reviews.freebsd.org/D50285
2025-05-28 02:16:30 +01:00
Mariusz Zaborski de121c5478 jail: copy MTU settings to vnet interface
Reported by:	Arne Steinkamm <arne@steinkamm.com>
Reviewed by:	bapt, thj
Differential Revision:	https://reviews.freebsd.org/D48334
2025-05-09 11:42:07 +02:00
Dave Cottlehuber a0165254bf release: use "runtime" instead of "minimal" for OCI image name
The runtime name is taken from the main pkg-base package that this
image is built off.

Sponsored by:	SkunkWerks, GmbH
MFC after:	3 days
Reviewed by:	dfr, emaste
Differential Revision:	https://reviews.freebsd.org/D50043
2025-04-27 23:47:29 +00:00
Alexander Ziaee ec95b6a3c7 examples/csh: Case insensitive search in pager
This is one of the most commonly requested configurations I'm asked to
share or put in man(1). Currently I think this is the most appropriate
and cannonical place for it.

MFC after:		3 days
Reviewed by:		carlavilla, imp
Approved by:		carlavilla (mentor)
Differential Revision:	https://reviews.freebsd.org/D49833
2025-04-19 12:41:40 -04:00
Doug Rabson d03c82c28d release: add optional OCI images
This adds three OCI archive format files to the release containing
FreeBSD base images suitable for static linked, dynamic linked and shell
workloads. The shell image also contains pkg-bootstrap and can be easily
extended by installing packages (including pkgbase packages).

Reviewed by: dch, cpersiva, jlduran, zlei
Differential Revision: https://reviews.freebsd.org/D46759
MFC after: 2 days
2024-11-08 13:23:08 +00:00
Christos Margiolis 7ae4868a9a sound examples: Delete stale ossinit.h file
Fixes:		3decd659a788("sound examples: Simplify audio example")
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
2024-08-24 15:16:21 +03:00
Christos Margiolis 6747b1a821 sound examples: Move MIDI example out of OSS directory
This example is not related to OSS.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, meka_tilda.center
Differential Revision:	https://reviews.freebsd.org/D46308
2024-08-24 15:07:49 +03:00
Christos Margiolis 3decd659a7 sound examples: Simplify audio example
- Merge ossinit.h and basic.c.
- Rename basic.c to audio.c.
- Use err(3) instead of fprintf(3) + exit(3).
- Some style(9) improvements.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D46307
2024-08-24 15:07:45 +03:00
Christos Margiolis 0ca4d5d820 sound examples: Simplify MIDI example
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D46306
2024-08-24 15:07:40 +03:00
Ed Maste 5c2bc3db20 Remove "All Rights Reserved" from FreeBSD Foundation copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder.

Sponsored by:	The FreeBSD Foundation
2024-07-30 12:16:36 -04:00
Christos Margiolis f08ecd24a1 sound examples: Add sndstat nvlist example
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45969
2024-07-27 14:54:40 +03:00
Christos Margiolis cb00491fbc sound examples: Organize files in directories
More examples will be added, so it's better to be organized.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D45968
2024-07-27 14:54:35 +03:00
Warner Losh e9ac41698b Remove residual blank line at start of Makefile
This is a residual of the $FreeBSD$ removal.

MFC After: 3 days (though I'll just run the command on the branches)
Sponsored by: Netflix
2024-07-15 16:43:39 -06:00
Andrew Turner eda7eff0d2 share/examples/etc/make.conf: Remove old arm archs
Remove the pre-armv7 architecture options from the example make.conf.
These have either been removed, or will soon be removed from the build.

Reviewed by:	manu, imp, emaste
Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D45636
2024-06-20 09:26:10 +00:00
Alan Somers 873881b7db targ: fix compiling the example
The targ example program doesn't compile with current clang, and
probably hasn't for multiple releases.  Fix the build.  I don't have the
right hardware to test it, though.

MFC after:	2 weeks
Sponsored by:	Axcient
2024-06-18 18:17:31 -06:00
George V. Neville-Neil 793556efde Fix up a mistake in the CFLAGS added. Pointed out by jrtc. 2024-05-01 13:21:59 -04:00
George V. Neville-Neil e60ca52b72 Out of tree modules should be built with DTrace by default. 2024-05-01 13:00:52 -04:00
Mark Johnston c100fe0ba3 examples: Install bhyve files on arm64
Sponsored by:	Innovate UK
2024-05-01 11:24:05 -04:00
Mark Johnston aa34b1d20e vmrun.sh: Add arm64 support
For now, we enumerate disk devices before network devices.  This is to
work around a problem wherein u-boot remaps BARs during boot in a way
that bhyve does not handle.  Some discussion and experiments suggest
that this can be handled by having bhyve not map BARs during boot on
arm64; until a solution is implemented, however, this workaround is
sufficient for simple usage and doesn't have any real downsides.

The console and bootrom are specified slightly differently versus amd64,
and a few of vmrun.sh's command-line options are amd64-only.

Reviewed by:	corvink, jhb
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D44933
2024-05-01 08:36:30 -04:00
Mark Johnston 63d5f8c0f2 vmrun.sh: Stop passing -A to bhyve
It's a no-op now.

Sponsored by:	Innovate UK
2024-04-24 09:58:04 -04:00
Lexi Winter c3dd71ab4c share/examples: move examples into appropriate packages
Allow a new variable SE_xxxPACKAGE to be used to place an example group
into a package.

Move the following examples into existing appropriate packages:

- bhyve examples into FreeBSD-bhyve
- bootforth examples into FreeBSD-bootloader
- csh examples into FreeBSD-csh
- ipfw examples into FreeBSD-ipfw
- jail examples into FreeBSD-jail
- pf examples into FreeBSD-pf
- ppp examples into FreeBSD-ppp
- printing examples into FreeBSD-lp
- uefisign examples into FreeBSD-efi-tools
- ypldap examples into FreeBSD-yp
- hast examples into FreeBSD-hast

Move all other examples into the new 'FreeBSD-examples' package.

This removes a significant number of files from the FreeBSD-utilities
package.

Reviewed by: imp, manu
Pull Request: https://github.com/freebsd/freebsd-src/pull/1176
2024-04-22 22:36:35 -06:00
Assume-Zhan 0789c3bd2c share/examples/sound: Fix spelling "controller"
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/994
2024-02-13 14:18:04 +08:00
YuZhong-Chen edc7b46ebe Fix typo in share/examples/sunrpc/dir/rls.c
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/974
2024-02-13 12:36:58 +08:00
YuZhong-Chen ee40f9e860 Fix typo in share/examples/sound/ossinit.h
Event:		Advanced UNIX Programming Course (Fall’23) at NTHU.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/974
2024-02-13 12:36:05 +08:00
Lexi Winter 4339f1e667 share/examples/IPv6/USAGE: remove
This document dates from the KAME days and, among other things,
references the 'prefix' command which has not existed for a long time.
Since IPv6 configuration is now documented in the Handbook, remove this
obsolete file.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1094
2024-02-02 08:30:18 -07:00
Christos Margiolis 2ee77056d2 vmrun.sh: allow device name arguments in pci-passthru option
This is more intuitive than having to run `pciconf -l` and figure out
the bus/slot/func entry manually.

Reviewed by:	markj
Sponsored by;	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43270
2024-01-02 20:20:42 +02:00
Christos Margiolis 029b10b16a vmrun.sh: add missing options in usage message
Reviewed by:	markj
Sponsored by;	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D43269
2024-01-02 20:20:08 +02:00
Dimitry Andric 69c8025a49 Silence snprintf truncation warnings in printf_test examples
Building share/examples/tests with clang 18 results in a few warnings
like:

  share/examples/tests/tests/plain/printf_test.c:67:6: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 17 [-Werror,-Wformat-truncation]
     67 |         if (snprintf(buffer, sizeof(buffer), "0123456789abcdef") != 16)
        |             ^

Since these tests are meant as an example of testing snprintf overflow,
suppress the warnings.

MFC after:	3 days
2023-12-21 23:45:52 +01:00
Warner Losh 0044e9124e share: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00