44#include "utilities/qstring.h"
45#include "utilities/qcount.h"
66 int fd = open(filepath, O_RDONLY, 0);
71 ssize_t readed = read(fd, buf, (
sizeof(buf) - 1));
96 int fd = open(filepath, O_CREAT | O_WRONLY | O_TRUNC,
97 (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH));
101 char *str =
qstrdupf(
"%"PRId64, number);
102 ssize_t updated = write(fd, str, strlen(str));
bool qcount_save(const char *filepath, int64_t number)
Save counter(integer) to file with advisory file locking.
int64_t qcount_read(const char *filepath)
Read counter(integer) from file with advisory file locking.
int64_t qcount_update(const char *filepath, int64_t number)
Increases(or decrease) the counter value as much as specified number with advisory file locking.
char * qstrdupf(const char *format,...)
Duplicate a formatted string.