Stiffstream / restinio

Cross-platform, efficient, customizable, and robust asynchronous HTTP(S)/WebSocket server C++ library with the right balance between performance and ease of use
Other
1.16k stars 93 forks source link

sendfile_posix: only use *64 APIs when _LARGEFILE64_SOURCE is defined #213

Open aberaud opened 8 months ago

aberaud commented 8 months ago

64 APIS are considered deprecated and should not be used unless _LARGEFILE64_SOURCE is explicitly defined.

eao197 commented 8 months ago

Hi!

64 APIS are considered deprecated

Could you please provide a reference to a document that declares the Large-File Summit (LFS) specification for POSIX deprecated?

aberaud commented 2 days ago

Hi,

The API with 64 suffix is called the transitional LFS API and is mostly designed to be used by legacy 32 bits systems.

As documented by glibc for _LARGEFILE64_SOURCE:

This macro was introduced as part of the Large File Support extension (LFS). It is a transition interface for the period when 64 bit offsets are not generally used (see _FILE_OFFSET_BITS).

The modern way to manage large files is to use the standard POSIX API (without 64) with _FILE_OFFSET_BITS=64.

In any case, APIs with 64 at the end must not be used if _LARGEFILE64_SOURCE is not defined, so this patch fixes that.

eao197 commented 2 days ago

Hi, @aberaud !

Thanks you very much for the explanation.

We'll take a closer look at it the next week.