uprintf Kernel Service

Purpose

Submits a request to print a message to the controlling terminal of a process.

Syntax

#include <sys/uprintf.h>

int uprintf ( Format [,
Value, ...])
char *Format;

Parameters

Item Description
Format Specifies a character string containing either or both of two types of objects:
  • Plain characters, which are copied to the message output stream.
  • Conversion specifications, each of which causes 0 or more items to be retrieved from the Value parameter list. Each conversion specification consists of a % (percent sign) followed by a character that indicates the type of conversion to be applied:
    %
    Performs no conversion. Prints %.
    d, i
    Accepts an integer Value and converts it to signed decimal notation.
    u
    Accepts an integer Value and converts it to unsigned decimal notation.
    o
    Accepts an integer Value and converts it to unsigned octal notation.
    x
    Accepts an integer Value and converts it to unsigned hexadecimal notation.
    s
    Accepts a Value as a string (character pointer), and characters from the string are printed until a \ 0 (null character) is encountered. Value must be non-null and the maximum length of the string is limited to UP_MAXSTR characters.
    Field width or precision conversion specifications are not supported.

    The following constants are defined in the /usr/include/sys/uprintf.h file:

    • UP_MAXSTR
    • UP_MAXARGS
    • UP_MAXCAT
    • UP_MAXMSG

    The Format string may contain from 0 to the number of conversion specifications specified by the UP_MAXARGS constant. The maximum length of the Format string is the number of characters specified by the UP_MAXSTR constant. Format must be non-null.

    The maximum length of the constructed kernel message is limited to the number of characters specified by the UP_MAXMSG constant. Messages larger then the number of characters specified by the UP_MAXMSG constant are discarded.

Value Specifies, as an array, the value to be converted. The number, type, and order of items in the Value parameter list should match the conversion specifications within the Format string.

Description

The uprintf kernel service submits a kernel message request. Once the request has been successfully submitted, the uprintfd daemon constructs the message based on the Format and Value parameters of the request. The uprintfd daemon then writes the message to the process' controlling terminal.

Execution Environment

The uprintf kernel service can be called from the process environment only.

Return Values

Item Description
0 Indicates a successful operation.
ENOMEM Indicates that memory is not available to buffer the request.
ENODEV Indicates that a controlling terminal does not exist for the process.
ESRCH Indicates that the uprintfd daemon is not active. No requests may be submitted.
EINVAL Indicates that a string Value string pointer is null or the string Value parameter is greater than the number of characters specified by the UP_MAXSTR constant.
EINVAL Indicates one of the following:
  • Format string pointer is null.
  • Number of characters in the Format string is greater than the number specified by the UP_MAXSTR constant.
  • Number of conversion specifications contained within the Format string is greater than the number specified by the UP_MAXARGS constant.