summaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-common/source/posix
diff options
context:
space:
mode:
authorrobot-contrib <[email protected]>2025-05-14 06:53:03 +0300
committerrobot-contrib <[email protected]>2025-05-14 07:05:42 +0300
commit286dbc77293811055ff4f9303cd376eff9e50104 (patch)
treea50eea3eb2b824c7c68e15b4cc3e127731776d32 /contrib/restricted/aws/aws-c-common/source/posix
parent0bf9db6399352012396e7791bcfd762e944b33c2 (diff)
Update contrib/restricted/aws/aws-c-common to 0.12.2
commit_hash:fc6e67f9b12b0b888c90bb97bf2b1cbfcd74a044
Diffstat (limited to 'contrib/restricted/aws/aws-c-common/source/posix')
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/clock.c6
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/cross_process_lock.c1
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/environment.c20
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/thread.c19
4 files changed, 43 insertions, 3 deletions
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/clock.c b/contrib/restricted/aws/aws-c-common/source/posix/clock.c
index b2c3bc3f0e7..4ca0a47ba37 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/clock.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/clock.c
@@ -9,7 +9,9 @@
static const uint64_t NS_PER_SEC = 1000000000;
-#if defined(CLOCK_MONOTONIC_RAW)
+#if defined(CLOCK_BOOTTIME)
+# define HIGH_RES_CLOCK CLOCK_BOOTTIME
+#elif defined(CLOCK_MONOTONIC_RAW)
# define HIGH_RES_CLOCK CLOCK_MONOTONIC_RAW
#else
# define HIGH_RES_CLOCK CLOCK_MONOTONIC
@@ -47,7 +49,7 @@ static int (*s_gettime_fn)(clockid_t clock_id, struct timespec *tp) = NULL;
static void s_do_osx_loads(void *user_data) {
(void)user_data;
- s_gettime_fn = (int (*)(clockid_t clock_id, struct timespec * tp)) dlsym(RTLD_DEFAULT, "clock_gettime");
+ s_gettime_fn = (int (*)(clockid_t clock_id, struct timespec *tp))dlsym(RTLD_DEFAULT, "clock_gettime");
}
int aws_high_res_clock_get_ticks(uint64_t *timestamp) {
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/cross_process_lock.c b/contrib/restricted/aws/aws-c-common/source/posix/cross_process_lock.c
index 1ef5d2b5fe4..f9483418443 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/cross_process_lock.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/cross_process_lock.c
@@ -133,7 +133,6 @@ cleanup:
void aws_cross_process_lock_release(struct aws_cross_process_lock *instance_lock) {
if (instance_lock) {
- flock(instance_lock->locked_fd, LOCK_UN);
close(instance_lock->locked_fd);
AWS_LOGF_TRACE(AWS_LS_COMMON_GENERAL, "static: Lock file released for fd %d", instance_lock->locked_fd);
aws_mem_release(instance_lock->allocator, instance_lock);
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/environment.c b/contrib/restricted/aws/aws-c-common/source/posix/environment.c
index f4b69caea25..ba1f8bb4425 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/environment.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/environment.c
@@ -8,6 +8,26 @@
#include <aws/common/string.h>
#include <stdlib.h>
+struct aws_string *aws_get_env(struct aws_allocator *allocator, const char *name) {
+
+ const char *value = getenv(name);
+ if (value == NULL) {
+ return NULL;
+ }
+
+ return aws_string_new_from_c_str(allocator, value);
+}
+
+struct aws_string *aws_get_env_nonempty(struct aws_allocator *allocator, const char *name) {
+
+ const char *value = getenv(name);
+ if (value == NULL || value[0] == '\0') {
+ return NULL;
+ }
+
+ return aws_string_new_from_c_str(allocator, value);
+}
+
int aws_get_environment_value(
struct aws_allocator *allocator,
const struct aws_string *variable_name,
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/thread.c b/contrib/restricted/aws/aws-c-common/source/posix/thread.c
index af7fac84cf9..34b5dbe9486 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/thread.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/thread.c
@@ -275,6 +275,25 @@ int aws_thread_launch(
if (attr_return) {
goto cleanup;
}
+ } else if (!options->stack_size) {
+ /**
+ * On some systems, the default stack size is too low (128KB on musl at the time of writing this), which can
+ * cause stack overflow when the dependency chain is long. Increase the stack size to at
+ * least 1MB, which is the default on Windows.
+ */
+ size_t min_stack_size = (size_t)1 * 1024 * 1024;
+ size_t current_stack_size;
+ attr_return = pthread_attr_getstacksize(attributes_ptr, &current_stack_size);
+ if (attr_return) {
+ goto cleanup;
+ }
+
+ if (current_stack_size < min_stack_size) {
+ attr_return = pthread_attr_setstacksize(attributes_ptr, min_stack_size);
+ if (attr_return) {
+ goto cleanup;
+ }
+ }
}
/* AFAIK you can't set thread affinity on apple platforms, and it doesn't really matter since all memory