فهرست منبع

csky: fix struct semid_ds layout for TIME64

csky uses the asm-generic kernel semid64_ds (sem_otime, sem_otime_high,
sem_ctime, sem_ctime_high, sem_nsems -- sem_nsems at offset 52), like
arc/arm/or1k/xtensa/riscv.  bits/sem.h omitted csky from the arch list
that drops __uclibc_unused1/2 under __UCLIBC_USE_TIME64__, so the TIME64
build kept the padding and placed sem_nsems at offset 60.  The kernel
writes it at 52, so semctl(IPC_STAT) returned sem_nsems == 0 (and the
64-bit sem_otime/sem_ctime were reconstructed from the wrong words).
Add csky to that list.

Verified with test/misc/sem under qemu-system-cskyv2 (gcc-15.2.0,
UCLIBC_USE_TIME64=y).

Signed-off-by: Ramin Moussavi <ramin.moussavi@yacoub.de>
Ramin Moussavi 1 هفته پیش
والد
کامیت
f62f251b9f
1فایلهای تغییر یافته به همراه4 افزوده شده و 4 حذف شده
  1. 4 4
      libc/sysdeps/linux/common/bits/sem.h

+ 4 - 4
libc/sysdeps/linux/common/bits/sem.h

@@ -45,8 +45,8 @@ struct semid_ds
 #else
   __time_t sem_otime;			/* last semop() time */
 #endif
-#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__) && !defined(__riscv)) || \
-    ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__) || defined(__riscv)) && !defined(__UCLIBC_USE_TIME64__))
+#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__) && !defined(__riscv) && !defined(__csky__)) || \
+    ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__) || defined(__riscv) || defined(__csky__)) && !defined(__UCLIBC_USE_TIME64__))
   unsigned long int __uclibc_unused1;
 #endif
 #if defined(__UCLIBC_USE_TIME64__)
@@ -55,8 +55,8 @@ struct semid_ds
 #else
   __time_t sem_ctime;			/* last time changed by semctl() */
 #endif
-#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__) && !defined(__riscv)) || \
-    ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__) || defined(__riscv)) && !defined(__UCLIBC_USE_TIME64__))
+#if (__WORDSIZE == 32 && !defined(__ARC64_ARCH32__) && !defined(__arc__) && !defined(__arm__) && !defined(__or1k__) && !defined(__xtensa__) && !defined(__riscv) && !defined(__csky__)) || \
+    ((defined(__ARC64_ARCH32__) || defined(__arc__) || defined(__arm__) || defined(__or1k__) || defined(__xtensa__) || defined(__riscv) || defined(__csky__)) && !defined(__UCLIBC_USE_TIME64__))
   unsigned long int __uclibc_unused2;
 #endif
   unsigned long int sem_nsems;		/* number of semaphores in set */