comparison src/fns.c @ 350:80a890dbbeb5

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Wed, 24 Jul 1991 23:47:06 +0000
parents d7da9e79438f
children 21aa17a1560d
comparison
equal deleted inserted replaced
349:feacf757c5b2 350:80a890dbbeb5
49 #include <nlist.h> 49 #include <nlist.h>
50 #endif /* NLIST_STRUCT */ 50 #endif /* NLIST_STRUCT */
51 #endif /* not VMS */ 51 #endif /* not VMS */
52 #endif /* LOAD_AVE_TYPE */ 52 #endif /* LOAD_AVE_TYPE */
53 53
54 #ifdef DGUX
55 #include <sys/dg_sys_info.h> /* for load average info - DJB */
56 #endif
57
54 /* Note on some machines this defines `vector' as a typedef, 58 /* Note on some machines this defines `vector' as a typedef,
55 so make sure we don't use that name in this file. */ 59 so make sure we don't use that name in this file. */
56 #undef vector 60 #undef vector
57 #define vector ***** 61 #define vector *****
58 62
1179 } 1183 }
1180 UNGCPRO; 1184 UNGCPRO;
1181 } 1185 }
1182 1186
1183 /* Avoid static vars inside a function since in HPUX they dump as pure. */ 1187 /* Avoid static vars inside a function since in HPUX they dump as pure. */
1188 #ifdef DGUX
1189 static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
1190
1191 #else /* Not DGUX */
1192
1184 static int ldav_initialized; 1193 static int ldav_initialized;
1185 static int ldav_channel; 1194 static int ldav_channel;
1186 #ifdef LOAD_AVE_TYPE 1195 #ifdef LOAD_AVE_TYPE
1187 #ifndef VMS 1196 #ifndef VMS
1188 static struct nlist ldav_nl[2]; 1197 static struct nlist ldav_nl[2];
1190 #endif /* LOAD_AVE_TYPE */ 1199 #endif /* LOAD_AVE_TYPE */
1191 1200
1192 #define channel ldav_channel 1201 #define channel ldav_channel
1193 #define initialized ldav_initialized 1202 #define initialized ldav_initialized
1194 #define nl ldav_nl 1203 #define nl ldav_nl
1204 #endif /* Not DGUX */
1195 1205
1196 DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0, 1206 DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0,
1197 "Return list of 1 minute, 5 minute and 15 minute load averages.\n\ 1207 "Return list of 1 minute, 5 minute and 15 minute load averages.\n\
1198 Each of the three load averages is multiplied by 100,\n\ 1208 Each of the three load averages is multiplied by 100,\n\
1199 then converted to integer.") 1209 then converted to integer.")
1200 () 1210 ()
1201 { 1211 {
1212 #ifdef DGUX
1213 /* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */
1214 load_info.one_minute = 0.0; /* just in case there is an error */
1215 load_info.five_minute = 0.0;
1216 load_info.fifteen_minute = 0.0;
1217 dg_sys_info (&load_info, DG_SYS_INFO_LOAD_INFO_TYPE,
1218 DG_SYS_INFO_LOAD_VERSION_0);
1219
1220 return Fcons (make_number ((int)(load_info.one_minute * 100.0)),
1221 Fcons (make_number ((int)(load_info.five_minute * 100.0)),
1222 Fcons (make_number ((int)(load_info.fifteen_minute * 100.0)),
1223 Qnil)));
1224 #else /* not DGUX */
1202 #ifndef LOAD_AVE_TYPE 1225 #ifndef LOAD_AVE_TYPE
1203 error ("load-average not implemented for this operating system"); 1226 error ("load-average not implemented for this operating system");
1204 1227
1205 #else /* LOAD_AVE_TYPE defined */ 1228 #else /* LOAD_AVE_TYPE defined */
1206 1229
1318 return Fcons (make_number (LOAD_AVE_CVT (load_ave[0])), 1341 return Fcons (make_number (LOAD_AVE_CVT (load_ave[0])),
1319 Fcons (make_number (LOAD_AVE_CVT (load_ave[1])), 1342 Fcons (make_number (LOAD_AVE_CVT (load_ave[1])),
1320 Fcons (make_number (LOAD_AVE_CVT (load_ave[2])), 1343 Fcons (make_number (LOAD_AVE_CVT (load_ave[2])),
1321 Qnil))); 1344 Qnil)));
1322 #endif /* LOAD_AVE_TYPE */ 1345 #endif /* LOAD_AVE_TYPE */
1346 #endif /* not DGUX */
1323 } 1347 }
1324 1348
1325 #undef channel 1349 #undef channel
1326 #undef initialized 1350 #undef initialized
1327 #undef nl 1351 #undef nl