//go:build linux || darwin

package handlers

import "syscall"

func diskUsage(path string) map[string]any {
	var stat syscall.Statfs_t
	if err := syscall.Statfs(path, &stat); err != nil {
		return nil
	}
	total := stat.Blocks * uint64(stat.Bsize)
	free := stat.Bfree * uint64(stat.Bsize)
	return map[string]any{
		"total_bytes": total,
		"free_bytes":  free,
		"used_bytes":  total - free,
		"path":        path,
	}
}
