Skip to content

Commit 324d13b

Browse files
committed
FileSystem: drop open64(), glibc remap open() and others with _FILE_OFFSET_BITS 64
1 parent d62d364 commit 324d13b

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

src/common/FileSystem.cpp

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828
===========================================================================
2929
*/
3030

31-
#if defined(_WIN32)
32-
#elif defined(__linux__) && defined(__GLIBC__)
33-
#define DAEMON_OPEN64
31+
#if defined(__GLIBC__)
32+
#define _FILE_OFFSET_BITS 64
3433
#endif
3534

3635
#if defined(BUILD_ENGINE)
@@ -198,8 +197,6 @@ inline int my_open(Str::StringRef path, openMode_t mode)
198197
int fd = _open_osfhandle(reinterpret_cast<intptr_t>(h), modes[mode_] | O_BINARY | O_NOINHERIT);
199198
if (fd == -1)
200199
CloseHandle(h);
201-
#elif defined(DAEMON_OPEN64)
202-
int fd = open64(path.c_str(), modes[mode_] | O_CLOEXEC, 0666);
203200
#else
204201
// This doesn't actually work in Native Client, but it's not used anyways.
205202
// O_CLOEXEC is supported in macOS from 10.7 onwards.
@@ -242,8 +239,6 @@ inline offset_t my_ftell(FILE* fd)
242239
{
243240
#ifdef _WIN32
244241
return _ftelli64(fd);
245-
#elif defined(DAEMON_OPEN64)
246-
return ftello64(fd);
247242
#else
248243
return ftello(fd);
249244
#endif
@@ -252,25 +247,19 @@ inline int my_fseek(FILE* fd, offset_t off, int whence)
252247
{
253248
#ifdef _WIN32
254249
return _fseeki64(fd, off, whence);
255-
#elif defined(DAEMON_OPEN64)
256-
return fseeko64(fd, off, whence);
257250
#else
258251
return fseeko(fd, off, whence);
259252
#endif
260253
}
261254
#ifdef _WIN32
262255
typedef struct _stati64 my_stat_t;
263-
#elif defined(DAEMON_OPEN64)
264-
using my_stat_t = struct stat64;
265256
#else
266257
using my_stat_t = struct stat;
267258
#endif
268259
inline int my_fstat(int fd, my_stat_t* st)
269260
{
270261
#ifdef _WIN32
271262
return _fstati64(fd, st);
272-
#elif defined(DAEMON_OPEN64)
273-
return fstat64(fd, st);
274263
#else
275264
return fstat(fd, st);
276265
#endif
@@ -279,8 +268,6 @@ inline int my_stat(Str::StringRef path, my_stat_t* st)
279268
{
280269
#ifdef _WIN32
281270
return _wstati64(Str::UTF8To16(path).c_str(), st);
282-
#elif defined(DAEMON_OPEN64)
283-
return stat64(path.c_str(), st);
284271
#else
285272
return stat(path.c_str(), st);
286273
#endif
@@ -298,8 +285,6 @@ inline intptr_t my_pread(int fd, void* buf, size_t count, offset_t offset)
298285
return -1;
299286
}
300287
return bytesRead;
301-
#elif defined(DAEMON_OPEN64)
302-
return pread64(fd, buf, count, offset);
303288
#else
304289
return pread(fd, buf, count, offset);
305290
#endif

0 commit comments

Comments
 (0)