X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fget-rusage-as.c;h=5567f95703061a1fd0f17e6bcca9f2e7d3dd1dd0;hb=47cb657eca1abf2c26c32c8ce03def994a3ee37c;hp=41363c547fd4f43c11fe925f30cb830019196c4c;hpb=fe810bf8507a92354b4750e6dd1b3bd974ab7fc5;p=gnulib.git diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c index 41363c547..5567f9570 100644 --- a/lib/get-rusage-as.c +++ b/lib/get-rusage-as.c @@ -66,7 +66,7 @@ OpenBSD: a) setrlimit exists, but RLIMIT_AS is not defined. - b) No VMA iteration API exists. + b) mquery() can be used to find out about the virtual memory areas. AIX: a) setrlimit with RLIMIT_AS succeeds but does not really work: The OS @@ -308,6 +308,14 @@ get_rusage_as_via_setrlimit (void) return result; } +#else + +static inline uintptr_t +get_rusage_as_via_setrlimit (void) +{ + return 0; +} + #endif @@ -364,3 +372,31 @@ get_rusage_as (void) return get_rusage_as_via_iterator (); #endif } + + +#ifdef TEST + +#include + +int +main () +{ + printf ("Initially: 0x%08lX 0x%08lX 0x%08lX\n", + get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (), + get_rusage_as ()); + malloc (0x88); + printf ("After small malloc: 0x%08lX 0x%08lX 0x%08lX\n", + get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (), + get_rusage_as ()); + malloc (0x8812); + printf ("After medium malloc: 0x%08lX 0x%08lX 0x%08lX\n", + get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (), + get_rusage_as ()); + malloc (0x281237); + printf ("After large malloc: 0x%08lX 0x%08lX 0x%08lX\n", + get_rusage_as_via_setrlimit (), get_rusage_as_via_iterator (), + get_rusage_as ()); + return 0; +} + +#endif /* TEST */