Browse code

- solaris fixes: - renamed struct meminfo to mem_info due to name conflicts, fixed sc $$(atempts+1) (thanks go to Josip Gracin) - proper ISA ARCH detection on solaris (uname -p) - cosmetics: io_wait log log msg. removed

Andrei Pelinescu-Onciul authored on 25/07/2005 14:41:20
Showing 9 changed files
... ...
@@ -42,6 +42,7 @@
42 42
 #  2005-06-26  numeric OSREL & HAVE_KQUEUE added to the *BSD (andrei)
43 43
 #  2005-07-04  HAVE_DEVPOLL added to solaris (andrei)
44 44
 #  2005-07-06  gcc 4.0 optimizations support (andrei)
45
+#  2005-07-25  better solaris arch detection (andrei)
45 46
 
46 47
 
47 48
 # check if already included/exported
... ...
@@ -62,14 +63,29 @@ EXTRAVERSION = -dev14-tcp
62 62
 
63 63
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
64 64
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
65
-ARCH = $(shell uname -m |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
66
-			-e s/armv4l/arm/ -e "s/Power Macintosh/ppc/" -e "s/cobalt/mips2/" \
65
+
66
+ifeq ($(OS),solaris)
67
+	GETARCH=uname -p
68
+else
69
+	GETARCH=uname -m
70
+endif
71
+
72
+ARCH := $(shell $(GETARCH) |sed -e s/i.86/i386/ -e s/sun4u/sparc64/  \
73
+			-e s/armv4l/arm/ -e "s/Power Macintosh/ppc/" \
74
+			-e "s/cobalt/mips2/" \
67 75
 			-e s/amd64/x86_64/ )
76
+# fix sparc -> sparc64
77
+ifeq ($(ARCH),sparc)
78
+	ifeq ($(shell uname -m),sun4u)
79
+		ARCH := sparc64
80
+	endif
81
+endif
82
+
68 83
 OSREL = $(shell uname -r)
69 84
 # numerical version (good for comparisons: A.B.C => A*1000000+B*1000+C)
70 85
 OSREL_N= $(shell echo $(OSREL) | sed -e 's/^[^0-9]*//' \
71 86
 		-e 's/^\([0-9][0-9]*\(\.[0-9][0-9]*\)*\).*$$/\1/g' | \
72
-		(IFS=. read A B C ; R=0; \
87
+		(IFS=. read A B C D; R=0; \
73 88
 		[ -n "$$A" ] && R=`expr $$R \* 1000 + $$A` && \
74 89
 		[ -n "$$B" ] && R=`expr $$R \* 1000 + $$B` && \
75 90
 		[ -n "$$C" ] && R=`expr $$R \* 1000 + $$C`; echo $$R ) )
... ...
@@ -357,7 +373,7 @@ endif
357 357
 # platform dependent settings
358 358
 
359 359
 # find ld & as name (gnu or solaris)
360
-ifeq ($(ARCH), sparc64)
360
+ifeq ($(OS), solaris)
361 361
 ifeq ($(CC_NAME), gcc)
362 362
 		LDGCC=$(shell $(CC) -v 2>&1 | grep with-ld| \
363 363
 				   sed -e 's/.*--with-ld=\([^ ][^ ]*\).*/\1/' )
... ...
@@ -902,20 +918,14 @@ CFLAGS+= $(CC_EXTRA_OPTS)
902 902
 
903 903
 # setting LDFLAGS
904 904
 ifeq	($(CC_NAME), gcc)
905
-ifeq		($(ARCH), sparc64)
906
-ifeq			($(LDTYPE), solaris)
907
-					# solaris ld
908
-					LDFLAGS+=-O2 $(PROFILE)
909
-					MOD_LDFLAGS=-G $(LDFLAGS)
910
-else			
911
-					#gcc and maybe others, on solaris, with gnu ld
912
-					LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
913
-					MOD_LDFLAGS=-shared $(LDFLAGS)
914
-endif
915
-else
916
-			#gcc and maybe others
917
-			LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
918
-			MOD_LDFLAGS=-shared $(LDFLAGS)
905
+ifeq		($(LDTYPE), solaris)
906
+		# solaris ld
907
+		LDFLAGS+=-O2 $(PROFILE)
908
+		MOD_LDFLAGS=-G $(LDFLAGS)
909
+else		
910
+		#gcc and maybe others, => gnu ld
911
+		LDFLAGS+=-Wl,-O2 -Wl,-E $(PROFILE) 
912
+		MOD_LDFLAGS=-shared $(LDFLAGS)
919 913
 endif
920 914
 endif
921 915
 ifeq	($(CC_NAME), icc)
... ...
@@ -876,7 +876,7 @@ static int ps_fifo_cmd(FILE *stream, char *response_file )
876 876
 
877 877
 static int meminfo_fifo_cmd( FILE *stream, char *response_file )
878 878
 {
879
-	struct meminfo mi;
879
+	struct mem_info mi;
880 880
 	
881 881
 	if (response_file==0 || *response_file==0 ) { 
882 882
 		LOG(L_ERR, "ERROR: meminfo_fifo_cmd: null file\n");
... ...
@@ -511,11 +511,7 @@ int init_io_wait(io_wait_h* h, int max_fd, enum poll_types poll_method)
511 511
 			LOG(L_INFO, "init_io_wait: using %s as the io watch method"
512 512
 					" (auto detected)\n", poll_method_str[poll_method]);
513 513
 		}
514
-	}else{
515
-			LOG(L_INFO, "init_io_wait: using %s io watch method (forced)\n",
516
-					poll_method_str[poll_method]);
517 514
 	}
518
-
519 515
 	
520 516
 	h->poll_method=poll_method;
521 517
 	
... ...
@@ -549,7 +549,7 @@ void fm_status(struct fm_block* qm)
549 549
 
550 550
 /* fills a malloc info structure with info about the block
551 551
  * if a parameter is not supported, it will be filled with 0 */
552
-void fm_info(struct fm_block* qm, struct meminfo* info)
552
+void fm_info(struct fm_block* qm, struct mem_info* info)
553 553
 {
554 554
 	int r;
555 555
 	long total_frags;
... ...
@@ -137,7 +137,7 @@ void*  fm_realloc(struct fm_block*, void* p, unsigned long size);
137 137
 #endif
138 138
 
139 139
 void  fm_status(struct fm_block*);
140
-void  fm_info(struct fm_block*, struct meminfo*);
140
+void  fm_info(struct fm_block*, struct mem_info*);
141 141
 
142 142
 
143 143
 #endif
... ...
@@ -29,12 +29,13 @@
29 29
  * History:
30 30
  * --------
31 31
  *  2005-03-02  created (andrei)
32
+ *  2005-07-25  renamed meminfo to mem_info due to name conflict on solaris
32 33
  */
33 34
 
34 35
 #ifndef meminfo_h
35 36
 #define meminfo_h
36 37
 
37
-struct meminfo{
38
+struct mem_info{
38 39
 	unsigned long total_size;
39 40
 	unsigned long free;
40 41
 	unsigned long used;
... ...
@@ -687,7 +687,7 @@ void qm_status(struct qm_block* qm)
687 687
 
688 688
 /* fills a malloc info structure with info about the block
689 689
  * if a parameter is not supported, it will be filled with 0 */
690
-void qm_info(struct qm_block* qm, struct meminfo* info)
690
+void qm_info(struct qm_block* qm, struct mem_info* info)
691 691
 {
692 692
 	int r;
693 693
 	long total_frags;
... ...
@@ -148,7 +148,7 @@ void* qm_realloc(struct qm_block*, void* p, unsigned long size);
148 148
 #endif
149 149
 
150 150
 void  qm_status(struct qm_block*);
151
-void  qm_info(struct qm_block*, struct meminfo*);
151
+void  qm_info(struct qm_block*, struct mem_info*);
152 152
 
153 153
 
154 154
 #endif
... ...
@@ -911,7 +911,7 @@ case $1 in
911 911
 			exit 1
912 912
 		fi
913 913
 		chmod a+w $path
914
-		trap "rm $path;  clear; echo sc monitor ^C-ed; exit 1" 2
914
+		trap "rm $path;  clear; echo 'sc monitor ^C-ed'; exit 1" 2
915 915
 		attempt=0
916 916
 		if [ "$2" = "" ]; then
917 917
 		    loops=-1;
... ...
@@ -920,7 +920,7 @@ case $1 in
920 920
 		fi
921 921
 		clear
922 922
 		while [ $loops -ne $attempt ] ; do
923
-			attempt=$(($attempt + 1))
923
+			attempt=`expr $attempt + 1`
924 924
 			#clear
925 925
 			tput cup 0 0
926 926
 			print_stats $name $path $attempt