next up previous contents index
Next: Manipulating User Specifications Up: The OSFriends Interface Previous: The OSFriends Interface

Manipulating the State of Existing Processes

 

 

PROCEDURE SetMyWD(
    dir: Dir;
    path: PathName := NIL;
    euser: User := NIL)
  RAISES {Error}; (* PathES *)

  SetMyWD changes the working directory of the calling process. Since this affects every thread in the process that calls OS with a NIL directory handle, it should be used with caution; OS.OpenDir is recommended instead. Use SetMyWD only in main programs and try not to write packages that depend on it being set to something special before being called. Using the working directory will make it difficult to make your package multithreaded.

 

PROCEDURE SetMyUMask(umask: AccessMode) RAISES {};

  SetMyUMask sets the umask of the calling process. The admonition against using SetMyWD applies also to SetMyUMask.

  

PROCEDURE SetMyUser(
    effective: User;
    real: User := NIL;
    pswd: Text.T := NIL)
  RAISES {Error};
  (* InvalidArgumentEC, InvalidCredentialsEC, NotSuperUserEC *)

        SetMyUser sets the real and effective user name and password of the calling process, as OS.SetUser does for a process template; see page [*] for details. Once again, the admonition against using SetMyWD applies. Instead, use the euser parameter accepted by each procedure that does access checking.

 

PROCEDURE GetPriority(pid: PID): ThreadFriends.Priority
  RAISES {Error};

        GetPriority returns the priority associated with the specified process. It returns the priority of the calling process if pid is equal to NullPID. For an Ultrix process this is the priority of its only thread. For a Topaz process this is the priority of the first thread in its address space when it was first started.

Ultrix note: Ultrix priorities less than zero maps to ThreadFriends.ForegroundPriority, Ultrix priority zero maps to ThreadFriends.NormalPriority, and Ultrix priorities greater than zero map to ThreadFriends.BackgroundPriority.

     

PROCEDURE SetPriorityPID(
    pid: PID;
    priority: ThreadFriends.Priority)
  RAISES {Error};

PROCEDURE SetPriorityPGRP(
    pgrp: PGRP;
    priority: ThreadFriends.Priority)
  RAISES {Error};

PROCEDURE SetPriorityUser(
    user: Text.T;
    priority: ThreadFriends.Priority)
  RAISES {Error};

  These procedures set the priority of the process with a specified process identifier (SetPriorityPID), of all the processes in a specified process group (SetPriorityPGRP), or of all the processes with a specified effective user name. They raise BadPIDEC if no process was found.

When the priority of a process is changed this way, the priority of every thread in the process is set to the specified value. Note that doing this to a Topaz process with carefully assigned individual thread priorities is usually inadvisable.


next up previous contents index
Next: Manipulating User Specifications Up: The OSFriends Interface Previous: The OSFriends Interface
Paul McJones
8/28/1997