diff options
Diffstat (limited to 'drivers/unix')
-rw-r--r-- | drivers/unix/file_access_unix.cpp | 2 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 5 | ||||
-rw-r--r-- | drivers/unix/os_unix.h | 2 | ||||
-rw-r--r-- | drivers/unix/thread_posix.cpp | 11 |
4 files changed, 15 insertions, 5 deletions
diff --git a/drivers/unix/file_access_unix.cpp b/drivers/unix/file_access_unix.cpp index 349831077c..9f24633bd4 100644 --- a/drivers/unix/file_access_unix.cpp +++ b/drivers/unix/file_access_unix.cpp @@ -74,6 +74,8 @@ Error FileAccessUnix::_open(const String& p_path, int p_mode_flags) { else if (p_mode_flags==WRITE) mode_string="wb"; else if (p_mode_flags==READ_WRITE) + mode_string="rb+"; + else if (p_mode_flags==WRITE_READ) mode_string="wb+"; else return ERR_INVALID_PARAMETER; diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index be9bfe3166..8e3fba167f 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -232,13 +232,12 @@ uint64_t OS_Unix::get_unix_time() const { return time(NULL); }; -uint64_t OS_Unix::get_system_time_msec() const { +uint64_t OS_Unix::get_system_time_secs() const { struct timeval tv_now; gettimeofday(&tv_now, NULL); //localtime(&tv_now.tv_usec); //localtime((const long *)&tv_now.tv_usec); - uint64_t msec = uint64_t(tv_now.tv_sec)*1000+tv_now.tv_usec/1000; - return msec; + return uint64_t(tv_now.tv_sec); } diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 1baed9e869..a889bba0ff 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -95,7 +95,7 @@ public: virtual TimeZoneInfo get_time_zone_info() const; virtual uint64_t get_unix_time() const; - virtual uint64_t get_system_time_msec() const; + virtual uint64_t get_system_time_secs() const; virtual void delay_usec(uint32_t p_usec) const; virtual uint64_t get_ticks_usec() const; diff --git a/drivers/unix/thread_posix.cpp b/drivers/unix/thread_posix.cpp index 21bd95eade..bd33c81298 100644 --- a/drivers/unix/thread_posix.cpp +++ b/drivers/unix/thread_posix.cpp @@ -30,6 +30,10 @@ #if defined(UNIX_ENABLED) || defined(PTHREAD_ENABLED) +#ifdef PTHREAD_BSD_SET_NAME +#include <pthread_np.h> +#endif + #include "os/memory.h" Thread::ID ThreadPosix::get_ID() const { @@ -100,9 +104,14 @@ Error ThreadPosix::set_name(const String& p_name) { #else + #ifdef PTHREAD_BSD_SET_NAME + pthread_set_name_np(pthread, p_name.utf8().get_data()); + int err = 0; // Open/FreeBSD ignore errors in this function + #else int err = pthread_setname_np(pthread, p_name.utf8().get_data()); + #endif // PTHREAD_BSD_SET_NAME - #endif + #endif // PTHREAD_RENAME_SELF return err == 0 ? OK : ERR_INVALID_PARAMETER; |