gnutls_record_send_file(3)
π gnutls_record_send_file(3) π
okay so bestie, welcome to the gnutls manual, and today's episode is all about gnutls_record_send_file β an API function that yeets a whole file down your TLS connection. no cap, this one is lowkey iconic. π¦
β¨ NAME β¨
gnutls_record_send_file β API function, aka "the file-sending one". π
πΈ SYNOPSIS πΈ
#include <gnutls/gnutls.h>
ssize_t gnutls_record_send_file(gnutls_session_t session, int fd, off_t
* offset, size_t count);
π ARGUMENTS π
gnutls_session_t sessionβ bestie this is just agnutls_session_ttype. the session, the vibe, the whole thing. πint fdβ the file descriptor you're gonna read data from. your source. your supply. πoff_t * offsetβ it's relative to the file offset, and it marks the starting location for reading. after the function returns, it points to the position following the last read byte. (not me checking exactly where we landed π)size_t countβ the length of the data, in bytes, to be read from the file and sent. that's your byte budget fr fr. π’
π¦ DESCRIPTION π¦
so this function sends data from fd. and here's the tea: if KTLS (kernel TLS) is enabled, it will use the sendfile() system call to avoid the overhead of copying data between user space and the kernel. slay, zero-copy, main character energy. β¨
otherwise? this functionality is merely emulated by calling read() and gnutls_record_send(). it's giving "we got sendfile at home". π
if this implementation is suboptimal, check whether KTLS is enabled using gnutls_transport_is_ktls_enabled(). that's your vibe check, go do it. π
also, important: if offset is NULL then the file offset is incremented by the number of bytes send, otherwise the file offset remains unchanged. (yes it says "send" in the original, and yes we're keeping it exactly, periodt π
)
β RETURNS β
the number of bytes sent, or a negative error code. that's it, that's the return. π
π REPORTING BUGS π
found a bug? not cute. report it to <bugs@gnutls.org>.
home page: https://www.gnutls.org
π COPYRIGHT π
Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.
π«Ά SEE ALSO π«Ά
the full documentation for gnutls is maintained as a Texinfo manual. if the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit
https://www.gnutls.org/manual/
and that's the whole page, bestie!! this manual shipped as part of gnutls 3.8.13 β go forth and send those files, iykyk. mwah πβ¨ππ¦πΈπ
π¦ where this page comes from
- alpine 3.22: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.23: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- alpine 3.24: gnutls-doc 3.8.13-r0 Β· LGPL-2.1-or-later
- arch rolling: gnutls 3.8.13-3 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 43: gnutls-devel 3.8.13-1.fc43 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- fedora 44: gnutls-devel 3.8.13-1.fc44 Β· GPL-3.0-or-later AND LGPL-2.1-or-later
- ubuntu stonking: gnutls-doc 3.8.13-1ubuntu1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms