KWin
Loading...
Searching...
No Matches
src
utils
executable_path_sysctl.cpp
Go to the documentation of this file.
1
/*
2
SPDX-FileCopyrightText: 2021 Tobias C. Berner <tcberner@FreeBSD.org>
3
4
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5
*/
6
7
#include <sys/param.h>
8
#include <sys/sysctl.h>
9
#include <sys/types.h>
10
11
#include "
executable_path.h
"
12
13
QString
executablePathFromPid
(pid_t pid)
14
{
15
const
int
mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME,
static_cast<
int
>
(pid)};
16
char
buf[MAXPATHLEN];
17
size_t
cb =
sizeof
(buf);
18
if
(sysctl(mib, 4, buf, &cb,
nullptr
, 0) == 0) {
19
return
QString::fromLocal8Bit(realpath(buf,
nullptr
));
20
}
21
return
QString();
22
}
executable_path.h
executablePathFromPid
QString executablePathFromPid(pid_t pid)
Definition
executable_path_sysctl.cpp:13
Generated on Sat Feb 17 2024 01:42:10 for KWin by
1.10.0