Mercurial > hg > xemacs-beta
comparison src/getloadavg.c @ 410:de805c49cfc1 r21-2-35
Import from CVS: tag r21-2-35
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:19:21 +0200 |
parents | 74fd4e045ea6 |
children | 697ef44129c6 |
comparison
equal
deleted
inserted
replaced
409:301b9ebbdf3b | 410:de805c49cfc1 |
---|---|
42 apollo | 42 apollo |
43 BSD Real BSD, not just BSD-like. | 43 BSD Real BSD, not just BSD-like. |
44 convex | 44 convex |
45 DGUX | 45 DGUX |
46 hpux | 46 hpux |
47 MSDOS No-op for MSDOS. | |
48 NeXT | 47 NeXT |
49 sgi | 48 sgi |
50 sequent Sequent Dynix 3.x.x (BSD) | 49 sequent Sequent Dynix 3.x.x (BSD) |
51 _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV) | 50 _SEQUENT_ Sequent DYNIX/ptx 1.x.x (SYSV) |
52 sony_news NEWS-OS (works at least for 4.1C) | 51 sony_news NEWS-OS (works at least for 4.1C) |
53 UMAX | 52 UMAX |
54 UMAX4_3 | 53 UMAX4_3 |
55 WIN32 No-op for Windows95/NT. | 54 WIN32_NATIVE No-op for Windows95/NT. |
56 __linux__ Linux: assumes /proc filesystem mounted. | 55 __linux__ Linux: assumes /proc filesystem mounted. |
57 Support from Michael K. Johnson. | 56 Support from Michael K. Johnson. |
58 __NetBSD__ NetBSD: assumes /kern filesystem mounted. | 57 __NetBSD__ NetBSD: assumes /kern filesystem mounted. |
59 __OpenBSD__ OpenBSD: ditto. | 58 __OpenBSD__ OpenBSD: ditto. |
60 | 59 |
67 /* This should always be first. */ | 66 /* This should always be first. */ |
68 #ifdef HAVE_CONFIG_H | 67 #ifdef HAVE_CONFIG_H |
69 #include <config.h> | 68 #include <config.h> |
70 #endif | 69 #endif |
71 | 70 |
72 #ifndef WINDOWSNT | 71 #include "lisp.h" |
73 #ifndef __CYGWIN32__ | 72 #include "sysfile.h" /* for encapsulated open, close, read, write */ |
73 | |
74 #ifndef WIN32_NATIVE | |
75 #ifndef CYGWIN | |
74 | 76 |
75 #include <sys/types.h> | 77 #include <sys/types.h> |
76 | 78 |
77 /* Both the Emacs and non-Emacs sections want this. Some | 79 /* Both the Emacs and non-Emacs sections want this. Some |
78 configuration files' definitions for the LOAD_AVE_CVT macro (like | 80 configuration files' definitions for the LOAD_AVE_CVT macro (like |
79 sparc.h's) use macros like FSCALE, defined here. */ | 81 sparc.h's) use macros like FSCALE, defined here. */ |
80 #ifdef unix | 82 #ifdef unix |
81 #include <sys/param.h> | 83 #include <sys/param.h> |
82 #endif | 84 #endif |
83 | 85 |
84 #ifdef XEMACS | |
85 #include "lisp.h" | |
86 #include "sysfile.h" /* for encapsulated open, close, read, write */ | |
87 #endif /* XEMACS */ | |
88 | 86 |
89 /* Exclude all the code except the test program at the end | 87 /* Exclude all the code except the test program at the end |
90 if the system has its own `getloadavg' function. | 88 if the system has its own `getloadavg' function. |
91 | 89 |
92 The declaration of `errno' is needed by the test program | 90 The declaration of `errno' is needed by the test program |
108 | 106 |
109 #if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT) | 107 #if !defined(LDAV_CVT) && defined(LOAD_AVE_CVT) |
110 #define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0) | 108 #define LDAV_CVT(n) (LOAD_AVE_CVT (n) / 100.0) |
111 #endif | 109 #endif |
112 | 110 |
113 #ifdef XEMACS | |
114 #if defined (HAVE_KSTAT_H) | 111 #if defined (HAVE_KSTAT_H) |
115 #include <kstat.h> | 112 #include <kstat.h> |
116 #endif /* HAVE_KSTAT_H */ | 113 #endif /* HAVE_KSTAT_H */ |
117 #endif /* XEMACS */ | |
118 | 114 |
119 #if !defined (BSD) && defined (ultrix) | 115 #if !defined (BSD) && defined (ultrix) |
120 /* Ultrix behaves like BSD on Vaxen. */ | 116 /* Ultrix behaves like BSD on Vaxen. */ |
121 #define BSD | 117 #define BSD |
122 #endif | 118 #endif |
455 | 451 |
456 #ifdef DGUX | 452 #ifdef DGUX |
457 #include <sys/dg_sys_info.h> | 453 #include <sys/dg_sys_info.h> |
458 #endif | 454 #endif |
459 | 455 |
460 #ifdef XEMACS | |
461 #if defined (HAVE_SYS_PSTAT_H) | 456 #if defined (HAVE_SYS_PSTAT_H) |
462 #include <sys/pstat.h> | 457 #include <sys/pstat.h> |
463 #endif /* HAVE_SYS_PSTAT_H (on HPUX) */ | 458 #endif /* HAVE_SYS_PSTAT_H (on HPUX) */ |
464 #endif /* XEMACS */ | |
465 | 459 |
466 #if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) | 460 #if defined(HAVE_FCNTL_H) || defined(_POSIX_VERSION) |
467 #include <fcntl.h> | 461 #include <fcntl.h> |
468 #else | 462 #else |
469 #include <sys/file.h> | 463 #include <sys/file.h> |
777 = (load_ave.tl_lscale == 0 | 771 = (load_ave.tl_lscale == 0 |
778 ? load_ave.tl_avenrun.d[0] | 772 ? load_ave.tl_avenrun.d[0] |
779 : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale)); | 773 : (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale)); |
780 #endif /* OSF_MIPS */ | 774 #endif /* OSF_MIPS */ |
781 | 775 |
782 #if !defined (LDAV_DONE) && (defined (MSDOS) || defined (WIN32)) | 776 #if !defined (LDAV_DONE) && defined (WIN32_NATIVE) |
783 #define LDAV_DONE | 777 #define LDAV_DONE |
784 | 778 |
785 /* A faithful emulation is going to have to be saved for a rainy day. */ | 779 /* A faithful emulation is going to have to be saved for a rainy day. */ |
786 for ( ; elem < nelem; elem++) | 780 for ( ; elem < nelem; elem++) |
787 { | 781 { |
788 loadavg[elem] = 0.0; | 782 loadavg[elem] = 0.0; |
789 } | 783 } |
790 #endif /* MSDOS */ | 784 #endif /* WIN32_NATIVE */ |
791 | 785 |
792 #if !defined (LDAV_DONE) && defined (OSF_ALPHA) | 786 #if !defined (LDAV_DONE) && defined (OSF_ALPHA) |
793 #define LDAV_DONE | 787 #define LDAV_DONE |
794 | 788 |
795 struct tbl_loadavg load_ave; | 789 struct tbl_loadavg load_ave; |
976 } | 970 } |
977 return i; | 971 return i; |
978 } | 972 } |
979 | 973 |
980 #endif /*__GNUWIN32__*/ | 974 #endif /*__GNUWIN32__*/ |
981 #endif /* WINDOWSNT */ | 975 #endif /* WIN32_NATIVE */ |