You can create, modify, and delete objects and attributes, as shown in the following
table:
If you want to: |
Do this: |
Create a new object |
Create a file with the name of the object. The new object will come
into existence with no attributes. You can then write attributes to the
object, as required. |
Delete an object |
Delete the object file. |
Create a new attribute |
Write the attribute to the object file. |
Modify an attribute |
Write the new attribute value to the object file.
Note that there's no need to lseek() to the attribute's position
in the file first; seeking has no meaning in PPS.
|
Delete all existing attributes |
Open the object with O_TRUNC. |
Delete one attribute |
Prefix its name with a minus sign, then call write(). For
example:
// Delete the "url" attribute
sprintf( ppsobj, "-url\n" );
write( ppsobj-fd, ppsobj, strlen( ppsobj ) );
|
CAUTION:
Note the following about deleting attributes:
- Calling ftruncate() on an object file deletes all the object's
attributes, whatever the value of the length
argument.
- A simple Bourne shell redirection instruction (such as echo
attr::hello > /pps/object) entered from the command
line opens an object with O_TRUNC and deletes all
attributes.