1 /*************************************************************************/
2 /*  os_unix.cpp                                                          */
3 /*************************************************************************/
4 /*                       This file is part of:                           */
5 /*                           GODOT ENGINE                                */
6 /*                      https://godotengine.org                          */
7 /*************************************************************************/
8 /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur.                 */
9 /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md).   */
10 /*                                                                       */
11 /* Permission is hereby granted, free of charge, to any person obtaining */
12 /* a copy of this software and associated documentation files (the       */
13 /* "Software"), to deal in the Software without restriction, including   */
14 /* without limitation the rights to use, copy, modify, merge, publish,   */
15 /* distribute, sublicense, and/or sell copies of the Software, and to    */
16 /* permit persons to whom the Software is furnished to do so, subject to */
17 /* the following conditions:                                             */
18 /*                                                                       */
19 /* The above copyright notice and this permission notice shall be        */
20 /* included in all copies or substantial portions of the Software.       */
21 /*                                                                       */
22 /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
23 /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
24 /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
25 /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
26 /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
27 /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
28 /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
29 /*************************************************************************/
30 
31 #include "os_unix.h"
32 
33 #ifdef UNIX_ENABLED
34 
35 #include "core/os/thread_dummy.h"
36 #include "core/project_settings.h"
37 #include "drivers/unix/dir_access_unix.h"
38 #include "drivers/unix/file_access_unix.h"
39 #include "drivers/unix/mutex_posix.h"
40 #include "drivers/unix/net_socket_posix.h"
41 #include "drivers/unix/rw_lock_posix.h"
42 #include "drivers/unix/semaphore_posix.h"
43 #include "drivers/unix/thread_posix.h"
44 #include "servers/visual_server.h"
45 
46 #ifdef __APPLE__
47 #include <mach-o/dyld.h>
48 #include <mach/mach_time.h>
49 #endif
50 
51 #if defined(__FreeBSD__) || defined(__OpenBSD__)
52 #include <sys/param.h>
53 #include <sys/sysctl.h>
54 #endif
55 
56 #include <assert.h>
57 #include <dlfcn.h>
58 #include <errno.h>
59 #include <poll.h>
60 #include <signal.h>
61 #include <stdarg.h>
62 #include <stdio.h>
63 #include <stdlib.h>
64 #include <string.h>
65 #include <sys/time.h>
66 #include <sys/wait.h>
67 #include <unistd.h>
68 
69 /// Clock Setup function (used by get_ticks_usec)
70 static uint64_t _clock_start = 0;
71 #if defined(__APPLE__)
72 static double _clock_scale = 0;
_setup_clock()73 static void _setup_clock() {
74 	mach_timebase_info_data_t info;
75 	kern_return_t ret = mach_timebase_info(&info);
76 	ERR_FAIL_COND_MSG(ret != 0, "OS CLOCK IS NOT WORKING!");
77 	_clock_scale = ((double)info.numer / (double)info.denom) / 1000.0;
78 	_clock_start = mach_absolute_time() * _clock_scale;
79 }
80 #else
81 #if defined(CLOCK_MONOTONIC_RAW) && !defined(JAVASCRIPT_ENABLED) // This is a better clock on Linux.
82 #define GODOT_CLOCK CLOCK_MONOTONIC_RAW
83 #else
84 #define GODOT_CLOCK CLOCK_MONOTONIC
85 #endif
_setup_clock()86 static void _setup_clock() {
87 	struct timespec tv_now = { 0, 0 };
88 	ERR_FAIL_COND_MSG(clock_gettime(GODOT_CLOCK, &tv_now) != 0, "OS CLOCK IS NOT WORKING!");
89 	_clock_start = ((uint64_t)tv_now.tv_nsec / 1000L) + (uint64_t)tv_now.tv_sec * 1000000L;
90 }
91 #endif
92 
debug_break()93 void OS_Unix::debug_break() {
94 
95 	assert(false);
96 };
97 
handle_interrupt(int sig)98 static void handle_interrupt(int sig) {
99 	if (ScriptDebugger::get_singleton() == NULL)
100 		return;
101 
102 	ScriptDebugger::get_singleton()->set_depth(-1);
103 	ScriptDebugger::get_singleton()->set_lines_left(1);
104 }
105 
initialize_debugging()106 void OS_Unix::initialize_debugging() {
107 
108 	if (ScriptDebugger::get_singleton() != NULL) {
109 		struct sigaction action;
110 		memset(&action, 0, sizeof(action));
111 		action.sa_handler = handle_interrupt;
112 		sigaction(SIGINT, &action, NULL);
113 	}
114 }
115 
unix_initialize_audio(int p_audio_driver)116 int OS_Unix::unix_initialize_audio(int p_audio_driver) {
117 
118 	return 0;
119 }
120 
initialize_core()121 void OS_Unix::initialize_core() {
122 
123 #ifdef NO_THREADS
124 	ThreadDummy::make_default();
125 	SemaphoreDummy::make_default();
126 	MutexDummy::make_default();
127 	RWLockDummy::make_default();
128 #else
129 	ThreadPosix::make_default();
130 #if !defined(OSX_ENABLED) && !defined(IPHONE_ENABLED)
131 	SemaphorePosix::make_default();
132 #endif
133 	MutexPosix::make_default();
134 	RWLockPosix::make_default();
135 #endif
136 	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_RESOURCES);
137 	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_USERDATA);
138 	FileAccess::make_default<FileAccessUnix>(FileAccess::ACCESS_FILESYSTEM);
139 	//FileAccessBufferedFA<FileAccessUnix>::make_default();
140 	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_RESOURCES);
141 	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_USERDATA);
142 	DirAccess::make_default<DirAccessUnix>(DirAccess::ACCESS_FILESYSTEM);
143 
144 #ifndef NO_NETWORK
145 	NetSocketPosix::make_default();
146 	IP_Unix::make_default();
147 #endif
148 
149 	_setup_clock();
150 }
151 
finalize_core()152 void OS_Unix::finalize_core() {
153 
154 	NetSocketPosix::cleanup();
155 }
156 
alert(const String & p_alert,const String & p_title)157 void OS_Unix::alert(const String &p_alert, const String &p_title) {
158 
159 	fprintf(stderr, "ERROR: %s\n", p_alert.utf8().get_data());
160 }
161 
get_stdin_string(bool p_block)162 String OS_Unix::get_stdin_string(bool p_block) {
163 
164 	if (p_block) {
165 		char buff[1024];
166 		String ret = stdin_buf + fgets(buff, 1024, stdin);
167 		stdin_buf = "";
168 		return ret;
169 	}
170 
171 	return "";
172 }
173 
get_name() const174 String OS_Unix::get_name() const {
175 
176 	return "Unix";
177 }
178 
get_unix_time() const179 uint64_t OS_Unix::get_unix_time() const {
180 
181 	return time(NULL);
182 };
183 
get_system_time_secs() const184 uint64_t OS_Unix::get_system_time_secs() const {
185 	struct timeval tv_now;
186 	gettimeofday(&tv_now, NULL);
187 	return uint64_t(tv_now.tv_sec);
188 }
189 
get_system_time_msecs() const190 uint64_t OS_Unix::get_system_time_msecs() const {
191 	struct timeval tv_now;
192 	gettimeofday(&tv_now, NULL);
193 	return uint64_t(tv_now.tv_sec) * 1000 + uint64_t(tv_now.tv_usec) / 1000;
194 }
195 
get_date(bool utc) const196 OS::Date OS_Unix::get_date(bool utc) const {
197 	time_t t = time(NULL);
198 	struct tm lt;
199 	if (utc) {
200 		gmtime_r(&t, &lt);
201 	} else {
202 		localtime_r(&t, &lt);
203 	}
204 	Date ret;
205 	ret.year = 1900 + lt.tm_year;
206 	// Index starting at 1 to match OS_Unix::get_date
207 	//   and Windows SYSTEMTIME and tm_mon follows the typical structure
208 	//   of 0-11, noted here: http://www.cplusplus.com/reference/ctime/tm/
209 	ret.month = (Month)(lt.tm_mon + 1);
210 	ret.day = lt.tm_mday;
211 	ret.weekday = (Weekday)lt.tm_wday;
212 	ret.dst = lt.tm_isdst;
213 
214 	return ret;
215 }
216 
get_time(bool utc) const217 OS::Time OS_Unix::get_time(bool utc) const {
218 	time_t t = time(NULL);
219 	struct tm lt;
220 	if (utc) {
221 		gmtime_r(&t, &lt);
222 	} else {
223 		localtime_r(&t, &lt);
224 	}
225 	Time ret;
226 	ret.hour = lt.tm_hour;
227 	ret.min = lt.tm_min;
228 	ret.sec = lt.tm_sec;
229 	get_time_zone_info();
230 	return ret;
231 }
232 
get_time_zone_info() const233 OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
234 	time_t t = time(NULL);
235 	struct tm lt;
236 	localtime_r(&t, &lt);
237 	char name[16];
238 	strftime(name, 16, "%Z", &lt);
239 	name[15] = 0;
240 	TimeZoneInfo ret;
241 	ret.name = name;
242 
243 	char bias_buf[16];
244 	strftime(bias_buf, 16, "%z", &lt);
245 	int bias;
246 	bias_buf[15] = 0;
247 	sscanf(bias_buf, "%d", &bias);
248 
249 	// convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes
250 	int hour = (int)bias / 100;
251 	int minutes = bias % 100;
252 	if (bias < 0)
253 		ret.bias = hour * 60 - minutes;
254 	else
255 		ret.bias = hour * 60 + minutes;
256 
257 	return ret;
258 }
259 
delay_usec(uint32_t p_usec) const260 void OS_Unix::delay_usec(uint32_t p_usec) const {
261 
262 	struct timespec rem = { static_cast<time_t>(p_usec / 1000000), (static_cast<long>(p_usec) % 1000000) * 1000 };
263 	while (nanosleep(&rem, &rem) == EINTR) {
264 	}
265 }
get_ticks_usec() const266 uint64_t OS_Unix::get_ticks_usec() const {
267 
268 #if defined(__APPLE__)
269 	uint64_t longtime = mach_absolute_time() * _clock_scale;
270 #else
271 	// Unchecked return. Static analyzers might complain.
272 	// If _setup_clock() succeeded, we assume clock_gettime() works.
273 	struct timespec tv_now = { 0, 0 };
274 	clock_gettime(GODOT_CLOCK, &tv_now);
275 	uint64_t longtime = ((uint64_t)tv_now.tv_nsec / 1000L) + (uint64_t)tv_now.tv_sec * 1000000L;
276 #endif
277 	longtime -= _clock_start;
278 
279 	return longtime;
280 }
281 
execute(const String & p_path,const List<String> & p_arguments,bool p_blocking,ProcessID * r_child_id,String * r_pipe,int * r_exitcode,bool read_stderr,Mutex * p_pipe_mutex)282 Error OS_Unix::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
283 
284 #ifdef __EMSCRIPTEN__
285 	// Don't compile this code at all to avoid undefined references.
286 	// Actual virtual call goes to OS_JavaScript.
287 	ERR_FAIL_V(ERR_BUG);
288 #else
289 	if (p_blocking && r_pipe) {
290 
291 		String argss;
292 		argss = "\"" + p_path + "\"";
293 
294 		for (int i = 0; i < p_arguments.size(); i++) {
295 
296 			argss += String(" \"") + p_arguments[i] + "\"";
297 		}
298 
299 		if (read_stderr) {
300 			argss += " 2>&1"; // Read stderr too
301 		} else {
302 			argss += " 2>/dev/null"; //silence stderr
303 		}
304 		FILE *f = popen(argss.utf8().get_data(), "r");
305 
306 		ERR_FAIL_COND_V_MSG(!f, ERR_CANT_OPEN, "Cannot pipe stream from process running with following arguments '" + argss + "'.");
307 
308 		char buf[65535];
309 
310 		while (fgets(buf, 65535, f)) {
311 
312 			if (p_pipe_mutex) {
313 				p_pipe_mutex->lock();
314 			}
315 			(*r_pipe) += String::utf8(buf);
316 			if (p_pipe_mutex) {
317 				p_pipe_mutex->unlock();
318 			}
319 		}
320 		int rv = pclose(f);
321 		if (r_exitcode)
322 			*r_exitcode = WEXITSTATUS(rv);
323 
324 		return OK;
325 	}
326 
327 	pid_t pid = fork();
328 	ERR_FAIL_COND_V(pid < 0, ERR_CANT_FORK);
329 
330 	if (pid == 0) {
331 		// is child
332 
333 		if (!p_blocking) {
334 			// For non blocking calls, create a new session-ID so parent won't wait for it.
335 			// This ensures the process won't go zombie at end.
336 			setsid();
337 		}
338 
339 		Vector<CharString> cs;
340 		cs.push_back(p_path.utf8());
341 		for (int i = 0; i < p_arguments.size(); i++)
342 			cs.push_back(p_arguments[i].utf8());
343 
344 		Vector<char *> args;
345 		for (int i = 0; i < cs.size(); i++)
346 			args.push_back((char *)cs[i].get_data());
347 		args.push_back(0);
348 
349 		execvp(p_path.utf8().get_data(), &args[0]);
350 		// still alive? something failed..
351 		fprintf(stderr, "**ERROR** OS_Unix::execute - Could not create child process while executing: %s\n", p_path.utf8().get_data());
352 		raise(SIGKILL);
353 	}
354 
355 	if (p_blocking) {
356 
357 		int status;
358 		waitpid(pid, &status, 0);
359 		if (r_exitcode)
360 			*r_exitcode = WEXITSTATUS(status);
361 
362 	} else {
363 
364 		if (r_child_id)
365 			*r_child_id = pid;
366 	}
367 
368 	return OK;
369 #endif
370 }
371 
kill(const ProcessID & p_pid)372 Error OS_Unix::kill(const ProcessID &p_pid) {
373 
374 	int ret = ::kill(p_pid, SIGKILL);
375 	if (!ret) {
376 		//avoid zombie process
377 		int st;
378 		::waitpid(p_pid, &st, 0);
379 	}
380 	return ret ? ERR_INVALID_PARAMETER : OK;
381 }
382 
get_process_id() const383 int OS_Unix::get_process_id() const {
384 
385 	return getpid();
386 };
387 
has_environment(const String & p_var) const388 bool OS_Unix::has_environment(const String &p_var) const {
389 
390 	return getenv(p_var.utf8().get_data()) != NULL;
391 }
392 
get_locale() const393 String OS_Unix::get_locale() const {
394 
395 	if (!has_environment("LANG"))
396 		return "en";
397 
398 	String locale = get_environment("LANG");
399 	int tp = locale.find(".");
400 	if (tp != -1)
401 		locale = locale.substr(0, tp);
402 	return locale;
403 }
404 
open_dynamic_library(const String p_path,void * & p_library_handle,bool p_also_set_library_path)405 Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
406 
407 	String path = p_path;
408 
409 	if (FileAccess::exists(path) && path.is_rel_path()) {
410 		// dlopen expects a slash, in this case a leading ./ for it to be interpreted as a relative path,
411 		//  otherwise it will end up searching various system directories for the lib instead and finally failing.
412 		path = "./" + path;
413 	}
414 
415 	if (!FileAccess::exists(path)) {
416 		//this code exists so gdnative can load .so files from within the executable path
417 		path = get_executable_path().get_base_dir().plus_file(p_path.get_file());
418 	}
419 
420 	if (!FileAccess::exists(path)) {
421 		//this code exists so gdnative can load .so files from a standard unix location
422 		path = get_executable_path().get_base_dir().plus_file("../lib").plus_file(p_path.get_file());
423 	}
424 
425 	p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW);
426 	ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + p_path + ". Error: " + dlerror());
427 	return OK;
428 }
429 
close_dynamic_library(void * p_library_handle)430 Error OS_Unix::close_dynamic_library(void *p_library_handle) {
431 	if (dlclose(p_library_handle)) {
432 		return FAILED;
433 	}
434 	return OK;
435 }
436 
get_dynamic_library_symbol_handle(void * p_library_handle,const String p_name,void * & p_symbol_handle,bool p_optional)437 Error OS_Unix::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
438 	const char *error;
439 	dlerror(); // Clear existing errors
440 
441 	p_symbol_handle = dlsym(p_library_handle, p_name.utf8().get_data());
442 
443 	error = dlerror();
444 	if (error != NULL) {
445 		ERR_FAIL_COND_V_MSG(!p_optional, ERR_CANT_RESOLVE, "Can't resolve symbol " + p_name + ". Error: " + error + ".");
446 
447 		return ERR_CANT_RESOLVE;
448 	}
449 	return OK;
450 }
451 
set_cwd(const String & p_cwd)452 Error OS_Unix::set_cwd(const String &p_cwd) {
453 
454 	if (chdir(p_cwd.utf8().get_data()) != 0)
455 		return ERR_CANT_OPEN;
456 
457 	return OK;
458 }
459 
get_environment(const String & p_var) const460 String OS_Unix::get_environment(const String &p_var) const {
461 
462 	if (getenv(p_var.utf8().get_data()))
463 		return getenv(p_var.utf8().get_data());
464 	return "";
465 }
466 
set_environment(const String & p_var,const String & p_value) const467 bool OS_Unix::set_environment(const String &p_var, const String &p_value) const {
468 
469 	return setenv(p_var.utf8().get_data(), p_value.utf8().get_data(), /* overwrite: */ true) == 0;
470 }
471 
get_processor_count() const472 int OS_Unix::get_processor_count() const {
473 
474 	return sysconf(_SC_NPROCESSORS_CONF);
475 }
476 
get_user_data_dir() const477 String OS_Unix::get_user_data_dir() const {
478 
479 	String appname = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/name"));
480 	if (appname != "") {
481 		bool use_custom_dir = ProjectSettings::get_singleton()->get("application/config/use_custom_user_dir");
482 		if (use_custom_dir) {
483 			String custom_dir = get_safe_dir_name(ProjectSettings::get_singleton()->get("application/config/custom_user_dir_name"), true);
484 			if (custom_dir == "") {
485 				custom_dir = appname;
486 			}
487 			return get_data_path().plus_file(custom_dir);
488 		} else {
489 			return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname);
490 		}
491 	}
492 
493 	return ProjectSettings::get_singleton()->get_resource_path();
494 }
495 
get_executable_path() const496 String OS_Unix::get_executable_path() const {
497 
498 #ifdef __linux__
499 	//fix for running from a symlink
500 	char buf[256];
501 	memset(buf, 0, 256);
502 	ssize_t len = readlink("/proc/self/exe", buf, sizeof(buf));
503 	String b;
504 	if (len > 0) {
505 		b.parse_utf8(buf, len);
506 	}
507 	if (b == "") {
508 		WARN_PRINT("Couldn't get executable path from /proc/self/exe, using argv[0]");
509 		return OS::get_executable_path();
510 	}
511 	return b;
512 #elif defined(__OpenBSD__)
513 	char resolved_path[MAXPATHLEN];
514 
515 	realpath(OS::get_executable_path().utf8().get_data(), resolved_path);
516 
517 	return String(resolved_path);
518 #elif defined(__FreeBSD__)
519 	int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
520 	char buf[MAXPATHLEN];
521 	size_t len = sizeof(buf);
522 	if (sysctl(mib, 4, buf, &len, NULL, 0) != 0) {
523 		WARN_PRINT("Couldn't get executable path from sysctl");
524 		return OS::get_executable_path();
525 	}
526 	String b;
527 	b.parse_utf8(buf);
528 	return b;
529 #elif defined(__APPLE__)
530 	char temp_path[1];
531 	uint32_t buff_size = 1;
532 	_NSGetExecutablePath(temp_path, &buff_size);
533 
534 	char *resolved_path = new char[buff_size + 1];
535 
536 	if (_NSGetExecutablePath(resolved_path, &buff_size) == 1)
537 		WARN_PRINT("MAXPATHLEN is too small");
538 
539 	String path(resolved_path);
540 	delete[] resolved_path;
541 
542 	return path;
543 #else
544 	ERR_PRINT("Warning, don't know how to obtain executable path on this OS! Please override this function properly.");
545 	return OS::get_executable_path();
546 #endif
547 }
548 
log_error(const char * p_function,const char * p_file,int p_line,const char * p_code,const char * p_rationale,ErrorType p_type)549 void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, int p_line, const char *p_code, const char *p_rationale, ErrorType p_type) {
550 	if (!should_log(true)) {
551 		return;
552 	}
553 
554 	const char *err_details;
555 	if (p_rationale && p_rationale[0])
556 		err_details = p_rationale;
557 	else
558 		err_details = p_code;
559 
560 	// Disable color codes if stdout is not a TTY.
561 	// This prevents Godot from writing ANSI escape codes when redirecting
562 	// stdout and stderr to a file.
563 	const bool tty = isatty(fileno(stdout));
564 	const char *red = tty ? "\E[0;31m" : "";
565 	const char *red_bold = tty ? "\E[1;31m" : "";
566 	const char *yellow = tty ? "\E[0;33m" : "";
567 	const char *yellow_bold = tty ? "\E[1;33m" : "";
568 	const char *magenta = tty ? "\E[0;35m" : "";
569 	const char *magenta_bold = tty ? "\E[1;35m" : "";
570 	const char *cyan = tty ? "\E[0;36m" : "";
571 	const char *cyan_bold = tty ? "\E[1;36m" : "";
572 	const char *reset = tty ? "\E[0m" : "";
573 	const char *bold = tty ? "\E[1m" : "";
574 
575 	switch (p_type) {
576 		case ERR_WARNING:
577 			logf_error("%sWARNING: %s: %s%s%s\n", yellow_bold, p_function, reset, bold, err_details);
578 			logf_error("%s   At: %s:%i.%s\n", yellow, p_file, p_line, reset);
579 			break;
580 		case ERR_SCRIPT:
581 			logf_error("%sSCRIPT ERROR: %s: %s%s%s\n", magenta_bold, p_function, reset, bold, err_details);
582 			logf_error("%s   At: %s:%i.%s\n", magenta, p_file, p_line, reset);
583 			break;
584 		case ERR_SHADER:
585 			logf_error("%sSHADER ERROR: %s: %s%s%s\n", cyan_bold, p_function, reset, bold, err_details);
586 			logf_error("%s   At: %s:%i.%s\n", cyan, p_file, p_line, reset);
587 			break;
588 		case ERR_ERROR:
589 		default:
590 			logf_error("%sERROR: %s: %s%s%s\n", red_bold, p_function, reset, bold, err_details);
591 			logf_error("%s   At: %s:%i.%s\n", red, p_file, p_line, reset);
592 			break;
593 	}
594 }
595 
~UnixTerminalLogger()596 UnixTerminalLogger::~UnixTerminalLogger() {}
597 
OS_Unix()598 OS_Unix::OS_Unix() {
599 	Vector<Logger *> loggers;
600 	loggers.push_back(memnew(UnixTerminalLogger));
601 	_set_logger(memnew(CompositeLogger(loggers)));
602 }
603 
604 #endif
605