diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2009-11-10 04:14:04 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-10 10:32:38 -0500 |
commit | 7584af10cf46e0f4aa1696f1be79fa0f19a945ba (patch) | |
tree | e40065330c913b3c5a79da0080444cea761816d7 /sound/core | |
parent | e7373b702f6eab35f315e016a4159860a7a4d686 (diff) |
sound: rawmidi: record a substream's owner process
Record the pid of the task that opened a RawMIDI substream.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/rawmidi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c index 818b1299ed91..2f766123b158 100644 --- a/sound/core/rawmidi.c +++ b/sound/core/rawmidi.c | |||
@@ -278,6 +278,7 @@ static int open_substream(struct snd_rawmidi *rmidi, | |||
278 | substream->active_sensing = 0; | 278 | substream->active_sensing = 0; |
279 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) | 279 | if (mode & SNDRV_RAWMIDI_LFLG_APPEND) |
280 | substream->append = 1; | 280 | substream->append = 1; |
281 | substream->pid = get_pid(task_pid(current)); | ||
281 | rmidi->streams[substream->stream].substream_opened++; | 282 | rmidi->streams[substream->stream].substream_opened++; |
282 | } | 283 | } |
283 | substream->use_count++; | 284 | substream->use_count++; |
@@ -488,6 +489,8 @@ static void close_substream(struct snd_rawmidi *rmidi, | |||
488 | snd_rawmidi_runtime_free(substream); | 489 | snd_rawmidi_runtime_free(substream); |
489 | substream->opened = 0; | 490 | substream->opened = 0; |
490 | substream->append = 0; | 491 | substream->append = 0; |
492 | put_pid(substream->pid); | ||
493 | substream->pid = NULL; | ||
491 | rmidi->streams[substream->stream].substream_opened--; | 494 | rmidi->streams[substream->stream].substream_opened--; |
492 | } | 495 | } |
493 | 496 | ||
@@ -1336,6 +1339,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, | |||
1336 | substream->number, | 1339 | substream->number, |
1337 | (unsigned long) substream->bytes); | 1340 | (unsigned long) substream->bytes); |
1338 | if (substream->opened) { | 1341 | if (substream->opened) { |
1342 | snd_iprintf(buffer, | ||
1343 | " Owner PID : %d\n", | ||
1344 | pid_vnr(substream->pid)); | ||
1339 | runtime = substream->runtime; | 1345 | runtime = substream->runtime; |
1340 | snd_iprintf(buffer, | 1346 | snd_iprintf(buffer, |
1341 | " Mode : %s\n" | 1347 | " Mode : %s\n" |
@@ -1357,6 +1363,9 @@ static void snd_rawmidi_proc_info_read(struct snd_info_entry *entry, | |||
1357 | substream->number, | 1363 | substream->number, |
1358 | (unsigned long) substream->bytes); | 1364 | (unsigned long) substream->bytes); |
1359 | if (substream->opened) { | 1365 | if (substream->opened) { |
1366 | snd_iprintf(buffer, | ||
1367 | " Owner PID : %d\n", | ||
1368 | pid_vnr(substream->pid)); | ||
1360 | runtime = substream->runtime; | 1369 | runtime = substream->runtime; |
1361 | snd_iprintf(buffer, | 1370 | snd_iprintf(buffer, |
1362 | " Buffer size : %lu\n" | 1371 | " Buffer size : %lu\n" |