/*- * Copyright (c) 2007, Sofian Brabez * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $Id$ */ #include #include #include #include #include #include static inline void mod_info(const char *mod_name, const struct module_stat *mod_stat); static inline void mod_info(const char *mod_name, const struct module_stat *mod_stat) { printf("%s = struct module_mod_stat{\n\tversion:%d\n\tmodname:%s\n\tid:%d\n\toffset:%lf\n}\n" ,mod_name,mod_stat->version,mod_stat->name,mod_stat->id,mod_stat->data.longval); } int main(int argc, char *argv[]) { int modid; struct module_stat mod_stat; if(argc!=2) { printf("Usage: %s \n",argv[0]); exit(0); } mod_stat.version = sizeof(struct module_stat); for (modid = modfind(argv[1]); modid > 0; modid = modfnext(modid)) { if(modstat(modid,&mod_stat)==-1) { perror("modstat"); exit(-1); } mod_info(mod_stat.name,&mod_stat); } return (0); }