- Added new API: SC_GET_PID
- Fixed data type pid - unsigned int. 
- Fixed cmd_ps output pid; 

git-svn-id: svn://kolibrios.org@8633 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-03-03 21:14:44 +00:00
parent 504bda29b5
commit 1a73ba1001
3 changed files with 17 additions and 8 deletions

View File

@ -18,13 +18,13 @@ printf (" PID NAME RAM KB\n\r", PID, buf1k+10);
for (i = 1;;i++) for (i = 1;;i++)
{ {
n = kol_process_info(i, buf1k); n = kol_process_info(i, buf1k);
PID = *(buf1k+30); memcpy(&PID, buf1k+30 ,sizeof(unsigned));
STATE = *(buf1k+50); STATE = *(buf1k+50);
if (9 != STATE) if (9 != STATE)
{ {
if (!sel || 0 == strnicmp(param, buf1k+10, 10)) if (!sel || 0 == strnicmp(param, buf1k+10, 10))
{ {
printf (" %7d %11s %d\n\r", PID, buf1k+10, (*(int*)(buf1k+26)+1)/1024); printf (" %7u %11s %d\n\r", PID, buf1k+10, (*(int*)(buf1k+26)+1)/1024);
if (sel) if (sel)
{ {
LAST_PID = PID; LAST_PID = PID;

View File

@ -7,6 +7,7 @@ int program_console(int pid)
char name[32]; char name[32];
char *buffer; char *buffer;
char *buf1k;
int result; int result;
int i; int i;
char command; char command;
@ -17,7 +18,7 @@ itoa(pid, name);
strcat(name, "-SHELL"); strcat(name, "-SHELL");
buffer = NULL; buffer = NULL;
buf1k = NULL;
for (i = 0; i < 30; i++) for (i = 0; i < 30; i++)
{ {
@ -41,7 +42,6 @@ for (i = 0; i < 30; i++)
switch (command) switch (command)
{ {
case SC_EXIT: case SC_EXIT:
*buffer = SC_OK; *buffer = SC_OK;
is_end = 1; is_end = 1;
@ -76,6 +76,14 @@ for (i = 0; i < 30; i++)
*buffer = SC_OK; *buffer = SC_OK;
break; break;
case SC_GET_PID:
buf1k=malloc(1024);
kol_process_info(-1, buf1k);
memcpy(buffer+1, buf1k+30, sizeof(unsigned));
*buffer = SC_OK;
free(buf1k);
break;
default: default:
#if LANG_ENG #if LANG_ENG
printf (" Error in console application.\n\r"); printf (" Error in console application.\n\r");

View File

@ -6,3 +6,4 @@
#define SC_GETC 4 #define SC_GETC 4
#define SC_GETS 5 #define SC_GETS 5
#define SC_CLS 6 #define SC_CLS 6
#define SC_GET_PID 7