6 Commits

Author SHA256 Message Date
a5772e76df Accepting request 1255634 from devel:libraries:c_c++
- Add upstream patch to fix build on aarch64:
  * libcosmos-fix-aarch64.patch (forwarded request 1254181 from Guillaume_G)

OBS-URL: https://build.opensuse.org/request/show/1255634
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libcosmos?expand=0&rev=8
2025-03-25 21:10:27 +00:00
16810c7720 Accepting request 1254181 from home:Guillaume_G:branches:openSUSE:Factory:ARM
- Add upstream patch to fix build on aarch64:
  * libcosmos-fix-aarch64.patch

OBS-URL: https://build.opensuse.org/request/show/1254181
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libcosmos?expand=0&rev=22
2025-03-24 13:18:19 +00:00
c146a22921 Accepting request 1253007 from devel:libraries:c_c++
- drop no longer needed provides/obsoletes

- update to version 0.4.0:
  This release contains major API additions and harmonization of the API
  modeling. The latter causes breaking changes.
  Bugfixes
  - fix bad value for SignalNr::TERM_STOP.
  - fix inconsistent state in SubProc when child is killed by a signal.
  - fix bugs in the error handling of the pthread API.
  Filesystem
  - added support for access() and faccessat().
  - added support for flock() API.
  - added file locking operations in FileDescriptor.
  - added for asynchronous signal-driven I/O in FileDescriptor.
  - added support for file lease support in FileDescriptor.
  - renamed TYPE_MASK and MODE_MASK enum values to avoid preprocessor macro name clashes on some GCC toolchains (e.g. Ubuntu arm cross toolchain).
  Signals
  - support for sending thread-directed signals.
  - add pause() wrapper.
  - add sigqueue() variant for sending signals.
  - support sigsuspend().
  - full support for asynchronous signal handling via sigaction()
    harmonize process state information by fully wrapping siginfo_t. This type
    is now used in cosmos::proc::wait() as well in asynchronous signal handling
    and cosmos::proc::wait_info() and some other locations. This replaces
    WaitRes, which was only a partial special-purpose wrapper over siginfo_t.
  - added wrapper for sigaltstack().
  Threads
  - use dedicated ThreadID that is distinct from ProcessID.
  ptrace() API

OBS-URL: https://build.opensuse.org/request/show/1253007
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libcosmos?expand=0&rev=7
2025-03-14 22:52:28 +00:00
d191c4781f - drop no longer needed provides/obsoletes
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libcosmos?expand=0&rev=20
2025-03-14 09:18:11 +00:00
ad823f595f OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libcosmos?expand=0&rev=19 2025-03-13 13:12:41 +00:00
d312d16772 - update to version 0.4.0:
This release contains major API additions and harmonization of the API
  modeling. The latter causes breaking changes.
  Bugfixes
  - fix bad value for SignalNr::TERM_STOP.
  - fix inconsistent state in SubProc when child is killed by a signal.
  - fix bugs in the error handling of the pthread API.
  Filesystem
  - added support for access() and faccessat().
  - added support for flock() API.
  - added file locking operations in FileDescriptor.
  - added for asynchronous signal-driven I/O in FileDescriptor.
  - added support for file lease support in FileDescriptor.
  - renamed TYPE_MASK and MODE_MASK enum values to avoid preprocessor macro name clashes on some GCC toolchains (e.g. Ubuntu arm cross toolchain).
  Signals
  - support for sending thread-directed signals.
  - add pause() wrapper.
  - add sigqueue() variant for sending signals.
  - support sigsuspend().
  - full support for asynchronous signal handling via sigaction()
    harmonize process state information by fully wrapping siginfo_t. This type
    is now used in cosmos::proc::wait() as well in asynchronous signal handling
    and cosmos::proc::wait_info() and some other locations. This replaces
    WaitRes, which was only a partial special-purpose wrapper over siginfo_t.
  - added wrapper for sigaltstack().
  Threads
  - use dedicated ThreadID that is distinct from ProcessID.
  ptrace() API
  - basic wrapper around the ptrace() ioctl like call
    more advanced type safe class Tracee which covers the individual ptrace requests in a type safe way

OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libcosmos?expand=0&rev=18
2025-03-12 10:30:11 +00:00
5 changed files with 216 additions and 18 deletions

129
libcosmos-fix-aarch64.patch Normal file
View File

@@ -0,0 +1,129 @@
From 54b144f95866ba8d54854ac3db31776449af9dab Mon Sep 17 00:00:00 2001
From: Matthias Gerstner <Matthias.Gerstner@nefkom.net>
Date: Tue, 18 Mar 2025 15:53:16 +0200
Subject: [PATCH] ptrace API: exclude more ptrace::Request constants if not
available
These constants are not available on aarch64. I don't see a better way
than to use the preprocessor to exclude them and also the wrappers in
Tracee at the moment.
Users of these requests likely are pretty low-level themselves, so
dealing with some #ifdef's will hopefully not be too much of a burden on
them.
Fixes #1
---
include/proc/Tracee.hxx | 8 ++++++++
include/proc/ptrace.hxx | 21 ++++++++++++++++++---
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/include/proc/Tracee.hxx b/include/proc/Tracee.hxx
index a92bd5d..e852bd0 100644
--- a/include/proc/Tracee.hxx
+++ b/include/proc/Tracee.hxx
@@ -208,6 +208,7 @@ public: // functions
this->request(ptrace::Request::POKEUSER, offset, value);
}
+#ifdef PTRACE_GETREGS
/// Copy the tracee's general purpose registers into the provided structure.
/**
* You need to include sys/user.h and check out the data structure
@@ -222,7 +223,9 @@ public: // functions
// it, we'd need an #ifdef of some sort.
this->request(ptrace::Request::GETREGS, nullptr, &out);
}
+#endif
+#ifdef PTRACE_SETREGS
/// Modify the tracee's general purpose registers.
/**
* Some register modifications may be disallowed by the kernel to
@@ -232,7 +235,9 @@ public: // functions
// NOTE: see getRegisters() about Sparc architecture
this->request(ptrace::Request::SETREGS, nullptr, &out);
}
+#endif
+#ifdef PTRACE_GETFPREGS
/// Copy the tracee's floating point registers into the provided structure.
/**
* This is similar to getRegisters() but provides the floating point
@@ -244,7 +249,9 @@ public: // functions
// NOTE: see getRegisters() about Sparc architecture
this->request(ptrace::Request::GETFPREGS, nullptr, &out);
}
+#endif
+#ifdef PTRACE_SETFPREGS
/// Modify the tracee's floating point registers.
/**
* \see setRegisters().
@@ -252,6 +259,7 @@ public: // functions
void setFloatRegisters(const struct user_fpregs_struct &out) {
this->request(ptrace::Request::SETFPREGS, nullptr, &out);
}
+#endif
/// Retrieve a set of registers from the tracee.
/**
diff --git a/include/proc/ptrace.hxx b/include/proc/ptrace.hxx
index 7329f6e..8187d10 100644
--- a/include/proc/ptrace.hxx
+++ b/include/proc/ptrace.hxx
@@ -82,9 +82,14 @@ enum class RegisterType {
/// Basic requests that can be passed to the ptrace() system call.
/**
+ * \note Some of these requests are only available on some architectures.
+ * Some have also been deprecated by now. This can only be modeled via #ifdefs
+ * currently, which means that client code has to deal with the possibility of
+ * the affected requests not being available.
+ *
* \note On system call level this has an actual `enum __ptrace_request` type,
- * thus there is no defined underlying type and we keep the compiler's
- * default.
+ * thus there is no defined underlying type and we keep the compiler's
+ * default.
**/
enum class Request {
/// The tracee asks to be traced by its parent.
@@ -99,16 +104,24 @@ enum class Request {
POKEDATA = PTRACE_POKEDATA,
/// Write a word at the given offset into the tracee's USER data.
POKEUSER = PTRACE_POKEUSER,
+#ifdef PTRACE_GETREGS
/// Copy the tracee's general-purpose registers to the given address in the tracer.
GETREGS = PTRACE_GETREGS,
+#endif
+#ifdef PTRACE_GETFPREGS
/// Copy the tracee's floating-point registers to the given address in the tracer.
GETFPREGS = PTRACE_GETFPREGS,
+#endif
/// Reg the tracee's registers in an architecture dependent way.
GETREGSET = PTRACE_GETREGSET,
+#ifdef PTRACE_SETREGS
/// Modify the tracee's general-purpose registers (not available on all architectures).
SETREGS = PTRACE_SETREGS,
+#endif
+#ifdef PTRACE_SETFPREGS
/// Modify the tracee's floating-point registers.
SETFPREGS = PTRACE_SETFPREGS,
+#endif
/// Modify the tracee's registers, analogous to GETREGSET.
SETREGSET = PTRACE_SETREGSET,
/// Retrieve information about the signal that cause the tracee to stop. Copies a siginfo_t structure.
@@ -156,9 +169,11 @@ enum class Request {
SECCOMP_GET_FILTER = PTRACE_SECCOMP_GET_FILTER,
/// Restart the stopped tracee, but first detach from it.
DETACH = PTRACE_DETACH,
+#ifdef PTRACE_GET_THREAD_AREA
/// Performs an operation similar to `get_thread_area()`.
GET_THREAD_AREA = PTRACE_GET_THREAD_AREA,
-#if PTRACE_SET_THREAD_AREA
+#endif
+#ifdef PTRACE_SET_THREAD_AREA
/// Performs an operation similar to `set_thread_area()`.
SET_THREAD_AREA = PTRACE_SET_THREAD_AREA,
#endif

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f2df570858c4cef758c82ef61294551a52a31d36b7c0326a862a1ae43debca3c
size 207316

3
libcosmos-v0.4.0.tar.xz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e0887356df11422d8f0f7a994b18391313e2ddd85842f9ab71319bfe94ff46e6
size 235360

View File

@@ -1,7 +1,78 @@
-------------------------------------------------------------------
Tue Mar 18 15:44:55 UTC 2025 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Add upstream patch to fix build on aarch64:
* libcosmos-fix-aarch64.patch
-------------------------------------------------------------------
Fri Mar 14 09:17:46 UTC 2025 - Matthias Gerstner <matthias.gerstner@suse.com>
- drop no longer needed provides/obsoletes
-------------------------------------------------------------------
Wed Mar 12 10:27:14 UTC 2025 - Matthias Gerstner <matthias.gerstner@suse.com>
- update to version 0.4.0:
This release contains major API additions and harmonization of the API
modeling. The latter causes breaking changes.
Bugfixes
- fix bad value for SignalNr::TERM_STOP.
- fix inconsistent state in SubProc when child is killed by a signal.
- fix bugs in the error handling of the pthread API.
Filesystem
- added support for access() and faccessat().
- added support for flock() API.
- added file locking operations in FileDescriptor.
- added for asynchronous signal-driven I/O in FileDescriptor.
- added support for file lease support in FileDescriptor.
- renamed TYPE_MASK and MODE_MASK enum values to avoid preprocessor macro name clashes on some GCC toolchains (e.g. Ubuntu arm cross toolchain).
Signals
- support for sending thread-directed signals.
- add pause() wrapper.
- add sigqueue() variant for sending signals.
- support sigsuspend().
- full support for asynchronous signal handling via sigaction()
harmonize process state information by fully wrapping siginfo_t. This type
is now used in cosmos::proc::wait() as well in asynchronous signal handling
and cosmos::proc::wait_info() and some other locations. This replaces
WaitRes, which was only a partial special-purpose wrapper over siginfo_t.
- added wrapper for sigaltstack().
Threads
- use dedicated ThreadID that is distinct from ProcessID.
ptrace() API
- basic wrapper around the ptrace() ioctl like call
more advanced type safe class Tracee which covers the individual ptrace requests in a type safe way
Time
- introduce IntervalTime for relative time specifications. Previously
std::chrono::milliseconds have been used in some APIs where actually
struct timespec is used on system level. To allow full use of the TimeSpec
precision and also clearly mark the type for relative time interval, use
another dedicated TimeSpec based type called IntervalTime.
Other
- provide an explicit cosmos::no_init tag for opt-in to non-initialized
objects like TimeSpec. This avoids surprises but still allows to have
performance benefits if necesary by using the no_init ctor variants.
some harmonization in method names, cleanup and documentation fixes.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Aug 6 12:53:38 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com> Tue Aug 6 12:53:38 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com>
- Setup obsoletes/provides to cover the renaming of the library SONAME. - Setup obsoletes/provides to cover the renaming of the library SONAME.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Aug 6 11:45:15 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com> Tue Aug 6 11:45:15 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com>
@@ -12,7 +83,7 @@ Tue Aug 6 11:45:15 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com>
Wed Jul 24 08:31:12 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com> Wed Jul 24 08:31:12 UTC 2024 - Matthias Gerstner <matthias.gerstner@suse.com>
- change library package name from libcosmos-0_2_0 to libcosmos-0, because it - change library package name from libcosmos-0_2_0 to libcosmos-0, because it
needs to follow the library's SONAME which is libcosmos.so.0. needs to follow the library's SONAME which is libcosmos.so.0.
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jul 24 08:03:14 UTC 2024 - matthias.gerstner@suse.com Wed Jul 24 08:03:14 UTC 2024 - matthias.gerstner@suse.com

View File

@@ -1,7 +1,7 @@
# #
# spec file for package libcosmos # spec file for package libcosmos
# #
# Copyright (c) 2024 SUSE LLC # Copyright (c) 2025 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -16,7 +16,7 @@
# #
%define version 0.3.1 %define version 0.4.0
Name: libcosmos Name: libcosmos
Version: %{version} Version: %{version}
@@ -25,8 +25,9 @@ Summary: A library providing a modern C++ API for the Linux operating sys
License: MIT License: MIT
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
URL: https://github.com/gerstner-hub/libcosmos URL: https://github.com/gerstner-hub/libcosmos
Source0: libcosmos-v0.3.1.tar.xz Source0: libcosmos-v%{version}.tar.xz
# PATCH-FIX-UPSTREAM - https://github.com/gerstner-hub/libcosmos/commit/54b144
Patch0: libcosmos-fix-aarch64.patch
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: scons BuildRequires: scons
@@ -36,16 +37,13 @@ This is libcosmos, a library providing a modern C++ API for the Linux
operating system. It is intended for low level systems programming on Linux, operating system. It is intended for low level systems programming on Linux,
while relying on a strong C++ type model for robustness and expressiveness. while relying on a strong C++ type model for robustness and expressiveness.
%package -n libcosmos-3 %package -n libcosmos-4
Summary: A library providing a modern C++ API for the Linux operating system Summary: A library providing a modern C++ API for the Linux operating system
Group: System/Libraries Group: System/Libraries
Provides: %{name} = %{version} Provides: %{name} = %{version}
Obsoletes: %{name} < %{version} Obsoletes: %{name} < %{version}
# renamed from broken package name that didn't follow SONAME
Provides: libcosmos-0_2_0 = %{version}
Obsoletes: libcosmos-0_2_0 < %{version}
%description -n libcosmos-3 %description -n libcosmos-4
A library providing a modern C++ API for the Linux operating system. A library providing a modern C++ API for the Linux operating system.
The runtime library files for libcosmos. The runtime library files for libcosmos.
@@ -53,7 +51,7 @@ The runtime library files for libcosmos.
%package devel %package devel
Summary: A library providing a modern C++ API for the Linux operating system Summary: A library providing a modern C++ API for the Linux operating system
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: libcosmos-3 = %{version} Requires: libcosmos-4 = %{version}
Requires: libstdc++-devel Requires: libstdc++-devel
%description devel %description devel
@@ -62,7 +60,7 @@ A library providing a modern C++ API for the Linux operating system.
Header and development files for libcosmos. Header and development files for libcosmos.
%prep %prep
%setup -q -n %{name}-v%{version} %autosetup -p1 -n %{name}-v%{version}
%build %build
scons libtype=shared scons libtype=shared
@@ -74,9 +72,9 @@ scons install instroot=%{buildroot}/usr
#%%check #%%check
#scons run_tests #scons run_tests
%ldconfig_scriptlets -n libcosmos-3 %ldconfig_scriptlets -n libcosmos-4
%files -n libcosmos-3 %files -n libcosmos-4
%license LICENSE %license LICENSE
%doc README.md %doc README.md
%{_libdir}/libcosmos.so.* %{_libdir}/libcosmos.so.*