aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/rawmidi.h2
-rw-r--r--sound/core/rawmidi.c9
2 files changed, 11 insertions, 0 deletions
diff --git a/include/sound/rawmidi.h b/include/sound/rawmidi.h
index c23c26585700..2480e7d10dcf 100644
--- a/include/sound/rawmidi.h
+++ b/include/sound/rawmidi.h
@@ -46,6 +46,7 @@
46struct snd_rawmidi; 46struct snd_rawmidi;
47struct snd_rawmidi_substream; 47struct snd_rawmidi_substream;
48struct snd_seq_port_info; 48struct snd_seq_port_info;
49struct pid;
49 50
50struct snd_rawmidi_ops { 51struct snd_rawmidi_ops {
51 int (*open) (struct snd_rawmidi_substream * substream); 52 int (*open) (struct snd_rawmidi_substream * substream);
@@ -97,6 +98,7 @@ struct snd_rawmidi_substream {
97 struct snd_rawmidi_str *pstr; 98 struct snd_rawmidi_str *pstr;
98 char name[32]; 99 char name[32];
99 struct snd_rawmidi_runtime *runtime; 100 struct snd_rawmidi_runtime *runtime;
101 struct pid *pid;
100 /* hardware layer */ 102 /* hardware layer */
101 struct snd_rawmidi_ops *ops; 103 struct snd_rawmidi_ops *ops;
102}; 104};
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"