Skip to contentSkip to conversation

Query about DSP_Close() function

DISCUSSION Ameya Palande 3 participants 4 messages Mar 30, 2009

lore
Share & tools
lore
#0 lore raw

Hi Hari,

I am trying to make sure that when an application closes a file handle all the resources are freed properly.

I saw that DEV_CleanupProcessState() is never called. I am not able to locate its definition :(
Is this code intentionally disabled/removed for some reason?

Cheers,
Ameya.

/*
* ======== DSP_Close ========
* The Calling Process handle is passed to DEV_CleanupProcesState
* for cleaning up of any resources used by the application
*/
bool DSP_Close(u32 dwOpenContext)

{
        bool retVal = false;

        DBC_Require(dwOpenContext != 0);

        GT_0trace(curTrace, GT_ENTER, "Entering DSP_Close\n");

#ifndef RES_CLEANUP_DISABLE

        if (DSP_SUCCEEDED(DEV_CleanupProcessState((HANDLE) dwOpenContext))) {
                //GT_0trace(curTrace, GT_1CLASS, "DSP_Close Succeeded \r\n");
                pr_emerg("DSP_Close Succeeded\n");
                retVal = true;
        } else {
                //GT_0trace(curTrace, GT_7CLASS, "DSP_Close failed \r\n");
                pr_emerg("DSP_Close failed\n");
        }

#endif

        return retVal;
}
#1 lore raw

Hi Ameya,

Quoted 3 lines

I am trying to make sure that when an application closes a file handle all the resources are freed properly.

-- The current Bridge resource cleanup design is handling the resource cleanup in the Bridge open as opposed to do Bridge close. The Bridge Open function loops through cleaning up the resources (that weren't freed by the User applications) of all the processes that were killed.

Thank you,
Best regards,
Hari

Quoted 48 lines

-----Original Message-----
From: Ameya Palande [mailto:[email protected]]
Sent: Monday, March 30, 2009 11:53 AM
To: Kanigeri, Hari
Cc: Doyu Hiroshi; [email protected]
Subject: Query about DSP_Close() function

Hi Hari,

I am trying to make sure that when an application closes a file handle all the resources are freed properly.

I saw that DEV_CleanupProcessState() is never called. I am not able to locate its definition :(
Is this code intentionally disabled/removed for some reason?

Cheers,
Ameya.

/*
* ======== DSP_Close ========
* The Calling Process handle is passed to DEV_CleanupProcesState
* for cleaning up of any resources used by the application
*/
bool DSP_Close(u32 dwOpenContext)

{
        bool retVal = false;

        DBC_Require(dwOpenContext != 0);

        GT_0trace(curTrace, GT_ENTER, "Entering DSP_Close\n");

#ifndef RES_CLEANUP_DISABLE

if (DSP_SUCCEEDED(DEV_CleanupProcessState((HANDLE)

dwOpenContext))) {
                //GT_0trace(curTrace, GT_1CLASS, "DSP_Close Succeeded
\r\n");
                pr_emerg("DSP_Close Succeeded\n");
                retVal = true;
        } else {
                //GT_0trace(curTrace, GT_7CLASS, "DSP_Close failed \r\n");
                pr_emerg("DSP_Close failed\n");
        }

#endif

        return retVal;
}
#2 lore raw
Quoted 8 lines · Hari

Hi Ameya,

Quoted 3 lines

I am trying to make sure that when an application closes a file handle all the resources are freed properly.

-- The current Bridge resource cleanup design is handling the resource cleanup in the Bridge open as opposed to do Bridge close. The Bridge Open function loops through cleaning up the resources (that weren't freed by the User applications) of all the processes that were killed.

Why? Wouldn't it make more sense to cleanup at close, exactly when the file descriptor is closed?

Signature · 1 line
Felipe Contreras
#3 lore raw

Felipe,

Quoted 4 lines

Why? Wouldn't it make more sense to cleanup at close, exactly when the file descriptor is closed?

-- Yes, I agree with you that it does make more sense and looks cleaner to cleanup the resources at closeup and this is in our TODO list. This change requires some modification to the existing resource cleanup design though.

Thank you,
Best regards,
Hari