Re: Bug in man page for CONSOLE_IOCTL(4) - KDGETMODE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Chris

On 07/16/2016 05:11 AM, Chris Gassib wrote:
Description:
The manual entry for KDGETMODE specifies "argp points to a long which
is set to one of the above values." At least on x86_64-bit Fedora24,
the text should probably specify argp is an int (32-bit), rather than
a long (64-bit).

Repo:
Open a file descriptor to the local console, and execute some code like the following:
    long arg = -1;
    if (-1 == ioctl(fd, KDGETMODE, &arg)) { return -1; }
    printf("KDGETMODE: 0x%lx\n", arg);

Now try this version:
    int arg = -1;
    if (-1 == ioctl(fd, KDGETMODE, &arg)) { return -1; }
    printf("KDGETMODE: 0x%x\n", arg);

Result:
The first version gives this result:
KDGETMODE: 0xffffffff00000001

The second version gives this result:
KDGETMODE: 0x1

Expected:
Either documentation incorrect, or the API is. One of them should be
changed so they match, or perhaps the documentation should specify
that it only applies to the 32-bit version.

Reading the source confirms your point, and it's the documentation that
should be fixed. I've made that change. Thanks for the report.

Cheers,

Michael


--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux