blob: 8a8d3a2b0311f29e921103de9804886bedfe5fc2 [file] [log] [blame]
Dimitry Ivanov708589f2016-09-19 10:50:28 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
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
17#ifndef __DLFCN_SYMLINK_SUPPORT_H__
18#define __DLFCN_SYMLINK_SUPPORT_H__
19
20#include <string>
21
22void create_dlfcn_test_symlink(const char* suffix, std::string* result);
23void remove_dlfcn_test_symlink(const std::string& path);
24
25class DlfcnSymlink {
26 public:
27 explicit DlfcnSymlink(const char* test_name) {
28 create_dlfcn_test_symlink(test_name, &symlink_path_);
29 }
30
31 ~DlfcnSymlink() {
32 remove_dlfcn_test_symlink(symlink_path_);
33 }
34
35 const std::string& get_symlink_path() const {
36 return symlink_path_;
37 }
38
39 private:
40 std::string symlink_path_;
41};
42
43#endif /* __DLFCN_SYMLINK_SUPPORT_H__ */