GFS_PIO_SENDFILE(3)

πŸ’– GFS_PIO_SENDFILE(3) πŸ’–

okay bestie, gather round, because this one is a Gfarm manual page and it is lowkey serving ✨file transfer realness✨. It's gfs_pio_sendfile, and yes, the name is giving "send a file" β€” but plot twist, it's actually about receiving a Gfarm file onto your local machine. The way that naming is chaotic but we move πŸ’…


✨ NAME ✨

gfs_pio_sendfile β€” receive a Gfarm file to local machine 🫢


🌸 SYNOPSIS 🌸

#include <gfarm/gfarm.h>

gfarm_error_t gfs_pio_sendfile(GFS_File w_gf, gfarm_off_t w_off,
                               int r_fd, gfarm_off_t r_off,
                               gfarm_off_t len, gfarm_off_t * sentp);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜•. This function sends len bytes of data, and it's moving them from here to there:

  • from the position specified by the offset r_off in a local file, which is pointed to by a file descriptor r_fd πŸ‘‰ that's the read side
  • to the position specified by the offset w_off of a Gfarm file w_gf πŸ‘‰ that's the write side

and if len is -1? iconic behavior honestly, because then this function just transfers until the end of the file. no byte left behind, periodt πŸŽ€

The transferred bytes get stored into the memory pointed to by sentp β€” but ONLY when sentp is not NULL. (if you passed NULL, no receipts, that's on you πŸ™ˆ)

and here's the detail you need for the vibe check: if len is a positive value, and the value pointed to by sentp is less than len, that means the transfer reached EOF. so like, fewer bytes than you asked for = you hit the end of the file. fr fr, that's the signal πŸ‘‘


πŸ’œ RETURN VALUES πŸ’œ

  • GFARM_ERR_NO_ERROR β€” slay, the function terminated successfully πŸ’…βœ¨
  • GFARM_ERR_OPERATION_NOT_PERMITTED β€” gf does not specify a regular file. not every file gets to be a regular file, and that's just the rules 🚫
  • GFARM_ERR_BAD_FILE_DESCRIPTOR β€” the file descriptor specified by gf is not a valid one, or is not open for reading 😭 like bestie, that fd is not okay
  • GFARM_ERR_NO_FILE_SYSTEM_NODE β€” there is no available file system node πŸ’€ nowhere to put this, sorry
  • GFARM_ERR_NO_MEMORY β€” insufficient memory was available 🫠
  • Others β€” an error except the above occurred. The reason is shown by gfarm_error_string(3). go check that one for the full story 🧚

🌈 SEE ALSO 🌈

gfs_pio_create(3), gfs_pio_open(3), gfs_pio_write(3), gfs_pio_recvfile(3)


and that's the whole page, bestie 🫢 this was Gfarm, dated 12 Aug 2015, and honestly it ate. go forth and transfer your bytes responsibly πŸ’–βœ¨πŸŽ€