4 #if defined(__FreeBSD__)
10 #if defined(__NetBSD__)
16 #if defined(__OpenBSD__)
22 #if defined(__APPLE__)
33 #if defined(__amd64__) || defined(__x86_64__)
40 #include <sys/types.h>
42 #include <sys/socket.h>
43 #include <sys/errno.h>
45 #include <sys/syslimits.h>
50 #define BL printf(" ");
51 #define QUOT printf("\"");
52 #define NL printf("\n");
53 #define LB printf("{"); BL
54 #define RB BL printf("}");
55 #define SEMI printf(";");
56 #define grovel(t) printf("TYPEDEF: "); printf("%d", sizeof(t)); BL printf(#t); NL
57 #define grovel2impl(t,n) BL BL BL BL LB QUOT printf(#t); QUOT BL QUOT printf((n)); QUOT RB
58 #define grovel2(t,n) grovel2impl(t,n) NL
59 #define grovel2end(t,n) grovel2impl(t,n) BL SEMI NL
60 #define header(os) printf("vvv %s vvv", (os)); NL
61 #define footer(os) printf("^^^ %s ^^^", (os)); NL
62 #define header2(os,struct) printf("vvv %s %s vvv", (os), (struct)); NL
63 #define footer2(os,struct) printf("^^^ %s %s ^^^", (os), (struct)); NL
64 #define struct(n) printf("C-STRUCT: %s\n", (n));
65 #define constant(n) printf("#define "); printf(#n); printf(" %d (HEX: %04x)", (n), (n)); NL
69 header2("openbsd", "types");
78 grovel(struct timespec
);
80 footer2("openbsd", "types");
85 header2("openbsd", "stat");
87 grovel2(dev_t
, "st_dev");
88 grovel2(ino_t
, "st_ino");
89 grovel2(mode_t
, "st_mode");
90 grovel2(nlink_t
, "st_nlink");
91 grovel2(uid_t
, "st_uid");
92 grovel2(gid_t
, "st_gid");
93 grovel2(dev_t
, "st_rdev");
94 grovel2(int32_t, "st_lspare0");
95 grovel2(struct timespec
, "st_atim");
96 grovel2(struct timespec
, "st_mtim");
97 grovel2(struct timespec
, "st_ctim");
98 grovel2(off_t
, "st_size");
99 grovel2(int64_t, "st_blocks");
100 grovel2(u_int32_t
, "st_blksize");
101 grovel2(u_int32_t
, "st_flags");
102 grovel2(u_int32_t
, "st_gen");
103 grovel2(int32_t, "st_lspare1");
104 grovel2(struct timespec
, "st_birthtimespec");
105 grovel2(int64_t, "st_qspare1");
106 grovel2end(int64_t, "st_qspare2");
107 footer2("openbsd", "stat");
120 grovel(struct timespec
);
126 void unix_constants()
135 constant(FD_SETSIZE
);
136 constant(SOL_SOCKET
);
137 constant(SO_REUSEADDR
);
138 constant(SO_OOBINLINE
);
139 constant(SO_SNDTIMEO
);
140 constant(SO_RCVTIMEO
);
142 constant(O_NONBLOCK
);
145 constant(EINPROGRESS
);
147 constant(PROT_WRITE
);
149 constant(MAP_SHARED
);
172 grovel(struct kevent
);