2

Is there any kind of sendfile64 for FreeBSD i386? Can't find anything like this in FreeBSD sys calls reference.

5
  • 1
    Doesn't sendfile work for you? FreeBSD doesn't have 64-suffixed calls at all.
    – arrowd
    Commented Feb 25, 2018 at 14:00
  • @arrowd it works but has a certain limitation on 32 system: off_t and size_t are 4 bytes long, so sendfile cannot handle files larger than 4Gb. On linux there is a sendfile64/fstat64... that solve the issue, so I want to know if there any solution for FreeBSD or to get a confirmation from people experienced in domain that there is no way to use sendfile on 32bit system for large files.
    – kola
    Commented Feb 25, 2018 at 18:11
  • What version of FreeBSD are you running? I was pretty sure that off_t and size_t were 64-bit on BSDs for a long time now: what do you get if you print out sizeof(off_t) and sizeof(size_t)?
    – ErikF
    Commented Feb 25, 2018 at 22:16
  • It outputs 4. I used thit port download.freebsd.org/ftp/releases/VM-IMAGES/11.1-RELEASE/i386/…
    – kola
    Commented Feb 26, 2018 at 12:52
  • Correct: sizeof(off_t) is 8, so the issue can be resolved as described here unix.stackexchange.com/a/427273/46624
    – kola
    Commented Mar 1, 2018 at 15:56

1 Answer 1

2

Even on i386, off_t is 64bit. Only size_t is 32bit. If you call sendfile() you can specify nbytes = 0, and it will send the entire file. The offset is 64bit, so if you need to send only part of a large file, you'd have to loop calling sendfile() with 32bit sized chunks, and increasing the offset.

In general you should not have any problems handling large files even on FreeBSD/i386.

1
  • Yes, you are right. That is what I end up with.
    – kola
    Commented Mar 1, 2018 at 15:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .