MyWebUniversity.com Home Page
 



OpenSolaris man pages main menu


Extended Library Functions                      tsalarmget(3EXT)



NAME
     tsalarmget, tsalarmset - get or set alarm relays

SYNOPSIS
     cc [ flag... ] file... -ltsalarm [ library... ]
     #include 

     int tsalarmget(uint32t alarmtype, uint32t *alarmstate);


     int tsalarmset(uint32t alarmtype, uint32t alarmstate);


PARAMETERS
     alarmtype

         The alarm type whose state is retrieved  or  set.  Valid
         settings are:

         TSALARMCRITICAL    critical


         TSALARMAJOR       major


         TSALARMINOR       minor


         TSALARMUSER        user



     alarmstate

         The state of the alarm. Valid settings are:

         TSALARMSTATEON         The alarm  state  needs  to  be
                                  changed to "on", or is returned
                                  as "on".


         TSALARMSTATEOF        The alarm  state  needs  to  be
                                  changed   to   "off",   or   is
                                  returned as "off".


         TSALARMSTATEUNKNOWN    The alarm state is returned  as
                                  unknown.







SunOS 5.11           Last change: 4 Sep 2007                    1






Extended Library Functions                      tsalarmget(3EXT)



DESCRIPTION
     The TSALARM interface provides functions through which alarm
     relays  can  be  controlled.  The  set of functions and data
     structures of this interface are defined in the  
     header.


     There are four alarm relays that  are  controlled  by  ILOM.
     Each  alarm  can  be  set  to "on" or "off" by using tsalarm
     interfaces provided from  the  host.  The  four  alarms  are
     labeled as critical, major, minor, and  user. The user alarm
     is set by a user application depending on system  condition.
     LEDs  in front of the box provide a visual indication of the
     four alarms. The number of alarms  and  their  meanings  and
     labels can vary across platforms.


     The tsalarmget() function gets the state of alarmtype  and
     returnsit   in  alarmstate.  If  successful,  the  function
     returns 0.


     The tsalarmset() function sets the state of  alarmtype  to
     the  value  in  alarmstate.  If  successful,  the  function
     returns 0.


     The following structures are defined in :

       typedef struct tsalarmreq {
            uint32t     alarmid;
            uint32t     alarmaction;
       } tsalarmreqt;


       typedef struct tsalarmresp {
            uint32t     status;
            uint32t     alarmid;
            uint32t     alarmstate;
       } tsalarmrespt;


RETURN VALUES
     The tsalarmget() and  tsalarmset()  functions  return  the
     following values:

     TSALARMCHANELINITFAILURE

         Channel initialization failed.






SunOS 5.11           Last change: 4 Sep 2007                    2






Extended Library Functions                      tsalarmget(3EXT)



     TSALARMCOMFAILURE

         Channel communication failed.


     TSALARMNULREQDATA

         Allocating memory for request data failed.


     TSALARMSUCES

         Successful completion.


     TSALARMUNBOUNDPACKETRECVD

         An incorrect packet was received.



     The tsalarmget() function returns the following value:

     TSALARMGETEROR    An error occurred   while  getting  the
                          alarm state.



     The tsalarmset() function returns the following value:

     TSALARMSETEROR    An error occurred   while  setting  the
                          alarm state.


EXAMPLES
     Example 1 Get and set an alarm state.


     The following example demonstrates how to  get  and  set  an
     alarm state.


       #include 
       #include 
       #include 
       #include 
       #include 

       void help(char *name) {
          printf("Syntax:  %s [get   set  ]\n\n", name);
          printf("         type  = { critical, major, minor, user }\n");
          printf("         state = { on, off }\n\n");



SunOS 5.11           Last change: 4 Sep 2007                    3






Extended Library Functions                      tsalarmget(3EXT)



          exit(0);
       }

       int main(int argc, char **argv) {

          uint32t alarmtype, alarmstate;

          if (argc < 3)
             help(argv[0]);

          if (strncmp(argv[2], "critical", 1) == 0)
             alarmtype = TSALARMCRITICAL;
          else if (strncmp(argv[2], "major", 2) == 0)
             alarmtype = TSALARMAJOR;
          else if (strncmp(argv[2], "minor", 2) == 0)
             alarmtype = TSALARMINOR;
          else if (strncmp(argv[2], "user", 1) == 0)
             alarmtype = TSALARMUSER;
          else
             help(argv[0]);

          if (strncmp(argv[1], "get", 1) == 0) {
             tsalarmget(alarmtype, &alarmstate);
             printf("alarm = %d\tstate = %d\n", alarmtype, alarmstate);
          }
          else if (strncmp(argv[1], "set", 1) == 0) {
             if (strncmp(argv[3], "on", 2) == 0)
                alarmstate = TSALARMSTATEON;
             else if (strncmp(argv[3], "off", 2) == 0)
                alarmstate = TSALARMSTATEOF;
             else
                help(argv[0]);

             tsalarmset(alarmtype, alarmstate);
          }
          else {
             help(argv[0]);
          }

          return 0;
       }


ATRIBUTES
     See attributes(5) for descriptions of the  following  attri-
     butes:









SunOS 5.11           Last change: 4 Sep 2007                    4






Extended Library Functions                      tsalarmget(3EXT)



     
           ATRIBUTE TYPE               ATRIBUTE VALUE       
    
     Interface Stability          Uncommitted                 
    
     MT-Level                     Safe                        
    


SEE ALSO
     libtsalarm(3LIB), attributes(5)












































SunOS 5.11           Last change: 4 Sep 2007                    5



OpenSolaris man pages main menu

Contact us      |       About us      |       Term of use      |       Copyright © 2000-2010 MyWebUniversity.com ™