Mercurial > emacs
comparison src/getloadavg.c @ 97019:853e0fcfb3f7
(nl): Rename to name_list to avoid ncurses.h clash (bug#86).
(getloadavg): Callers changed.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Fri, 25 Jul 2008 18:05:01 +0000 |
parents | ade33f1b986e |
children | e038c1a8307c |
comparison
equal
deleted
inserted
replaced
97018:e69df42acc7c | 97019:853e0fcfb3f7 |
---|---|
488 static int getloadavg_initialized; | 488 static int getloadavg_initialized; |
489 /* Offset in kmem to seek to read load average, or 0 means invalid. */ | 489 /* Offset in kmem to seek to read load average, or 0 means invalid. */ |
490 static long offset; | 490 static long offset; |
491 | 491 |
492 # if !defined(VMS) && !defined(sgi) && !defined(__linux__) | 492 # if !defined(VMS) && !defined(sgi) && !defined(__linux__) |
493 static struct nlist nl[2]; | 493 static struct nlist name_list[2]; |
494 # endif /* Not VMS or sgi */ | 494 # endif /* Not VMS or sgi */ |
495 | 495 |
496 # ifdef SUNOS_5 | 496 # ifdef SUNOS_5 |
497 static kvm_t *kd; | 497 static kvm_t *kd; |
498 # endif /* SUNOS_5 */ | 498 # endif /* SUNOS_5 */ |
878 /* Get the address of LDAV_SYMBOL. */ | 878 /* Get the address of LDAV_SYMBOL. */ |
879 if (offset == 0) | 879 if (offset == 0) |
880 { | 880 { |
881 # ifndef sgi | 881 # ifndef sgi |
882 # ifndef NLIST_STRUCT | 882 # ifndef NLIST_STRUCT |
883 strcpy (nl[0].n_name, LDAV_SYMBOL); | 883 strcpy (name_list[0].n_name, LDAV_SYMBOL); |
884 strcpy (nl[1].n_name, ""); | 884 strcpy (name_list[1].n_name, ""); |
885 # else /* NLIST_STRUCT */ | 885 # else /* NLIST_STRUCT */ |
886 # ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME | 886 # ifdef HAVE_STRUCT_NLIST_N_UN_N_NAME |
887 nl[0].n_un.n_name = LDAV_SYMBOL; | 887 name_list[0].n_un.n_name = LDAV_SYMBOL; |
888 nl[1].n_un.n_name = 0; | 888 name_list[1].n_un.n_name = 0; |
889 # else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ | 889 # else /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ |
890 nl[0].n_name = LDAV_SYMBOL; | 890 name_list[0].n_name = LDAV_SYMBOL; |
891 nl[1].n_name = 0; | 891 name_list[1].n_name = 0; |
892 # endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ | 892 # endif /* not HAVE_STRUCT_NLIST_N_UN_N_NAME */ |
893 # endif /* NLIST_STRUCT */ | 893 # endif /* NLIST_STRUCT */ |
894 | 894 |
895 # ifndef SUNOS_5 | 895 # ifndef SUNOS_5 |
896 if ( | 896 if ( |
897 # if !(defined (_AIX) && !defined (ps2)) | 897 # if !(defined (_AIX) && !defined (ps2)) |
898 nlist (KERNEL_FILE, nl) | 898 nlist (KERNEL_FILE, name_list) |
899 # else /* _AIX */ | 899 # else /* _AIX */ |
900 knlist (nl, 1, sizeof (nl[0])) | 900 knlist (name_list, 1, sizeof (name_list[0])) |
901 # endif | 901 # endif |
902 >= 0) | 902 >= 0) |
903 /* Omit "&& nl[0].n_type != 0 " -- it breaks on Sun386i. */ | 903 /* Omit "&& name_list[0].n_type != 0 " -- it breaks on Sun386i. */ |
904 { | 904 { |
905 # ifdef FIXUP_KERNEL_SYMBOL_ADDR | 905 # ifdef FIXUP_KERNEL_SYMBOL_ADDR |
906 FIXUP_KERNEL_SYMBOL_ADDR (nl); | 906 FIXUP_KERNEL_SYMBOL_ADDR (name_list); |
907 # endif | 907 # endif |
908 offset = nl[0].n_value; | 908 offset = name_list[0].n_value; |
909 } | 909 } |
910 # endif /* !SUNOS_5 */ | 910 # endif /* !SUNOS_5 */ |
911 # else /* sgi */ | 911 # else /* sgi */ |
912 int ldav_off; | 912 int ldav_off; |
913 | 913 |
939 to use the currently running kernel. */ | 939 to use the currently running kernel. */ |
940 kd = kvm_open (0, 0, 0, O_RDONLY, 0); | 940 kd = kvm_open (0, 0, 0, O_RDONLY, 0); |
941 if (kd != 0) | 941 if (kd != 0) |
942 { | 942 { |
943 /* nlist the currently running kernel. */ | 943 /* nlist the currently running kernel. */ |
944 kvm_nlist (kd, nl); | 944 kvm_nlist (kd, name_list); |
945 offset = nl[0].n_value; | 945 offset = name_list[0].n_value; |
946 getloadavg_initialized = 1; | 946 getloadavg_initialized = 1; |
947 } | 947 } |
948 # endif /* SUNOS_5 */ | 948 # endif /* SUNOS_5 */ |
949 } | 949 } |
950 | 950 |