Skip to content

Commit

Permalink
threads: remove u_long usage
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjulien committed Apr 16, 2020
1 parent 3ba4afd commit d4f86e3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/threads.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2007-2013 Open Information Security Foundation
/* Copyright (C) 2007-2020 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
Expand Down Expand Up @@ -222,46 +222,46 @@ enum {
#define SCGetThreadIdLong(...) ({ \
long tmpthid; \
thr_self(&tmpthid); \
u_long _scgetthread_tid = (u_long)tmpthid; \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})
#elif __OpenBSD__
#define SCGetThreadIdLong(...) ({ \
pid_t tpid; \
tpid = getpid(); \
u_long _scgetthread_tid = (u_long)tpid; \
unsigned long _scgetthread_tid = (unsigned long)tpid; \
_scgetthread_tid; \
})
#elif __CYGWIN__
#define SCGetThreadIdLong(...) ({ \
u_long _scgetthread_tid = (u_long)GetCurrentThreadId(); \
unsigned long _scgetthread_tid = (unsigned long)GetCurrentThreadId(); \
_scgetthread_tid; \
})
#elif OS_WIN32
#define SCGetThreadIdLong(...) ({ \
u_long _scgetthread_tid = (u_long)GetCurrentThreadId(); \
unsigned long _scgetthread_tid = (unsigned long)GetCurrentThreadId(); \
_scgetthread_tid; \
})
#elif OS_DARWIN
#define SCGetThreadIdLong(...) ({ \
thread_port_t tpid; \
tpid = mach_thread_self(); \
u_long _scgetthread_tid = (u_long)tpid; \
unsigned long _scgetthread_tid = (unsigned long)tpid; \
_scgetthread_tid; \
})
#elif defined(sun)
#include <thread.h>
#define SCGetThreadIdLong(...) ({ \
thread_t tmpthid = thr_self(); \
u_long _scgetthread_tid = (u_long)tmpthid; \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})

#else
#define SCGetThreadIdLong(...) ({ \
pid_t tmpthid; \
tmpthid = syscall(SYS_gettid); \
u_long _scgetthread_tid = (u_long)tmpthid; \
unsigned long _scgetthread_tid = (unsigned long)tmpthid; \
_scgetthread_tid; \
})
#endif /* OS FREEBSD */
Expand Down
2 changes: 1 addition & 1 deletion src/tm-threads.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2007-2017 Open Information Security Foundation
/* Copyright (C) 2007-2020 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
Expand Down
2 changes: 1 addition & 1 deletion src/util-lua-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ static int LuaCallbackFileState(lua_State *luastate)
*/
static int LuaCallbackThreadInfoPushToStackFromThreadVars(lua_State *luastate, const ThreadVars *tv)
{
u_long tid = SCGetThreadIdLong();
unsigned long tid = SCGetThreadIdLong();
lua_pushinteger (luastate, (lua_Integer)tid);
lua_pushstring (luastate, tv->name);
lua_pushstring (luastate, tv->thread_group_name);
Expand Down

0 comments on commit d4f86e3

Please sign in to comment.