For simplicity, don't use the snprintf_lkp() wrapper,

simply use snprintf() here
This commit is contained in:
Kaiwan N Billimoria
2024-01-22 11:59:08 +05:30
parent b4cb4aaa79
commit 5cd39db4fd
3 changed files with 24 additions and 3 deletions

View File

@@ -54,7 +54,14 @@ static void disp_cpumask(pid_t pid, cpu_set_t *cpumask, unsigned int ncores)
char tmpbuf[128];
printf("CPU affinity mask for PID %d:\n", pid);
snprintf_lkp(tmpbuf, 127, "ps -A |awk '$1 == %d {print $0}'", pid);
/* We don't use our snprintf_lkp() wrapper here as that will require
* linking into the klib.c file... here, we're demo-ing the module
* stacking approach, as opposed to the 'library' link approach, so
* we pedantically avoid it. Don't have any such qualms in production;
* simply use it and link approproately.
*/
snprintf(tmpbuf, 127, "ps -A |awk '$1 == %d {print $0}'", pid);
//snprintf_lkp(tmpbuf, 127, "ps -A |awk '$1 == %d {print $0}'", pid);
if (system(tmpbuf) == -1)
fprintf(stderr, "Warning: %s():system(3) (to show ps output)"
" failed\n", __func__);

View File

@@ -46,7 +46,14 @@ void llkd_sysinfo2(void)
char msg[MSGLEN];
memset(msg, 0, MSGLEN);
snprintf_lkp(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
/* We don't use our snprintf_lkp() wrapper here as that will require
* linking into the klib.c file... here, we're demo-ing the module
* stacking approach, as opposed to the 'library' link approach, so
* we pedantically avoid it. Don't have any such qualms in production;
* simply use it and link approproately.
*/
snprintf(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
//snprintf_lkp(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
/* Strictly speaking, all this #if... is considered ugly and should be
* isolated as far as is possible

View File

@@ -49,7 +49,14 @@ void llkd_sysinfo2(void)
char msg[MSGLEN];
memset(msg, 0, MSGLEN);
snprintf_lkp(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
/* We don't use our snprintf_lkp() wrapper here as that will require
* linking into the klib.c file... here, we're demo-ing the module
* stacking approach, as opposed to the 'library' link approach, so
* we pedantically avoid it. Don't have any such qualms in production;
* simply use it and link approproately.
*/
snprintf(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
//snprintf_lkp(msg, 48, "%s(): minimal Platform Info:\nCPU: ", __func__);
/* Strictly speaking, all this #if... is considered ugly and should be
* isolated as far as is possible