* Return 0 on success or else a negative value.
*/
LTTNG_HIDDEN
-int utils_create_stream_file(char *path_name, char *file_name, uint64_t size,
+int utils_create_stream_file(const char *path_name, char *file_name, uint64_t size,
uint64_t count, int uid, int gid)
{
int ret, out_fd, flags, mode;
*
* @return 0 on success, -1 on failure.
*/
+LTTNG_HIDDEN
int utils_parse_size_suffix(char *str, uint64_t *size)
{
regex_t regex;
* Obtain the value of LTTNG_HOME environment variable, if exists.
* Otherwise returns the value of HOME.
*/
+LTTNG_HIDDEN
char *utils_get_home_dir(void)
{
char *val = NULL;
}
return getenv(DEFAULT_LTTNG_FALLBACK_HOME_ENV_VAR);
}
+
+/*
+ * With the given format, fill dst with the time of len maximum siz.
+ *
+ * Return amount of bytes set in the buffer or else 0 on error.
+ */
+LTTNG_HIDDEN
+size_t utils_get_current_time_str(const char *format, char *dst, size_t len)
+{
+ size_t ret;
+ time_t rawtime;
+ struct tm *timeinfo;
+
+ assert(format);
+ assert(dst);
+
+ /* Get date and time for session path */
+ time(&rawtime);
+ timeinfo = localtime(&rawtime);
+ ret = strftime(dst, len, format, timeinfo);
+ if (ret == 0) {
+ ERR("Unable to strftime with format %s at dst %p of len %lu", format,
+ dst, len);
+ }
+
+ return ret;
+}