linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* tcgetattr() can set errno to 22 / EINVAL
@ 2025-11-03 12:45 Дилян Палаузов
  2025-11-03 13:20 ` Alejandro Colomar
  0 siblings, 1 reply; 4+ messages in thread
From: Дилян Палаузов @ 2025-11-03 12:45 UTC (permalink / raw)
  To: Alejandro Colomar; +Cc: linux-man

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
  Дилян

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-06 13:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-03 12:45 tcgetattr() can set errno to 22 / EINVAL Дилян Палаузов
2025-11-03 13:20 ` Alejandro Colomar
2025-11-06 12:38   ` Florian Weimer
2025-11-06 13:12     ` Дилян Палаузов

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).