/ | Mailing list | Docs | Examples | GitHub
libssh2_sftp_fstatvfs

Name

libssh2_sftp_statvfs, libssh2_sftp_fstatvfs - get file system statistics

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 require statvfs@openssh.com and fstatvfs@openssh.com extension support on the server.

sftp - SFTP instance as returned by

handle - SFTP File Handle as returned by

path - full path of any file within the mounted file system.

path_len - length of the full path.

st - Pointer to a LIBSSH2_SFTP_STATVFS structure 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 */
};

It is unspecified whether all members of the returned struct have meaningful values on all file systems.

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 by exec(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. While LIBSSH2_ERROR_EAGAIN is a negative number, it is not really a failure per se.

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.

Availability

Added in libssh2 1.2.6

See also

libssh2_sftp_init(3), libssh2_sftp_open_ex(3), libssh2_sftp_open_ex

This HTML page was made with roffit.

libssh2_agent_connect()
libssh2_agent_disconnect()
libssh2_agent_free()
libssh2_agent_get_identity()
libssh2_agent_get_identity_path()
libssh2_agent_init()
libssh2_agent_list_identities()
libssh2_agent_set_identity_path()
libssh2_agent_sign()
libssh2_agent_userauth()
libssh2_banner_set()
libssh2_base64_decode()
libssh2_channel_close()
libssh2_channel_direct_streamlocal_ex()
libssh2_channel_direct_tcpip()
libssh2_channel_direct_tcpip_ex()
libssh2_channel_eof()
libssh2_channel_exec()
libssh2_channel_flush()
libssh2_channel_flush_ex()
libssh2_channel_flush_stderr()
libssh2_channel_forward_accept()
libssh2_channel_forward_cancel()
libssh2_channel_forward_listen()
libssh2_channel_forward_listen_ex()
libssh2_channel_free()
libssh2_channel_get_exit_signal()
libssh2_channel_get_exit_status()
libssh2_channel_handle_extended_data()
libssh2_channel_handle_extended_data2()
libssh2_channel_ignore_extended_data()
libssh2_channel_open_ex()
libssh2_channel_open_session()
libssh2_channel_process_startup()
libssh2_channel_read()
libssh2_channel_read_ex()
libssh2_channel_read_stderr()
libssh2_channel_receive_window_adjust()
libssh2_channel_receive_window_adjust2()
libssh2_channel_request_auth_agent()
libssh2_channel_request_pty()
libssh2_channel_request_pty_ex()
libssh2_channel_request_pty_size()
libssh2_channel_request_pty_size_ex()
libssh2_channel_send_eof()
libssh2_channel_set_blocking()
libssh2_channel_setenv()
libssh2_channel_setenv_ex()
libssh2_channel_shell()
libssh2_channel_signal_ex()
libssh2_channel_subsystem()
libssh2_channel_wait_closed()
libssh2_channel_wait_eof()
libssh2_channel_window_read()
libssh2_channel_window_read_ex()
libssh2_channel_window_write()
libssh2_channel_window_write_ex()
libssh2_channel_write()
libssh2_channel_write_ex()
libssh2_channel_write_stderr()
libssh2_channel_x11_req()
libssh2_channel_x11_req_ex()
libssh2_crypto_engine()
libssh2_exit()
libssh2_free()
libssh2_hostkey_hash()
libssh2_init()
libssh2_keepalive_config()
libssh2_keepalive_send()
libssh2_knownhost_add()
libssh2_knownhost_addc()
libssh2_knownhost_check()
libssh2_knownhost_checkp()
libssh2_knownhost_del()
libssh2_knownhost_free()
libssh2_knownhost_get()
libssh2_knownhost_init()
libssh2_knownhost_readfile()
libssh2_knownhost_readline()
libssh2_knownhost_writefile()
libssh2_knownhost_writeline()
libssh2_poll()
libssh2_poll_channel_read()
libssh2_publickey_add()
libssh2_publickey_add_ex()
libssh2_publickey_init()
libssh2_publickey_list_fetch()
libssh2_publickey_list_free()
libssh2_publickey_remove()
libssh2_publickey_remove_ex()
libssh2_publickey_shutdown()
libssh2_scp_recv()
libssh2_scp_recv2()
libssh2_scp_send()
libssh2_scp_send64()
libssh2_scp_send_ex()
libssh2_session_abstract()
libssh2_session_banner_get()
libssh2_session_banner_set()
libssh2_session_block_directions()
libssh2_session_callback_set()
libssh2_session_callback_set2()
libssh2_session_disconnect()
libssh2_session_disconnect_ex()
libssh2_session_flag()
libssh2_session_free()
libssh2_session_get_blocking()
libssh2_session_get_read_timeout()
libssh2_session_get_timeout()
libssh2_session_handshake()
libssh2_session_hostkey()
libssh2_session_init()
libssh2_session_init_ex()
libssh2_session_last_errno()
libssh2_session_last_error()
libssh2_session_method_pref()
libssh2_session_methods()
libssh2_session_set_blocking()
libssh2_session_set_last_error()
libssh2_session_set_read_timeout()
libssh2_session_set_timeout()
libssh2_session_startup()
libssh2_session_supported_algs()
libssh2_sftp_close()
libssh2_sftp_close_handle()
libssh2_sftp_closedir()
libssh2_sftp_fsetstat()
libssh2_sftp_fstat()
libssh2_sftp_fstat_ex()
libssh2_sftp_fstatvfs()
libssh2_sftp_fsync()
libssh2_sftp_get_channel()
libssh2_sftp_init()
libssh2_sftp_last_error()
libssh2_sftp_lstat()
libssh2_sftp_mkdir()
libssh2_sftp_mkdir_ex()
libssh2_sftp_open()
libssh2_sftp_open_ex()
libssh2_sftp_open_ex_r()
libssh2_sftp_open_r()
libssh2_sftp_opendir()
libssh2_sftp_posix_rename()
libssh2_sftp_posix_rename_ex()
libssh2_sftp_read()
libssh2_sftp_readdir()
libssh2_sftp_readdir_ex()
libssh2_sftp_readlink()
libssh2_sftp_realpath()
libssh2_sftp_rename()
libssh2_sftp_rename_ex()
libssh2_sftp_rewind()
libssh2_sftp_rmdir()
libssh2_sftp_rmdir_ex()
libssh2_sftp_seek()
libssh2_sftp_seek64()
libssh2_sftp_setstat()
libssh2_sftp_shutdown()
libssh2_sftp_stat()
libssh2_sftp_stat_ex()
libssh2_sftp_statvfs()
libssh2_sftp_symlink()
libssh2_sftp_symlink_ex()
libssh2_sftp_tell()
libssh2_sftp_tell64()
libssh2_sftp_unlink()
libssh2_sftp_unlink_ex()
libssh2_sftp_write()
libssh2_sign_sk()
libssh2_trace()
libssh2_trace_sethandler()
libssh2_userauth_authenticated()
libssh2_userauth_banner()
libssh2_userauth_hostbased_fromfile()
libssh2_userauth_hostbased_fromfile_ex()
libssh2_userauth_keyboard_interactive()
libssh2_userauth_keyboard_interactive_ex()
libssh2_userauth_list()
libssh2_userauth_password()
libssh2_userauth_password_ex()
libssh2_userauth_publickey()
libssh2_userauth_publickey_fromfile()
libssh2_userauth_publickey_fromfile_ex()
libssh2_userauth_publickey_frommemory()
libssh2_userauth_publickey_sk()
libssh2_version()