File indexing completed on 2024-04-14 03:52:56

0001 /*
0002     This file is part of the KDE libraries
0003     SPDX-FileCopyrightText: 2014 Alex Richardson <arichardson.kde@gmail.com>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 #include "kioglobal_p.h"
0008 
0009 #include <QFile>
0010 #include <signal.h>
0011 #include <unistd.h>
0012 
0013 KIOCORE_EXPORT bool KIOPrivate::isProcessAlive(qint64 pid)
0014 {
0015     return ::kill(pid, 0) == 0;
0016 }
0017 
0018 KIOCORE_EXPORT void KIOPrivate::sendTerminateSignal(qint64 pid)
0019 {
0020     ::kill(pid, SIGTERM);
0021 }
0022 
0023 KIOCORE_EXPORT bool KIOPrivate::createSymlink(const QString &source, const QString &destination, SymlinkType type)
0024 {
0025     Q_UNUSED(type)
0026     return ::symlink(QFile::encodeName(source).constData(), QFile::encodeName(destination).constData()) == 0;
0027 }
0028 
0029 KIOCORE_EXPORT bool KIOPrivate::changeOwnership(const QString &file, KUserId newOwner, KGroupId newGroup)
0030 {
0031     return ::chown(QFile::encodeName(file).constData(), newOwner.nativeId(), newGroup.nativeId()) == 0;
0032 }