Description: shm_segments: use the PowerPC offset of shm_segsz on PowerPC PowerPC orders struct shmid_ds with the three time fields before shm_segsz; the generic layout puts shm_segsz first. The fixed offset therefore reads shm_atime on ppc64el and ppc64, and the oversized value makes the following shmread() fail, so the segment never reaches %segments. That fails t/72-shm_segments.t and t/74-seg_map.t. . Minimal alternative to portable-shmid_ds.patch; use one or the other. Author: Edmund Lodewijks Forwarded: https://github.com/stevieb9/ipc-shareable/issues/66 Last-Update: 2026-08-28 --- --- a/lib/IPC/Shareable.pm +++ b/lib/IPC/Shareable.pm @@ -723,10 +723,16 @@ my $stat_buf = ''; shmctl($id, IPC_STAT, $stat_buf) or next; + # PowerPC orders struct shmid_ds with the three time fields before + # shm_segsz; everywhere else shm_segsz comes first, right after + # ipc_perm. Both ipc_perm layouts are 48 bytes, so shm_segsz sits at + # 72 rather than 48 on 64-bit, and at 76 rather than 36 on 32-bit. + my $ppc = $Config{archname} =~ /^(?:powerpc|ppc)/i; + my ($segsz) = $^O eq 'linux' ? ( $Config{longsize} == 8 - ? unpack('x[48] Q', $stat_buf) # 64-bit Linux - : unpack('x[36] L', $stat_buf) ) # 32-bit Linux + ? unpack($ppc ? 'x[72] Q' : 'x[48] Q', $stat_buf) # 64-bit Linux + : unpack($ppc ? 'x[76] L' : 'x[36] L', $stat_buf) ) # 32-bit Linux : $^O eq 'freebsd' && $Config{longsize} == 8 ? unpack('x[32] Q', $stat_buf) # 64-bit FreeBSD (key_t=long=8, ipc_perm=32) : $^O eq 'solaris'