Index Index for
Section 3
Index Alphabetical
listing for G
Bottom of page Bottom of
page

get_proplist_entry(3)

NAME

get_proplist_entry - initializes pointers to the corresponding entries in an Extended File Attribute buffer

SYNOPSIS

#include <sys/proplist.h> int get_proplist_entry( char **name, int **flags, int **value_size, char **value, char **bufptr );

PARAMETERS

**name Points to the Extended File Attribute name. **flags Points to the system-wide file attributes for Extended File Attribute entries in the Property List. **value_size Points to the size in bytes of the Extended File Attribute value. **value Points to the Extended File Attribute value. **bufptr Points to the Extended File Attribute buffer.

DESCRIPTION

The get_proplist_entry() function initializes the **name, **value_size, and **value parameters with the corresponding values in the Extended File Attribute buffer pointed to by **bufptr. The function can be called repeatedly because it advances the Extended File Attribute buffer pointer **bufptr to the end of the current entry. An Extended File Attribute is a name and value pair that is contained in a variable-sized structure called a Property List. A Property List is part of a file's metadata and can contain abstract name and value pairs (Extended File Attributes) that can be set either by the operating system (for example, ACLs and privileges) or by a user-level application (for example, PC File Attributes). This function should be used to parse the Extended File Attribute buffer returned by the getproplist(3) function.

RETURN VALUES

If successful, the function returns the size of the current Extended File Attribute in the Property List.

EXAMPLES

#include <sys/proplist.h> main() { char *ptr, *buf, *name, *value; int *value_len, *flags, buffer_size, min_buffer_size, ret, nbytes; struct proplistname_args; static char *names[] = { "primary_name", "secondary_name", }; /* * How big a buffer do I need to store my name and value * pair in a property list ? */ buffer_size = sizeof_proplist_entry("primary_name", 18); buffer_size += sizeof_proplist_entry("secondary_name", 13); /* * Malloc the buffer */ buf = ptr = (char *)malloc(buffer_size); . . . again: /* * Call the system call to load buffer with property list * entries. */ ret = getproplist("/tmp/foo", &getargs, buffer_size, buf, &min_buffer_size); if (ret < 0) { perror("getproplist"); free(buf); exit(1); } /* * If buffer_size is not sufficient to store the name and value * pairs, malloc a bigger buffer and try again. */ if (ret == 0 && min_buffer_size) { free(buf); buf = (char *)malloc(min_buffer_size); buffer_size = min_buffer_size; goto again; } /* * Buffer contains ret bytes of name and value pairs */ ptr = buf; while (ret > 0) { /* * Call getproplist_entry to initialize name and value * pointers to entries position within buffer. */ ret -= get_proplist_entry(&name, &flags, &value_len, &value, &ptr); printf("name %s value len %d value %s\n", name, *value_len, value); } . . .

SEE ALSO

Functions: add_proplist_entry(3), delproplist(3), fdelproplist(3), fgetproplist(3), fsetproplist(3), get_proplist_entry(3), getproplist(3), setproplist(3), sizeof_proplist_entry(3). Files: proplist(4), sys/proplist.h.

Index Index for
Section 3
Index Alphabetical
listing for G
Top of page Top of
page