<div>tcberner created this revision.<br />
tcberner added reviewers: rakuco, graesslin.<br />
tcberner set the repository for this revision to rKWIN KWin.<br />
Restricted Application added a project: Plasma.<br />
Restricted Application added a subscriber: plasma-devel.</div><br /><div><strong>REVISION SUMMARY</strong><div><p>Similar to[[ <a href="https://phabricator.kde.org/D1216" class="remarkup-link" target="_blank" rel="noreferrer">https://phabricator.kde.org/D1216</a> |  <a href="https://phabricator.kde.org/D1216" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: line-through;" rel="noreferrer">D1216</a> ]] add procctl call to disable ptrace on FreeBSD.</p>

<p>We cannot do the procfs-lookup to check whether the process is already being run inside gdb -- however, on FreeBSD, we could use the P_TRACED flag of the process to figure this out:</p>

<blockquote><p>sys/proc.h:#define P_TRACED        0x00800 /* Debugged process being traced. */</p></blockquote>

<p>And the code would look something similar to</p>

<div class="remarkup-code-block" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="border: 1px solid #f1c40f;
          background: #fdf5d4;
          font-size: 10x;
          padding: 8px;">pid_t pid = getpid();
struct procstat *prstat = procstat_open_sysctl();
struct kinfo_proc *procinfo;
unsigned int cnt;
procinfo = procstat_getprocs(prstat, KERN_PROC_PID, pid, &cnt);
long p_flags = procinfo->ki_flag;
int p_traced = p_flags & P_TRACED; 
if (p_traced != P_TRACED) {
    mode = PROC_TRACE_CTL_DISABLE;
    procctl(P_PID, getpid(), PROC_TRACE_CTL, &mode);
}
procstat_freeprocs(prstat,procinfo);
procstat_close(prstat);</pre></div>

<p>But as wayland is [far] in the future on FreeBSD, and that check above is a bit lengthy, I think it is enough if we add it once it is needed.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>rKWIN KWin</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D1425" rel="noreferrer">https://phabricator.kde.org/D1425</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
config-kwin.h.cmake<br />
main_wayland.cpp</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>tcberner, rakuco, graesslin<br /><strong>Cc: </strong>plasma-devel, sebas<br /></div>