#ifndef __UTILS_H__
#define __UTILS_H__
+#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <launcher_env.h>
+#include <sys/prctl.h>
+
#ifndef PATH_SEPARATOR
#define PATH_SEPARATOR '/'
#endif
+#ifndef PROFILE_BASENAME
+#define PROFILE_BASENAME ".__tizen_specific_profile_data"
+#endif
+
namespace bf = boost::filesystem;
namespace bs = boost::system;
FS_PRESERVE_OWNERSHIP_AND_PERMISSIONS = (1 << 3)
};
+#ifndef PR_TASK_PERF_USER_TRACE
+#define PR_TASK_PERF_USER_TRACE 666
+#endif
+
/**
* @brief concat path with PATH_SEPARATOR
* @param[in] destination path
* @param[in] source path
- * return std::string result path
+ * @return std::string result path
*/
std::string concatPath(const std::string& path1, const std::string& path2);
/**
* @brief get canonicalized absolute Path
* @param[in] source path
- * return std::string result path
+ * @return std::string result path
*/
std::string getAbsolutePath(const std::string& path);
/**
* @brief get the directory of file
* @param[in] source path
- * return std::string result path
+ * @return std::string result path
*/
std::string getBaseName(const std::string& path);
* @param[in] original string
* @param[in] pattern to match
* @param[in] replacement string
- * return std::string the modified string
+ * @return std::string the modified string
*/
std::string replaceAll(const std::string& str, const std::string& pattern, const std::string& replace);
/**
* @brief get root path
* @param[in] package id
- * return std::string root path
+ * @return std::string root path
*/
std::string getRootPath(const std::string& pkgId);
/**
* @brief get exec name
* @param[in] package id
- * return std::string exec name
+ * @return std::string exec name
*/
std::string getExecName(const std::string& pkgId);
/**
* @brief get app type
* @param[in] package id
- * return std::string app type
+ * @return std::string app type
*/
std::string getAppType(const std::string& pkgId);
* @brief get metadata value
* @param[in] package id
* @param[in] metadata key
- * return std::string metadata value
+ * @return std::string metadata value
*/
std::string getMetadataValue(const std::string& pkgId, const std::string& key);
/**
+ * @brief change the extension of a path or file
+ * @param[in] source path or file
+ * @param[in] from extension
+ * @param[in] to extension
+ * @return std::string path or file with changed extension
+ */
+std::string changeExtension(const std::string& path, const std::string& from, const std::string& to);
+
+/**
+ * @brief check the path is 'readonly' or not
+ * @param[in] path
+ * @return bool package readonly value
+ */
+bool isReadOnlyArea(const std::string& path);
+
+/**
* @brief split path with ":" delimiter and put that in the vector
* @param[in] source path
* @param[out] string vector
bool isFile(const std::string& path);
/**
+ * @brief check symlink file
+ * @param[in] source path
+ * @return bool
+ */
+bool isSymlinkFile(const std::string& path);
+
+/**
* @brief check directory exists
* @param[in] source path
* @return bool
bool isManagedAssembly(const std::string& filePath);
/**
- * @brief check the file is native image or not.
- * @param[in] file path
- * @return return true when the file is native image.
- */
-bool isNativeImage(const std::string& filePath);
-
-/**
* @brief Resolve assembly files from directories and append their paths to the given list.
* @remark If a native image exists for an assembly in the same directory, it will be used.
* If multiple assemblies of the same name exist, the first one will be used.
pkgmgrinfo_app_list_cb app_cb,
void *user_data);
+/**
+ * @brief Prints HW Clock log
+ * @param[in] format `printf`-like format string
+ * @param[in] ... `printf`-like variadic list of arguments corresponding to the format string
+ */
+void printHWClockLog(const char* format, ...);
+
+/**
+ * @brief Return NCDB startup hook
+ * @return NCDB startup hook
+ */
+const char* getNCDBStartupHook();
+
+/**
+ * @brief Check is NCDB startup hook provided in DOTNET_STARTUP_HOOKS env
+ * @return `true` if provided, otherwise `false`
+ */
+bool isNCDBStartupHookProvided();
+
#endif /* __UTILS_H__ */