📄 snmplock.c
字号:
/* * Copyright 2000-2005 Wind River Systems, Inc. * All rights reserved. Provided under license only. * Distribution or other use of this software is only * permitted pursuant to the terms of a license agreement * from Wind River Systems (and is otherwise prohibited). * Refer to that license agreement for terms of use. *//* snmplock.c - routines for controlling access to data *//*modification history--------------------01b,18apr05,job update copyright notices01a,24nov03,job update copyright information$Log: snmplock.c,v $Revision 1.2 2001/11/06 21:20:29 joshrevised new path hackingRevision 1.1.1.1 2001/11/05 17:47:43 tnealeTornado shuffleRevision 1.3.2.1 2001/06/28 18:22:59 joshSeeding the Cormorant branch with the code from the oldcormorant branchRevision 1.2.2.1 2001/04/11 19:35:42 joshmoving cormorant-specific files onto the specialcormorant branch so they don't get in kingfisher's wayRevision 1.2 2001/01/19 22:22:27 paulUpdate copyright.Revision 1.1 2000/06/09 14:01:29 joshcode to lock system resources so they can be safely manipulted*//*DESCRIPTIONThis module contains the routines to lock system resources safely.INCLUDE FILES: asn1.h, snmp.h, snmpdefs.h *//* includes */#include <wrn/wm/snmp/engine/asn1.h>#include <wrn/wm/snmp/engine/snmp.h>#include <wrn/wm/snmp/engine/snmpdefs.h>/***************************************************************************** SNMP_Get_System_Lock - Lock the system so as to safely be able to access* SNMP-related data structures.** This function grabs the SNMP_infrastructure_lock so that SNMP database* objects can be safely accessed.** RETURNS: ENVOY_ERR_NOERR if lock was successful* ENVOY_ERR_LOCK_FAILED if lock was unsuccessful*/envoy_err_t SNMP_Get_System_Lock ( bits8_t which ) { if (which == SNMP_READ_LOCK) { if (ENVOY_SNMP_GET_READ_LOCK(SNMP_infrastructure_lock) == 0) return ENVOY_ERR_NOERR; else return ENVOY_ERR_LOCK_FAILED; } else if (which == SNMP_WRITE_LOCK) { if (ENVOY_SNMP_GET_WRITE_LOCK(SNMP_infrastructure_lock) == 0) return ENVOY_ERR_NOERR; else return ENVOY_ERR_LOCK_FAILED; } return ENVOY_ERR_LOCK_FAILED; }/***************************************************************************** SNMP_Release_System_Lock - Unlock the system after locking it via* a call to SNMP_Get_System_Lock()** This function releases the SNMP_infrastructure_lock. It shouldn't be* called unless the lock has already been obtained using* SNMP_Get_System_Lock(). ** RETURNS: ENVOY_ERR_NOERR if lock was successful* ENVOY_ERR_LOCK_FAILED if lock was unsuccessful*/void SNMP_Release_System_Lock ( bits8_t which ) { if (which == SNMP_READ_LOCK) ENVOY_SNMP_RELEASE_READ_LOCK(SNMP_infrastructure_lock); else if (which == SNMP_WRITE_LOCK) ENVOY_SNMP_RELEASE_WRITE_LOCK(SNMP_infrastructure_lock); return; }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -