2 * Copyright (c) 2023 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef LIB_LAUNCHPAD_GLIB_UTIL_HH_
18 #define LIB_LAUNCHPAD_GLIB_UTIL_HH_
21 #include <sys/types.h>
22 #include <tzplatform_config.h>
27 #include <app_info.hh>
31 #define EXPORT_API __attribute__((visibility("default")))
34 #define GLOBAL_USER tzplatform_getuid(TZ_SYS_GLOBALAPP_USER)
38 class EXPORT_API Util {
40 static void SetEnvironments(const AppInfo* app_info);
41 static void DeleteSocketPath(pid_t pid, uid_t uid);
42 static int EnableExternalPackage(const AppInfo* app_info);
43 static int MountResourceDirectories(const AppInfo* app_info);
44 [[nodiscard]] static int MountGadgetDirectories(const tizen_base::Bundle& b);
45 static int WaitTepMount(const AppInfo* app_info);
46 static std::string GetLibDirectory(const std::string& app_path);
47 static void CloseAllFds(const std::vector<int>& except_fds = {});
48 static int PrepareAppSocket();
49 static int PrepareAppIdFile(const AppInfo* app_info);
50 static int SendCmdToAmd(enum AmdCmd cmd);
51 static int SendCmdToAmd(enum AmdCmd cmd, bundle* request, int opt);
52 static int MountLibraryDirectories(const tizen_base::Bundle& b);
55 } // namespace launchpad
57 #endif // LIB_LAUNCHPAD_GLIB_UTIL_HH_