Skip to content

Commit b3d57d4

Browse files
brad0zpostfacto
authored andcommitted
Fill in Plat_IsInDebugSession() for FreeBSD
1 parent f47a957 commit b3d57d4

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

src/tier0/dbg.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ using namespace SteamNetworkingSocketsLib;
3737
#include <sys/sysctl.h>
3838
#endif
3939

40+
#if IsFreeBSD()
41+
#include <sys/types.h>
42+
#include <sys/sysctl.h>
43+
#include <sys/user.h>
44+
#endif
45+
4046
#if IsPlaystation() && defined(_DEBUG)
4147
// NDA material
4248
#endif
@@ -57,6 +63,18 @@ bool Plat_IsInDebugSession()
5763
info.kp_proc.p_flag = 0;
5864
sysctl(mib,4,&info,&size,NULL,0);
5965
return ((info.kp_proc.p_flag & P_TRACED) == P_TRACED);
66+
#elif IsFreeBSD()
67+
int mib[4];
68+
struct kinfo_proc info;
69+
size_t size;
70+
mib[0] = CTL_KERN;
71+
mib[1] = KERN_PROC;
72+
mib[2] = KERN_PROC_PID;
73+
mib[3] = getpid();
74+
size = sizeof(info);
75+
if (sysctl(mib, 4, &info, &size, NULL, 0) == -1)
76+
return false;
77+
return ((info.ki_flag & P_TRACED) != 0);
6078
#elif IsLinux()
6179
static FILE *fp;
6280
if ( !fp )

0 commit comments

Comments
 (0)