Userland: Teach strace(1) to format pledge(2)

This commit is contained in:
Sergey Bugaev 2023-07-23 15:33:39 +03:00 committed by Andrew Kaster
parent 8c8ba4cfe4
commit cd4298ae04

View file

@ -579,6 +579,15 @@ static void format_close(FormattedSyscallBuilder& builder, int fd)
builder.add_arguments(fd);
}
static ErrorOr<void> format_pledge(FormattedSyscallBuilder& builder, Syscall::SC_pledge_params* params_p)
{
auto params = TRY(copy_from_process(params_p));
builder.add_arguments(
StringArgument { params.promises },
StringArgument { params.execpromises });
return {};
}
static ErrorOr<void> format_poll(FormattedSyscallBuilder& builder, Syscall::SC_poll_params* params_p)
{
// TODO: format fds and sigmask properly
@ -749,6 +758,9 @@ static ErrorOr<void> format_syscall(FormattedSyscallBuilder& builder, Syscall::F
case SC_open:
TRY(format_open(builder, (Syscall::SC_open_params*)arg1));
break;
case SC_pledge:
TRY(format_pledge(builder, (Syscall::SC_pledge_params*)arg1));
break;
case SC_poll:
TRY(format_poll(builder, (Syscall::SC_poll_params*)arg1));
break;