Messages in this thread | | | Date | Tue, 22 Jun 2021 03:18:28 -0400 | From | nick black <> | Subject | why were GIO_FONTX/PIO_FONTX dropped? i was using them |
| |
Jiri et al,
I'm the author of Notcurses, a library for "blingful terminal UIs". As part of this, I was using the GIO_FONTX and PIO_FONTX ioctl()s to reprogram the Linux console fonts. I proposed this functionality on 2019-12-22 in Notcurses bug #201:
https://github.com/dankamongmen/notcurses/issues/201
On 2020-05-13, I began using these two ioctls (along with their _UNIMAP equivalents), as documented in console_ioctl(2), to recover the font, scan it for Unicode block- and line-drawing characters, and add them if absent:
https://github.com/dankamongmen/notcurses/pull/795/files https://github.com/dankamongmen/notcurses/pull/794/files
some happy initial results were saved for posterity; i've reproduced them here:
https://nick-black.com/images/you-stole-my-ioctls.jpg
this worked perfectly, and I extended my Quadblitter to it, and cheerfully considered this a completed feature. You can see the results in this video from September 2020. it starts at 192s in, though you ought just watch the whole thing because it's awesome [0]:
https://www.youtube.com/watch?v=cYhZ7myXyyg&t=192s
How sad, then, when a few weeks back I noticed that this working code was no longer working on newer kernels:
https://github.com/dankamongmen/notcurses/issues/1726
I assumed it was my bug, having heard something over the years of Linux's commitment to APIs and not breaking working code. but today i went through the console_ioctl(2) man page (2017-09-15), and my code, and strace, and finally the kbd 2.3.3 source, where i found out about KDFONTOP. ok, but why weren't FONTX working? then i found ff2047fb755d4415ec3c70ac799889371151796d:
"As was demonstrated by commit 90bfdeef83f1 (tty: make FONTX ioctl use the tty pointer they were actually passed), these ioctls are not used from userspace, as: 1) they used to be broken (set up font on current console, not the open one) and racy (before the commit above) 2) KDFONTOP ioctl is used for years instead"
as hopefully demonstrated here, they *were* used from userspace. i'm happy to move to KDFONTOP (since it doesn't appear to be in the 5.11 man pages, maybe i'll write it up), but this was somewhat rude, and maybe the ioctls weren't as broken as you think?
also, i notice the definitions weren't removed. if no userspace was using them, they could have been, right? that would have been better than the ioctl()s mysteriously failing with ENOTTY.
i'll go ahead and switch to KDFONTOP, and send in a patch for the man page. hack on! and watch out for we little poeple =].
--nick
[0] just kidding, that one's old. check this out:
https://www.youtube.com/watch?v=dcjkezf1ARY
or if you hate youtube,
https://notcurses.com/notcurses-3-the-saga-continues.m4v
-- nick black -=- https://www.nick-black.com to make an apple pie from scratch, you need first invent a universe.
| |