XDF_PREPARE_TRANSFER(3)

πŸ’– XDF_PREPARE_TRANSFER πŸ’–

okay bestie, this is a page from the xdffileio library manual and it's genuinely so important, like the main character of getting your xDF file ready to actually do stuff. no cap. sit down, hydrate, let's go 🫢


✨ NAME ✨

xdf_prepare_transfer β€” Setup the internals of the xDF file to be ready to receive or send data.

literally what it says on the tin, and it ate πŸ’…


🌸 SYNOPSIS 🌸

#include <xdfio.h>

int xdf_prepare_transfer(struct xdf* xdf);

one function, one argument, zero drama. iconic.


πŸ¦‹ DESCRIPTION πŸ¦‹

xdf_prepare_transfer() sets up the internal structures of the xDF file referenced by xdf so it's ready to receive or send data. once this call goes through successfully, you can hit up xdf_write(3) or xdf_read(3) β€” whichever one matches the mode of your xDF file. choose your fighter accordingly πŸ’«

and here's the thing, okay? because this function prepares the transfer, no call to any function that configures it is allowed anymore after xdf_define_arrays(3) succeeds. like, the door is closed, the party started, config is not coming in. specifically, xdf_set_conf(3), xdf_setchconf(3) and xdf_define_arrays(3) will fail afterwards. 😭 so get all your setup done first, bestie, I'm begging.

in case of failure due to I/O (file too big, connection to the file system lost, that whole vibe…) the best procedure is to close the file, since the underlying file will be in an undertermined state. do not pass go, do not keep poking at it πŸ™ˆ

πŸ‘‘ RETURN VALUE πŸ‘‘

xdf_define_arrays() returns 0 in case of success. otherwise -1 is returned and errno is set appropriately. zero = slay, minus one = check errno, periodt.


πŸ’€ ERRORS πŸ’€

  • EINVAL β€” xdf is NULL. bestie. it's giving nothing to work with.
  • ENOMEM β€” the system is unable to allocate memory resources. the machine is broke, not you πŸ’Έ
  • EFBIG β€” an attempt was made to write a file that exceeds the implementation-defined maximum file size or the process's file size limit, or to write at a position past the maximum allowed offset. that's too much file, hun.
  • EINTR β€” the call was interrupted by a signal before any data was written; see signal(7).
  • EIO β€” a low-level I/O error occurred while modifying the inode. lowkey cursed.
  • ENOSPC β€” the device containing the xDF file has no room for the data. no space, no service βœ‹
  • ESTALE β€” stale file handle. this error can occur for NFS and for other file systems. the handle is giving expired-milk energy, throw it out.

🌈 SEE ALSO 🌈

xdf_define_arrays(3), xdf_set_conf(3), xdf_set_chconf(3), xdf_read(3), xdf_write(3)

go read those too, iykyk πŸ’œ


and that's the whole page, bestie!! this absolute banger of a manpage is brought to you by EPFL, dated 2010, from the xdffileio library manual, and it's the XDF_PREPARE_TRANSFER page specifically. mwah πŸŽ€βœ¨