freeipmi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freeipmi-devel] Re: libfreipmi: Locking and Synchronization


From: Albert Chu
Subject: [Freeipmi-devel] Re: libfreipmi: Locking and Synchronization
Date: Wed, 31 Mar 2004 12:39:11 -0800

>  * Unlocking on exit or crash is handled automatically.

How exactly are you handling this?  Right now, it looks as though
I need to manually clean up a lock, for example, if a signal is caught.

Al

--
Albert Chu
address@hidden
Lawrence Livermore National Laboratory

----- Original Message -----
From: Anand Babu <address@hidden>
Date: Wednesday, March 31, 2004 9:14 am
Subject: libfreipmi: Locking and Synchronization

> 
> Implements mutex based on Sys V Semaphores.
> 
> IPMI_IPCKEY 
> 
>   PATH: "/var/lock/libfreeipmi/ipckey"
>   Uses ftok () and PROJ_ID to generate KEYS.
> 
> 
> IPCKEY APIs:
> 
>   IPMI_LAN_IPCKEY ()
>   IPMI_KCS_IPCKEY ()
>   IPMI_SMIC_IPCKEY ()
>   IPMI_BT_IPCKEY ()
>   Returns 'key'.
> 
> 
> Initialization API:
> 
>   int ipmi_mutex_init (key_t key);
>   Returns 'semid'.
> 
> 
> Locking APIs:
> 
>   IPMI_MUTEX_LOCK(semid)
>   IPMI_MUTEX_UNLOCK(semid)
>   IPMI_MUTEX_DOWN (semid)
>   IPMI_MUTEX_UP (semid)
>   Returns 'void'
> 
>   IPMI_MUTEX_LOCK_INTERRUPTIBLE (semid)
>   IPMI_MUTEX_LOCK_ASYNC (semid)
>   IPMI_MUTEX_DOWN_INTERRUPTIBLE (semid)
>   IPMI_MUTEX_DOWN_ASYNC (semid)
>   Return '0' on success, otherwise it returns '-1' with errno
>   indicating the error. Should restart when errno is 'EAGAIN'.
> 
> KCS Driver:
> 
>   int ipmi_kcs_get_mutex_semid (void);
> 
>   int ipmi_kcs_io_init (u_int16_t sms_io_base, unsigned long
>                        sleep_usecs);
>   Initialized locking internally.
>                        
>   int8_t ipmi_kcs_cmd (u_int16_t sms_io_base, u_int8_t lun, u_int8_t
>                fn, fiid_obj_t obj_cmd_rq, fiid_template_t
>                tmpl_cmd_rq, fiid_obj_t obj_cmd_rs, fiid_template_t
>                tmpl_cmd_rs);
>   Locking handled internally. Handles BMC transaction - write and
>   read.
> 
>   int8_t ipmi_kcs_cmd_interruptible (u_int16_t sms_io_base, u_int8_t
>             lun, u_int8_t fn, fiid_obj_t obj_cmd_rq, fiid_template_t
>             tmpl_cmd_rq, fiid_obj_t obj_cmd_rs, fiid_template_t
>             tmpl_cmd_rs);
>   Interruptible Locking. Should retry when errno is EAGAIN.
>    Handles BMC transaction - write and read.
> 
> 
> Notes:
>  * Unlocking on exit or crash is handled automatically.
>  * You can use "ipcs" and "ipcrm" utilities to view and manipulate
>    these mutexes. 
>    
> -- 
> _.|_ 
> (_||_)
> Free as in Freedom <www.gnu.org>
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]