*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> add_proplist_entry (3)              
Title
Content
Arch
Section
 

add_proplist_entry(3)

Contents


NAME    [Toc]    [Back]

       add_proplist_entry  -  adds  an Extended File Attribute to
       the Extended File Attribute buffer

SYNOPSIS    [Toc]    [Back]

       #include <sys/proplist.h>

       int add_proplist_entry(
               char *name,
               int flags,
               int value_size,
               char *value,
               char **bufptr );

PARAMETERS    [Toc]    [Back]

       Points to the Extended File Attribute name, a  null-terminated
  ASCII string.  Specifies system-wide attributes for
       Extended  File  Attribute   entries.   These   system-wide
       attributes  are  defined in sys/proplist.h.  Specifies the
       size in  bytes  of  the  Extended  File  Attribute  value.
       Points  to  the  value  of  the  Extended  File Attribute.
       Points to the Extended File Attribute buffer.

DESCRIPTION    [Toc]    [Back]

       The add_proplist_entry() function initializes an  Extended
       File  Attribute  buffer,  pointed to by **bufptr, with the
       Extended File Attribute specified by the *name and  *value
       parameters.  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).

       Although not a requirement, it is recommended that you use
       the   sizeof_proplist_entry(3)  and  add_proplist_entry(3)
       functions to initialize the Extended File Attribute buffer
       passed to setproplist(3) and fsetproplist(3).

RETURN VALUES    [Toc]    [Back]

       If  successful,  the  function returns the number of bytes
       copied into the Extended File Attribute buffer.

EXAMPLES    [Toc]    [Back]

       #include <sys/proplist.h> main() { char *ptr, *buf, *name,
       *value;    int     *value_len,    *options,   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);

       /*
        * Call add_proplist_entry to initialize the buffer with
        * the first name and value pair.
        */   ret   =  add_proplist_entry("primary_name",  0,  18,
                       "Primary Name Value", &ptr); /*
        * Call add_proplist_entry to initialize the buffer with
        * the second name and value pair.
        */ ret  +=  add_proplist_entry("secondary_name",  0,  13,
                          "Another  Value",  &ptr);  if  (ret  !=
       buffer_size) {      printf("ret %d  !=  buffer_size  %d0",
       ret,     buffer_size);          free(buf,    buffer_size);
            exit(1); }

       /*
        * Buffer now contains both name  and  value  pairs.  Call
       setproplist
        *  system call to actually associate name and value pairs
       to
        * file.
        */ nbytes = setproplist("/tmp/foo", 1, buffer_size, buf);
               if (nbytes < 0 || nbytes != buffer_size) {
                       perror("setproplist");
                       free(buf);
                       exit(1);
               }

SEE ALSO    [Toc]    [Back]

      
      
       Functions:   delproplist(3),   fdelproplist(3),   fgetproplist(3), fsetproplist(3), get_proplist_entry(3),  getproplist(3), setproplist(3), sizeof_proplist_entry(3)

       Files: proplist(4)



                                            add_proplist_entry(3)
[ Back ]
 Similar pages
Name OS Title
get_proplist_entry Tru64 initializes pointers to the corresponding entries in an Extended File Attribute buffer
sizeof_proplist_entry Tru64 determines space necessary to store an Extended File Attribute
setextattr OpenBSD set a named extended attribute
cdxar Tru64 Read the Extended Attribute Record from a CD-ROM
getextattr OpenBSD retrieve a named extended attribute
VOP_SETEXTATTR FreeBSD set named extended attribute for a vnode
cd_cxar Tru64 reads the Extended Attribute Record for
cd_xar Tru64 reads the Extended Attribute Record for
VOP_GETEXTATTR FreeBSD retrieve named extended attribute from a vnode
VOP_LISTEXTATTR FreeBSD retrieve a list of named extended attribute from a vnode
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service