1 /*
2 * Copyright (c) 2024 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "library_func_mock.h"
17
18 using namespace OHOS::Storage::DistributedFile;
dlopen(const char * file,int mode)19 void *dlopen(const char *file, int mode)
20 {
21 if (LibraryFunc::libraryFunc_ == nullptr) {
22 return nullptr;
23 }
24 return LibraryFunc::libraryFunc_->dlopen(file, mode);
25 }
26
dlclose(void * handle)27 int dlclose(void *handle)
28 {
29 if (LibraryFunc::libraryFunc_ == nullptr) {
30 return -1;
31 }
32 return LibraryFunc::libraryFunc_->dlclose(handle);
33 }
34
dlsym(void * __restrict handle,const char * __restrict name)35 void *dlsym(void *__restrict handle, const char *__restrict name)
36 {
37 if (LibraryFunc::libraryFunc_ == nullptr) {
38 return nullptr;
39 }
40 return LibraryFunc::libraryFunc_->dlsym(handle, name);
41 }
42
realpath(const char * __restrict path,char * __restrict resolved_path)43 char *realpath(const char *__restrict path, char *__restrict resolved_path)
44 {
45 if (LibraryFunc::libraryFunc_ == nullptr) {
46 return nullptr;
47 }
48 return LibraryFunc::libraryFunc_->realpath(path, resolved_path);
49 }
50
51