1 | /* |
2 | This file is part of the KDE libraries |
3 | SPDX-FileCopyrightText: 2014 Alex Richardson <arichardson.kde@gmail.com> |
4 | |
5 | SPDX-License-Identifier: LGPL-2.0-only |
6 | */ |
7 | #include "kioglobal_p.h" |
8 | |
9 | #include <QFile> |
10 | #include <signal.h> |
11 | #include <unistd.h> |
12 | |
13 | KIOCORE_EXPORT bool KIOPrivate::isProcessAlive(qint64 pid) |
14 | { |
15 | return ::kill(pid: pid, sig: 0) == 0; |
16 | } |
17 | |
18 | KIOCORE_EXPORT void KIOPrivate::sendTerminateSignal(qint64 pid) |
19 | { |
20 | ::kill(pid: pid, SIGTERM); |
21 | } |
22 | |
23 | KIOCORE_EXPORT bool KIOPrivate::createSymlink(const QString &source, const QString &destination, SymlinkType type) |
24 | { |
25 | Q_UNUSED(type) |
26 | return ::symlink(from: QFile::encodeName(fileName: source).constData(), to: QFile::encodeName(fileName: destination).constData()) == 0; |
27 | } |
28 | |
29 | KIOCORE_EXPORT bool KIOPrivate::changeOwnership(const QString &file, KUserId newOwner, KGroupId newGroup) |
30 | { |
31 | return ::chown(file: QFile::encodeName(fileName: file).constData(), owner: newOwner.nativeId(), group: newGroup.nativeId()) == 0; |
32 | } |
33 | |