All of lore.kernel.org
 help / color / mirror / Atom feed
* missing snd_dlclose in timer.c
@ 2006-04-25  9:03 Benoit Fouet
  2006-04-25 13:27 ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Benoit Fouet @ 2006-04-25  9:03 UTC (permalink / raw)
  To: alsa-devel

Hi,

I worked on an ARM9E platform with not much memory. We had to
dynamically link the libraries we needed.
BTW I found out that there was a dlclose missing in ALSA lib in the
snd_timer_open_conf function.
Find below the diff of my file, if you want to add it in th hg repository.

Cheers,
Ben


diff -r 211e55692b5d src/timer/timer.c
--- a/src/timer/timer.c Wed Apr 19 12:29:47 2006 +0200
+++ b/src/timer/timer.c Tue Apr 25 10:53:04 2006 +0200
@@ -171,7 +171,10 @@ static int snd_timer_open_conf(snd_timer
        _err:
        if (type_conf)
                snd_config_delete(type_conf);
-       return err >= 0 ? open_func(timer, name, timer_root, timer_conf,
mode) : err;
+       err = err >= 0 ? open_func(timer, name, timer_root, timer_conf,
mode) : err;
+       if (h)
+               snd_dlclose(h);
+       return err;
 }

 static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t
*root, const char *name, int mode)



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25  9:03 missing snd_dlclose in timer.c Benoit Fouet
@ 2006-04-25 13:27 ` Takashi Iwai
  2006-04-25 14:30   ` Benoit Fouet
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2006-04-25 13:27 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Tue, 25 Apr 2006 11:03:28 +0200,
Benoit Fouet wrote:
> 
> Hi,
> 
> I worked on an ARM9E platform with not much memory. We had to
> dynamically link the libraries we needed.
> BTW I found out that there was a dlclose missing in ALSA lib in the
> snd_timer_open_conf function.
> Find below the diff of my file, if you want to add it in th hg repository.

A good catch.

I just wonder whether it's safe to call dlclose() there.
Can the callback functions dynamically registered by open
(e.g. snd_timer_hw_open) be still accessed safely after dlclose()?

Or should we keep dl handle and dlclose it in snd_timer_close()?


Takashi


> 
> Cheers,
> Ben
> 
> 
> diff -r 211e55692b5d src/timer/timer.c
> --- a/src/timer/timer.c Wed Apr 19 12:29:47 2006 +0200
> +++ b/src/timer/timer.c Tue Apr 25 10:53:04 2006 +0200
> @@ -171,7 +171,10 @@ static int snd_timer_open_conf(snd_timer
>         _err:
>         if (type_conf)
>                 snd_config_delete(type_conf);
> -       return err >= 0 ? open_func(timer, name, timer_root, timer_conf,
> mode) : err;
> +       err = err >= 0 ? open_func(timer, name, timer_root, timer_conf,
> mode) : err;
> +       if (h)
> +               snd_dlclose(h);
> +       return err;
>  }
> 
>  static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t
> *root, const char *name, int mode)
> 
> 
> 
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/alsa-devel
> 


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25 13:27 ` Takashi Iwai
@ 2006-04-25 14:30   ` Benoit Fouet
  2006-04-25 14:41     ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Benoit Fouet @ 2006-04-25 14:30 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2892 bytes --]



Takashi Iwai wrote:

>At Tue, 25 Apr 2006 11:03:28 +0200,
>Benoit Fouet wrote:
>  
>
>>Hi,
>>
>>I worked on an ARM9E platform with not much memory. We had to
>>dynamically link the libraries we needed.
>>BTW I found out that there was a dlclose missing in ALSA lib in the
>>snd_timer_open_conf function.
>>Find below the diff of my file, if you want to add it in th hg repository.
>>    
>>
>
>A good catch.
>
>I just wonder whether it's safe to call dlclose() there.
>Can the callback functions dynamically registered by open
>(e.g. snd_timer_hw_open) be still accessed safely after dlclose()?
>
>Or should we keep dl handle and dlclose it in snd_timer_close()?
>
>
>Takashi
>  
>
It surely is safer to keep the library opened as long as its symbol are
likely to be used.
I'm afraid I'm not aware enough of how it works to answer more clearly.
btw, the symbols I used were in asound library, and were consequently
still reachable after dlclose as the library was not really unloaded.
Keeping the handle must be the best way to guarantee symbols can be
reached until snd_timer_close.

Ben

>
>  
>
>>Cheers,
>>Ben
>>
>>
>>diff -r 211e55692b5d src/timer/timer.c
>>--- a/src/timer/timer.c Wed Apr 19 12:29:47 2006 +0200
>>+++ b/src/timer/timer.c Tue Apr 25 10:53:04 2006 +0200
>>@@ -171,7 +171,10 @@ static int snd_timer_open_conf(snd_timer
>>        _err:
>>        if (type_conf)
>>                snd_config_delete(type_conf);
>>-       return err >= 0 ? open_func(timer, name, timer_root, timer_conf,
>>mode) : err;
>>+       err = err >= 0 ? open_func(timer, name, timer_root, timer_conf,
>>mode) : err;
>>+       if (h)
>>+               snd_dlclose(h);
>>+       return err;
>> }
>>
>> static int snd_timer_open_noupdate(snd_timer_t **timer, snd_config_t
>>*root, const char *name, int mode)
>>
>>
>>
>>-------------------------------------------------------
>>Using Tomcat but need to do more? Need to support web services, security?
>>Get stuff done quickly with pre-integrated technology to make your job easier
>>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>>_______________________________________________
>>Alsa-devel mailing list
>>Alsa-devel@lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/alsa-devel
>>
>>    
>>
>
>
>-------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Alsa-devel mailing list
>Alsa-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/alsa-devel
>  
>

[-- Attachment #2: Type: text/html, Size: 4059 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25 14:30   ` Benoit Fouet
@ 2006-04-25 14:41     ` Takashi Iwai
  2006-04-25 15:22       ` Benoit Fouet
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2006-04-25 14:41 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Tue, 25 Apr 2006 16:30:08 +0200,
Benoit Fouet wrote:
> 
> Takashi Iwai wrote:
> 
>     At Tue, 25 Apr 2006 11:03:28 +0200,
>     Benoit Fouet wrote:
> 
>         Hi,
>         
>         I worked on an ARM9E platform with not much memory. We had to
>         dynamically link the libraries we needed.
>         BTW I found out that there was a dlclose missing in ALSA lib in the
>         snd_timer_open_conf function.
>         Find below the diff of my file, if you want to add it in th hg repository.
> 
>     A good catch.
>     
>     I just wonder whether it's safe to call dlclose() there.
>     Can the callback functions dynamically registered by open
>     (e.g. snd_timer_hw_open) be still accessed safely after dlclose()?
>     
>     Or should we keep dl handle and dlclose it in snd_timer_close()?
> 
>     Takashi
> 
> It surely is safer to keep the library opened as long as its symbol are likely to be
> used.
> I'm afraid I'm not aware enough of how it works to answer more clearly.
> btw, the symbols I used were in asound library, and were consequently still reachable
> after dlclose as the library was not really unloaded.
> Keeping the handle must be the best way to guarantee symbols can be reached until
> snd_timer_close.

I guess so, too.  alsa-lib has a mechanism to allow users specifying
an extra shared object to be loaded.  Thus symbols are not always in
libasound.so that is kept opened.

I'll fix codes to call snd_dlclose() in close.


thanks,

Takashi


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25 14:41     ` Takashi Iwai
@ 2006-04-25 15:22       ` Benoit Fouet
  2006-04-25 16:10         ` Takashi Iwai
  0 siblings, 1 reply; 7+ messages in thread
From: Benoit Fouet @ 2006-04-25 15:22 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]



Takashi Iwai wrote:

>At Tue, 25 Apr 2006 16:30:08 +0200,
>Benoit Fouet wrote:
>  
>
>>Takashi Iwai wrote:
>>
>>    At Tue, 25 Apr 2006 11:03:28 +0200,
>>    Benoit Fouet wrote:
>>
>>        Hi,
>>        
>>        I worked on an ARM9E platform with not much memory. We had to
>>        dynamically link the libraries we needed.
>>        BTW I found out that there was a dlclose missing in ALSA lib in the
>>        snd_timer_open_conf function.
>>        Find below the diff of my file, if you want to add it in th hg repository.
>>
>>    A good catch.
>>    
>>    I just wonder whether it's safe to call dlclose() there.
>>    Can the callback functions dynamically registered by open
>>    (e.g. snd_timer_hw_open) be still accessed safely after dlclose()?
>>    
>>    Or should we keep dl handle and dlclose it in snd_timer_close()?
>>
>>    Takashi
>>
>>It surely is safer to keep the library opened as long as its symbol are likely to be
>>used.
>>I'm afraid I'm not aware enough of how it works to answer more clearly.
>>btw, the symbols I used were in asound library, and were consequently still reachable
>>after dlclose as the library was not really unloaded.
>>Keeping the handle must be the best way to guarantee symbols can be reached until
>>snd_timer_close.
>>    
>>
>
>I guess so, too.  alsa-lib has a mechanism to allow users specifying
>an extra shared object to be loaded.  Thus symbols are not always in
>libasound.so that is kept opened.
>
>I'll fix codes to call snd_dlclose() in close.
>
>  
>
Ok, thank you for precision :)

Ben


[-- Attachment #2: Type: text/html, Size: 1933 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25 15:22       ` Benoit Fouet
@ 2006-04-25 16:10         ` Takashi Iwai
  2006-04-25 16:29           ` Benoit Fouet
  0 siblings, 1 reply; 7+ messages in thread
From: Takashi Iwai @ 2006-04-25 16:10 UTC (permalink / raw)
  To: Benoit Fouet; +Cc: alsa-devel

At Tue, 25 Apr 2006 17:22:55 +0200,
Benoit Fouet wrote:
> 
> Takashi Iwai wrote:
> 
>     At Tue, 25 Apr 2006 16:30:08 +0200,
>     Benoit Fouet wrote:
> 
>         Takashi Iwai wrote:
>         
>             At Tue, 25 Apr 2006 11:03:28 +0200,
>             Benoit Fouet wrote:
>         
>                 Hi,
>                 
>                 I worked on an ARM9E platform with not much memory. We had to
>                 dynamically link the libraries we needed.
>                 BTW I found out that there was a dlclose missing in ALSA lib in the
>                 snd_timer_open_conf function.
>                 Find below the diff of my file, if you want to add it in th hg repository.
>         
>             A good catch.
>             
>             I just wonder whether it's safe to call dlclose() there.
>             Can the callback functions dynamically registered by open
>             (e.g. snd_timer_hw_open) be still accessed safely after dlclose()?
>             
>             Or should we keep dl handle and dlclose it in snd_timer_close()?
>         
>             Takashi
>         
>         It surely is safer to keep the library opened as long as its symbol are likely to be
>         used.
>         I'm afraid I'm not aware enough of how it works to answer more clearly.
>         btw, the symbols I used were in asound library, and were consequently still reachable
>         after dlclose as the library was not really unloaded.
>         Keeping the handle must be the best way to guarantee symbols can be reached until
>         snd_timer_close.
> 
>     I guess so, too.  alsa-lib has a mechanism to allow users specifying
>     an extra shared object to be loaded.  Thus symbols are not always in
>     libasound.so that is kept opened.
>     
>     I'll fix codes to call snd_dlclose() in close.
> 
> Ok, thank you for precision :)

I fixed it on Hg repo now.


Takashi


-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: missing snd_dlclose in timer.c
  2006-04-25 16:10         ` Takashi Iwai
@ 2006-04-25 16:29           ` Benoit Fouet
  0 siblings, 0 replies; 7+ messages in thread
From: Benoit Fouet @ 2006-04-25 16:29 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2538 bytes --]


Takashi Iwai wrote:

>At Tue, 25 Apr 2006 17:22:55 +0200,
>Benoit Fouet wrote:
>  
>
>>Takashi Iwai wrote:
>>
>>    At Tue, 25 Apr 2006 16:30:08 +0200,
>>    Benoit Fouet wrote:
>>
>>        Takashi Iwai wrote:
>>        
>>            At Tue, 25 Apr 2006 11:03:28 +0200,
>>            Benoit Fouet wrote:
>>        
>>                Hi,
>>                
>>                I worked on an ARM9E platform with not much memory. We had to
>>                dynamically link the libraries we needed.
>>                BTW I found out that there was a dlclose missing in ALSA lib in the
>>                snd_timer_open_conf function.
>>                Find below the diff of my file, if you want to add it in th hg repository.
>>        
>>            A good catch.
>>            
>>            I just wonder whether it's safe to call dlclose() there.
>>            Can the callback functions dynamically registered by open
>>            (e.g. snd_timer_hw_open) be still accessed safely after dlclose()?
>>            
>>            Or should we keep dl handle and dlclose it in snd_timer_close()?
>>        
>>            Takashi
>>        
>>        It surely is safer to keep the library opened as long as its symbol are likely to be
>>        used.
>>        I'm afraid I'm not aware enough of how it works to answer more clearly.
>>        btw, the symbols I used were in asound library, and were consequently still reachable
>>        after dlclose as the library was not really unloaded.
>>        Keeping the handle must be the best way to guarantee symbols can be reached until
>>        snd_timer_close.
>>
>>    I guess so, too.  alsa-lib has a mechanism to allow users specifying
>>    an extra shared object to be loaded.  Thus symbols are not always in
>>    libasound.so that is kept opened.
>>    
>>    I'll fix codes to call snd_dlclose() in close.
>>
>>Ok, thank you for precision :)
>>    
>>
>
>I fixed it on Hg repo now.
>
>
>Takashi
>  
>
Seems like I missed some others :-)

Ben

>
>-------------------------------------------------------
>Using Tomcat but need to do more? Need to support web services, security?
>Get stuff done quickly with pre-integrated technology to make your job easier
>Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
>http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
>_______________________________________________
>Alsa-devel mailing list
>Alsa-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/alsa-devel
>  
>

[-- Attachment #2: Type: text/html, Size: 3332 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2006-04-25 16:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-25  9:03 missing snd_dlclose in timer.c Benoit Fouet
2006-04-25 13:27 ` Takashi Iwai
2006-04-25 14:30   ` Benoit Fouet
2006-04-25 14:41     ` Takashi Iwai
2006-04-25 15:22       ` Benoit Fouet
2006-04-25 16:10         ` Takashi Iwai
2006-04-25 16:29           ` Benoit Fouet

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.