1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
|
/*
atlc - arbitrary transmission line calculator, for the analysis of
transmission lines are directional couplers.
Copyright (C) 2002. Dr. David Kirkby, PhD (G8WRB).
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either package_version 2
of the License, or (at your option) any later package_version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA.
Dr. David Kirkby, e-mail drkirkby@ntlworld.com
*/
/* Try to get data. This will work only on a Linux machine. */
#include "config.h"
#ifdef HAVE_STDIO_H /* it does ***not** necessarily mean it's Linux */
#ifdef HAVE_STDLIB_H /* but it will define some variables that we */
#ifdef HAVE_SYS_TYPES_H /* later check for, to confirm it's Linux */
#ifdef HAVE_SYS_UTSNAME_H /* later check for, to confirm it's Linux */
#ifdef HAVE_UNISTD_H
#ifdef HAVE_STRING_H
#ifdef HAVE_SYS_SYSINFO_H
#ifdef HAVE_LINUX_IP_H /* I don't want to include this, but it is proof
that the system is Linux */
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/utsname.h>
#include <unistd.h>
#include <string.h>
#include <sys/sysinfo.h>
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif /* End of including header files likely to be on Linux system */
#include "defs.h"
#define BYTES_PER_MB 1048576
int try_linux(struct computer_data *data)
{
#ifdef HAVE_STDIO_H /* it does ***not** necessarily mean it's Linux */
#ifdef HAVE_STDLIB_H /* but it will define some variables that we */
#ifdef HAVE_SYS_TYPES_H /* later check for, to confirm it's Linux */
#ifdef HAVE_SYS_UTSNAME_H /* later check for, to confirm it's Linux */
#ifdef HAVE_UNISTD_H
#ifdef HAVE_STRING_H
#ifdef HAVE_SYS_SYSINFO_H
#ifdef HAVE_LINUX_IP_H /* I don't want to include this, but it is proof
that the system is Linux */
/* Obtain the maximum number of CPUs supported on the Linux system */
/* Obtain the number of CPUs online on the Linux system */
#ifdef _SC_NPROCESSORS_CONF
if( sysconf(_SC_NPROCESSORS_CONF) >= 1)
sprintf(data->cpus,"%d", sysconf( _SC_NPROCESSORS_CONF));
#endif
/* Obtain the of CPU and FPU on the Linux box */
/* Obtain the RAM on the Linux system if possible. Currently this is
done in try_portable.c, but is not 100% accurate on Linux */
/* Obtain operating system informaton */
/* Obtain the manufacturer - I don't think this will be too possible,
but it might be, but clearly some boxes are going to be generic. */
/* Obtain the Platform */
return(PROBABLY_LINUX);
#endif
#endif
#endif
#endif
#endif
#endif
#endif
#endif
return(-1);
}
|