#!/usr/bin/perl

open (IOCTLS,'/scratch/petalinux-yocto/yocto_downloads_2018.2_zynqmp-generic/build_zynqmp-generic/tmp/work/aarch64-xilinx-linux/perl/5.24.1-r0/recipe-sysroot/usr/include/sys/ioctl.h') || die "ioctl open failed";

while (<IOCTLS>) {
    if (/^\s*#\s*define\s+\w+\s+_IO(R|W|WR)\('?\w+'?,\s*\w+,\s*([^)]+)/) {
	$need{$2}++;
    } 
}

foreach $key ( sort keys %need ) {
    print $key,"\n";
} 
