diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-04-13 08:54:14 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-04-14 10:58:32 +0100 |
commit | 2c81e17222bee3acdfb722a7aecb8f2b8f75422a (patch) | |
tree | d3d73fce14c676b2cb98d31184bf136128abbc0b | |
parent | 5c8124df2efed4b8691239cd357cf69211b0c844 (diff) | |
download | poky-2c81e17222bee3acdfb722a7aecb8f2b8f75422a.tar.gz |
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>
-rw-r--r-- | meta/recipes-connectivity/socat/socat/0001-Access-c_ispeed-and-c_ospeed-via-APIs.patch | 53 |
1 files changed, 33 insertions, 20 deletions
diff --git a/meta/recipes-connectivity/socat/socat/0001-Access-c_ispeed-and-c_ospeed-via-APIs.patch b/meta/recipes-connectivity/socat/socat/0001-Access-c_ispeed-and-c_ospeed-via-APIs.patch index 367b48f113..c0e27f3d78 100644 --- a/meta/recipes-connectivity/socat/socat/0001-Access-c_ispeed-and-c_ospeed-via-APIs.patch +++ b/meta/recipes-connectivity/socat/socat/0001-Access-c_ispeed-and-c_ospeed-via-APIs.patch | |||
@@ -1,39 +1,52 @@ | |||
1 | From 545d3dec8c91d6074516ffcfa79323ddf9d83839 Mon Sep 17 00:00:00 2001 | 1 | From fb10ab134d630705cae0c7be42437cc289af7d32 Mon Sep 17 00:00:00 2001 |
2 | From: Khem Raj <raj.khem@gmail.com> | 2 | From: Khem Raj <raj.khem@gmail.com> |
3 | Date: Tue, 15 Mar 2016 21:36:02 +0000 | 3 | Date: Tue, 15 Mar 2016 21:36:02 +0000 |
4 | Subject: [PATCH] Access c_ispeed and c_ospeed via APIs | 4 | Subject: [PATCH] Use __c_ispeed and __c_ospeed on musl |
5 | 5 | ||
6 | Use cfsetispeed(), cfsetospeed(), cfgetispeed, and cfgetospeed() | 6 | Original intention of these asserts is to find if termios structure |
7 | instead of operating on c_ispeed and c_ospeed termios structure | 7 | is mapped correctly to locally define union, the get* APIs for |
8 | members directly because they are not guaranteed to exist on all | 8 | baudrate would not do the right thing since they do not return the |
9 | libc implementations | 9 | value from c_ospeed/c_ispeed but the value which is stored in iflag |
10 | for baudrate. | ||
11 | |||
12 | So we check if we are on Linux but not using glibc then we use | ||
13 | __c_ispeed and __c_ospeed as defined in musl, however these are | ||
14 | internal elements of structs it should not have been used this | ||
15 | way. | ||
10 | 16 | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | 17 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
18 | |||
12 | --- | 19 | --- |
13 | Upstream-Status: Submitted | 20 | Upstream-Status: Pending |
14 | 21 | ||
15 | xioinitialize.c | 8 ++++---- | 22 | xioinitialize.c | 7 +++++++ |
16 | 1 file changed, 4 insertions(+), 4 deletions(-) | 23 | 1 file changed, 7 insertions(+) |
17 | 24 | ||
18 | diff --git a/xioinitialize.c b/xioinitialize.c | 25 | diff --git a/xioinitialize.c b/xioinitialize.c |
19 | index 9f50155..632ca4c 100644 | 26 | index 9f50155..8fb2e4c 100644 |
20 | --- a/xioinitialize.c | 27 | --- a/xioinitialize.c |
21 | +++ b/xioinitialize.c | 28 | +++ b/xioinitialize.c |
22 | @@ -65,10 +65,10 @@ int xioinitialize(void) { | 29 | @@ -65,6 +65,12 @@ int xioinitialize(void) { |
23 | #if HAVE_TERMIOS_ISPEED && (ISPEED_OFFSET != -1) && (OSPEED_OFFSET != -1) | 30 | #if HAVE_TERMIOS_ISPEED && (ISPEED_OFFSET != -1) && (OSPEED_OFFSET != -1) |
24 | #if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) | 31 | #if defined(ISPEED_OFFSET) && (ISPEED_OFFSET != -1) |
25 | #if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) | 32 | #if defined(OSPEED_OFFSET) && (OSPEED_OFFSET != -1) |
26 | - tdata.termarg.c_ispeed = 0x56789abc; | 33 | +#if defined(__linux__) && !defined(__GLIBC__) |
27 | - tdata.termarg.c_ospeed = 0x6789abcd; | 34 | + tdata.termarg.__c_ispeed = 0x56789abc; |
28 | - assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]); | 35 | + tdata.termarg.__c_ospeed = 0x6789abcd; |
29 | - assert(tdata.termarg.c_ospeed == tdata.speeds[OSPEED_OFFSET]); | 36 | + assert(tdata.termarg.__c_ispeed == tdata.speeds[ISPEED_OFFSET]); |
30 | + cfsetispeed(&tdata.termarg, 0x56789abc); | 37 | + assert(tdata.termarg.__c_ospeed == tdata.speeds[OSPEED_OFFSET]); |
31 | + cfsetospeed(&tdata.termarg, 0x6789abcd); | 38 | +#else |
32 | + assert(cfgetispeed(&tdata.termarg) == tdata.speeds[ISPEED_OFFSET]); | 39 | tdata.termarg.c_ispeed = 0x56789abc; |
33 | + assert(cfgetospeed(&tdata.termarg) == tdata.speeds[OSPEED_OFFSET]); | 40 | tdata.termarg.c_ospeed = 0x6789abcd; |
41 | assert(tdata.termarg.c_ispeed == tdata.speeds[ISPEED_OFFSET]); | ||
42 | @@ -72,6 +78,7 @@ int xioinitialize(void) { | ||
43 | #endif | ||
34 | #endif | 44 | #endif |
35 | #endif | 45 | #endif |
46 | +#endif | ||
47 | } | ||
36 | #endif | 48 | #endif |
49 | |||
37 | -- | 50 | -- |
38 | 1.9.1 | 51 | 2.8.0 |
39 | 52 | ||