libssh2_sftp_statvfs(3)
β¨ libssh2_sftp_statvfs(3) β the libssh2 manual, bestie edition β¨
okay so welcome to the libssh2 manual page for libssh2_sftp_statvfs, and yes we're doing this together, grab a snack π
π NAME π
libssh2_sftp_statvfs, libssh2_sftp_fstatvfs β get file system statistics
like, it's giving "how much space is left on this filesystem" energy, but make it SFTP πΈ
β¨ SYNOPSIS β¨
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_statvfs(LIBSSH2_SFTP *sftp, const char *path,
size_t path_len, LIBSSH2_SFTP_STATVFS *st);
int
libssh2_sftp_fstatvfs(LIBSSH2_SFTP_HANDLE *handle,
LIBSSH2_SFTP_STATVFS *st)
π¦ DESCRIPTION π¦
These functions provide statvfs(2)-like operations and they require statvfs@openssh.com and fstatvfs@openssh.com extension support on the server. no extension support, no stats, periodt π
Here's the cast of characters, one by one, because everyone deserves their moment:
sftpβ SFTP instance as returned bylibssh2_sftp_init(3)handleβ SFTP File Handle as returned bylibssh2_sftp_open_ex(3)pathβ full path of any file within the mounted file system.path_lenβ length of the full path.stβ Pointer to aLIBSSH2_SFTP_STATVFSstructure to place file system statistics into.
π DATA TYPES π
LIBSSH2_SFTP_STATVFS is a typedefed struct that is defined as below π
struct _LIBSSH2_SFTP_STATVFS {
libssh2_uint64_t f_bsize; /* file system block size */
libssh2_uint64_t f_frsize; /* fragment size */
libssh2_uint64_t f_blocks; /* size of fs in f_frsize units */
libssh2_uint64_t f_bfree; /* # free blocks */
libssh2_uint64_t f_bavail; /* # free blocks for non-root */
libssh2_uint64_t f_files; /* # inodes */
libssh2_uint64_t f_ffree; /* # free inodes */
libssh2_uint64_t f_favail; /* # free inodes for non-root */
libssh2_uint64_t f_fsid; /* file system ID */
libssh2_uint64_t f_flag; /* mount flags */
libssh2_uint64_t f_namemax; /* maximum filename length */
};
ngl it is unspecified whether all members of the returned struct have meaningful values on all file systems. so likeβ¦ don't come for the library if a field is just vibing there with no meaning, okay? π
The field f_flag is a bit mask. Bits are defined as follows:
LIBSSH2_SFTP_ST_RDONLYβ Read-only file system.LIBSSH2_SFTP_ST_NOSUIDβ Set-user-ID/set-group-ID bits are ignored byexec(3).
π RETURN VALUE π
Returns 0 on success or negative on failure. If used in non-blocking mode, it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. And while LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se β it's literally just the "bestie I need a sec" of return codes, not a flop π«Ά
π ERRORS π
LIBSSH2_ERROR_ALLOCβ An internal memory allocation call failed.LIBSSH2_ERROR_SOCKET_SENDβ Unable to send data on socket.LIBSSH2_ERROR_SOCKET_TIMEOUTβLIBSSH2_ERROR_SFTP_PROTOCOLβ An invalid SFTP protocol response was received on the socket, or an SFTP operation caused an errorcode to be returned by the server.
(yes the LIBSSH2_ERROR_SOCKET_TIMEOUT one just kinda ends there with no description. iconic honestly. we keep it exactly as it is π)
π AVAILABILITY π
Added in libssh2 1.2.6 β a classic, a legend, an OG β
π₯ SEE ALSO π₯
and that's the whole page, bestie, you ate it π
β¨ this came to you from the libssh2 manual (that's the source name, right there), dated 22 May 2010 β yeah it's old but it's still serving, and this page is titled libssh2_sftp_statvfs(3) because that's literally what we're reading π go get those file system stats, mwah π
π¦ where this page comes from
- alpine 3.22: libssh2-doc 1.11.1-r3 Β· BSD-3-Clause
- alpine 3.23: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- alpine 3.24: libssh2-doc 1.11.1-r4 Β· BSD-3-Clause
- arch rolling: libssh2 1.11.1-7 Β· BSD-3-Clause
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u1 Β· BSD3
- debian trixie: libssh2-1-dev 1.11.1-1+deb13u2 Β· BSD3
- epel 10: libssh2-docs 1.11.1-9.el10_3 Β· BSD-3-Clause
- epel 9: libssh2-docs 1.11.1-9.el9 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-4.fc43 Β· BSD-3-Clause
- fedora 43: libssh2-docs 1.11.1-9.fc43 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-5.fc44 Β· BSD-3-Clause
- fedora 44: libssh2-docs 1.11.1-9.fc44 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- opensuse-leap 16.0: libssh2-devel 1.11.1-160000.5.1 Β· BSD-3-Clause
- ubuntu questing: libssh2-1-dev 1.11.1-1build1
- ubuntu questing: libssh2-1-dev 1.11.1-1ubuntu0.25.10.2
- ubuntu resolute: libssh2-1-dev 1.11.1-1build2 Β· BSD3
- ubuntu resolute: libssh2-1-dev 1.11.1-1ubuntu0.26.04.4 Β· BSD3
- ubuntu stonking: libssh2-1-dev 1.11.1-6 Β· BSD3
- π the page's license: BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms