dd(1): Sync with FreeBSD
New features:
- Added conv=fsync flag
- Added conv=fdatasync flag
- Added oflag=fsync and oflag=sync flags
- Added iflag=fullblock flag
- Added iflag=direct and oflag=direct flags that set O_DIRECT
Fixes:
- Fixed SIGINT handling.
kern: Clean up malloc_uninit()
* Correct the diagnostic log message by omitting the CPU id, which
doesn't apply here. The unfreed bytes must be summed from all CPUs.
* Clean up excess INVARIANTS ifdef's by using '__debugvar' instead.
kern: Remove the little-use kvasnprintf() and kvasfree()
The kvasnprintf() requires a known max length, so it's basically the
same as kmalloc()+kvsnprintf(). Therefore, it's different to vasprintf()
and is of little use. Actually, the DRM subsystem implements its
kvasprintf(), the vasprintf() equivalent.
For simplicity, just remove kvasnprintf()+kvasfree() and convert
existing code to either use a buffer array or manually call kmalloc().
bsd.dep.mk: Fix mkdep(1) parameter order
I'll need to use ${MKDEP} to set extra compiler flags (e.g.,
`-include .../header.h`) in the forthcoming GDB. This would break the
${_MKDEPSRCDIR} because mkdep(1) would pass all remaining arguments to
${CC} once it comes across an unknown argument.
So move ${MKDEP} after ${_MKDEPSRCDIR} to fix the parameter order.
This is a follow-up fix to commit
dec8bf51d1d328f09ffaaf9e4c5a458a346ef590.
gmp: Update and rewrite makefiles
* Update the makefiles to build the imported 6.3.0.
* Split the building of file generation tools into a separate makefile
in the `tools/` subdirectory, and move the library building to the
`lib/` subdirectory.
* Use <bsd.hostprog.mk> to build the generation tools.
* Keep `gmp.h` at the main directory so there is no `config.h` that
may possibly confuse the GMP users, such as the case with MPC that's
got fixed in commit 140e2138b6e2614a71884aa87702138fe3691e53.
* Re-organize the sources in a separate `Makefile.src`. Just copy the
`mpn_objs_in_libgmp` list from the generated Makefile, and thus
greatly simplify the makefile rules.
* Adjust cc80/cc120 to use the updated `libgmp.a` location.
bsd.hostprog.mk: Reimplement to support multiple programs
Introduce PROGS and PROGS_CXX together with per-program variables to
support the multiple-program mode, allowing to build multiple programs
with one makefile. This mode can help simplify the makefiles as well as
the hierarchies.
The original single-program mode is kept backward compatible.
mpc: Fix inclusion paths to correctly include its own 'config.h'
It wrongly included the GMP's 'config.h', as the '../gmp/' directory has
both 'gmp.h' and 'config.h'.
libncurses: Remove obsolete targets from libtic's Makefile
The <bsd.hostlib.mk> already handles the 'afterdepend' and 'install'
targets, so no need to manually define them.
world: Remove obsolete 'build-tools' uses for host programs
These host programs (except share/syscons/mapsmk) are built with
<bsd.hostprog.mk>, which has replaced the 'build-tools' target in 2004.
So just remove the obsolete 'build-tools' target as well as the
'install' target.
Also remove the 'build-tools' target from <bsd.sys.mk>.
kernel: Fix two bugs in gptinit()
* Fix the wrong type for 'table_lba'; should be 'uint64_t' instead of
'uint32_t', and fix the read to use le64toh().
* Allow the partition table has entries more than 128 (MAX_GPT_ENTRIES).
The UEFI specification basically has no upper limit, but we limit to
parsing the first 128 (MAX_GPT_ENTRIES) entries.
This actually happens with a Proxmox v9.2 ISO, which uses GPT and
allocates 44 blocks for the partition table, so there are 176 entries.
For example, here is the gpt(8) of a USB stick written with this ISO:
```
Disk da8: 57.3GB (120225792 512-byte sectors)
Start Sectors Size Index Contents
0 1 512B - PMBR
1 1 512B - Primary GPT header
[13 lines not shown]
gcc120,gcc80: Fix depend generation for multiple libraries
In the makefiles of these libraries, the `depend` and `all` targets were
used to create the generated files, so the builtin `depend` rules that
call mkdep(1) were simply overridden and ignored.
Fix this by using the `beforedepend` target instead. This convention
has been already used in a few other libraries, such as
gcc*/libstdc++/components/*.
mk: Fix ${group}_FLAGS_FILES to support sources with subdirs
Previously ${group}_FLAGS_FILES required bare filenames as the
per-group flags were propagated into build commands via
${_${.IMPSRC:T}_FLAGS}, where the `:T` suffix required the subdirs
be ignored for the sources. However, this caused the following problems:
* `make depend` on ${group}_FLAGS_FILES will fail when the subdirs of
the sources are excluded, because `make` will be unable to find them.
* Ignoring the subdir portion of the sources can make the flags be
wrongly set for unwanted files in different directories that share a
same filename.
To fix the above problems, propagate the per-group flags via variables
that use the target names, which are predictable and includes the
subdirs that avoid the ambiguity. In addition, strip the filename
suffix so the flags apply to all kinds of objects such as *.o, *.po and
*.So.
Adjust cc120/libbackend/Makefile accordingly.