[lwp] Implementation of setpgrp and fix mmap2 problems (#9308)
* mmap2 failure handling 当传入一个非常大的地址时,offset会计算得到一个值,又因为传入的地址错误,rc会得到错误码,结合offset会得到一个很奇怪的值。 * Implementation of setpgrp 执行setpgrp会走到这一步,在执行getpgrp无法得到创建的group的值 * Modify the return method of mmap
This commit is contained in:
parent
9d95ad9b8d
commit
9a84c13b2e
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue