+ /*
+ * Calculations from:
+ * http://cvs.opensolaris.org/source/xref/on/usr/src/cmd/swap/swap.c
+ * Also see:
+ * http://www.itworld.com/Comp/2377/UIR980701perf/ (outdated?)
+ * /usr/include/vm/anon.h
+ *
+ * In short, swap -s shows: allocated + reserved = used, available
+ *
+ * However, Solaris does not allow to allocated/reserved more than the
+ * available swap (physical memory + disk swap), so the pedant may
+ * prefer: allocated + unallocated = reserved, available
+ *
+ * We map the above to: used + resv = n/a, free
+ *
+ * Does your brain hurt yet? - Christophe Kalt
+ *
+ * Oh, and in case you wonder,
+ * swap_alloc = pagesize * ( ai.ani_max - ai.ani_free );
+ * can suffer from a 32bit overflow.
+ */
+ swap_alloc = (derive_t) ((ai.ani_max - ai.ani_free) * pagesize);
+ swap_resv = (derive_t) ((ai.ani_resv + ai.ani_free - ai.ani_max)
+ * pagesize);
+ swap_avail = (derive_t) ((ai.ani_max - ai.ani_resv) * pagesize);
+
+ swap_submit ("used", swap_alloc, DS_TYPE_GAUGE);
+ swap_submit ("free", swap_avail, DS_TYPE_GAUGE);
+ swap_submit ("reserved", swap_resv, DS_TYPE_GAUGE);
+/* #endif HAVE_LIBKSTAT */
+
+#elif HAVE_SWAPCTL
+ struct swapent *swap_entries;
+ int swap_num;
+ int status;
+ int i;