OceanBase Plugin Development Kit
OceanBase Plugin Development Kit
载入中...
搜索中...
未找到
ob_plugin_libmain.c
浏览该文件的文档.
1/*
2 * Copyright (c) 2025 OceanBase.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#include <unistd.h>
17#include <stdio.h>
18#include "oceanbase/ob_plugin.h"
19
20#ifdef __linux__
21#include <sys/utsname.h>
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#ifdef LD_LIBRARY_PATH
29const char __plugin_service_interp[] __attribute__((section(".interp"))) = LD_LIBRARY_PATH;
30#endif
31
39
41{
42 const char *compiled_by = "COMPILED BY: ";
43
44#ifdef __clang__
45 printf("%sclang %s\n", compiled_by, __clang__version__);
46#elif defined(__GNUC__)
47 printf("%sGCC %s\n", compiled_by, __VERSION__);
48#else
49 printf("Unknown compiler\n");
50#endif
51}
52
54{
55#ifdef __linux__
56 struct utsname uname_info;
57 if (0 == uname(&uname_info)) {
58 printf("COMPILED ON: %s %s %s %s\n",
59 uname_info.sysname, uname_info.release, uname_info.version, uname_info.machine);
60 }
61#endif
62}
63
65{
66 extern const char *OBP_DYNAMIC_PLUGIN_NAME_VAR;
68 extern const char *OBP_DYNAMIC_PLUGIN_BUILD_BRANCH_VAR;
69 extern const char *OBP_DYNAMIC_PLUGIN_BUILD_DATE_VAR;
70 extern const char *OBP_DYNAMIC_PLUGIN_BUILD_TIME_VAR;
72
74
75 printf("OceanBase Plugin Library: %s\n", OBP_DYNAMIC_PLUGIN_NAME_VAR);
78 printf("\n");
79 printf("AUTHOR: %s\n", plugin->author);
80 printf("LIBRARY VERSION: ");
81 __print_version(plugin->version);
82 printf("\n");
83 printf("PLUGIN API VERSION: ");
85 printf("\n");
86 printf("LICENSE: %s\n", plugin->license);
87 printf("REVISION: %s\n", OBP_DYNAMIC_PLUGIN_BUILD_REVISION_VAR);
88 printf("BUILD_BRANCH: %s\n", OBP_DYNAMIC_PLUGIN_BUILD_BRANCH_VAR);
90 printf("\n");
91
92 _exit(0);
93}
94
95#ifdef __cplusplus
96} // extern "C"
97#endif
#define OBP_PLUGIN_API_VERSION_CURRENT
current API version
uint64_t ObPluginVersion
The version type
#define OBP_DYNAMIC_PLUGIN_PLUGIN_VAR
#define OBP_DYNAMIC_PLUGIN_BUILD_DATE_VAR
#define OBP_DYNAMIC_PLUGIN_BUILD_REVISION_VAR
#define OBP_DYNAMIC_PLUGIN_BUILD_BRANCH_VAR
#define OBP_DYNAMIC_PLUGIN_NAME_VAR
#define OBP_VERSION_FIELD_NUMBER
The maximum number of each field of version
#define OBP_DYNAMIC_PLUGIN_BUILD_TIME_VAR
void _ob_plugin_lib_main()
void __print_version(ObPluginVersion version)
void __print_os_info()
void __print_compiler_info()
ob plugin description structure
const char * license
The license of the plugin.
ObPluginVersion version
library version for the plugin
const char * author