Trusted Solaris Developer's Guide

Copying and Duplicating Attribute Structures

The TSIX library provides routines for copying and duplicating an attribute structure. They both do the same thing using different parameter lists. Use the one that meets your application requirements. This example shows the two ways to copy the security attributes in sendattrs to recvattrs.

#include <tsix/t6attrs.h>
#include <tsol/label.h>

main()
{
	size_t size;
	t6attr_t sendattrs, recvattrs;
	t6mask_t sendmask, recvmask;

	recvmask = T6M_SL;
	recvattrs = t6alloc_blk(recvmask);
	sendmask = T6M_CLEARANCE;
	sendattrs = t6alloc_blk(sendmask);

/* Copy the attributes in sendattrs to recvattrs */
	t6copy_blk(sendattrs, recvattrs);

/* Duplicate the attributes in sendattrs to recvattrs */
	recvattrs = t6dup_blk(sendattrs);
}