Skip to content
Open
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
10 changes: 10 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
libcap2 (1:2.75-10deepin1) unstable; urgency=medium

* Add sw64 architecture support
- Add __sw64__ to psx/psx_calls.c architecture detection
- Fixes compilation error on sw64 systems:
"invalid operands to binary | (have 'sigset_t' and 'long unsigned int')"
- The sw64 (Sunway) architecture requires explicit handling of sigset_t

-- lichenggang <lichenggang@uniontech.com> Tue, 17 Mar 2026 15:51:00 +0800

libcap2 (1:2.75-10) unstable; urgency=medium

* d/rules: Fix typo in override_dh_auto_clean
Expand Down
12 changes: 12 additions & 0 deletions debian/patches/Add-sw64-architecture-support.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- libcap2-2.75.orig/psx/psx_calls.c
+++ libcap2-2.75/psx/psx_calls.c
@@ -48,7 +48,8 @@
|| defined(__mips__) || defined(__loongarch__) \
|| defined(__powerpc__) || defined(__s390__) || defined(__riscv) \
|| defined(__alpha__) || defined(__hppa__) || defined(__sh__) \
- || defined(__m68k__) || defined(__sparc__)
+ || defined(__m68k__) || defined(__sparc__) \
+ || defined(__sw64__)

#undef _NSIG
#undef _NSIG_BPW
44 changes: 44 additions & 0 deletions debian/patches/Fix-sigset-operations-for-sw64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
Description: Fix sigset operations for sw64 architecture
On sw64 architecture, sigset_t is not a simple integer type and cannot
be manipulated using bitwise operations directly. Replace custom macros
with standard POSIX sigemptyset() and sigaddset() functions which are
portable across all architectures.
Author: Deepin Packages Builder <packages@deepin.org>
Forwarded: no
Last-Update: 2026-03-17

--- libcap2-2.75.orig/psx/psx_calls.c
+++ libcap2-2.75/psx/psx_calls.c
@@ -112,21 +112,6 @@
#define _psx_rt_sigaction(sig, act, oact) \
syscall(SYS_rt_sigaction, sig, act, oact, sizeof(sigset_t))

-#define _psx_sigemptyset(pmask) \
- memset(pmask, 0, sizeof(*(pmask)))
-
-#ifdef _NSIG_WORDS
-
-#define _psx_sigaddset(pmask, signo) \
- (pmask)->sig[(signo-1)/_NSIG_BPW] |= 1UL << (((signo-1)%_NSIG_BPW))
-
-#else /* ndef _NSIG_WORDS */
-
-#define _psx_sigaddset(pmask, signo) \
- *(pmask) |= 1UL << (signo-1)
-
-#endif /* def _NSIG_WORDS */
-
#ifdef SA_RESTORER
/*
* Actual assembly code for this "function" is embedded in
@@ -246,8 +231,8 @@
/*
* Block interrupts while potentially rewriting the handler.
*/
- _psx_sigemptyset(&mask);
- _psx_sigaddset(&mask, psx_tracker.psx_sig);
+ sigemptyset(&mask);
+ sigaddset(&mask, psx_tracker.psx_sig);
_psx_rt_sigprocmask(SIG_BLOCK, &mask, &orig);
_psx_rt_sigaction(psx_tracker.psx_sig, NULL, &existing_sa);
if (existing_sa.sa_handler != (void *) &psx_posix_syscall_actor) {
2 changes: 2 additions & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Glibc-needs-a-constant-to-be-defined-for-puts-to-work.patch
Add-support-for-some-less-mainstream-architectures.patch
Extend-support-further-to-__m68k__-and-possibly-__sparc__.patch
Be-more-systematic-using-the-kernel-signal-handler-APIs.patch
Add-sw64-architecture-support.patch
Fix-sigset-operations-for-sw64.patch
Loading