From: "Дилян Палаузов" <dilyan.palauzov@aegee.org>
To: Alejandro Colomar <alx@kernel.org>
Cc: linux-man@vger.kernel.org
Subject: tcgetattr() can set errno to 22 / EINVAL
Date: Mon, 03 Nov 2025 14:45:06 +0200 [thread overview]
Message-ID: <ebb992217f4a2ceca9a6d9868f50da73c68e8cdb.camel@aegee.org> (raw)
Hello,
please amend the errors at https://man7.org/linux/man-pages/man3/tcgetattr.3p.html that the function tcgetattr() can set errno to EINVAL 22 Invalid argument for /dev/hidraw files.
Using kernel 6.6.60 on armv7l and libc 2.36 (where tcgetattr is implemented in termios/tcgetattr.c as ioctl(fd, TCGETS, …)), this program
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
void main() {
int fd = open("/dev/hidraw0", O_RDWR | O_NONBLOCK |O_NOCTTY);
struct termios s;
errno = 0;
int ret = tcgetattr(fd, &s);
printf("Returned fd is %i ret is %i errno is %i %m\n", fd, ret, errno);
}
puts:
Returned fd is 3 ret is -1 errno is 22 Invalid argument
Well at https://pubs.opengroup.org/onlinepubs/9799919799/functions/tcgetattr.html Open Group Base Specifications Issue 8/year 2024 also says only EBADF and ENOTTY.
Kind regards
Дилян
next reply other threads:[~2025-11-03 12:46 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 12:45 Дилян Палаузов [this message]
2025-11-03 13:20 ` tcgetattr() can set errno to 22 / EINVAL Alejandro Colomar
2025-11-06 12:38 ` Florian Weimer
2025-11-06 13:12 ` Дилян Палаузов
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ebb992217f4a2ceca9a6d9868f50da73c68e8cdb.camel@aegee.org \
--to=dilyan.palauzov@aegee.org \
--cc=alx@kernel.org \
--cc=linux-man@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).