From: "Pali Rohár" <pali@kernel.org>
To: Stefan Roese <sr@denx.de>
Cc: "Marek Behún" <kabel@kernel.org>,
"Michal Vasilek" <michal.vasilek@nic.cz>
Subject: [PATCH] tools: termios_linux.h: Fix compilation on non-glibc systems
Date: Thu, 8 Sep 2022 16:59:36 +0200 [thread overview]
Message-ID: <20220908145936.29234-1-pali@kernel.org> (raw)
TCGETS2 is defined in header file asm/ioctls.h provided by linux kernel.
On glib systems it is automatically included by some other glibc include
header file and therefore TCGETS2 is present in termios_linux.h when
linux kernel provides it.
On non-glibc systems (e.g. musl) asm/ioctls.h is not automatically included
which results in the strange error that BOTHER is supported, TCGETS2 not
defined and struct termios does not provide c_ispeed member.
tools/kwboot.c: In function 'kwboot_tty_change_baudrate':
tools/kwboot.c:662:6: error: 'struct termios' has no member named 'c_ospeed'
662 | tio.c_ospeed = tio.c_ispeed = baudrate;
| ^
Fix this issue by explicitly including asm/ioctls.h file which provides
TCGETS2 macro (if supported on selected architecture) to not depending on
glibc auto-include behavior and because termios_linux.h requires it.
With this change it is possible compile kwboot with musl libc.
Reported-by: Michal Vasilek <michal.vasilek@nic.cz>
Signed-off-by: Pali Rohár <pali@kernel.org>
---
Stefan, could you include this patch into -rc queue so kwboot can be
compiled also with musl libc?
---
tools/termios_linux.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/termios_linux.h b/tools/termios_linux.h
index 45f5c1233c01..0806a91180a0 100644
--- a/tools/termios_linux.h
+++ b/tools/termios_linux.h
@@ -29,6 +29,7 @@
#include <errno.h>
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <asm/ioctls.h>
#include <asm/termbits.h>
#if defined(BOTHER) && defined(TCGETS2)
--
2.20.1
reply other threads:[~2022-09-08 18:04 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220908145936.29234-1-pali@kernel.org \
--to=pali@kernel.org \
--cc=kabel@kernel.org \
--cc=michal.vasilek@nic.cz \
--cc=sr@denx.de \
/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