kernel/apple_ir: Add Apple IR receiver driver.
USB HID driver for Apple IR receivers found in Mac computers
(2006-2011 era). Uses the u4b USB stack with interrupt transfers
and delivers key events through evdev.
Supports Apple Remote (proprietary 5-byte protocol) and generic NEC
IR remotes. Synthetic key-up events are generated via a 125ms callout
since the hardware sends no release reports.
Add UQ_HID_IGNORE quirks for all Apple IR receiver product IDs so
uhid(4) does not claim the device first. DragonFly's newbus probe
short-circuits on a 0 return, so the quirk is necessary to prevent
uhid's class-wide HID match from winning.
kernel/apple_smc: Table-drive sysctl registration and collapse duplicate handlers.
Replace fanminspeed/fanmaxspeed/fantargetspeed with single fanrw handler
using key index packed in arg2 bits [15:8]. Collapse sms_x/y/z, light
left/right, and mssd/mssp wrappers into table-indexed handlers. Table-drive
per-fan and system-state sysctl registration loops.
hammer2: factor out directory mtime update in vnops
Add hammer2_update_dir_mtime() for the repeated mtime/ctime update
pattern used after directory-modifying operations. Easier to maintain
and document in one place.
hammer: factor out blockmap layer CRC verification
Add hammer_verify_layer1_crc() and hammer_verify_layer2_crc() helpers
for the double-check-under-lock CRC pattern used across all blockmap
functions. Easier to maintain and document in one place.
awk(1): Override FOPEN_MAX to handle 64 open files instead of 20
Awk uses a fixed array of size FOPEN_MAX to track the open files, so it
could only open max 20 files as the default FOPEN_MAX is defined to be
20 in <stdio.h>. Override FOPEN_MAX to 64 to support more open files.
Obtained-from: FreeBSD (commit d97cdd33492f5afe2150e1fced657c9a31911c67)
bsd.crunchgen.mk: Pass CFLAGS to "make exe" to enable WARNS
The "make exe" phase builds the stub objects and the final crunched
executable. Because the crunchgen(1) generated makefile does not
include any makefile from the system, the ${CFLAGS} was empty and the
${WARNS} tunable was ineffective.
By explicitly passing the ${CFLAGS} to the "make exe" phase, the ${WARNS}
is correctly accounted in the main Makefile (that includes
<bsd.crunchgen.mk>) and works as expected.
The "make objs" that builds the objects of each individual tool to be
crunched is not affected. Those objects are already built with their
corresponding ${WARNS} and ${CFLAGS}.
As we're explicitly setting the ${CFLAGS}, filter the LTO flags in
<bsd.crunchgen.mk> and thus revert the previous commit
a3f29142615c9b60b7f2d6c4eecbf55e595d778b.
[6 lines not shown]
crunchgen(1): Fix compilation warnings (prepare for future update)
Fix the following compilation warnings when we enable WARNS for
initrd/{rescue,rescue.libcrypto} build in the future:
```
rescue.c: In function 'cmpstringp':
rescue.c:88:20: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
const char *s1 = *(const char **)p1;
^
rescue.c:89:20: error: cast discards 'const' qualifier from pointer target type [-Werror=cast-qual]
const char *s2 = *(const char **)p2;
^
rescue.c: In function 'crunched_usage':
rescue.c:96:1: error: old-style function definition [-Werror=old-style-definition]
crunched_usage()
^~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
[2 lines not shown]
uname(1): Add '-b' flag to show the kernel's build-ID
The kernel's build-ID has been exposed via the "kern.build_id" sysctl
MIB. Add a '-b' flag to uname(1) to report it.
Obtained-from: FreeBSD (https://reviews.freebsd.org/D20511)
kern.pre.mk: Introduce ${ELDFLAGS} to help customize linker flags
Similar to the case in kmod.mk, introduce the ${ELDFLAGS} variable to
collect the linker flags and makes it easier to customize them.
While there, clean up a bit.
platform: Remove obsolete '.exception_ranges' from linker scripts
As the comment says, it was generate by the Sun/Oracle C++ compiler,
so does not apply to us. Just remove it as FreeBSD did.
See also: FreeBSD
kernel: Expose the build-ID via "kern.build_id" sysctl
Update the linker scripts to expose the start and end of the
linker-generated build-ID, and add the "kern.build_id" sysctl handler to
fetch the information.
A subsequent commit will update uname(1) to report it as well.
Obtained-from: FreeBSD (https://reviews.freebsd.org/D20326)
platform: Use INT3 instead of NOP for x86 binary padding
We should never end up executing the inter-function padding, so we
are better off faulting than silently carrying on to whatever function
happens to be next.
Obtained-from: FreeBSD (https://reviews.freebsd.org/D10047)
stand: Remove obsolete 'FREEBSD_ELF' define
The last use of it was removed from <link.h> back in 2002 in FreeBSD, so
it never affected DragonFly.
Obtained-from: FreeBSD (https://reviews.freebsd.org/D42964)
platform: Move debug sections to a common linker script
In addition, sync the debug sections with FreeBSD's to add DWARF 4 and 5.
Obtained-from: FreeBSD (https://reviews.freebsd.org/D44071)
platform: Remove .ldata/.lrodata/.lbss sections from ldscript
The kernel is compiled with '-mcmodel=kernel', so the compiler never
emits the large model sections (e.g., .ldata/.lrodata/.lbss). Therefore,
remove such sections from the kernel linker scripts.
This change has another major benefit: the '.bss' section now correctly
lies at the end, so the linker does not need to allocate real file space
to store the BSS section. As a result, the kernel file size is reduced
by 14MB (e.g., stripped kernel reduces from 29MB to 15MB)! Meanwhile,
the following gold linker warning is also fixed:
```
/usr/libexec/binutils234/elf/ld.gold: warning: script places BSS section in the middle of a LOAD segment; space will be allocated in the file
```
See also: FreeBSD (https://reviews.freebsd.org/D21859)
platform: Remove wrong comment from ldscript
The comment 'default linker script' was copied from the GNU ld's default
linker script, and is obviously wrong for the kernel, so just remove it.