---
name: "pvm_settmask"
section: "3"
platform: "linux"
package: "pvm-dev"
version: "3.4.2-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/pvm_settmask"
---

# pvm\_settmask(3)

Get or set trace mask of a task or its children.

## NAME

pvm\_gettmask, pvm\_settmask - Get or set trace mask of a task or its children.

## SYNOPSIS

```
C	#include <pvm3.h>
	#include <pvmtev.h>
	int info = pvm_gettmask( int who, Pvmtmask mask )
	int info = pvm_settmask( int who, Pvmtmask mask )
Fortran	Not Available
```

## PARAMETERS

- who

  **Specifies which trace mask to get or set:**

  ```
  	PvmTaskSelf	The current task
  	PvmTaskChild	Children tasks to be spawned
  ```

- mask

  **Trace mask (owned by caller),** **which is filled in with the current trace vector on calling pvm\_gettmask** **or used to set the current trace vector on calling pvm\_settmask.**\

- info

  **Status code returned.** **Values less than zero indicate an error.**

## DESCRIPTION

**Each task has a trace mask,** **which can be used to individually enable tracing of each** *libpvm* function. The mask is inherited from its parent task (or initially all cleared if the task has no parent). When calls are made to functions in libpvm, the parameters and results are sent in messages to the *trace sink* of the task (variable *PvmTraceTid* set by calling *pvm\_setopt* - see man page).

The PVM console and XPVM use this system to get trace data from application programs.

A task can get or set either its own trace mask, or the mask passed to children it spawns. Note the mask must be set before the spawn call; setting the child trace mask has no effect on already-running children.

The trace mask can be kept in a temporary variable, declared as:

	Pvmtmask mymask;

Right now, this is a character array with approximately 80 bits.

There are four macros defined to manipulate trace masks. Along with the functions, these allow a program to get the current trace mask, modify or save it, and put it back:

```
	TEV_INIT_MASK(mask)
	TEV_SET_MASK(mask, kind)
	TEV_UNSET_MASK(mask, kind)
	TEV_CHECK_MASK(mask, kind)
```

TEV\_INIT\_MASK initializes a mask to all bits cleared and must be used to initialize a trace mask (unless that is done by setting it from pvm\_gettmask). TEV\_SET\_MASK sets a bit in a mask. Bit values are defined in \<pvmtev.h\>. Likewise, TEV\_UNSET\_MASK clears a single bit and TEV\_CHECK\_MASK checks to see if a bit is set, returning nonzero if true.

Note: Most events in the trace mask come in pairs, the first (ending in ...0) is generated on entry to a function and the second (...1) on exit. The trace mask has only half as many bits as there are events; events are enabled in pairs. In other words, if you select TEV\_SEND0, you'll also get TEV\_SEND1.

The trace mask is deliberately kept as a printable (and null-terminated) string, for two reasons. First, it is passed through the environment between tasks, in the form:

	PVMTMASK=@@AAOG@@NO@L@@@@@@@@

so the pvmd doesn't have to explicitly manage it. Second, the mask variables can be passed between tasks using pvm\_pkstr() or otherwise manipulated as strings.

pvm\_gettmask and pvm\_settmask return PvmOk on success, else a negative value.

## EXAMPLES

```
C:
	#include <pvm3.h>
	#include <pvmtev.h>
	Pvmtmask m;
	pvm_gettmask( PvmTaskChild, m );
	TEV_SET_MASK(m, TEV_ADDHOSTS0 );
	pvm_settmask( PvmTaskChild, m );
	pvm_spawn( "worker", (char **)0, PvmTaskDefault, "", 1, (int *)0);
```

## ERRORS

The following error condition can be returned by pvm\_gettmask or pvm\_settmask:

- PvmBadParam

  invalid value for *who* argument.

## SEE ALSO

pvm(1PVM), pvm\_getopt(3PVM), pvm\_setopt(3PVM)
