obj-y += yagl_device.o
obj-y += yagl_log.o
+obj-y += yagl_util.o
obj-y += yagl_process.o
obj-y += yagl_thread.o
obj-y += yagl_server.o
#endif
#include "yagl_types.h"
+#include "yagl_util.h"
//#define YAGL_LOG_DISABLE
#define YAGL_LOG_FUNC_SET_TS(__func, __ts) \
const char* _yagl_log_current_func = #__func; \
- yagl_pid _yagl_log_current_pid = (__ts ? __ts->ps->id : 0); \
- yagl_tid _yagl_log_current_tid = (__ts ? __ts->id : 0)
+ yagl_pid _yagl_log_current_pid = (__ts ? __ts->ps->id : yagl_get_pid()); \
+ yagl_tid _yagl_log_current_tid = (__ts ? __ts->id : yagl_get_tid())
#define YAGL_LOG_FUNC_SET(__func) YAGL_LOG_FUNC_SET_TS(__func, cur_ts)
--- /dev/null
+/*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * Lukasz Kostyra <l.kostyra@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "yagl_util.h"
+
+#ifdef CONFIG_WIN32
+#include <Windows.h>
+#else
+#include <unistd.h>
+#include <sys/syscall.h>
+
+#ifdef CONFIG_DARWIN
+#define SYSCALL_GET_TID SYS_thread_selfid
+#else
+#define SYSCALL_GET_TID SYS_gettid
+#endif
+
+#endif
+
+yagl_pid yagl_get_pid(void)
+{
+#ifdef CONFIG_WIN32
+ return (yagl_pid)GetCurrentProcessId();
+#else
+ return (yagl_pid)getpid();
+#endif
+}
+
+yagl_tid yagl_get_tid(void)
+{
+#ifdef CONFIG_WIN32
+ return (yagl_tid)GetCurrentThreadId();
+#else
+ return (yagl_tid)syscall(SYSCALL_GET_TID);
+#endif
+}
\ No newline at end of file
--- /dev/null
+/*
+ * yagl
+ *
+ * Copyright (c) 2000 - 2020 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Stanislav Vorobiov <s.vorobiov@samsung.com>
+ * Jinhyung Jo <jinhyung.jo@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ * Lukasz Kostyra <l.kostyra@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#ifndef _QEMU_YAGL_UTIL_H
+#define _QEMU_YAGL_UTIL_H
+
+#include "yagl_types.h"
+
+yagl_pid yagl_get_pid(void);
+
+yagl_tid yagl_get_tid(void);
+
+#endif // _QEMU_YAGL_UTIL_H