You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Unix: Remove now unnecessary I/O defines, cleanup
- `LIBC_FILEIO_ENABLED` wasn't defined anywhere, even in _other platforms_. - `NO_NETWORK` is also never defined. It probably isn't enough anyway to disable network APIs in the current codebase. - `UNIX_SOCKET_UNAVAILABLE` is never defined in this code but used by some other platforms, clarify that. - `NO_STATVFS` can be removed as Android supports it since API level 19, which is our current min SDK level. It's also only used for `DirAccessUnix::get_space_left()` which is anyway overridden by `DirAccessJAndroid::get_space_left()` so it shouldn't make a difference. * Fixed documentation for `DirAccess.get_space_left()`. - `NO_FCNTL` is likely also a remnant of early Android days, in current NDK r23 it seems to be available. Also cleaned up unused `fcntl.h` includes. - `NO_ALLOCA` is never defined, and we use alloca in many places now.
This commit is contained in:
@@ -30,24 +30,20 @@
|
||||
|
||||
#include "file_access_unix.h"
|
||||
|
||||
#if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED)
|
||||
#if defined(UNIX_ENABLED)
|
||||
|
||||
#include "core/os/os.h"
|
||||
#include "core/string/print_string.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#if defined(UNIX_ENABLED)
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID_ENABLED
|
||||
#include <sys/statvfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef MSVC
|
||||
#define S_ISREG(m) ((m)&_S_IFREG)
|
||||
#include <io.h>
|
||||
@@ -56,12 +52,6 @@
|
||||
#define S_ISREG(m) ((m)&S_IFREG)
|
||||
#endif
|
||||
|
||||
#ifndef NO_FCNTL
|
||||
#include <fcntl.h>
|
||||
#else
|
||||
#include <sys/ioctl.h>
|
||||
#endif
|
||||
|
||||
void FileAccessUnix::check_errors() const {
|
||||
ERR_FAIL_COND_MSG(!f, "File must be opened before use.");
|
||||
|
||||
@@ -131,13 +121,8 @@ Error FileAccessUnix::open_internal(const String &p_path, int p_mode_flags) {
|
||||
int fd = fileno(f);
|
||||
|
||||
if (fd != -1) {
|
||||
#if defined(NO_FCNTL)
|
||||
unsigned long par = 0;
|
||||
ioctl(fd, FIOCLEX, &par);
|
||||
#else
|
||||
int opts = fcntl(fd, F_GETFD);
|
||||
fcntl(fd, F_SETFD, opts | FD_CLOEXEC);
|
||||
#endif
|
||||
}
|
||||
|
||||
last_error = OK;
|
||||
@@ -339,4 +324,4 @@ FileAccessUnix::~FileAccessUnix() {
|
||||
_close();
|
||||
}
|
||||
|
||||
#endif // UNIX_ENABLED || LIBC_FILEIO_ENABLED
|
||||
#endif // UNIX_ENABLED
|
||||
|
||||
Reference in New Issue
Block a user