mirror of
https://git.yoctoproject.org/poky
synced 2026-04-10 14:02:21 +02:00
socat: Use c_ispeed and c_ospeed based upon libc
musl calls them __c_ispeed and __c_ospeed and we can not use get/set APIs because the get APIs will return the value from iflags and not from *speed element from termios struct (From OE-Core rev: b4744ffb94f76f2be138f2f9bd04153034bf62df) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -1,39 +1,52 @@
|
||||
From 545d3dec8c91d6074516ffcfa79323ddf9d83839 Mon Sep 17 00:00:00 2001
|
||||
From fb10ab134d630705cae0c7be42437cc289af7d32 Mon Sep 17 00:00:00 2001
|
||||
From: Khem Raj <raj.khem@gmail.com>
|
||||
Date: Tue, 15 Mar 2016 21:36:02 +0000
|
||||
Subject: [PATCH] Access c_ispeed and c_ospeed via APIs
|
||||
Subject: [PATCH] Use __c_ispeed and __c_ospeed on musl
|
||||
|
||||
Use cfsetispeed(), cfsetospeed(), cfgetispeed, and cfgetospeed()
|
||||
instead of operating on c_ispeed and c_ospeed termios structure
|
||||
members directly because they are not guaranteed to exist on all
|
||||
libc implementations
|
||||
Original intention of these asserts is to find if termios structure
|
||||
is mapped correctly to locally define union, the get* APIs for
|
||||
baudrate would not do the right thing since they do not return the
|
||||
value from c_ospeed/c_ispeed but the value which is stored in iflag
|
||||
for baudrate.
|
||||
|
||||
So we check if we are on Linux but not using glibc then we use
|
||||
__c_ispeed and __c_ospeed as defined in musl, however these are
|
||||
internal elements of structs it should not have been used this
|
||||
way.
|
||||
|
||||
Signed-off-by: Khem Raj <raj.khem@gmail.com>
|
||||
---
|
||||
Upstream-Status: Submitted
|
||||
|
||||
xioinitialize.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
---
|
||||
Upstream-Status: Pending
|
||||
|
||||
xioinitialize.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
diff --git a/xioinitialize.c b/xioinitialize.c
|
||||
index 9f50155..632ca4c 100644
|
||||
index 9f50155..8fb2e4c 100644
|
||||
--- a/xioinitialize.c
|
||||
+++ b/xioinitialize.c
|
||||
@@ -65,10 +65,10 @@ int xioinitialize(void) {
|
||||
@@ -65,6 +65,12 @@ int xioinitialize(void) {
|
||||
#if HAVE_TERMIOS_ISPEED && (ISPEED_OFFSET != -1) && (OSPEED_OFFSET != -1)
|
||||
#if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1)
|
||||
#if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1)
|
||||
- tdata.termarg.c_ispeed = 0x56789abc;
|
||||
- tdata.termarg.c_ospeed = 0x6789abcd;
|
||||
- assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]);
|
||||
- assert(tdata.termarg.c_ospeed == tdata.speeds[OSPEED_OFFSET]);
|
||||
+ cfsetispeed(&tdata.termarg, 0x56789abc);
|
||||
+ cfsetospeed(&tdata.termarg, 0x6789abcd);
|
||||
+ assert(cfgetispeed(&tdata.termarg) == tdata.speeds[ISPEED_OFFSET]);
|
||||
+ assert(cfgetospeed(&tdata.termarg) == tdata.speeds[OSPEED_OFFSET]);
|
||||
+#if defined(__linux__) && !defined(__GLIBC__)
|
||||
+ tdata.termarg.__c_ispeed = 0x56789abc;
|
||||
+ tdata.termarg.__c_ospeed = 0x6789abcd;
|
||||
+ assert(tdata.termarg.__c_ispeed == tdata.speeds[ISPEED_OFFSET]);
|
||||
+ assert(tdata.termarg.__c_ospeed == tdata.speeds[OSPEED_OFFSET]);
|
||||
+#else
|
||||
tdata.termarg.c_ispeed = 0x56789abc;
|
||||
tdata.termarg.c_ospeed = 0x6789abcd;
|
||||
assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]);
|
||||
@@ -72,6 +78,7 @@ int xioinitialize(void) {
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
+#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
--
|
||||
1.9.1
|
||||
2.8.0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user