Skip to content

[lwp] Implementation of setpgrp and fix mmap2 problems #9308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions components/lwp/lwp_pgrp.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,18 @@ sysret_t sys_setpgid(pid_t pid, pid_t pgid)
if (group == RT_NULL)
{
group = lwp_pgrp_create(process);
lwp_pgrp_move(group, process);
session = lwp_session_find(sid);
if (session == RT_NULL)
{
LOG_E("the session of sid: %d cannot be found", sid);
err = -EPERM;
goto exit;
}
else
{
lwp_session_insert(session, group);
}
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion components/lwp/lwp_syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ void *sys_mmap2(void *addr, size_t length, int prot,
rc = (sysret_t)lwp_mmap2(lwp_self(), addr, length, prot, flags, fd, pgoffset);
}

return (char *)rc + offset;
return rc < 0 ? (char *)rc : (char *)rc + offset;
}

sysret_t sys_munmap(void *addr, size_t length)
Expand Down
Loading