diff --git a/build-support/grovel.c b/build-support/grovel.c index 2e39d2495e..2b8aad2e5f 100644 --- a/build-support/grovel.c +++ b/build-support/grovel.c @@ -32,9 +32,12 @@ #if defined(UNIX) #include #include + #include + #include + #include + #include #endif - #define BL printf(" "); #define QUOT printf("\""); #define NL printf("\n"); @@ -50,6 +53,7 @@ #define header2(os,struct) printf("vvv %s %s vvv", (os), (struct)); NL #define footer2(os,struct) printf("^^^ %s %s ^^^", (os), (struct)); NL #define struct(n) printf("C-STRUCT: %s\n", (n)); +#define constant(n) printf("#define "); printf(#n); printf(" %d (HEX: %04x)", (n), (n)); NL void openbsd_types() { @@ -79,9 +83,9 @@ void openbsd_stat() grovel2(gid_t, "st_gid"); grovel2(dev_t, "st_rdev"); grovel2(int32_t, "st_lspare0"); - grovel2(struct timespec, "st_atimespec"); - grovel2(struct timespec, "st_mtimespec"); - grovel2(struct timespec, "st_ctimespec"); + grovel2(struct timespec, "st_atim"); + grovel2(struct timespec, "st_mtim"); + grovel2(struct timespec, "st_ctim"); grovel2(off_t, "st_size"); grovel2(int64_t, "st_blocks"); grovel2(u_int32_t, "st_blksize"); @@ -109,6 +113,28 @@ void unix_types() grovel(time_t); grovel(uid_t); } + +void unix_constants() +{ + constant(O_RDONLY); + constant(O_WRONLY); + constant(O_RDWR); + constant(O_APPEND); + constant(O_CREAT); + constant(O_TRUNC); + constant(O_EXCL); + constant(FD_SETSIZE); + constant(SOL_SOCKET); + constant(SO_REUSEADDR); + constant(SO_OOBINLINE); + constant(SO_SNDTIMEO); + constant(SO_RCVTIMEO); + constant(F_SETFL); + constant(O_NONBLOCK); + constant(EINTR); + constant(EAGAIN); + constant(EINPROGRESS); +} int main() { //grovel(char); @@ -121,6 +147,7 @@ int main() { //grovel(void*); //grovel(char*); + #ifdef FREEBSD grovel(blkcnt_t); grovel(blksize_t); @@ -134,8 +161,10 @@ int main() { #ifdef UNIX unix_types(); + unix_constants(); #endif grovel(long); return 0; } +