From: Jo E. S. <jo...@on...> - 2024-10-10 20:01:19
|
>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 |