示例#1
0
文件: gwmscb.c 项目: fosslc/Ingres
/*{
** Name:	GM_rm_scb	- remove GWM scb for current session.
**
** Description:
**	Clear out the SCB for the session.
**
** Re-entrancy:
**	worry about sharing memory_left counters with parent streams.
**
** Inputs:
**	none.
**
** Outputs:
**	none.
**
** Returns:
**	E_DB_OK		if all went well.
**	E_DB_ERROR	if allocation error occured; it is logged.
**
** History:
**	7-oct-92 (daveb)
**	    created.
*/
DB_STATUS
GM_rm_scb(void)
{
    GM_SCB	*scb;
    DB_STATUS	db_stat = E_DB_OK;

    do				/* one-time through */
    {
	scb = GM_gt_scb();
	if( scb == NULL )
	{
	    GM_error( E_GW82C1_NO_SCB );
	    db_stat = E_DB_ERROR;
	    break;
	}

	if( GM_gt_sem( &scb->gs_sem ) != E_DB_OK )
	{
	    db_stat = E_DB_ERROR;
	    break;
	}
	GM_nuke_domain( scb );
	GM_release_sem( &scb->gs_sem );
	    
	/* close stream and delete all mem in it */
	CSr_semaphore( &scb->gs_sem );

    } while ( FALSE );

    return( db_stat );
}
示例#2
0
GSTATUS 
DDFSemDestroy (
	PSEMAPHORE sem) 
{
    GSTATUS err = GSTAT_OK;
    CScnd_free(&sem->cond);
    CSr_semaphore(&sem->semaphore);
    return(err);
}
示例#3
0
文件: lgkinit.c 项目: fosslc/Ingres
/*{
** Name: LGK_destroy()	- destroy shared memory segment used by lg and lk
**
** Description:
**	Destroy the shared memory segment.
**
** Inputs:
**	none.
**
** Outputs:
**	none.
**
**	Returns:
**	    !OK		couldn't destroy it for some reason.
**	    OK		success.
**
** History:
**	Summer, 1992 (bryanp)
**	    Working on the new portable logging and locking system.
**	30-Apr-2003 (jenjo02)
**	    Destroy the mem_ext_sem. BUG 110121.
**	19-Jun-2003 (jenjo02)
**	    Prototyped function, which is a static. Before
**	    destroying the memory, free it as some OS's 
**	    (read "Linux") insist, returning EIDRM if the 
**	    process still has the memory "pinned", destroys it,
**	    then attempts to MEget_pages it again. This does
**	    not seem to trouble other OS's (Solaris, etal).
*/
static STATUS 
LGK_destroy(
SIZE_TYPE	pages,
CL_ERR_DESC *sys_err)
{
    STATUS	ret_val;
    i4		err_code;
    LGK_MEM	*lgk_mem = (LGK_MEM *)LGK_base.lgk_mem_ptr;

    /* Destroy the semaphore */
    CSr_semaphore(&lgk_mem->mem_ext_sem);
    CS_cp_sem_cleanup("lglkdata.mem", sys_err);
    MEfree_pages((PTR)lgk_mem, pages, sys_err);
    ret_val = MEsmdestroy("lglkdata.mem", sys_err);
    if (ret_val)
    {
	uleFormat(NULL, ret_val, (CL_ERR_DESC *)sys_err,
			    ULE_LOG, NULL, NULL, 0, NULL, &err_code, 0);
	ret_val = E_DMA803_LGKDEST_ERROR;
    }
    LGK_base.lgk_mem_ptr = NULL;

    return(ret_val);
}