WORD Psetpgrp(WORD pid, WORD newgrp)

Description:  attaches the calling process to a group of processes.

Opcode:  270  (0x010e)

Availability:  If the MiNT cookie is present.

Parameters:  
    pid is the PID of the process which group you want to change. If it is 0, you will change the group of the calling process.
    newgrp is the GID (Group ID) of the group to attach the process to. A negative value will inquire the current group ID the process currently belongs to. 


Binding:  
    move.w  newgrp,-(sp)
    move.w  pid,-(sp)
    move.w  #$010e,-(sp)
    trap    #1
    addq.l  #6,sp
Return value:  If the kernel finds out that the pid is plain fantasy, it will return ENOENT. To change a process's group, you must have root privileges, or be the
process itself, or be the process's parent. If you aren't any of these, the call will return EACCES.
Otherwize:
- if newgrp is negative, the call will return the current group ID to which the process is attached.
- if newgrp is null, the group of the process is reset to the PID of the process specified by pid.
- if newgrp is positive or null, the call returns the new group of the process.

Definition:
    It is possible to set up groups of processes, just like you have groups of users. For instance, when you have a shell and that you quit it, all the processes that where running in the shell are terminated. It is because they are set to belong to the shell's process group. The shell is then told to be the session leader. A common use is to use the PID of the session leader as group number. The default process group of a process is inherited from its parent. The kernel has a process group equal to 0. 
    Thank to process groups, you can broadcast signals to a number of related processes very easily. 


mailto: Panzano
HTTP:


See Also: Nothing


Thanks for your GEMTOS visit!!!

(C) 2000 Gemtos.free.fr. All rights reserved by the authors.