25 #include <sys/types.h>
52 #define SOL_UTIL_MAX_READ_ATTEMPTS 10
136 int sol_util_vread_file(const
char *path, const
char *fmt, va_list args) SOL_ATTR_SCANF(2, 0);
170 SOL_ATTR_WARN_UNUSED_RESULT
188 SOL_ATTR_WARN_UNUSED_RESULT
202 SOL_ATTR_WARN_UNUSED_RESULT
216 SOL_ATTR_WARN_UNUSED_RESULT
230 SOL_ATTR_WARN_UNUSED_RESULT
244 SOL_ATTR_WARN_UNUSED_RESULT
301 else if ((
size_t)ret < size)
328 const char *dir_path,
329 struct dirent *ent),
const void *data);
int sol_util_move_file(const char *old_path, const char *new_path, mode_t mode)
Moves file on filesystem.
#define SOL_ATTR_PRINTF(fmt, arg)
Specifies that a function takes printf style arguments which should be type-checked against a format ...
Definition: sol-macros.h:189
int int ssize_t sol_util_write_file_slice(const char *path, struct sol_str_slice slice)
Write the slice content the file pointed by path.
char * sol_util_load_file_fd_string(int fd, size_t *size)
Reads the contents of a file.
int sol_util_get_user_config_dir(struct sol_buffer *buffer)
Get the user context config directory for current app.
bool sol_util_busy_wait_file(const char *path, uint64_t nanoseconds)
Wait for some file to become available.
int sol_util_get_rootdir(char *out, size_t size)
Gets the root directory.
int int struct sol_buffer * sol_util_load_file_fd_raw(int fd)
Reads the contents of a file.
char * sol_util_load_file_string(const char *filename, size_t *size)
Reads the contents of a file.
These are common Soletta macros.
int int sol_util_vwrite_file(const char *path, const char *fmt, va_list args) SOL_ATTR_PRINTF(2
Write the formatted string in the file pointed by path.
static struct sol_buffer value
Definition: server.c:42
int sol_util_read_file(const char *path, const char *fmt,...) SOL_ATTR_SCANF(2
Reads from a file the contents according with the formatted string.
sol_util_iterate_dir_reason
Return values (for non-error paths) expected from sol_util_iterate_dir() callbacks.
Definition: sol-util-file.h:62
String slice type.
Definition: sol-str-slice.h:84
These are routines that Soletta provides for its buffer implementation.
static FILE * fd
Definition: download.c:28
#define SOL_ATTR_WARN_UNUSED_RESULT
Causes a warning to be emitted if a caller of the function with this attribute does not use its retur...
Definition: sol-macros.h:187
int int sol_util_vread_file(const char *path, const char *fmt, va_list args) SOL_ATTR_SCANF(2
Reads from a file the contents according with the formatted string.
int sol_util_load_file_buffer(const char *filename, struct sol_buffer *buf)
Reads the contents of a file and append to a buffer.
static int sol_util_fill_buffer_exactly(int fd, struct sol_buffer *buffer, size_t size)
Fills buffer with data read from file fd with an exact amount of bytes.
Definition: sol-util-file.h:295
The directory iteration should continue.
Definition: sol-util-file.h:64
int sol_util_file_encode_filename(struct sol_buffer *buf, const struct sol_str_slice value)
Encode string to be used as a file name.
int sol_util_iterate_dir(const char *path, enum sol_util_iterate_dir_reason(*iterate_dir_cb)(void *data, const char *dir_path, struct dirent *ent), const void *data)
Iterate over a directory.
int sol_util_load_file_fd_buffer(int fd, struct sol_buffer *buf)
Reads the contents of a file and append to a buffer.
int sol_util_write_file(const char *path, const char *fmt,...) SOL_ATTR_PRINTF(2
Write the formatted string in the file pointed by path.
ssize_t sol_util_fill_buffer(int fd, struct sol_buffer *buffer, size_t size)
Fills buffer with data read from file fd.
int sol_util_create_recursive_dirs(const struct sol_str_slice path, mode_t mode)
Create directories recursively.
struct sol_str_slice sol_util_file_get_basename(struct sol_str_slice path)
Get the basename of a path.
A sol_buffer is a dynamic array, that can be resized if needed.
Definition: sol-buffer.h:130
The directory iteration should stop.
Definition: sol-util-file.h:63
int sol_util_fd_set_flag(int fd, int flag)
Set a flag into a file descriptor.
#define SOL_ATTR_SCANF(fmt, arg)
Specifies that a function takes scanf style arguments which should be type-checked against a format s...
Definition: sol-macros.h:190