Files
AnyPS5/core/libs/prx/libSceLibcInternal/include/Spawn.hpp
T
DavidandClaude Fable 5.1 2fe382c658 feat(libSceLibcInternal): implement the posix_spawn attribute and file action calls
XPSemu (PPSA97358) imports eleven posix_spawn calls from
libSceLibcInternal.prx, one reference each, and no call site is known.
Predicted stop (import order, not measured), behind isnanf (idx 296):
`FAIL: unresolved ELF import 44hlATrd47U from libSceLibcInternal.prx`
(posix_spawnattr_init, idx 347), followed by p--TkNVsXjA, LG6O0oW9bQU,
Sj7y+JO5PcM, Ud8CbISKRGM, Hq9-2AMG+ks, IUfBO5UIZNc, Heh4KJwyoX8 (348-355),
UV4m0bznVtU, Ani6e+T-y6Q and 3Nr9caNHhyg (379-381).

The nine object calls follow FreeBSD release/11.4.0 (8c639945a445)
lib/libc/gen/posix_spawn.c: posix_spawnattr_init allocates a zeroed
attribute object (ENOMEM on failure), _destroy frees it, _setflags and
_setsigdefault store the value; posix_spawn_file_actions_init allocates an
empty list (-1 on failure, as in 11.4), _destroy frees it with its
entries, and _addopen (path copied), _adddup2 and _addclose append in
order after returning EBADF for a negative descriptor. Null or
uninitialized objects, which FreeBSD dereferences, throw.

posix_spawn and posix_spawnp throw "process creation not implemented",
as execvp does: FreeBSD validates no argument before rfork/vfork, and no
child process can be created here. TechnicalDebt records them.
guest_posix_spawn covers the attribute round trips, the recorded action
sequence, the EBADF cases and the throws. NIDs computed with
tools/nid_names.py and present in aerolib.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-13 07:56:19 +00:00

38 lines
832 B
C++

#ifndef CORE_LIBS_PRX_LIBSCELIBCINTERNAL_INCLUDE_SPAWN_HPP
#define CORE_LIBS_PRX_LIBSCELIBCINTERNAL_INCLUDE_SPAWN_HPP
#include <cstdint>
#include <string>
#include <vector>
struct GuestSignalSet {
std::uint32_t bits[4];
};
static_assert(sizeof(GuestSignalSet) == 16);
struct PosixSpawnAttributes {
std::int16_t flags;
std::int32_t processGroup;
std::int32_t schedulingPriority;
std::int32_t schedulingPolicy;
GuestSignalSet signalDefault;
GuestSignalSet signalMask;
};
enum class PosixSpawnFileActionKind { Open, Duplicate, Close };
struct PosixSpawnFileAction {
PosixSpawnFileActionKind kind;
int descriptor;
std::string path;
int openFlags;
std::uint16_t mode;
int newDescriptor;
};
struct PosixSpawnFileActions {
std::vector<PosixSpawnFileAction> actions;
};
#endif