Skip to content

Commit

Permalink
Remove sys/wait.h from Fcitx5Utils
Browse files Browse the repository at this point in the history
  • Loading branch information
wengxt committed Feb 2, 2025
1 parent de44ba8 commit c9e54c8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ else()
endif()

check_function_exists(pipe2 HAVE_PIPE2)
check_include_file(sys/wait.h HAVE_SYS_WAIT_H)
check_include_file(sys/mman.h HAVE_SYS_MMAN_H)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
Expand Down
1 change: 1 addition & 0 deletions config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#define DBUS_SYSTEM_BUS_DEFAULT_ADDRESS "@DBUS_SYSTEM_BUS_DEFAULT_ADDRESS@"

#cmakedefine HAVE_PIPE2
#cmakedefine HAVE_SYS_WAIT_H
#cmakedefine HAVE_SYS_MMAN_H

#ifndef _GNU_SOURCE
Expand Down
10 changes: 8 additions & 2 deletions src/lib/fcitx-utils/misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
*
*/
#include "misc.h"
#include <sys/wait.h>
#include <unistd.h>
#include <cstdio>
#include <string>
Expand All @@ -15,6 +14,10 @@
#include "log.h"
#include "misc_p.h"

#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif

#if defined(LIBKVM_FOUND)
#include <fcntl.h>
#include <kvm.h>
Expand All @@ -34,7 +37,7 @@ namespace fcitx {

void startProcess(const std::vector<std::string> &args,
const std::string &workingDirectory) {
#if defined(__APPLE__) && TARGET_OS_IPHONE
#if defined(_WIN32) || (defined(__APPLE__) && TARGET_OS_IPHONE)
FCITX_UNUSED(args);
FCITX_UNUSED(workingDirectory);
FCITX_ERROR() << "Not implemented";
Expand Down Expand Up @@ -137,6 +140,9 @@ std::string getProcessName(pid_t pid) {
}
return result;
#endif
#elif defined(_WIN32)
FCITX_UNUSED(pid);
return {};
#else
auto path = fmt::format("/proc/{}/exe", pid);
if (auto link = fs::readlink(path)) {
Expand Down

0 comments on commit c9e54c8

Please sign in to comment.