-
Notifications
You must be signed in to change notification settings - Fork 588
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ALSA ioctls PVERSION and CARD_INFO to record_syscall
VMware Workstation needs to query ALSA for information about the system's audio devices to allow users to select which device to direct VM audio output to. When running rr against Workstation, I found rr asserting around ioctls SNDRV_CTL_IOCTL_PVERSION and SNDRV_CTL_IOCTL_CARD_INFO. This patch is my total wild guess on how to patch around this problem. It's enough to launch Workstation and have it running under rr, but I cannot attest to its correctness.
- Loading branch information
1 parent
cc8b23c
commit 89374ab
Showing
6 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ | ||
|
||
#include "rrutil.h" | ||
|
||
#ifndef ALSA_DEVICE_DIRECTORY | ||
#define ALSA_DEVICE_DIRECTORY "/dev/snd/" | ||
#endif | ||
|
||
int main(int argc, char* argv[]) { | ||
int fd = open(ALSA_DEVICE_DIRECTORY "control0", O_NONBLOCK | O_RDONLY); | ||
if (fd < 0) { | ||
test_assert(errno == EACCES || errno == ENOENT); | ||
} else { | ||
int* pversion; | ||
struct snd_ctl_card_info* info; | ||
|
||
ALLOCATE_GUARD(pversion, 'x'); | ||
*pversion = -1; | ||
test_assert(0 == ioctl(fd, SNDRV_CTL_IOCTL_PVERSION, pversion)); | ||
VERIFY_GUARD(pversion); | ||
test_assert(pversion >= 0); | ||
|
||
ALLOCATE_GUARD(info, 1); | ||
test_assert(0 == ioctl(fd, SNDRV_CTL_IOCTL_CARD_INFO, info)); | ||
VERIFY_GUARD(info); | ||
test_assert(info->id[0] > 1); | ||
test_assert(info->driver[0] > 1); | ||
} | ||
|
||
atomic_puts("EXIT-SUCCESS"); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters