Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:guana.histark:gnome-desktop-3.38.5-1-el8-x86_64
fc31-systemd-243.9
0001-Revert-hashmap-make-sure-to-initialize-sha...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-Revert-hashmap-make-sure-to-initialize-shared-hash-k.patch of Package fc31-systemd-243.9
From de646878d39a184d3e5ecac5e49fac63b5d27dbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl> Date: Sun, 20 Sep 2020 14:37:39 +0200 Subject: [PATCH] Revert "hashmap: make sure to initialize shared hash key atomically" This reverts commit df14a160095987140f4435412156a80ec628fd7c. --- src/basic/hashmap.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/basic/hashmap.c b/src/basic/hashmap.c index 64fbad1969..3bd94a1320 100644 --- a/src/basic/hashmap.c +++ b/src/basic/hashmap.c @@ -1,7 +1,6 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ #include <errno.h> -#include <pthread.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -21,6 +20,7 @@ #include "strv.h" #if ENABLE_DEBUG_HASHMAP +#include <pthread.h> #include "list.h" #endif @@ -195,6 +195,7 @@ assert_cc(DIRECT_BUCKETS(struct set_entry) < (1 << 3)); * a handful of directly stored entries in a hashmap. When a hashmap * outgrows direct storage, it gets its own key for indirect storage. */ static uint8_t shared_hash_key[HASH_KEY_SIZE]; +static bool shared_hash_key_initialized; /* Fields that all hashmap/set types must have */ struct HashmapBase { @@ -770,10 +771,6 @@ static void reset_direct_storage(HashmapBase *h) { memset(p, DIB_RAW_INIT, sizeof(dib_raw_t) * hi->n_direct_buckets); } -static void shared_hash_key_initialize(void) { - random_bytes(shared_hash_key, sizeof(shared_hash_key)); -} - static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enum HashmapType type HASHMAP_DEBUG_PARAMS) { HashmapBase *h; const struct hashmap_type_info *hi = &hashmap_type_info[type]; @@ -796,8 +793,10 @@ static struct HashmapBase *hashmap_base_new(const struct hash_ops *hash_ops, enu reset_direct_storage(h); - static pthread_once_t once = PTHREAD_ONCE_INIT; - assert_se(pthread_once(&once, shared_hash_key_initialize) == 0); + if (!shared_hash_key_initialized) { + random_bytes(shared_hash_key, sizeof(shared_hash_key)); + shared_hash_key_initialized= true; + } #if ENABLE_DEBUG_HASHMAP h->debug.func = func;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor