Handling SIGTSTP (Ctrl+Z) /SIGCONT/fg with aplay/cplay

Takashi Iwai tiwai at suse.de
Wed Jan 5 17:54:35 CET 2022


On Wed, 05 Jan 2022 16:56:47 +0100,
Vinod Koul wrote:
> 
> Hi Daniel,
> 
> On 05-01-22, 16:31, Daniel Baluta wrote:
> > Hi all,
> > 
> > Is there any quick document for handling Ctrl + Z with aplay/cplay?
> 
> cplay does have have handler for it, patches would be welcome :)
> 
> > I don't see this signal handled with alsa-lib or tinycompress although
> > linux kernel offers PAUSE/RESUME ioctls.
> 
> Are you sure, I checked with aplay, it seems to me work for me on Fedora
> 
> $ aplay test.wav
> Playing WAVE 'test.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
> ^Z
> [1]+  Stopped                 aplay test.wav
> 
> It did pause the file and I was able to resume it from the last
> position.
> 
> FWIW:
> $ aplay --version
> aplay: version 1.2.6 by Jaroslav Kysela <perex at perex.cz>
> 
> > What should be the expected behavior?
> 
> Pause the stream should be apt behaviour, unless Takashi or Jaroslav
> have better ideas

There is no special handling in alsa-lib or aplay program itself about
this signal; it's just "paused" by the terminal, so no data is fed.
And, after the resume, it deals with the standard XRUN error
handling.

That said, it's a sort of XRUN injection.  (IIRC, someone explicitly
requested to keep this "feature" in axfr, too.)


Takashi


More information about the Alsa-devel mailing list