Fix freebsd (#464)
* FreeBSD: catchup with the internal changes in code * FreeBSD: use statvfs instead on statfs Follow NetBSD here while here, catch up with code architecture changes
This commit is contained in:
parent
262327a795
commit
db279644c3
|
@ -595,7 +595,7 @@ void print_battery_info(battery_info_ctx_t *ctx) {
|
||||||
#endif
|
#endif
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__OpenBSD__)
|
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) || defined(__OpenBSD__)
|
||||||
/* These OSes report battery time in minutes. */
|
/* These OSes report battery time in minutes. */
|
||||||
hide_seconds = true;
|
ctx->hide_seconds = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ctx->number < 0) {
|
if (ctx->number < 0) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ static int print_bytes_human(char *outwalk, uint64_t bytes, const char *prefix_t
|
||||||
* Determines whether remaining bytes are below given threshold.
|
* Determines whether remaining bytes are below given threshold.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#if defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
static bool below_threshold(struct statfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
|
static bool below_threshold(struct statfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
|
||||||
#else
|
#else
|
||||||
static bool below_threshold(struct statvfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
|
static bool below_threshold(struct statvfs buf, const char *prefix_type, const char *threshold_type, const double low_threshold) {
|
||||||
|
@ -124,17 +124,17 @@ void print_disk_info(disk_info_ctx_t *ctx) {
|
||||||
|
|
||||||
INSTANCE(ctx->path);
|
INSTANCE(ctx->path);
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
#if defined(__OpenBSD__) || defined(__DragonFly__) || defined(__APPLE__)
|
||||||
struct statfs buf;
|
struct statfs buf;
|
||||||
|
|
||||||
if (statfs(path, &buf) == -1)
|
if (statfs(path, &buf) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
|
||||||
struct statvfs buf;
|
struct statvfs buf;
|
||||||
|
|
||||||
if (statvfs(path, &buf) == -1)
|
if (statvfs(ctx->path, &buf) == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mounted = true;
|
mounted = true;
|
||||||
|
|
|
@ -250,8 +250,8 @@ void print_volume(volume_ctx_t *ctx) {
|
||||||
const char *devicename = "UNSUPPORTED"; /* TODO: implement support for this */
|
const char *devicename = "UNSUPPORTED"; /* TODO: implement support for this */
|
||||||
pbval = 1;
|
pbval = 1;
|
||||||
|
|
||||||
if (mixer_idx > 0)
|
if (ctx->mixer_idx > 0)
|
||||||
asprintf(&mixerpath, "/dev/mixer%d", mixer_idx);
|
asprintf(&mixerpath, "/dev/mixer%d", ctx->mixer_idx);
|
||||||
else
|
else
|
||||||
mixerpath = defaultmixer;
|
mixerpath = defaultmixer;
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ void print_volume(volume_ctx_t *ctx) {
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mixer_idx > 0)
|
if (ctx->mixer_idx > 0)
|
||||||
free(mixerpath);
|
free(mixerpath);
|
||||||
|
|
||||||
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
#if defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
|
@ -351,7 +351,7 @@ void print_volume(volume_ctx_t *ctx) {
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
buffer = apply_volume_format(fmt, buffer, vol & 0x7f, devicename);
|
ctx->buf = apply_volume_format(ctx->fmt, vol & 0x7f, devicename);
|
||||||
close(mixfd);
|
close(mixfd);
|
||||||
goto out_with_format;
|
goto out_with_format;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue