Last active
October 7, 2021 07:42
-
-
Save takaswie/cfa9bcf234c1d724c7b3403f26926eef to your computer and use it in GitHub Desktop.
ABI compatibility test for asound.h in regards of snd_pcm_mmap_control
This file contains hidden or 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#define __user | |
#include "path-to-include/uapi/sound/asound.h" | |
#if defined(PREVIOUS) | |
// Previous definition. | |
struct pcm_mmap_control { | |
snd_pcm_uframes_t appl_ptr; | |
snd_pcm_uframes_t avail_min; | |
}; | |
#define offset(field) (offsetof(struct pcm_mmap_control, field)) | |
#define size(field) (sizeof(data.field)) | |
#else | |
#define offset(field) (offsetof(struct __snd_pcm_mmap_control64, field)) | |
#define size(field) (sizeof(data.field)) | |
#endif | |
int main(int argc, const char *argv[]) | |
{ | |
struct __snd_pcm_mmap_control64 data; | |
#ifndef PREVIOUS | |
printf("__pad1: %zu, %zu\n", offset(__pad1), size(__pad1)); | |
#endif | |
printf("appl_ptr: %zu, %zu\n", offset(appl_ptr), size(appl_ptr)); | |
#ifndef PREVIOUS | |
printf("__pad2: %zu, %zu\n", offset(__pad2), size(__pad2)); | |
printf("__pad3: %zu, %zu\n", offset(__pad3), size(__pad3)); | |
#endif | |
printf("avail_min: %zu, %zu\n", offset(avail_min), size(avail_min)); | |
#ifndef PREVIOUS | |
printf("__pad4: %zu, %zu\n", offset(__pad4), size(__pad4)); | |
#endif | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment