Update strlcat and strlcpy to latest OpenBSD versions. Remove last references to strcat and strcpy. Patch submitted by: David Love <david@homeunix.org.uk>
Make sure we always close kstat. Spotted by: "Javier Donaire" <jyuyu@fraguel.org> (in load_stats.c)
Add WIN32 support via MINGW. We'll need to add stuff to the README file about what this requires to build. All the hard work done by: skel
Linux always has atoll, but Cygwin doesn't.
Cast numbers to be the same type when doing a comparison.
atoll is only used in one place in libstatgrab, so move it's definition to before that one use. Given this hasn't caused us problems I'm guessing that atoll is actually available on Linux and Cygwin, which would make having the function here void. If so, it can simply be removed instead.
Add sg_get_pstat_static for HP-UX. (Untested.)
We don't need the realloc workaround -- we don't rely on the GNU behaviour.
Merge in patch to provide support for HP-UX 11.11. Contributed by Roy Keene - thanks Roy!
Use sg_set_error_with_errno whenever errno's valid. Change the one user of SG_ERROR_ENOENT to SG_ERROR_SYSCTL instead (since that's what it should have been).
Do the errno capturing in a nicer way.
Add function to allow grabbing of the current errno. Should we store errno too maybe?
Clear the error buffer on startup.
Shift a bunch of parsing functions to be linux/cygwin only. Prompted by a regex related compile error on FreeBSD (we don't use regex's on FreeBSD).
The rest of the error handling stuff (except the vector code). I've been extremely unimaginative with the string names in error.c, but they're all in one place so much easier to tidy up. I'm also beginning to wonder if we actually needed an SG_ERROR_SYSTEM_CALL to indicate some call into the system failed - because the majority of our errors are those :-) Still to do, then: - vector code - better string names in error.c - deal with arg string in some way - make use of the error status in statgrab/saidar/examples
Fixed tools.c change of enum Fixed a FD leak in solaris and added nice value.
Whitespace tidyup - change spaces to tabs.
Change malloc -> sg_malloc, realloc -> sg_realloc, and rewrite the one calloc call to use sg_malloc.
Change the last few instances of strdup to use sg_update_string.
Add sg_realloc, and a macro fo sg_malloc.
Consistently return -1 for error.
NetBSD's sysctl sometimes (repeatably) misreports the size of struct uvmexp. Fortunately, it's a fixed-size structure anyway, so we don't need to dynamically allocate it. We probably should be using struct uvmexp_sysctl anyway, since it's ABI-stable.
Update name of project at the top of all soure files. These files now exist in their own right, rather than as part of the "CMS".
Make sg_update_string return an int to indicate success, so that it can be used to set a string to NULL. Make Linux process_stats code set proctitle to NULL if it's empty rather than "".
Rename all the functions, types and enums in the API to be consistent. Types are now of the form "sg_mem_stats"; functions of the form "sg_get_mem_stats"; enums of the form "SG_PROCESS_STATE_RUNNING". (The old get_proc_snapshot follows the usual calling convention now.) Make internal functions static where possible. Rename non-static internal functions to have an sg_ prefix so they don't collide with those from other libraries. In particular, strlcpy and strlcat are now called sg_strlcpy and sg_strlcat and are always included. Fix saidar and statgrab to use the new API.
Kill a memory leak when the mapping already exists.
Fix a couple of warnings on Solaris.
Add prototype for get_svr_from_bsd, and make it take and return const char *.
I like copy_string. We should use it EVERYWHERE. Also, the name needed changing.
Fix realloc memory leak.
Fix a bunch of warnings on the BSD's.
Add an get_kvm2 function to open kvm with slightly different args. This set of args doesn't seem to need elevated privileges, but in my last test wouldn't perform the functions required in swap_stats.
We don't need kvm on FreeBSD 5 any more.
Add a workaround for NetBSD: the first call to get_uvmexp() doesn't fill in the structure, so we would normally get junk values on the first call that used it.
Add support for DragonFly BSD 1.0. Also a minor tweak to the network interface code to make it more portable.
There's no need to get_uvmexp on startup on NetBSD any more.
kvm is now only needed for FreeBSD, so change defines accordingly.
Use sysctl to read struct uvmexp, since this works on both NetBSD and OpenBSD.
Added extra ifdef due to compile error
Ooops, wrong logic and didn't think hard enough about it.
Solaris 6 doesn't have libdevinfo. So, as a way to get it to compile, we will not do the drive mappings sol 6 and lower.
A whole bunch of minor cosmetic changes.
Alter the licensing of libstatgrab. The library part is now under the LGPL, whilst the tools/examples are under the GPL. Both licenses are included in the distribution (and are both now in CVS). Also made a minor alteration to the webpage where it said everything was licensed under the GPL.
Not the exactly "nice" code. Infact, not entirely happy with it... But, it makes a *massive* speed increase to the statgrab_init() function on solaris. It goes from take 15-20 seconds on pelican to < 1.
Fix broken comment.
Solaris 7 "fix" :)
Added strlcat/strlcpy (taken from openssh). Added a #define for both, and also atoll which we appear to of forgotten about when it was written. Removed that #ifdef around get_ll_match as atoll will now always be defined.
Replace duplicated code for dropping privileges with a library function that always drops setuid/setgid privileges.
Minor tiding
Turn on the solaris disk mapping code. Fix some minor bugs, and remove some debugging code.
Die nasty incorrect whitespace. Ahem. Excuse me.
Basic implementation of name mapping for solaris. The code is ugly, mostly because its initially taken from a sun example, and modified. It needs tiding somewhat. I'm not sure if tools.c is the right place for this, i guess it could go in disk_stats.c, but its doing a specific job, and we could right another mini-program which does the disk mappings. Comments welcome about the general implementation. Should we call build_mapping if the user calls get_svr_from_bsd and build_mapping hasn't been run before? Or should we force them to use the init function? (Bare in mind, on some systems, to do the mappings correctly the program will require to be root. (Only ones with a /dev/osa , so everything with an A1000 for e.g.)
Provide atoll() on platforms that don't have it.
Add support for cygwin. This is a bit limited, there's a few things that can't be retrieved on cygwin such as load averages, diskio, network io, and process stats. The package compiles and runs, and both saidar and statgrab work. Taken from a patch submitted by Ron Arts <raarts@netland.nl>. Thanks Ron!
Changed the style slightly to be more readable.
Added statgrab_init() This function just calls the get_kvm type functions so all special privilages can be dropped after this function has been called. It currently only does stuff on *bsd (and needs testing on netbsd). All other OS's will just have a function that returns 0 Solaris at somepoint may need to do something here so we can do the drive mappings.
Initial support for NetBSD. This adds NetBSD support for everything except diskio stats (since they're even more disturbingly complex to get at on NetBSD than the three OSs we already support). Tested against NetBSD 1.6 on i386.
Add a helper function for opening the kvm handle. This removes a little bit of duplicated code, and means that we don't open and close kvm (which can potentially be quite expensive) each time we use it. This will also be useful for NetBSD.
Remove headers from tools.h that the prototypes don't need (since they're included elsewhere where needed). Include tools.h in tools.c, so we get warnings if the prototypes are wrong.
Tidy up of lots of little things. :)
Add the standard header. Particularly the bit about including config.h was needed to allow the ifdef around the last function to work.
Make the functions that use atoll have a #ifdef HAVE_ATOLL around them. I did this because freebsd doesn't have this function, and it doesn't need to run any of the functions in tools.h that uses them.
Made network stats work with linux.
Working linux diskio stats. Fixed bug in tools.c
Useful tools, currently only one function. Function takes a file pointer and will read threw it until it hits a passed string. It will return that line.
This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.