This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/18000 )
Change subject: HACK: Disable the use of thread-local storage
......................................................................
HACK: Disable the use of thread-local storage
This will disable the thread-safe use of many libosmo* featues,
but it seems even in 2020 there are still systems out there
wthat don't support thread-local-storage.
Related: OS#4456
Related: OS#4062
Change-Id: I9baa7047fc4ff1a595ee318dcdb1247f1460da1b
---
M include/osmocom/core/talloc.h
M include/osmocom/gsm/cbsp.h
M src/context.c
M src/fsm.c
M src/gb/gprs_ns.c
M src/gsm/abis_nm.c
M src/gsm/apn.c
M src/gsm/cbsp.c
M src/gsm/gsm0808_utils.c
M src/gsm/gsm23003.c
M src/gsm/gsm48.c
M src/gsm/gsm_utils.c
M src/gsm/rsl.c
M src/msgb.c
M src/select.c
M src/sim/core.c
M src/socket.c
M src/utils.c
18 files changed, 39 insertions(+), 39 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/00/18000/1
diff --git a/include/osmocom/core/talloc.h b/include/osmocom/core/talloc.h
index c68a56c..07148df 100644
--- a/include/osmocom/core/talloc.h
+++ b/include/osmocom/core/talloc.h
@@ -19,7 +19,7 @@
void *select;
};
-extern __thread struct osmo_talloc_contexts *osmo_ctx;
+extern struct osmo_talloc_contexts *osmo_ctx;
/* short-hand #defines for the osmo talloc contexts (OTC) that can be used to pass
* to the various _c functions like msgb_alloc_c() */
diff --git a/include/osmocom/gsm/cbsp.h b/include/osmocom/gsm/cbsp.h
index 90516cb..6f7dbad 100644
--- a/include/osmocom/gsm/cbsp.h
+++ b/include/osmocom/gsm/cbsp.h
@@ -283,7 +283,7 @@
} u;
};
-extern const __thread char *osmo_cbsp_errstr;
+extern const char *osmo_cbsp_errstr;
struct msgb *osmo_cbsp_msgb_alloc(void *ctx, const char *name);
struct msgb *osmo_cbsp_encode(void *ctx, const struct osmo_cbsp_decoded *in);
diff --git a/src/context.c b/src/context.c
index bad012b..bf13557 100644
--- a/src/context.c
+++ b/src/context.c
@@ -26,7 +26,7 @@
#include <osmocom/core/talloc.h>
#include <osmocom/core/utils.h>
-__thread struct osmo_talloc_contexts *osmo_ctx;
+ struct osmo_talloc_contexts *osmo_ctx;
int osmo_ctx_init(const char *id)
{
diff --git a/src/fsm.c b/src/fsm.c
index 1e8909e..60927f2 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -95,7 +95,7 @@
static bool fsm_term_safely_enabled = false;
/*! Internal state for FSM instance termination cascades. */
-static __thread struct {
+static struct {
/*! The first FSM instance that invoked osmo_fsm_inst_term() in the current cascade. */
struct osmo_fsm_inst *root_fi;
/*! 2 if a secondary FSM terminates, 3 if a secondary FSM causes a tertiary FSM to terminate, and so on. */
@@ -583,7 +583,7 @@
*/
const char *osmo_fsm_event_name(struct osmo_fsm *fsm, uint32_t event)
{
- static __thread char buf[32];
+ static char buf[32];
if (!fsm->event_names) {
snprintf(buf, sizeof(buf), "%"PRIu32, event);
return buf;
@@ -613,7 +613,7 @@
*/
const char *osmo_fsm_state_name(struct osmo_fsm *fsm, uint32_t state)
{
- static __thread char buf[32];
+ static char buf[32];
if (state >= fsm->num_states) {
snprintf(buf, sizeof(buf), "unknown %"PRIu32, state);
return buf;
diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index 4e584ad..ede5152 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -1553,7 +1553,7 @@
const char *gprs_ns_ll_str(const struct gprs_nsvc *nsvc)
{
- static __thread char buf[80];
+ static char buf[80];
return gprs_ns_ll_str_buf(buf, sizeof(buf), nsvc);
}
diff --git a/src/gsm/abis_nm.c b/src/gsm/abis_nm.c
index 3fb8f0f..28bddd7 100644
--- a/src/gsm/abis_nm.c
+++ b/src/gsm/abis_nm.c
@@ -939,7 +939,7 @@
const char *abis_nm_dump_foh(const struct abis_om_fom_hdr *foh)
{
- static __thread char foh_buf[128];
+ static char foh_buf[128];
return abis_nm_dump_foh_buf(foh_buf, sizeof(foh_buf), foh);
}
diff --git a/src/gsm/apn.c b/src/gsm/apn.c
index a7074ea..c5169ad 100644
--- a/src/gsm/apn.c
+++ b/src/gsm/apn.c
@@ -31,7 +31,7 @@
#define APN_OI_GPRS_FMT "mnc%03u.mcc%03u.gprs"
#define APN_GPRS_FMT "%s.mnc%03u.mcc%03u.gprs"
-static __thread char apn_strbuf[APN_MAXLEN+1];
+static char apn_strbuf[APN_MAXLEN+1];
char *osmo_apn_qualify_buf(char *buf, size_t buf_len, unsigned int mcc, unsigned int mnc, const char *ni)
{
diff --git a/src/gsm/cbsp.c b/src/gsm/cbsp.c
index ccc2df5..eb1fbaa 100644
--- a/src/gsm/cbsp.c
+++ b/src/gsm/cbsp.c
@@ -33,7 +33,7 @@
#include <osmocom/gsm/cbsp.h>
#include <osmocom/gsm/gsm0808_utils.h>
-const __thread char *osmo_cbsp_errstr;
+const char *osmo_cbsp_errstr;
struct msgb *osmo_cbsp_msgb_alloc(void *ctx, const char *name)
{
diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c
index 7416d8f..cce7852 100644
--- a/src/gsm/gsm0808_utils.c
+++ b/src/gsm/gsm0808_utils.c
@@ -622,7 +622,7 @@
return ret;
}
-static __thread char dbuf[256];
+static char dbuf[256];
/*! Dump LCLS parameters (GCR excluded) into string for printing.
* \param[out] buf caller-allocated output string buffer
@@ -1887,7 +1887,7 @@
*/
const char *gsm0808_cell_id_name(const struct gsm0808_cell_id *cid)
{
- static __thread char buf[64];
+ static char buf[64];
return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
}
@@ -1897,7 +1897,7 @@
*/
const char *gsm0808_cell_id_name2(const struct gsm0808_cell_id *cid)
{
- static __thread char buf[64];
+ static char buf[64];
return gsm0808_cell_id_name_buf(buf, sizeof(buf), cid);
}
@@ -1954,7 +1954,7 @@
* See also gsm0808_cell_id_list_name_buf(). */
const char *gsm0808_cell_id_list_name(const struct gsm0808_cell_id_list2 *cil)
{
- static __thread char buf[1024];
+ static char buf[1024];
gsm0808_cell_id_list_name_buf(buf, sizeof(buf), cil);
return buf;
}
@@ -1981,7 +1981,7 @@
const char *gsm0808_channel_type_name(const struct gsm0808_channel_type *ct)
{
- static __thread char buf[128];
+ static char buf[128];
return gsm0808_channel_type_name_buf(buf, sizeof(buf), ct);
}
diff --git a/src/gsm/gsm23003.c b/src/gsm/gsm23003.c
index e20afcb..e5180b8 100644
--- a/src/gsm/gsm23003.c
+++ b/src/gsm/gsm23003.c
@@ -107,7 +107,7 @@
*/
const char *osmo_mcc_name(uint16_t mcc)
{
- static __thread char buf[8];
+ static char buf[8];
return osmo_mcc_name_buf(buf, sizeof(buf), mcc);
}
@@ -158,7 +158,7 @@
*/
const char *osmo_mnc_name(uint16_t mnc, bool mnc_3_digits)
{
- static __thread char buf[8];
+ static char buf[8];
return osmo_mnc_name_buf(buf, sizeof(buf), mnc, mnc_3_digits);
}
@@ -182,7 +182,7 @@
*/
const char *osmo_plmn_name(const struct osmo_plmn_id *plmn)
{
- static __thread char buf[16];
+ static char buf[16];
return osmo_plmn_name_buf(buf, sizeof(buf), plmn);
}
@@ -193,7 +193,7 @@
*/
const char *osmo_plmn_name2(const struct osmo_plmn_id *plmn)
{
- static __thread char buf[16];
+ static char buf[16];
return osmo_plmn_name_buf(buf, sizeof(buf), plmn);
}
@@ -230,7 +230,7 @@
*/
const char *osmo_lai_name(const struct osmo_location_area_id *lai)
{
- static __thread char buf[32];
+ static char buf[32];
return osmo_lai_name_buf(buf, sizeof(buf), lai);
}
@@ -265,7 +265,7 @@
*/
const char *osmo_cgi_name(const struct osmo_cell_global_id *cgi)
{
- static __thread char buf[32];
+ static char buf[32];
return osmo_cgi_name_buf(buf, sizeof(buf), cgi);
}
@@ -276,7 +276,7 @@
*/
const char *osmo_cgi_name2(const struct osmo_cell_global_id *cgi)
{
- static __thread char buf[32];
+ static char buf[32];
return osmo_cgi_name_buf(buf, sizeof(buf), cgi);
}
@@ -320,7 +320,7 @@
*/
const char *osmo_gummei_name(const struct osmo_gummei *gummei)
{
- static __thread char buf[32];
+ static char buf[32];
return osmo_gummei_name_buf(buf, sizeof(buf), gummei);
}
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 17b0829..95f0949 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -203,7 +203,7 @@
*/
const char *osmo_rai_name(const struct gprs_ra_id *rai)
{
- static __thread char buf[32];
+ static char buf[32];
return osmo_rai_name_buf(buf, sizeof(buf), rai);
}
@@ -502,7 +502,7 @@
*/
const char *osmo_mi_name(const uint8_t *mi, uint8_t mi_len)
{
- static __thread char mi_name[10 + GSM48_MI_SIZE + 1];
+ static char mi_name[10 + GSM48_MI_SIZE + 1];
return osmo_mi_name_buf(mi_name, sizeof(mi_name), mi, mi_len);
}
@@ -1149,7 +1149,7 @@
*/
const char *gsm48_pdisc_msgtype_name(uint8_t pdisc, uint8_t msg_type)
{
- static __thread char namebuf[64];
+ static char namebuf[64];
return gsm48_pdisc_msgtype_name_buf(namebuf, sizeof(namebuf), pdisc, msg_type);
}
@@ -1302,7 +1302,7 @@
*/
const char *osmo_gsm48_classmark_a5_name(const struct osmo_gsm48_classmark *cm)
{
- static __thread char buf[128];
+ static char buf[128];
return osmo_gsm48_classmark_a5_name_buf(buf, sizeof(buf), cm);
}
diff --git a/src/gsm/gsm_utils.c b/src/gsm/gsm_utils.c
index ae77a9d..33a3f8d 100644
--- a/src/gsm/gsm_utils.c
+++ b/src/gsm/gsm_utils.c
@@ -898,7 +898,7 @@
char *osmo_dump_gsmtime(const struct gsm_time *tm)
{
- static __thread char buf[64];
+ static char buf[64];
return osmo_dump_gsmtime_buf(buf, sizeof(buf), tm);
}
diff --git a/src/gsm/rsl.c b/src/gsm/rsl.c
index 5534aa2..bba91aa 100644
--- a/src/gsm/rsl.c
+++ b/src/gsm/rsl.c
@@ -264,7 +264,7 @@
*/
const char *rsl_chan_nr_str(uint8_t chan_nr)
{
- static __thread char str[20];
+ static char str[20];
return rsl_chan_nr_str_buf(str, sizeof(str), chan_nr);
}
diff --git a/src/msgb.c b/src/msgb.c
index 4edbdf3..fc5a9eb 100644
--- a/src/msgb.c
+++ b/src/msgb.c
@@ -511,7 +511,7 @@
*/
const char *msgb_hexdump(const struct msgb *msg)
{
- static __thread char buf[4100];
+ static char buf[4100];
return msgb_hexdump_buf(buf, sizeof(buf), msg);
}
diff --git a/src/select.c b/src/select.c
index 8e31205..5971ac5 100644
--- a/src/select.c
+++ b/src/select.c
@@ -52,9 +52,9 @@
/* keep a set of file descriptors per-thread, so that each thread can have its own
* distinct set of file descriptors to interact with */
-static __thread int maxfd = 0;
-static __thread struct llist_head osmo_fds; /* TLS cannot use LLIST_HEAD() */
-static __thread int unregistered_count;
+static int maxfd = 0;
+static struct llist_head osmo_fds; /* TLS cannot use LLIST_HEAD() */
+static int unregistered_count;
/*! Set up an osmo-fd. Will not register it.
* \param[inout] ofd Osmo FD to be set-up
diff --git a/src/sim/core.c b/src/sim/core.c
index d11c2d8..f6f022a 100644
--- a/src/sim/core.c
+++ b/src/sim/core.c
@@ -404,7 +404,7 @@
char *osim_print_sw(const struct osim_chan_hdl *ch, uint16_t sw_in)
{
- static __thread char sw_print_buf[256];
+ static char sw_print_buf[256];
return osim_print_sw_buf(sw_print_buf, sizeof(sw_print_buf), ch, sw_in);
}
diff --git a/src/socket.c b/src/socket.c
index 503ceaf..d153c30 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -1109,7 +1109,7 @@
*/
const char *osmo_sock_get_name2(int fd)
{
- static __thread char str[OSMO_SOCK_NAME_MAXLEN];
+ static char str[OSMO_SOCK_NAME_MAXLEN];
osmo_sock_get_name_buf(str, sizeof(str), fd);
return str;
}
diff --git a/src/utils.c b/src/utils.c
index 038288c..565324e 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -41,9 +41,9 @@
*
* \file utils.c */
-static __thread char namebuf[255];
+static char namebuf[255];
/* shared by osmo_str_tolower() and osmo_str_toupper() */
-static __thread char capsbuf[128];
+static char capsbuf[128];
/*! get human-readable string for given value
* \param[in] vs Array of value_string tuples
@@ -221,7 +221,7 @@
return nibblepos >> 1;
}
-static __thread char hexd_buff[4096];
+static char hexd_buff[4096];
static const char hex_chars[] = "0123456789abcdef";
/*! Convert binary sequence to hexadecimal ASCII string.
@@ -494,7 +494,7 @@
* sizeof(uint64_t), only the least significant bytes of value are encoded. */
uint8_t *osmo_encode_big_endian(uint64_t value, size_t data_len)
{
- static __thread uint8_t buf[sizeof(uint64_t)];
+ static uint8_t buf[sizeof(uint64_t)];
OSMO_ASSERT(data_len <= ARRAY_SIZE(buf));
osmo_store64be_ext(value, buf, data_len);
return buf;
--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18000
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9baa7047fc4ff1a595ee318dcdb1247f1460da1b
Gerrit-Change-Number: 18000
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200502/304f08ad/attachment.htm>