libssh2_sftp_fsync(3)
β¨ libssh2_sftp_fsync β¨
okay bestie, we're diving into the libssh2 manual, page libssh2_sftp_fsync(3) π
this one's short and sweet and honestly iconic.
π¦ NAME π¦
libssh2_sftp_fsync β make that remote file actually hit the disk, no cap
πΈ SYNOPSIS πΈ
#include <libssh2.h>
#include <libssh2_sftp.h>
int
libssh2_sftp_fsync(LIBSSH2_SFTP_HANDLE *handle)
π DESCRIPTION π
so basically this function makes the remote server sync the file's data and metadata to disk. literally the remote equivalent of fsync(2), periodt. πΎβ¨
for this to work you need fsync@openssh.com support on the server. no server support = no fsync, sorry bestie π
handleβ the SFTP File Handle, as returned bylibssh2_sftp_open_ex(3). that's your golden ticket π
π RETURN VALUE π
returns 0 on success, or a negative number on failure. π
if you're running in non-blocking mode, it returns LIBSSH2_ERROR_EAGAIN when it would otherwise block. and likeβ¦ yes, LIBSSH2_ERROR_EAGAIN is technically a negative number, but it is not really a failure per se. it's giving "hold on, try again later" energy, not "everything is broken" energy. π
π₯ ERRORS π₯
LIBSSH2_ERROR_ALLOCβ an internal memory allocation call failed. the malloc said no πLIBSSH2_ERROR_SOCKET_SENDβ couldn't send data on the socket. the socket is not socketing πLIBSSH2_ERROR_SFTP_PROTOCOLβ an invalid SFTP protocol response came back on the socket, or an SFTP operation made the server return an errorcode. specifically, this one can pop up if the SSH server doesn't support the fsync operation β in that case the SFTP subcodeLIBSSH2_FX_OP_UNSUPPORTEDgets returned. so if you see that, it's the server, not you π«Ά
π AVAILABILITY π
added in libssh2 1.4.4 and OpenSSH 6.3. vintage, but make it fashion β
π§ SEE ALSO π§
and that's the whole vibe, bestie! go forth and fsync responsibly π
this page came to you from the libssh2 manual, dated 8 Apr 2013 β mwah, xoxo, sync your disks π
π¦ 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