tags 517485 fixed-upstream thanks Hello Alan,
On 2/28/09, Alan Curry <pac...@kosh.dhis.org> wrote: > Package: manpages > Severity: normal > > > This description: > >> KDGETLED >> Get state of LEDs. argp points to a long. The lower three bits >> of *argp are set to the state of the LEDs, as follows: >> >> LED_CAP 0x04 caps lock led >> LEC_NUM 0x02 num lock led >> LED_SCR 0x01 scroll lock led > > is wrong. The kernel only stores a single byte *argp, so if you give it the > address of a long, you won't necessarily find the results in the low 3 bits > of the long. (It happens to work out that way if you are little-endian.) > Change "long" to "char" and the description will be correct. > > Demonstration program (run it on a big-endian machine to see that the actual > behavior is not what the man page says): > > #include <stdio.h> > #include <sys/ioctl.h> > #include <linux/kd.h> > > int main(void) > { > int ioctlret; > long longval; > > longval = -1; > > ioctlret = ioctl(0, KDGETLED, &longval); > printf("ioctlret=%d longval=%08lx\n", ioctlret, longval); > > return 0; > } Thanks for the excellently documented report! As you suggest, I have changed "long" to "char", and the change will be in ustream 3.20. Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ git://git.kernel.org/pub/scm/docs/man-pages/man-pages.git man-pages online: http://www.kernel.org/doc/man-pages/online_pages.html Found a bug? http://www.kernel.org/doc/man-pages/reporting_bugs.html -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org