Back to index

lshw  02.16
abi.cc
Go to the documentation of this file.
00001 /*
00002  * abi.cc
00003  *
00004  *
00005  */
00006 
00007 #include "version.h"
00008 #include "config.h"
00009 #include "abi.h"
00010 #include "osutils.h"
00011 #include <unistd.h>
00012 #include <stdlib.h>
00013 #include <dirent.h>
00014 
00015 __ID("@(#) $Id: mem.cc 1352 2006-05-27 23:54:13Z ezix $");
00016 
00017 #define PROC_SYS "/proc/sys"
00018 
00019 bool scan_abi(hwNode & system)
00020 {
00021   // are we compiled as 32- or 64-bit process ?
00022   system.setWidth(sysconf(_SC_LONG_BIT));
00023 
00024   pushd(PROC_SYS);
00025 
00026   if(exists("kernel/vsyscall64"))
00027   {
00028     system.addCapability("vsyscall64");
00029     system.setWidth(64);
00030   }
00031 
00032   if(chdir("abi") == 0)
00033   {
00034     int i,n;
00035     struct dirent **namelist;
00036 
00037     n = scandir(".", &namelist, selectfile, alphasort);
00038     for(i=0; i<n; i++)
00039     {
00040       system.addCapability(namelist[i]->d_name);
00041       free(namelist[i]);
00042     }
00043     if(namelist)
00044       free(namelist);
00045   }
00046 
00047   popd();
00048 
00049   system.describeCapability("vsyscall32", _("32-bit processes"));
00050   system.describeCapability("vsyscall64", _("64-bit processes"));
00051   return true;
00052 }