aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-io/source/posix/shared_library.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/restricted/aws/aws-c-io/source/posix/shared_library.c
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/aws/aws-c-io/source/posix/shared_library.c')
-rw-r--r--contrib/restricted/aws/aws-c-io/source/posix/shared_library.c132
1 files changed, 66 insertions, 66 deletions
diff --git a/contrib/restricted/aws/aws-c-io/source/posix/shared_library.c b/contrib/restricted/aws/aws-c-io/source/posix/shared_library.c
index 751c99bc23..6261ea9ea8 100644
--- a/contrib/restricted/aws/aws-c-io/source/posix/shared_library.c
+++ b/contrib/restricted/aws/aws-c-io/source/posix/shared_library.c
@@ -1,66 +1,66 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
- */
-
-#include <aws/io/shared_library.h>
-
-#include <aws/io/logging.h>
-
-#include <dlfcn.h>
-
-static const char *s_null = "<NULL>";
-static const char *s_unknown_error = "<Unknown>";
-
-int aws_shared_library_init(struct aws_shared_library *library, const char *library_path) {
- AWS_ZERO_STRUCT(*library);
-
- library->library_handle = dlopen(library_path, RTLD_LAZY);
- if (library->library_handle == NULL) {
- const char *error = dlerror();
- AWS_LOGF_ERROR(
- AWS_LS_IO_SHARED_LIBRARY,
- "id=%p: Failed to load shared library at path \"%s\" with error: %s",
- (void *)library,
- library_path ? library_path : s_null,
- error ? error : s_unknown_error);
- return aws_raise_error(AWS_IO_SHARED_LIBRARY_LOAD_FAILURE);
- }
-
- return AWS_OP_SUCCESS;
-}
-
-void aws_shared_library_clean_up(struct aws_shared_library *library) {
- if (library && library->library_handle) {
- dlclose(library->library_handle);
- library->library_handle = NULL;
- }
-}
-
-int aws_shared_library_find_function(
- struct aws_shared_library *library,
- const char *symbol_name,
- aws_generic_function *function_address) {
- if (library == NULL || library->library_handle == NULL) {
- return aws_raise_error(AWS_IO_SHARED_LIBRARY_FIND_SYMBOL_FAILURE);
- }
-
- /*
- * Suggested work around for (undefined behavior) cast from void * to function pointer
- * in POSIX.1-2003 standard, at least according to dlsym man page code sample.
- */
- *(void **)(function_address) = dlsym(library->library_handle, symbol_name);
-
- if (*function_address == NULL) {
- const char *error = dlerror();
- AWS_LOGF_ERROR(
- AWS_LS_IO_SHARED_LIBRARY,
- "id=%p: Failed to find shared library symbol \"%s\" with error: %s",
- (void *)library,
- symbol_name ? symbol_name : s_null,
- error ? error : s_unknown_error);
- return aws_raise_error(AWS_IO_SHARED_LIBRARY_FIND_SYMBOL_FAILURE);
- }
-
- return AWS_OP_SUCCESS;
-}
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
+ */
+
+#include <aws/io/shared_library.h>
+
+#include <aws/io/logging.h>
+
+#include <dlfcn.h>
+
+static const char *s_null = "<NULL>";
+static const char *s_unknown_error = "<Unknown>";
+
+int aws_shared_library_init(struct aws_shared_library *library, const char *library_path) {
+ AWS_ZERO_STRUCT(*library);
+
+ library->library_handle = dlopen(library_path, RTLD_LAZY);
+ if (library->library_handle == NULL) {
+ const char *error = dlerror();
+ AWS_LOGF_ERROR(
+ AWS_LS_IO_SHARED_LIBRARY,
+ "id=%p: Failed to load shared library at path \"%s\" with error: %s",
+ (void *)library,
+ library_path ? library_path : s_null,
+ error ? error : s_unknown_error);
+ return aws_raise_error(AWS_IO_SHARED_LIBRARY_LOAD_FAILURE);
+ }
+
+ return AWS_OP_SUCCESS;
+}
+
+void aws_shared_library_clean_up(struct aws_shared_library *library) {
+ if (library && library->library_handle) {
+ dlclose(library->library_handle);
+ library->library_handle = NULL;
+ }
+}
+
+int aws_shared_library_find_function(
+ struct aws_shared_library *library,
+ const char *symbol_name,
+ aws_generic_function *function_address) {
+ if (library == NULL || library->library_handle == NULL) {
+ return aws_raise_error(AWS_IO_SHARED_LIBRARY_FIND_SYMBOL_FAILURE);
+ }
+
+ /*
+ * Suggested work around for (undefined behavior) cast from void * to function pointer
+ * in POSIX.1-2003 standard, at least according to dlsym man page code sample.
+ */
+ *(void **)(function_address) = dlsym(library->library_handle, symbol_name);
+
+ if (*function_address == NULL) {
+ const char *error = dlerror();
+ AWS_LOGF_ERROR(
+ AWS_LS_IO_SHARED_LIBRARY,
+ "id=%p: Failed to find shared library symbol \"%s\" with error: %s",
+ (void *)library,
+ symbol_name ? symbol_name : s_null,
+ error ? error : s_unknown_error);
+ return aws_raise_error(AWS_IO_SHARED_LIBRARY_FIND_SYMBOL_FAILURE);
+ }
+
+ return AWS_OP_SUCCESS;
+}