b63256e69b
* bjm.c: Fix tabulation (such as extra spaces before tabs), convert punctuation where it deviates from prevalent form elsewhere in strace code, convert sizeof and offsetof where it deviates from from prevalent form, remove space between function/macro/array names and (parameters) or [index], add space between "if" and (condition), correct non-standard or wrong indentaion. * defs.h: Likewise * desc.c: Likewise * file.c: Likewise * ipc.c: Likewise * linux/arm/syscallent.h: Likewise * linux/avr32/syscallent.h: Likewise * linux/hppa/syscallent.h: Likewise * linux/i386/syscallent.h: Likewise * linux/ioctlsort.c: Likewise * linux/m68k/syscallent.h: Likewise * linux/microblaze/syscallent.h: Likewise * linux/powerpc/syscallent.h: Likewise * linux/s390/syscallent.h: Likewise * linux/s390x/syscallent.h: Likewise * linux/sh/syscallent.h: Likewise * linux/sh64/syscallent.h: Likewise * linux/tile/syscallent.h: Likewise * linux/x86_64/syscallent.h: Likewise * mem.c: Likewise * net.c: Likewise * pathtrace.c: Likewise * process.c: Likewise * signal.c: Likewise * sock.c: Likewise * strace.c: Likewise * stream.c: Likewise * sunos4/syscall.h: Likewise * sunos4/syscallent.h: Likewise * svr4/syscall.h: Likewise * svr4/syscallent.h: Likewise * syscall.c: Likewise * system.c: Likewise * test/childthread.c: Likewise * test/leaderkill.c: Likewise * test/skodic.c: Likewise * time.c: Likewise * util.c: Likewise Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
53 lines
1.3 KiB
C
53 lines
1.3 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <sys/types.h>
|
|
#include <stdint.h>
|
|
|
|
#include <asm/ioctl.h>
|
|
#include <linux/types.h>
|
|
|
|
#include "ioctldefs.h"
|
|
#include <linux/atmioc.h>
|
|
|
|
struct ioctlent {
|
|
const char* header;
|
|
const char* name;
|
|
unsigned long code;
|
|
};
|
|
|
|
struct ioctlent ioctls[] = {
|
|
#include "ioctls.h"
|
|
};
|
|
|
|
int nioctls = sizeof(ioctls) / sizeof(ioctls[0]);
|
|
|
|
|
|
int compare(const void* a, const void* b) {
|
|
unsigned long code1 = ((struct ioctlent *) a)->code;
|
|
unsigned long code2 = ((struct ioctlent *) b)->code;
|
|
const char *name1 = ((struct ioctlent *) a)->name;
|
|
const char *name2 = ((struct ioctlent *) b)->name;
|
|
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : strcmp(name1, name2);
|
|
}
|
|
|
|
|
|
int main(int argc, char** argv) {
|
|
int i;
|
|
|
|
/* ioctl_lookup() only looks at the NR and TYPE bits atm. */
|
|
for (i = 0; i < nioctls; i++)
|
|
ioctls[i].code &= (_IOC_NRMASK << _IOC_NRSHIFT) |
|
|
(_IOC_TYPEMASK << _IOC_TYPESHIFT);
|
|
|
|
qsort(ioctls, nioctls, sizeof(ioctls[0]), compare);
|
|
puts("\t/* Generated by ioctlsort */");
|
|
for (i = 0; i < nioctls; i++)
|
|
if (i == 0 || ioctls[i].code != ioctls[i-1].code ||
|
|
strcmp(ioctls[i].name, ioctls[i-1].name))
|
|
printf("\t{\"%s\",\t\"%s\",\t%#06lx},\n",
|
|
ioctls[i].header, ioctls[i].name, ioctls[i].code);
|
|
|
|
return 0;
|
|
}
|