Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,42 @@ jobs:
run: |
cmake -GNinja -B build -DCRASH_REPORTER=OFF
cmake --build build

freebsd:
name: FreeBSD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Build in FreeBSD VM
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
usesh: true

prepare: |
pkg update -f && pkg install -y \
cmake \
pkgconf \
cli11 \
spirv-tools \
qt6-base \
qt6-declarative \
qt6-shadertools \
qt6-wayland \
wayland \
wayland-protocols \
libdrm \
libxcb \
pipewire \
polkit \
glib \
mesa-libs \
git \
bash \
ninja \
gitup

run: |
cmake -GNinja -B build -DCRASH_REPORTER=OFF -DUSE_JEMALLOC=OFF -DCMAKE_C_FLAGS="-I/usr/local/include -L/usr/local/lib" -DCMAKE_CXX_FLAGS="-I/usr/local/include -L/usr/local/lib"
cmake --build build
17 changes: 12 additions & 5 deletions src/core/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <qtmetamacros.h>
#include <qtypes.h>
#include <sys/mman.h>
#include <sys/sendfile.h>
#include <unistd.h>

#include "instanceinfo.hpp"
#include "logcat.hpp"
Expand Down Expand Up @@ -392,7 +392,7 @@ void ThreadLogging::initFs() {
delete detailedFile;
detailedFile = nullptr;
} else {
auto lock = flock {
struct flock lock = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = 0,
Expand All @@ -414,7 +414,7 @@ void ThreadLogging::initFs() {
auto* oldFile = this->file;
if (oldFile) {
oldFile->seek(0);
sendfile(file->handle(), oldFile->handle(), nullptr, oldFile->size());
copy_file_range(oldFile->handle(), nullptr, file->handle(), nullptr, oldFile->size(), 0);
}

this->file = file;
Expand All @@ -426,7 +426,14 @@ void ThreadLogging::initFs() {
auto* oldFile = this->detailedFile;
if (oldFile) {
oldFile->seek(0);
sendfile(detailedFile->handle(), oldFile->handle(), nullptr, oldFile->size());
copy_file_range(
oldFile->handle(),
nullptr,
detailedFile->handle(),
nullptr,
oldFile->size(),
0
);
}

crash::CrashInfo::INSTANCE.logFd = detailedFile->handle();
Expand Down Expand Up @@ -889,7 +896,7 @@ bool LogReader::continueReading() {
}

void LogFollower::FcntlWaitThread::run() {
auto lock = flock {
struct flock lock = {
.l_type = F_RDLCK, // won't block other read locks when we take it
.l_whence = SEEK_SET,
.l_start = 0,
Expand Down
4 changes: 2 additions & 2 deletions src/core/paths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ void QsPaths::createLock() {
return;
}

auto lock = flock {
struct flock lock = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = 0,
Expand Down Expand Up @@ -389,7 +389,7 @@ bool QsPaths::checkLock(const QString& path, InstanceLockInfo* info, bool allowD
auto file = QFile(QDir(path).filePath("instance.lock"));
if (!file.open(QFile::ReadOnly)) return false;

auto lock = flock {
struct flock lock = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET,
.l_start = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/core/toolsupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ bool QmlToolingSupport::lockTooling() {
return false;
}

auto lock = flock {
struct flock lock = {
.l_type = F_WRLCK,
.l_whence = SEEK_SET, // NOLINT (fcntl.h??)
.l_start = 0,
Expand Down
2 changes: 2 additions & 0 deletions src/services/pam/conversation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <qsocketnotifier.h>
#include <qstring.h>
#include <qtmetamacros.h>
#include <csignal>
#include <sys/signal.h>
#include <sys/wait.h>

#include "../../core/logcat.hpp"
Expand Down
4 changes: 4 additions & 0 deletions src/services/pam/qml.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
#include <qtclasshelpermacros.h>
#include <qthread.h>
#include <qtmetamacros.h>
#ifdef __FreeBSD__
#include <security/pam_types.h>
#else
#include <security/_pam_types.h>
#endif
#include <security/pam_appl.h>

#include "conversation.hpp"
Expand Down
8 changes: 8 additions & 0 deletions src/services/pam/subprocess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
#include <qloggingcategory.h>
#include <qstring.h>
#include <sched.h>
#ifdef __FreeBSD__
#include <security/pam_types.h>
#else
#include <security/_pam_types.h>
#endif
#include <security/pam_appl.h>
#include <unistd.h>

Expand Down Expand Up @@ -83,7 +87,11 @@ PamIpcExitCode PamSubprocess::exec(const char* configDir, const char* config, co
logIf(this->log) << "Starting pam session for user \"" << user << "\" with config \"" << config
<< "\" in dir \"" << configDir << "\"" << std::endl;

#ifdef __FreeBSD__
auto result = pam_start(config, user, &conv, &handle);
#else
auto result = pam_start_confdir(config, user, &conv, configDir, &handle);
#endif

if (result != PAM_SUCCESS) {
logIf(true) << "Unable to start pam conversation with error \"" << pam_strerror(handle, result)
Expand Down