JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 3: Extended Library Functions, Volume 3     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Extended Library Functions, Volume 3

endprojent(3PROJECT)

Exacct(3PERL)

Exacct::Catalog(3PERL)

Exacct::File(3PERL)

Exacct::Object(3PERL)

Exacct::Object::Group(3PERL)

Exacct::Object::Item(3PERL)

fgetprojent(3PROJECT)

getdefaultproj(3PROJECT)

getprojbyid(3PROJECT)

getprojbyname(3PROJECT)

getprojent(3PROJECT)

getprojidbyname(3PROJECT)

inproj(3PROJECT)

Kstat(3PERL)

Lgrp(3PERL)

libpicl(3PICL)

libpicltree(3PICLTREE)

nv_alloc_fini(3NVPAIR)

nv_alloc_init(3NVPAIR)

nv_alloc_reset(3NVPAIR)

nvlist_add_boolean(3NVPAIR)

nvlist_add_boolean_array(3NVPAIR)

nvlist_add_boolean_value(3NVPAIR)

nvlist_add_byte(3NVPAIR)

nvlist_add_byte_array(3NVPAIR)

nvlist_add_double(3NVPAIR)

nvlist_add_int16(3NVPAIR)

nvlist_add_int16_array(3NVPAIR)

nvlist_add_int32(3NVPAIR)

nvlist_add_int32_array(3NVPAIR)

nvlist_add_int64(3NVPAIR)

nvlist_add_int64_array(3NVPAIR)

nvlist_add_int8(3NVPAIR)

nvlist_add_int8_array(3NVPAIR)

nvlist_add_nvlist(3NVPAIR)

nvlist_add_nvlist_array(3NVPAIR)

nvlist_add_nvpair(3NVPAIR)

nvlist_add_string(3NVPAIR)

nvlist_add_string_array(3NVPAIR)

nvlist_add_uint16(3NVPAIR)

nvlist_add_uint16_array(3NVPAIR)

nvlist_add_uint32(3NVPAIR)

nvlist_add_uint32_array(3NVPAIR)

nvlist_add_uint64(3NVPAIR)

nvlist_add_uint64_array(3NVPAIR)

nvlist_add_uint8(3NVPAIR)

nvlist_add_uint8_array(3NVPAIR)

nvlist_alloc(3NVPAIR)

nvlist_dup(3NVPAIR)

nvlist_exists(3NVPAIR)

nvlist_flag(3NVPAIR)

nvlist_free(3NVPAIR)

nvlist_lookup_boolean(3NVPAIR)

nvlist_lookup_boolean_array(3NVPAIR)

nvlist_lookup_boolean_value(3NVPAIR)

nvlist_lookup_byte(3NVPAIR)

nvlist_lookup_byte_array(3NVPAIR)

nvlist_lookup_double(3NVPAIR)

nvlist_lookup_int16(3NVPAIR)

nvlist_lookup_int16_array(3NVPAIR)

nvlist_lookup_int32(3NVPAIR)

nvlist_lookup_int32_array(3NVPAIR)

nvlist_lookup_int64(3NVPAIR)

nvlist_lookup_int64_array(3NVPAIR)

nvlist_lookup_int8(3NVPAIR)

nvlist_lookup_int8_array(3NVPAIR)

nvlist_lookup_nv_alloc(3NVPAIR)

nvlist_lookup_nvlist(3NVPAIR)

nvlist_lookup_nvlist_array(3NVPAIR)

nvlist_lookup_nvpair(3NVPAIR)

nvlist_lookup_pairs(3NVPAIR)

nvlist_lookup_string(3NVPAIR)

nvlist_lookup_string_array(3NVPAIR)

nvlist_lookup_uint16(3NVPAIR)

nvlist_lookup_uint16_array(3NVPAIR)

nvlist_lookup_uint32(3NVPAIR)

nvlist_lookup_uint32_array(3NVPAIR)

nvlist_lookup_uint64(3NVPAIR)

nvlist_lookup_uint64_array(3NVPAIR)

nvlist_lookup_uint8(3NVPAIR)

nvlist_lookup_uint8_array(3NVPAIR)

nvlist_merge(3NVPAIR)

nvlist_next_nvpair(3NVPAIR)

nvlist_pack(3NVPAIR)

nvlist_remove(3NVPAIR)

nvlist_remove_all(3NVPAIR)

nvlist_size(3NVPAIR)

nvlist_unpack(3NVPAIR)

nvlist_xalloc(3NVPAIR)

nvlist_xdup(3NVPAIR)

nvlist_xpack(3NVPAIR)

nvlist_xunpack(3NVPAIR)

nvpair_name(3NVPAIR)

nvpair_type(3NVPAIR)

nvpair_value_boolean_array(3NVPAIR)

nvpair_value_boolean_value(3NVPAIR)

nvpair_value_byte(3NVPAIR)

nvpair_value_byte_array(3NVPAIR)

nvpair_value_double(3NVPAIR)

nvpair_value_int16(3NVPAIR)

nvpair_value_int16_array(3NVPAIR)

nvpair_value_int32(3NVPAIR)

nvpair_value_int32_array(3NVPAIR)

nvpair_value_int64(3NVPAIR)

nvpair_value_int64_array(3NVPAIR)

nvpair_value_int8(3NVPAIR)

nvpair_value_int8_array(3NVPAIR)

nvpair_value_nvlist(3NVPAIR)

nvpair_value_nvlist_array(3NVPAIR)

nvpair_value_string(3NVPAIR)

nvpair_value_string_array(3NVPAIR)

nvpair_value_uint16(3NVPAIR)

nvpair_value_uint16_array(3NVPAIR)

nvpair_value_uint32(3NVPAIR)

nvpair_value_uint32_array(3NVPAIR)

nvpair_value_uint64(3NVPAIR)

nvpair_value_uint64_array(3NVPAIR)

nvpair_value_uint8(3NVPAIR)

nvpair_value_uint8_array(3NVPAIR)

pam(3PAM)

pam_acct_mgmt(3PAM)

pam_authenticate(3PAM)

pam_chauthtok(3PAM)

pam_close_session(3PAM)

pam_end(3PAM)

pam_eval(3PAM)

pam_get_data(3PAM)

pam_getenv(3PAM)

pam_getenvlist(3PAM)

pam_get_item(3PAM)

pam_get_user(3PAM)

pam_open_session(3PAM)

pam_putenv(3PAM)

pam_setcred(3PAM)

pam_set_data(3PAM)

pam_set_item(3PAM)

pam_sm(3PAM)

pam_sm_acct_mgmt(3PAM)

pam_sm_authenticate(3PAM)

pam_sm_chauthtok(3PAM)

pam_sm_close_session(3PAM)

pam_sm_open_session(3PAM)

pam_sm_setcred(3PAM)

pam_start(3PAM)

pam_strerror(3PAM)

papiAttributeListAddBoolean(3PAPI)

papiAttributeListAddCollection(3PAPI)

papiAttributeListAddDatetime(3PAPI)

papiAttributeListAddInteger(3PAPI)

papiAttributeListAddMetadata(3PAPI)

papiAttributeListAddRange(3PAPI)

papiAttributeListAddResolution(3PAPI)

papiAttributeListAddString(3PAPI)

papiAttributeListAddValue(3PAPI)

papiAttributeListDelete(3PAPI)

papiAttributeListFind(3PAPI)

papiAttributeListFree(3PAPI)

papiAttributeListFromString(3PAPI)

papiAttributeListGetBoolean(3PAPI)

papiAttributeListGetCollection(3PAPI)

papiAttributeListGetDatetime(3PAPI)

papiAttributeListGetInteger(3PAPI)

papiAttributeListGetMetadata(3PAPI)

papiAttributeListGetNext(3PAPI)

papiAttributeListGetRange(3PAPI)

papiAttributeListGetResolution(3PAPI)

papiAttributeListGetString(3PAPI)

papiAttributeListGetValue(3PAPI)

papiAttributeListToString(3PAPI)

papiJobCancel(3PAPI)

papiJobFree(3PAPI)

papiJobGetAttributeList(3PAPI)

papiJobGetId(3PAPI)

papiJobGetJobTicket(3PAPI)

papiJobGetPrinterName(3PAPI)

papiJobHold(3PAPI)

papiJobListFree(3PAPI)

papiJobModify(3PAPI)

papiJobMove(3PAPI)

papiJobPromote(3PAPI)

papiJobQuery(3PAPI)

papiJobRelease(3PAPI)

papiJobRestart(3PAPI)

papiJobStreamClose(3PAPI)

papiJobStreamOpen(3PAPI)

papiJobStreamWrite(3PAPI)

papiJobSubmit(3PAPI)

papiJobSubmitByReference(3PAPI)

papiJobValidate(3PAPI)

papiLibrarySupportedCall(3PAPI)

papiLibrarySupportedCalls(3PAPI)

papiPrinterAdd(3PAPI)

papiPrinterDisable(3PAPI)

papiPrinterEnable(3PAPI)

papiPrinterFree(3PAPI)

papiPrinterGetAttributeList(3PAPI)

papiPrinterListFree(3PAPI)

papiPrinterListJobs(3PAPI)

papiPrinterModify(3PAPI)

papiPrinterPause(3PAPI)

papiPrinterPurgeJobs(3PAPI)

papiPrinterQuery(3PAPI)

papiPrinterRemove(3PAPI)

papiPrinterResume(3PAPI)

papiPrintersList(3PAPI)

papiServiceCreate(3PAPI)

papiServiceDestroy(3PAPI)

papiServiceGetAppData(3PAPI)

papiServiceGetAttributeList(3PAPI)

papiServiceGetEncryption(3PAPI)

papiServiceGetPassword(3PAPI)

papiServiceGetServiceName(3PAPI)

papiServiceGetStatusMessage(3PAPI)

papiServiceGetUserName(3PAPI)

papiServiceSetAppData(3PAPI)

papiServiceSetAuthCB(3PAPI)

papiServiceSetEncryption(3PAPI)

papiServiceSetPassword(3PAPI)

papiServiceSetUserName(3PAPI)

papiStatusString(3PAPI)

picld_log(3PICLTREE)

picld_plugin_register(3PICLTREE)

picl_find_node(3PICL)

picl_get_first_prop(3PICL)

picl_get_frutree_parent(3PICL)

picl_get_next_by_col(3PICL)

picl_get_next_by_row(3PICL)

picl_get_next_prop(3PICL)

picl_get_node_by_path(3PICL)

picl_get_prop_by_name(3PICL)

picl_get_propinfo(3PICL)

picl_get_propinfo_by_name(3PICL)

picl_get_propval(3PICL)

picl_get_propval_by_name(3PICL)

picl_get_root(3PICL)

picl_initialize(3PICL)

picl_set_propval(3PICL)

picl_set_propval_by_name(3PICL)

picl_shutdown(3PICL)

picl_strerror(3PICL)

picl_wait(3PICL)

picl_walk_tree_by_class(3PICL)

pool_associate(3POOL)

pool_component_info(3POOL)

pool_component_to_elem(3POOL)

pool_conf_alloc(3POOL)

pool_conf_close(3POOL)

pool_conf_commit(3POOL)

pool_conf_export(3POOL)

pool_conf_free(3POOL)

pool_conf_info(3POOL)

pool_conf_location(3POOL)

pool_conf_open(3POOL)

pool_conf_remove(3POOL)

pool_conf_rollback(3POOL)

pool_conf_status(3POOL)

pool_conf_to_elem(3POOL)

pool_conf_update(3POOL)

pool_conf_validate(3POOL)

pool_create(3POOL)

pool_destroy(3POOL)

pool_dissociate(3POOL)

pool_dynamic_location(3POOL)

pool_error(3POOL)

pool_get_binding(3POOL)

pool_get_owning_resource(3POOL)

pool_get_pool(3POOL)

pool_get_property(3POOL)

pool_get_resource(3POOL)

pool_get_resource_binding(3POOL)

pool_get_status(3POOL)

pool_info(3POOL)

pool_put_property(3POOL)

pool_query_components(3POOL)

pool_query_pool_resources(3POOL)

pool_query_pools(3POOL)

pool_query_resource_components(3POOL)

pool_query_resources(3POOL)

pool_resource_create(3POOL)

pool_resource_destroy(3POOL)

pool_resource_info(3POOL)

pool_resource_to_elem(3POOL)

pool_resource_transfer(3POOL)

pool_resource_type_list(3POOL)

pool_resource_xtransfer(3POOL)

pool_rm_property(3POOL)

pool_set_binding(3POOL)

pool_set_status(3POOL)

pool_static_location(3POOL)

pool_strerror(3POOL)

pool_to_elem(3POOL)

pool_value_alloc(3POOL)

pool_value_free(3POOL)

pool_value_get_bool(3POOL)

pool_value_get_double(3POOL)

pool_value_get_int64(3POOL)

pool_value_get_name(3POOL)

pool_value_get_string(3POOL)

pool_value_get_type(3POOL)

pool_value_get_uint64(3POOL)

pool_value_set_bool(3POOL)

pool_value_set_double(3POOL)

pool_value_set_int64(3POOL)

pool_value_set_name(3POOL)

pool_value_set_string(3POOL)

pool_value_set_uint64(3POOL)

pool_version(3POOL)

pool_walk_components(3POOL)

pool_walk_pools(3POOL)

pool_walk_properties(3POOL)

pool_walk_resources(3POOL)

Privilege(3PERL)

proc_service(3PROC)

Project(3PERL)

project_walk(3PROJECT)

ps_kill(3PROC)

ps_lcontinue(3PROC)

ps_lgetcxregs(3PROC)

ps_lgetcxregsize(3PROC)

ps_lgetfpregs(3PROC)

ps_lgetregs(3PROC)

ps_lgetxregs(3PROC)

ps_lgetxregsize(3PROC)

ps_lrolltoaddr(3PROC)

ps_lsetcxregs(3PROC)

ps_lsetfpregs(3PROC)

ps_lsetregs(3PROC)

ps_lsetxregs(3PROC)

ps_lstop(3PROC)

ps_pcontinue(3PROC)

ps_pdread(3PROC)

ps_pdwrite(3PROC)

ps_pglobal_lookup(3PROC)

ps_pglobal_sym(3PROC)

ps_pread(3PROC)

ps_pstop(3PROC)

ps_ptread(3PROC)

ps_ptwrite(3PROC)

ps_pwrite(3PROC)

ptree_add_node(3PICLTREE)

ptree_add_prop(3PICLTREE)

ptree_add_row_to_table(3PICLTREE)

ptree_create_and_add_node(3PICLTREE)

ptree_create_and_add_prop(3PICLTREE)

ptree_create_node(3PICLTREE)

ptree_create_prop(3PICLTREE)

ptree_create_table(3PICLTREE)

ptree_delete_node(3PICLTREE)

ptree_delete_prop(3PICLTREE)

ptree_destroy_node(3PICLTREE)

ptree_destroy_prop(3PICLTREE)

ptree_find_node(3PICLTREE)

ptree_get_first_prop(3PICLTREE)

ptree_get_frutree_parent(3PICLTREE)

ptree_get_next_by_col(3PICLTREE)

ptree_get_next_by_row(3PICLTREE)

ptree_get_next_prop(3PICLTREE)

ptree_get_node_by_path(3PICLTREE)

ptree_get_prop_by_name(3PICLTREE)

ptree_get_propinfo(3PICLTREE)

ptree_get_propinfo_by_name(3PICLTREE)

ptree_get_propval(3PICLTREE)

ptree_get_propval_by_name(3PICLTREE)

ptree_get_root(3PICLTREE)

ptree_init_propinfo(3PICLTREE)

ptree_post_event(3PICLTREE)

ptree_register_handler(3PICLTREE)

ptree_unregister_handler(3PICLTREE)

ptree_update_propval(3PICLTREE)

ptree_update_propval_by_name(3PICLTREE)

ptree_walk_tree_by_class(3PICLTREE)

reparse_add(3REPARSE)

reparse_create(3REPARSE)

reparse_delete(3REPARSE)

reparse_deref(3REPARSE)

reparse_free(3REPARSE)

reparse_init(3REPARSE)

reparse_parse(3REPARSE)

reparse_remove(3REPARSE)

reparse_unparse(3REPARSE)

reparse_validate(3REPARSE)

rp_plugin_init(3REPARSE)

setproject(3PROJECT)

setprojent(3PROJECT)

Task(3PERL)

Ucred(3PERL)

papiAttributeListAddValue

, papiAttributeListAddBoolean

, papiAttributeListAddCollection

, papiAttributeListAddDatetime

, papiAttributeListAddInteger

, papiAttributeListAddMetadata

, papiAttributeListAddRange

, papiAttributeListAddResolution

, papiAttributeListAddString

, papiAttributeListDelete

, papiAttributeListGetValue

, papiAttributeListGetNext

, papiAttributeListFind

, papiAttributeListGetBoolean

, papiAttributeListGetCollection

, papiAttributeListGetDatetime

, papiAttributeListGetInteger

, papiAttributeListGetMetadata

, papiAttributeListGetRange

, papiAttributeListGetResolution

, papiAttributeListGetString

, papiAttributeListFromString

, papiAttributeListToString

, papiAttributeListFree

- manage PAPI attribute lists

Synopsis

cc [ flag… ] file-lpapi [ library… ] 
#include <papi.h>

papi_status_t papiAttributeListAddValue(papi_attribute_t ***attrs,
     int flags, char *name, papi_attribute_value_type_t type,
     papi_attribute_value_t *value);
papi_status_t papiAttributeListAddString(papi_attribute_t ***attrs,
     int flags, char *name, char *string);
papi_status_t papiAttributeListAddInteger(papi_attribute_t ***attrs,
     int flags, char *name, int integer);
papi_status_t papiAttributeListAddBoolean(papi_attribute_t ***attrs,
     int flags, char *name, char boolean);
papi_status_t papiAttributeListAddRange(papi_attribute_t ***attrs,
     int flags, char *name, int lower, int upper);
papi_status_t papiAttributeListAddResolution(papi_attribute_t ***attrs,
     int flags, char *name, int xres, int yres,
     papi_resolution_unit_t units);
papi_status_t papiAttributeListAddDatetime(papi_attribute_t ***attrs,
     int flags, char *name, time_t datetime);
papi_status_t papiAttributeListAddCollection(papi_attribute_t ***attrs,
     int flags, char *name, papi_attribute_t **collection);
papi_status_t papiAttributeListAddMetadata(papi_attribute_t ***attrs,
     int flags, char *name, papi_metadata_t metadata);
papi_status_t papiAttributeListDelete(papi_attribute_t ***attributes,
     char *name);
papi_status_t papiAttributeListGetValue(papi_attribute_t **list,
     void **iterator, char *name, papi_attribute_value_type_t type,
     papi_attribute_value_t **value);
papi_status_t papiAttributeListGetString(papi_attribute_t **list,
     void **iterator, char *name, char **vptr);
papi_status_t papiAttributeListGetInteger(papi_attribute_t **list,
     void **iterator, char *name, int *vptr);
papi_status_t papiAttributeListGetBoolean(papi_attribute_t **list,
     void **iterator, char *name, char *vptr);
papi_status_t papiAttributeListGetRange(papi_attribute_t **list,
     void **iterator, char *name, int *min, int *max);
papi_status_t papiAttributeListGetResolution(papi_attribute_t **list,
     void **iterator, char *name, int *x, int *y,
     papi_resolution_unit_t *units);
papi_status_t papiAttributeListGetDatetime(papi_attribute_t **list,
     void **iterator, char *name, time_t *dt);
papi_status_t papiAttributeListGetCollection(papi_attribute_t **list,
     void **iterator, char *name, papi_attribute_t ***collection);
papi_status_t papiAttributeListGetMetadata(papi_attribute_t **list,
     void **iterator, char *name, papi_metadata_t *vptr);
papi_attribute_t *papiAttributeListFind(papi_attribute_t **list,
     char *name);
papi_attribute_t *papiAttributeListGetNext(papi_attribute_t **list,
     void **iterator);
void papiAttributeListFree(papi_attribute_t **attributes);
papi_status_t papiAttributeListFromString(papi_attribute_t ***attrs,
     int flags, char *string);
papi_status_t papiAttributeListToString(papi_attribute_t **attrs,
     char *delim, char *buffer, size_t buflen);

Parameters

attrs

address of array of pointers to attributes

attributes

a list of attributes (of type papi_attribute_t **) contained in a collection. Lists can be hierarchical.

boolean

boolean value (PAPI_TRUE or PAPI_FALSE)

buffer

buffer to fill

buflen

length of supplied buffer

collection

list of attributes

datetime

attribute time value specified in time_t representation

delim

delimiter used in construction of a string representation of an attribute list

dt

date and time represented as a time_t

flags

Specify bit fields defining how actions will be performed:

PAPI_ATTR_REPLACE

Free any existing value(s) and replace it with the supplied value(s).

PAPI_ATTR_APPEND

Add the supplied value to the attribute.

PAPI_ATTR_EXCL

Add the supplied value to the attribute, if the attribute was not previously defined.

integer

integer value

iterator

iterator for enumerating multiple values of multi-value attributes

list

array of pointers to attributes (attribute list)

lower

lower bound for a range of integer

max

maximum value in a range

metadata

pseudo-values for specialized attributes PAPI_UNSUPPORTED, PAPI_DEFAULT, PAPI_UNKNOWN, PAPI_NO_VALUE, PAPI_NOT_SETTABLE, PAPI_DELETE

min

minimum value in a range

name

attribute name

string

string value

type

attribute type (PAPI_STRING, PAPI_INTEGER, PAPI_BOOLEAN, PAPI_RANGE, PAPI_RESOLUTION, PAPI_DATETIME, PAPI_COLLECTION, PAPI_METADATA)

units

resolution unit of measure (PAPI_RES_PER_INCH or PAPI_RES_PER_CM)

upper

upper bound for a range of integer

value

attribute value

vptr

pointer to arbitrary data

x

horizontal (x) resolution

xres

horizontal (x) component of a resolution

y

vertical (y) resolution

yres

vertical (y) component of a resolution

Description

The papiAttributeListAdd*() functions add new attributes and/or values to the attribute list passed in. If necessary, the attribute list passed in is expanded to contain a new attribute pointer for any new attributes added to the list. The list is null-terminated. Space for the new attributes and values is allocated and the name and value are copied into this allocated space.

If PAPI_ATTR_REPLACE is specified in flags, any existing attribute values are freed and replaced with the supplied value.

If PAPI_ATTR_APPEND is specified, the supplied value is appended to the attribute's list of values.

If PAPI_ATTR_EXCL is specified, the operation succeeds only if the attribute was not previously defined.

The papiAttributeListGet*() functions retrieve an attribute value from an attribute list. If the attribute is a multi-valued attribute, the first call to retrieve a value should pass in an iterator and attribute name. Subsequent calls to retrieve additional values should pass in the iterator and a null value for the attribute name. If a single-valued attribute is to be retrieved, NULL can be used in place of the iterator.

Upon successful completion of a get operation, the value passed in (string, integer, boolean, ...) is changed to the value from the attribute list. If the operation fails for any reason (type mismatch, not found, ...), the value passed in remains untouched.

The resulting value returned from a get operation is returned from the attribute list's allocated memory. It is not guaranteed to be available after the attribute list has been freed.

The papiAttributeListDelete() function removes an attribute from a supplied list.

The papiAttributeListFind() function allows an application to retrieve an entire attribute structure from the passed-in attribute list.

The papiAttributeListGetNext() function allows an application to walk through an attribute list returning subsequent attributes from the list. With the first call, the iterator should be initialized to NULL and subsequent calls should use NULL for the list argument.

The papiAttributeListFree() function deallocates all memory associated with an attribute list, including values that might have been retrieved previously using papiAttributeListGet*() calls.

The papiAttributeListFromString() function takes in a string representation of a set of attributes, parses the string and adds the attributes to the passed in attribute list using the flags to determine how to add them. String values are specified with “key=value”. Integer values are specified with “key=number”. Boolean values are specified with either “key=(true|false)” or “[no]key”. Multiple attributes can be specified in the string by separating them with a whitespace character.

The papiAttributeListToString() function converts an attribute list to a string representation that can be displayed to a user. The delimiter value is placed between attributes in the string.

Return Values

These functions return PAPI_OK upon successful completion and one of the following on failure:

PAPI_BAD_ARGUMENT

The supplied arguments were not valid.

PAPI_CONFLICT

There was an attribute type mismatch.

PAPI_NOT_FOUND

The requested attribute could not be found.

PAPI_NOT_POSSIBLE

The requested operation could not be performed due to buffer overflow.

PAPI_TEMPORARY_ERROR

Memory could not be allocated to add to the attribute list.

Examples

Example 1 The following example manipulates a PAPI attribute list.

/*
 * program to manipulate a PAPI attribute list
 */
#include <stdio.h>
#include <papi.h>

/*ARGSUSED*/
int
main(int ac, char *av[])
{
    char buf[BUFSIZ];
    papi_status_t status;
    papi_attribute_t **list = NULL;
    void *iter = NULL;
    char *string = NULL;
    int32_t integer = 0;

    /* build an attribute list */
    (void) papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
                                "job-title", "example");
    (void) papiAttributeListAddInteger(&list, PAPI_ATTR_EXCL,
                                "copies", 1);
    (void) papiAttributeListFromString(&list, PAPI_ATTR_REPLACE, av[1]);
    status = papiAttributeListAddString(&list, PAPI_ATTR_EXCL,
                                "document-format", "text/plain");
    if (status != PAPI_OK)
        printf("failed to set document-format to text/plain: %s\n",
               papiStatusString(status));

    /* dump the list */
    status = papiAttributeListToString(list, "\n\t", buf, sizeof (buf));
    if (status == PAPI_OK)
        printf("Attributes: %s\n", buf);
    else
        printf("Attribute list to big to dump\n");


    /* retreive various elements */
    integer = 12;
    (void) papiAttributeListGetInteger(list, NULL, "copies", &integer);
    printf("copies: %d\n", integer);

    string = NULL;
    for (status = papiAttributeListGetString(list, &oter,
                                            "job-files", &string);
         status == PAPI_OK;
         status = papiAttributeListGetString(list, &iter, NULL, &string))
        printf("file: %s\n", string);

    papiAttributeListFree(list);
}

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Volatile
MT-Level
Safe

See Also

libpapi(3LIB), attributes(5)