修复Ctrl+C会终止所有进程的问题

Signed-off-by: huangshan <huangshan9@huawei.com>
Change-Id: I5861569c63fd6c1adf8c702797e4d79eba76211f
This commit is contained in:
huangshan
2021-11-03 09:58:22 +08:00
parent 23c4f2b81b
commit cdc0877f16
7 changed files with 53 additions and 35 deletions

View File

@@ -436,17 +436,16 @@ STATIC VOID StoreReadChar(CONSOLE_CB *consoleCB, char ch, INT32 readcount)
}
}
VOID KillPgrp()
VOID KillPgrp(UINT16 consoleId)
{
INT32 consoleId;
LosProcessCB *process = OsCurrProcessGet();
if ((process->consoleID > CONSOLE_NUM - 1) || (process->consoleID < 0)) {
if ((consoleId > CONSOLE_NUM) || (consoleId <= 0)) {
return;
}
CONSOLE_CB *consoleCB = g_console[consoleId-1];
/* the default of consoleCB->pgrpId is -1, may not be set yet, avoid killing all processes */
if (consoleCB->pgrpId < 0) {
return;
}
consoleId = process->consoleID;
CONSOLE_CB *consoleCB = g_console[consoleId];
(VOID)OsKillLock(consoleCB->pgrpId, SIGINT);
}