adi_blksz(2) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

adi_blksz(2)

adi(2)                           System Calls                           adi(2)



NAME
       adi,   adi_set_enabled,  adi_get_enabled,  adi_blksz,  adi_version_max,
       adi_version_nbits - Application Data Integrity operations

SYNOPSIS
       #include <adi.h>

       int adi_set_enabled(int arg);

       int adi_get_enabled(void);

       int adi_blksz(void);

       int adi_version_max(void);

       int adi_version_nbits(void);

DESCRIPTION
       Applications can use the functions described in this  section  to  dis‐
       able,  enable,  or  query  the  per-thread  state  of  Application Data
       Integrity (ADI), and to determine the system constants used to  provide
       the  ADI feature. See the adi(7) man page for additional information on
       the ADI feature.


       The adi_set_enabled() function sets the state of ADI  for  the  calling
       thread.  The  value  of arg can be either ADI_DISABLE or ADI_ENABLE, to
       disable or enable ADI respectively.


       The adi_get_enabled() function returns the current state of ADI for the
       calling thread.


       The adi_blksz() function returns the granularity of ADI versioning sup‐
       ported by the platform. granularity can be used to determine the  opti‐
       mal  alignment  for  the  address  and size arguments, when calling the
       adi_clr_version(3C), adi_set_version(3C), or adi_memset(3C) functions.


       The adi_version_max() function returns the maximum value an application
       may use for an ADI version tag. This value can be used to determine the
       maximum value for the version argument when  calling  the  adi_set_ver‐
       sion(3C) or adi_memset(3C) functions.


       The  adi_version_nbits()  function returns the number of bits used in a
       64-bit virtual address to represent an ADI version  tag.  To  create  a
       versioned address, set the upper nbits in an address to the version. To
       normalize a versioned address, clear the upper  nbits  and  sign-extend
       the highest non-versioned bit as shown in the "Examples" section.

RETURN VALUES
       The  adi_set_enabled()  function  returns the previous state of ADI for
       the calling thread. On error, this function returns -1 and sets errno.


       The adi_get_enabled() function returns the current state of ADI for the
       calling thread. On error, this function returns -1 and sets errno.


       The adi_blksz() function returns the granularity of ADI versioning sup‐
       ported by the platform in bytes. On error, this function returns -1 and
       sets errno.


       The adi_version_max() function returns the maximum value an application
       may use for an ADI version tag. On error, this function returns -1  and
       sets errno.


       The  adi_version_nbits()  function returns the number of bits used in a
       64-bit virtual address to represent an ADI version tag. On error,  this
       function returns -1 and sets errno.

ERRORS
       All adi(2) family functions will fail if:


       ENOTSUP
                      o      ADI is not supported by the platform.


                      o      ADI is not supported for 32-bit processes.





       The adi_set_enabled() function will fail if:


       EINVAL    The argument is invalid.



EXAMPLES
       Example 1 Normalizing a Versioned Address



       The  following  example shows how you can normalize a versioned address
       by clearing the upper nbits and  sign-extending  the  highest  non-ver‐
       sioned bit:



         #include <sys/types.h>
         #include <adi.h>

         void adi_function(caddr_t addr, int version)
         {
                int nbits = adi_version_nbits();
                int shift = 64 - nbits;
                caddr_t versioned_addr;
                caddr_t normal_addr;

                /*
                 * Create a versioned address.
                 */
                versioned_addr = (caddr_t) ((version << shift) |
                    ((((unsigned long)addr) << nbits) >> nbits));

                /*
                 * Extract the version from a versioned address.
                 */
                version = ((unsigned long)versioned_addr) >> shift;

                /*
                 * Remove the version and normalize an address.
                 */
                normal_addr = (caddr_t) (((((long)versioned_addr) << nbits) >> nbits));
         }



ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ Interface StabilityVolatile _ MT-LevelMT-Safe


SEE ALSO
       adi(3C), adi(7), attributes(7), standards(7)



Oracle Solaris 11.4               2 Feb 2019                            adi(2)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3