Closed tehn closed 5 years ago
could be also implemented as auto-stopping recording when there's little or no space.
should add to new-crone Tape (auto-stop thread?)
statvfs
f_bsize * f_bfree
#include <sys/statvfs.h>
int statvfs(const char *path, struct statvfs *buf);
int fstatvfs(int fd, struct statvfs *buf);
DESCRIPTION
The function statvfs() returns information about a mounted file system.
path is the pathname of any file within the mounted file system. buf
is a pointer to a statvfs structure defined approximately as follows:
struct statvfs {
unsigned long f_bsize; /* file system block size */
unsigned long f_frsize; /* fragment size */
fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
fsblkcnt_t f_bfree; /* # free blocks */
fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */
fsfilcnt_t f_files; /* # inodes */
fsfilcnt_t f_ffree; /* # free inodes */
fsfilcnt_t f_favail; /* # free inodes for unprivileged users */
unsigned long f_fsid; /* file system ID */
unsigned long f_flag; /* mount flags */
unsigned long f_namemax; /* maximum filename length */
};
i added a disk space checker to matron some time ago:
https://github.com/monome/norns/blob/master/matron/src/hardware/stat.c#L62
the logic is implemented in menu.lua for auto-stop
make sure there is enough free disk space so the whole OS doesn't break.