From: Jo E. S. <jo...@on...> - 2024-10-12 11:55:11
|
Ok, got it. This struct is protected and can not be accessed directly, you need to use Fread to access it. Jo Even On Thu, 10 Oct 2024 19:28:19 +0000, "Jo Even Skarstein" <jo...@on...> wrote: >> From tos.hyp (Fcntl): >> >> > PPROCADDDR (0x5001): >> > >> > In the parameter arg a pointer to the address of the PCB (Process Control Block) is returned. >> >> The following code works and prints correct values (when compared with XaAES task manager and ps) when MP is disabled: >> >> void main(void) >> { >> long f = Fopen("u:\\proc\\.11", 0); /* Same behaviour when opening .-1 too */ >> struct PCB *p; >> printf("%ld\n", Fcntl((int) f, &p, 0x5001)); >> printf("pid: %d systime: %ld usrtime: %ld\n", p->pid, p->systime, p->usrtime); >> } >> >> However, if MP is enabled the same binary crashes with a bus error. Fcntl returns E_OK and the value of *p after the call looks sensible, but accessing the memory pointed to by *p results in a bus error. Am I doing something stupid here? I would assume so, since ps (the ancient one from MiNTOS/KGMD/SpareMiNT) works and I'm pretty sure it gets this information the same way. >> >> I have compiled it with both gcc and PureC with identical results. >> >> Jo Even >> >> >> _______________________________________________ >> Freemint-discuss mailing list >> Fre...@li... >> https://lists.sourceforge.net/lists/listinfo/freemint-discuss |