wlm_set_tag Subroutine

Purpose

Sets the current process's tag and related flags.

Library

Workload Manager Library (libwlm.a)

Syntax

#include <sys/wlm.h>

#include <sys/user.h>

int wlm_set_tag ( tag,  flags)

char *tag;

int *flags;

Description

The tag attribute is an attribute of a process that can be set using the Workload Manager (WLM) wlm_set_tag subroutine. This tag is a character string with a maximum length of WLM_TAG_LENGTH (not including the null terminator). Process tags can be displayed using the ps command.

The tag attribute is also one of the process attributes used in the assignment rules to automatically assign a process to a given class. The syntax of the assignment rules precludes the use of special characters in the application tag string. Thus, application tags should be comprised only of upper and lower case letters, numbers and underscores ('_').

The main use of the tag attribute is to allow WLM administrators to discriminate between several instances of the same application, which typically have the same user and group ids, execute the same binary, and, therefore, end up in the same class using the standard classification criteria.

For more details about application tags, refer to Workload Manager application programming interface in AIX® Version 7.1 Operating system and device management.

When an application sets its tag using wlm_set_tag, it is automatically reclassified according to the current assignment rules and the new tag is taken into account when doing this reclassification.

In addition to the tag itself, the application can also specify flags indicating to WLM if a child process should inherit the tag from its parent after a fork or an exec subroutine.

A process does not require any special privileges to set its tag.

Parameters

Item Description
tag Specifies the address of a character string. An error is returned if this tag is too long.
flags Specifies the address of an integer interpreted in a manner similar to the versflags field of the wlmargs structure passed to other API routines. The integer pointed to by flags should be initialized with WLM_VERSION. In addition, one or more of the following values can be or'ed to WLM_VERSION:
SWLMTAGINHERITFORK
Specifies that the children of this process inherit the parent's tag on the fork subroutine.
SWLMTAGINHERITEXEC
Specifies that the process retains its tag after a call to the exec subroutine.

Both flags can be set to specify that the children of a tagged process inherits the tag on the fork subroutine and then retains it on the exec subroutine.

Return Values

Upon successful completion, the wlm_set_tag subroutine returns a value of 0. In case of error, a non-0 value is returned.

Error Codes

For a list of the possible error codes returned by the WLM API functions, see the description of the wlm.h header file.