hi

would someone please help me
i'm trying to modify the setpriority system call in a way that it lets
a process explicitly change the priority of a child process

first thing i did was add the following macro constant in
/include/sys/resource.h:

/* resource.h*/
....
#define PRIO_CHILD 3
....
/* end resource.h*/


next, i changed the code in do_getsetpriority (in
usr/src/servers/pm/misc.c):


/* misc.c*/
....
PUBLIC int do_getsetpriority()
{
/* first few lines as in original minix 3 up to
* where the comment says 'Only support
* PRIO_PROCESS for now. */

if ((arg_which != PRIO_PROCESS) && (arg_which != PRIO_CHILD))
return(EINVAL);

if (arg_who == 0)
rmp_nr = who;
else
if ((rmp_nr = proc_from_pid(arg_who)) < 0)
return(ESRCH);

rmp = &mproc[rmp_nr];

if (arg_which == PRIO_PROCESS && mp->mp_effuid !=
SUPER_USER && mp->mp_effuid != rmp->mp_effuid &&
mp->mp_effuid != rmp->mp_realuid)
return EPERM;

else if (mproc[rmp->mp_parent].mp_pid != mp->mp_pid) /* arg_which =
PRIO_CHILD */
{
printf("NOT YOUR CHILD!\n\n");
return EPERM;
}

/* rest of function as is */
}
....
/* end misc.c*/

Now, I wanted to test this system call with the following programm:

/* test.c */
#include
#include
#include
#include
void main(void)
{
pid_t pid;
if (pid = fork() != 0)
setpriority(PRIO_CHILD, pid, 1));
else
while(1);
}
/* end test.c */

When I execute this, I always get the error: "NOT YOUR CHILD" as in
do_getsetpriority.
Whats my problem here??

Thanx,

Martin