2022-06-13 20:29:53 +00:00
|
|
|
diff -Paur --no-dereference -- m4.upstream/lib/freadahead.c m4/lib/freadahead.c
|
|
|
|
--- m4.upstream/lib/freadahead.c
|
|
|
|
+++ m4/lib/freadahead.c
|
2024-01-27 19:42:00 +00:00
|
|
|
@@ -30,6 +30,10 @@
|
|
|
|
/* This file is not used on systems that have the __freadahead function,
|
|
|
|
namely musl libc. */
|
2022-06-13 20:29:53 +00:00
|
|
|
|
|
|
|
+#if defined(__sortix__)
|
|
|
|
+#include <FILE.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
size_t
|
|
|
|
freadahead (FILE *fp)
|
|
|
|
{
|
2024-01-27 19:42:00 +00:00
|
|
|
@@ -94,6 +98,10 @@
|
|
|
|
if (fp->state == 4 /* WR */ || fp->rp >= fp->wp)
|
2022-06-13 20:29:53 +00:00
|
|
|
return 0;
|
2024-01-27 19:42:00 +00:00
|
|
|
return fp->wp - fp->rp;
|
2022-06-13 20:29:53 +00:00
|
|
|
+#elif defined __sortix__
|
|
|
|
+ if ( !(fp->flags & _FILE_LAST_READ) )
|
|
|
|
+ return 0;
|
|
|
|
+ return fp->amount_input_buffered - fp->offset_input_buffer;
|
|
|
|
#elif defined SLOW_BUT_NO_HACKS /* users can define this */
|
|
|
|
abort ();
|
|
|
|
return 0;
|
|
|
|
diff -Paur --no-dereference -- m4.upstream/lib/spawn_faction_addclose.c m4/lib/spawn_faction_addclose.c
|
|
|
|
--- m4.upstream/lib/spawn_faction_addclose.c
|
|
|
|
+++ m4/lib/spawn_faction_addclose.c
|
|
|
|
@@ -22,7 +22,9 @@
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
-#if !_LIBC
|
|
|
|
+#if defined(__sortix__)
|
|
|
|
+# define __sysconf(open_max) sysconf (open_max)
|
|
|
|
+#elif !_LIBC
|
|
|
|
# define __sysconf(open_max) getdtablesize ()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
diff -Paur --no-dereference -- m4.upstream/lib/spawn_faction_adddup2.c m4/lib/spawn_faction_adddup2.c
|
|
|
|
--- m4.upstream/lib/spawn_faction_adddup2.c
|
|
|
|
+++ m4/lib/spawn_faction_adddup2.c
|
|
|
|
@@ -22,7 +22,9 @@
|
|
|
|
#include <errno.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
-#if !_LIBC
|
|
|
|
+#if defined(__sortix__)
|
|
|
|
+# define __sysconf(open_max) sysconf (open_max)
|
|
|
|
+#elif !_LIBC
|
|
|
|
# define __sysconf(open_max) getdtablesize ()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
diff -Paur --no-dereference -- m4.upstream/lib/spawn_faction_addopen.c m4/lib/spawn_faction_addopen.c
|
|
|
|
--- m4.upstream/lib/spawn_faction_addopen.c
|
|
|
|
+++ m4/lib/spawn_faction_addopen.c
|
2024-01-27 19:42:00 +00:00
|
|
|
@@ -24,7 +24,9 @@
|
|
|
|
#include <string.h>
|
2022-06-13 20:29:53 +00:00
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
-#if !_LIBC
|
|
|
|
+#if defined(__sortix__)
|
|
|
|
+# define __sysconf(open_max) sysconf (open_max)
|
|
|
|
+#elif !_LIBC
|
|
|
|
# define __sysconf(open_max) getdtablesize ()
|
|
|
|
#endif
|
|
|
|
|
|
|
|
diff -Paur --no-dereference -- m4.upstream/lib/spawni.c m4/lib/spawni.c
|
|
|
|
--- m4.upstream/lib/spawni.c
|
|
|
|
+++ m4/lib/spawni.c
|
2024-01-27 19:42:00 +00:00
|
|
|
@@ -808,16 +808,20 @@
|
2022-06-13 20:29:53 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+#if !defined(__sortix__)
|
|
|
|
/* Set the process group ID. */
|
|
|
|
if ((flags & POSIX_SPAWN_SETPGROUP) != 0
|
|
|
|
&& setpgid (0, attrp->_pgrp) != 0)
|
|
|
|
_exit (SPAWN_ERROR);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
+#if !defined(__sortix__)
|
|
|
|
/* Set the effective user and group IDs. */
|
|
|
|
if ((flags & POSIX_SPAWN_RESETIDS) != 0
|
|
|
|
&& (local_seteuid (getuid ()) != 0
|
|
|
|
|| local_setegid (getgid ()) != 0))
|
|
|
|
_exit (SPAWN_ERROR);
|
|
|
|
+#endif
|
|
|
|
|
|
|
|
/* Execute the file actions. */
|
|
|
|
if (file_actions != NULL)
|