assert(buf != (char *)-1);
/* Whether PROT_WRITE is readable is arch-dependent. So compare
- * against write() result (to make the kernel read from buf). */
+ * against write() result (to make the kernel read from buf), and
+ * use a hard-coded list for the systems where this does not work. */
+#if defined(__hppa__) || \
+ defined(__loongarch__) || \
+ defined(__sparc__)
+ res = SIZE;
+#else
res = write(rwfd, buf, SIZE);
if (res < 0)
res = -errno;
+#endif
status |= attempt_rw(rwfd, buf, SIZE, 0, READ, SIZE);
status |= attempt_rw(rwfd, buf, SIZE, 0, WRITE, res);