Page MenuHomeFreeBSD

Add backwards API compatibility to kbdcontrol with Unicode support for dead keys
ClosedPublic

Authored by se on Feb 5 2023, 10:41 AM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 23, 8:37 PM
Unknown Object (File)
Fri, Nov 22, 11:31 PM
Unknown Object (File)
Thu, Nov 21, 4:08 PM
Unknown Object (File)
Tue, Nov 19, 8:23 AM
Unknown Object (File)
Tue, Nov 5, 7:24 AM
Unknown Object (File)
Oct 17 2024, 8:08 PM
Unknown Object (File)
Oct 17 2024, 8:08 PM
Unknown Object (File)
Oct 17 2024, 8:07 PM
Subscribers
None

Details

Summary

Unicode dead key support has been provided in review D38381, including backwards compatibility for an old kbdcontrol binary on a new kernel.
This patch set is meant to be applied after D38381 to temporarily allow a new kbdcontrol binary to operate on a new kernel.

Without this patch set a new kbdcontrol binary will only be able to set or display the main key code table, but not the dead key table for accented characters.
This would still provide sufficient console support to perform typical system administration tasks on files consisting of ASCII compatible names, but it might be inconvenient when a new world has to be productively used on an old kernel for some time.

This patch set has been created relative to -CURRENT as of today (without D38381 applied), but should be applied on top of D38381 to allow it to be reverted after a sufficient grace period. This will revert kbio.h back to the version as of D38381 (i.e. should remove the // from #ifdef _KERNEL lines in this patch - which are used instead of removal of those pre-processor lines to symbolize the temporary nature of this fallback code).

Test Plan

Apply patches from this review to -CURRENT as of today and rebuild the world.
Verify that kbdcontrol continues to work on the old kernel.

Additionally apply D38381 to -CURRENT as of today, excluding the chunks that modify kbio.h.
Rebuild the kernel and reboot. Verify that the kbdcontrol binary continues to work on the new kernel.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

This revision was not accepted when it landed; it landed in state Needs Review.Feb 6 2023, 11:02 PM
This revision was automatically updated to reflect the committed changes.
sys/sys/kbio.h
212

These violate style(9)

usr.sbin/kbdcontrol/kbdcontrol.c
936

0 for consistency with < 0?

sys/sys/kbio.h
212

This is meant to be temporarily compatibility, which has been requested by Warner Losh. The whole commit is to be reverted as soon as can be assumed, that all relevant systems have been upgraded to support the new PIO_DEADKEYMAP ioctl() definition in the kernel.

We do not support running a new userland on a new kernel, in general. But Warner mentioned a need to support this for some (not yet determined) time.

usr.sbin/kbdcontrol/kbdcontrol.c
936

The return value on success is known to be 0.
I wanted to have the accentmap transformation near to the ioctl() that needs it, but better style might have been:

	if (ioctl(0, GIO_DEADKEYMAP, &accentmap) < 0) {
                if (ioctl(0, OGIO_DEADKEYMAP, &oaccentmap) < 0)
                        memset(&accentmap, 0, sizeof(accentmap));
                else
                        to_new_accentmap(&oaccentmap, &accentmap);
        }

Since this whole commit is meant to be reverted when the need for the upward compatibility (new kbdcontrol on old kernel) no longer exists, I'm not convinced that this style change is required.

But I'll apply both the suggested changes (remove the //#ifdef _KERNEL lines and use the code fragment above), if you do not agree with my reasoning.