annotate mule-doc/NeXT.jp @ 160:1c55655d6702

Added tag r20-3b6 for changeset 3bb7ccffb0c0
author cvs
date Mon, 13 Aug 2007 09:41:47 +0200
parents 131b0175ea99
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 This is an article posted to Mule mailing-list by Yoshiyuki Akiba.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2 It describes what changes were necessary to install Mule on NeXT.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
3 Since the current Mule has already been patched for NeXT,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
4 all you have to do is (in config.h):
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5 #include <s-bsd4-3.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 #include <m-NeXT.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
7
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8 ============================================================
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9 Date: Fri, 12 Jun 92 10:22:51 JST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10 From: akiba@cbs.canon.co.jp (Yoshiyuki Akiba)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11 Return-Path: <akiba@cbs.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 To: mule@etl.go.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 In-Reply-To: Yoshiyuki Akiba's message of Thu, 4 Jun 92 10:00:35 JST <9206040100.AA17372@scarab.cbs.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14 Subject: Patch for NeXT (Re: GNUS cause SEGV on NeXT)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 *$B$*$7$^$$$K(BNeXT$BMQ$N%Q%C%A(B(shar$B7A<0(B)$B$,$D$$$F$$$^$9(B*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19 >>>>> akiba@cbs.canon.co.jp (Yoshiyuki Akiba) writes:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20 akiba> $B:#=5$O$A$g$C$H!";~4V$,$H$l$^$;$s$,!"Mh=5Cf$K$OK\7o$NBP:v$b4^(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21 akiba> $B$a$F(BNeXT$BMQ%Q%C%A%-%C%H$r$*FO$1$G$-$k$H;W$$$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 NeXT$B>e$G(BGNUS$B$r5/F0$9$k$H(Bsegmentation fault$B$r5/$3$9860x$,(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24 $B$o$+$j$^$7$?!#0J2<$KD4$Y$?7k2L$r$^$H$a$F$*$-$^$9!#$*$7$^(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25 $B$$$K!"(Bmule$B$r(BNeXT$B>e$GF0$+$9$?$a$N%Q%C%A$r$D$1$F$*$-$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27 $B%-%d%N%s3t<02q<R(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 $B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29 $B=)MU4nG7(B akiba@cbs.canon.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31 -----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
32 [GNUS$B$,F0$+$J$+$C$?$o$1(B]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
33
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
34 GNUS$B$,(Bsegmentation fault$B$r5/$3$9860x$O(Bdump$B$7$?$"$H$N(Bmule
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
35 (xemacs)$B$,(Bdump$BA0(B(temacs)$B$H0[$J$k%>!<%s$r;HMQ$7$F$?$?$a$G(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
36 $B$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
37
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
38 [$B%>!<%s$H$O(B]
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
39
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
40 NeXT$B$O%a%b%j3dEv$r%>!<%s$H$$$&C10L$G4IM}$7$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
41 NXCreateZone()$B$G%>!<%s$r:n$j!"(BNXZoneMalloc()$B$G%>!<%s$+$i(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
42 $B%a%b%j%V%m%C%/$r3d$jEv$F$^$9!#4XO"$N?<$$%*%V%8%'%/%H$rF1(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
43 $B0l$N%>!<%s$K$^$H$a$k$3$H$G%Z!<%8%U%)!<%k%H$r8:$i$9$J$I%Q(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
44 $B%U%)!<%^%s%9$N8~>e$KMxMQ$G$-$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
45 malloc(size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
46 $B$O!"$*$*$h$=(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
47 NXZoneMalloc(NXDefaultMallocZone(),size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
48 $B$HEy2A$G$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
49
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
50 malloc()$B$O(BNXDefaultMallocZone()$B$+$i%a%b%j%V%m%C%/$r3MF@(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
51 $B$7$^$9!#6u$-%V%m%C%/$O%>!<%s$4$H$KBg$-$5$H%V%m%C%/$X$N%](B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
52 $B%$%s%?$,J]B8$5$l$F$$$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
53
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
54 realloc()$B$N:]$K8eB3$K==J,$JBg$-$5$N6u$-%V%m%C%/$,$"$k>l(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
55 $B9g!"$3$N6u$-%V%m%C%/$r;H$C$F;XDj$5$l$?%V%m%C%/$r3HD%$7$^(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
56 $B$9!#6u$-%V%m%C%/$NBg$-$5$rJQ99$7$?>l9g%>!<%s$4$H$K4IM}$5(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
57 $B$l$F$$$k6u$-%V%m%C%/$N>pJs$r99?7$7$h$&$H$7$^$9!#(Bdump$BA0$K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
58 $B$G$-$?6u$-%V%m%C%/$r!"(Bdump$B8e$K(Brealloc()$B$,;H$*$&$H$7$?>l(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
59 $B9g!"K\MhB0$7$F$$$k%>!<%s$H0[$J$k%>!<%s$N6u$-%V%m%C%/>pJs(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
60 $B$r99?7$9$k$3$H$K$J$C$F:#2s$N$h$&$J>I>u$,5/$-$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
61
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
62 $B$=$3$G!"(BNXCreateZone()$B$G(Bemacs$BMQ$N(Bzone$B$r:n$C$F!"(Bdump$BA08e(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
63 $B$GF1$8%>!<%s$r;H$&$h$&$K$7$^$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
64
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
65 dump$BD>A0$N(BNXDefaultMallocZone()$B$r(Bdump$B8e$K%j%9%H%"$G$-$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
66 $B$HNI$$$N$G$9$,!"(Bcrt0.o$B$NItJ,$K$"$k=i4|2=ItJ,$G?7$?$J%>!<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
67 $B%s$,:n$i$l$F$$$k$N$G!"%j%9%H%"$G$-$k$H$7$F$b(Bcrt0$B$r:n$jD>(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
68 $B$9$3$H$K$J$C$FLLE]$J$N$G!":#2s$NJ}K!$r$H$j$^$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
69
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
70 *$B%Q%C%A$N;H$$J}(B*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
71
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
72 1. m-NeXT.h,unexNeXT.c$B$r%=!<%9$N%G%#%l%/%H%j$K0\F0(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
73 2. patch-for-NeXT$B$G%Q%C%A$r$"$F$k(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
74 3. s-bsd4-3.h,m-NeXT.h$B$r$D$+$C$F(Bmake$B$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
75
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
76 $B0J2<$K!"%Q%C%A$K$h$k=$@5$N<g$JE@$r$"$2$F$*$-$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
77
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
78 1) NeXT$B$GF0$/$h$&$K$7$?(B:-)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
79
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
80 unexNeXT.c$B$G(BMach-O$B%U%)!<%^%C%H$G(Bdump$B$G$-$k$h$&$K$7$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
81
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
82 2) malloc,realloc,free$B$r(BNXZone{Mallo,Realloc,Free}$B$GCV$-49$($?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
83
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
84 malloc$B4X?t72$N;HMQ$9$k%>!<%s$r(Bdump$B8e$K%j%9%H%"$G$-$J$$$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
85 $B$a@lMQ$N%>!<%s$r;HMQ$9$k$h$&$K$7$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
86
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
87 3) load-average$B$,@5$7$$CM$rJV$9$h$&$K$7$?(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
88
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
89 processor_set_info()$B$G%m!<%I%"%Y%l!<%8$r<h$j=P$;$k$N$G$3(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
90 $B$l$r;HMQ$7$?(B(kmem$B%0%k!<%W$N%Q!<%_%C%7%g%s$NI,MW$J$7(B)$B!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
91 m-NeXT.h$B$G(BLOAD_AVE_MACH$B$r(Bundef$B$9$l$P=>MhDL$jJ}K!$G%m!<%I(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
92 $B%"%Y%l!<%8$r(B/dev/kmem$B$+$iFI$_$@$=$&$H$9$k!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
93
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
94 3)$B$J$I!"$I$&$G$b$$$$$3$H$G$9$,!":n$C$F$_$^$7$?!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
95 LOAD_AVE_CVT()$B$b0l1~(B($B$*$=$i$/(B:-)$B@5$7$$Dj5A$K$7$F$"$j$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
96
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
97 #!/bin/sh
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
98 # This is a shell archive (produced by shar 3.49)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
99 # To extract the files from this archive, save it to a file, remove
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
100 # everything above the "!/bin/sh" line above, and type "sh file_name".
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
101 #
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
102 # made 06/09/1992 00:49 UTC by akiba@scarab
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
103 # Source directory /clients/UnderConstruction/mule-0.9.4/src
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
104 #
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
105 # existing files will NOT be overwritten unless -c is specified
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
106 #
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
107 # This shar contains:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
108 # length mode name
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
109 # ------ ---------- ------------------------------------------
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
110 # 2819 -rw-r--r-- m-NeXT.h
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
111 # 8482 -rw-r--r-- unexNeXT.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
112 # 5202 -rw-r--r-- patch-for-NeXT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
113 #
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
114 # ============= m-NeXT.h ==============
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
115 if test -f 'm-NeXT.h' -a X"$1" != X"-c"; then
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
116 echo 'x - skipping m-NeXT.h (File already exists)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
117 else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
118 echo 'x - extracting m-NeXT.h (Text)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
119 sed 's/^X//' << 'SHAR_EOF' > 'm-NeXT.h' &&
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
120 /* Configuration file for the NeXT machine. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
121 /* Copyright (C) 1985, 1986 Free Software Foundation, Inc.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
122 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
123 This file is part of GNU Emacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
124 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
125 GNU Emacs is distributed in the hope that it will be useful,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
126 but WITHOUT ANY WARRANTY. No author or distributor
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
127 accepts responsibility to anyone for the consequences of using it
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
128 or for whether it serves any particular purpose or works at all,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
129 unless he says so in writing. Refer to the GNU Emacs General Public
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
130 License for full details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
131 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
132 Everyone is granted permission to copy, modify and redistribute
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
133 GNU Emacs, but only under the conditions described in the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
134 GNU Emacs General Public License. A copy of this license is
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
135 supposed to have been given to you along with GNU Emacs so you
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
136 can know your rights and responsibilities. It should be in a
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
137 file named COPYING. Among other things, the copyright notice
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
138 and this notice must be preserved on all copies. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
139 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
140 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
141 /* The following three symbols give information on
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
142 X the size of various data types. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
143 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
144 #define SHORTBITS 16 /* Number of bits in a short */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
145 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
146 #define INTBITS 32 /* Number of bits in an int */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
147 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
148 #define LONGBITS 32 /* Number of bits in a long */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
149 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
150 /* 68000 has lowest-numbered byte as most significant */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
151 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
152 #define BIG_ENDIAN
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
153 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
154 /* Define how to take a char and sign-extend into an int.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
155 X On machines where char is signed, this is a no-op. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
156 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
157 #define SIGN_EXTEND_CHAR(c) (c)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
158 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
159 /* Say this machine is a 68000 */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
160 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
161 #ifndef m68000
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
162 #define m68000
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
163 #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
164 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
165 /* Use type int rather than a union, to represent Lisp_Object */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
166 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
167 #define NO_UNION_TYPE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
168 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
169 /* XINT must explicitly sign-extend */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
170 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
171 #define EXPLICIT_SIGN_EXTEND
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
172 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
173 #define LIB_STANDARD -lsys_s
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
174 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
175 /* define LOAD_AVE_MACH, load average to be obtained from other than kmem */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
176 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
177 #define LOAD_AVE_MACH
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
178 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
179 /* Data type of load average, as read out of kmem. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
180 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
181 #define LOAD_AVE_TYPE long
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
182 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
183 /* Convert that into an integer that is 100 for a load average of 1.0 */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
184 #define LSCALE 1000 /* defined in <sys/kernel.h> */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
185 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / LSCALE)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
186 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
187 /* KERNEL_FILE conflicts with some system header files */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
188 #undef KERNEL_FILE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
189 #define KERN_FILE "/mach"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
190 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
191 #define environ _environ
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
192 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
193 #define NO_REMAP
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
194 #define UNEXEC unexNeXT.o
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
195 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
196 /* not used in unexNeXT.c */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
197 #define TEXT_START 0 /* wrong: but nobody uses it anyway */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
198 #define TEXT_END get_etext()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
199 #define DATA_END get_edata()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
200 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
201 #define HAVE_ALLOCA
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
202 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
203 #define SYSTEM_MALLOC
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
204 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
205 /* shoud be in s-mach.h */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
206 #define LD_SWITCH_SYSTEM -X -noseglinkedit
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
207 #define C_SWITCH_SYSTEM -bsd
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
208 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
209 /* not to be included in ymakefile */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
210 #ifdef emacs
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
211 #include <zone.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
212 extern NXZone *emacszone;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
213 #define malloc(size) NXZoneMalloc(emacszone,size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
214 #define realloc(ptr,size) NXZoneRealloc(emacszone,ptr,size)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
215 #define free(ptr) NXZoneFree(emacszone,ptr)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
216 #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
217 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
218 /* quick hack */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
219 #define READ_BUF_SIZE (1024*128)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
220 #define ZONESIZE 128
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
221 SHAR_EOF
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
222 chmod 0644 m-NeXT.h ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
223 echo 'restore of m-NeXT.h failed'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
224 Wc_c="`wc -c < 'm-NeXT.h'`"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
225 test 2819 -eq "$Wc_c" ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
226 echo 'm-NeXT.h: original size 2819, current size' "$Wc_c"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
227 fi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
228 # ============= unexNeXT.c ==============
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
229 if test -f 'unexNeXT.c' -a X"$1" != X"-c"; then
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
230 echo 'x - skipping unexNeXT.c (File already exists)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
231 else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
232 echo 'x - extracting unexNeXT.c (Text)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
233 sed 's/^X//' << 'SHAR_EOF' > 'unexNeXT.c' &&
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
234 /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
235 X * unexec for the NeXT Mach environment.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
236 X *
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
237 X * Bradley Taylor (btaylor@NeXT.COM)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
238 X * February 28, 1990
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
239 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
240 #ifdef NeXT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
241 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
242 #undef __STRICT_BSD__
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
243 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
244 #include <stdio.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
245 #include <stdlib.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
246 #include <stdarg.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
247 #include <mach.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
248 #include <sys/loader.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
249 #include <sys/file.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
250 #include <sys/stat.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
251 #include <libc.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
252 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
253 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
254 extern struct section *getsectbyname(char *, char *);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
255 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
256 /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
257 X * Kludge: we don't expect any program data beyond VM_HIGHDATA
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
258 X * What is really needed is a way to find out from malloc() which
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
259 X * pages it vm_allocated and write only those out into the data segment.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
260 X *
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
261 X * This kludge may break when we stop using fixed virtual address
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
262 X * shared libraries. Actually, emacs will probably continue working, but be
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
263 X * much larger on disk than it needs to be (because non-malloced data will
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
264 X * be in the file).
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
265 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
266 static const unsigned VM_HIGHDATA = 0x2000000;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
267 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
268 typedef struct region_t {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
269 X vm_address_t address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
270 X vm_size_t size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
271 X vm_prot_t protection;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
272 X vm_prot_t max_protection;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
273 X vm_inherit_t inheritance;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
274 X boolean_t shared;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
275 X port_t object_name;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
276 X vm_offset_t offset;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
277 } region_t;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
278 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
279 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
280 static void
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
281 grow(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
282 X struct load_command ***the_commands,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
283 X unsigned *the_commands_len
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
284 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
285 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
286 X if (*the_commands == NULL) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
287 X *the_commands_len = 1;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
288 X *the_commands = malloc(sizeof(*the_commands));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
289 X } else {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
290 X (*the_commands_len)++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
291 X *the_commands = realloc(*the_commands,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
292 X (*the_commands_len *
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
293 X sizeof(**the_commands)));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
294 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
295 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
296 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
297 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
298 static void
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
299 save_command(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
300 X struct load_command *command,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
301 X struct load_command ***the_commands,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
302 X unsigned *the_commands_len
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
303 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
304 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
305 X struct load_command **tmp;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
306 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
307 X grow(the_commands, the_commands_len);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
308 X tmp = &(*the_commands)[*the_commands_len - 1];
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
309 X *tmp = malloc(command->cmdsize);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
310 X bcopy(command, *tmp, command->cmdsize);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
311 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
312 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
313 static void
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
314 fatal_unexec(char *format, ...)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
315 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
316 X va_list ap;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
317 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
318 X va_start(ap, format);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
319 X fprintf(stderr, "unexec: ");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
320 X vfprintf(stderr, format, ap);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
321 X fprintf(stderr, "\n");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
322 X va_end(ap);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
323 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
324 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
325 static int
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
326 read_macho(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
327 X int fd,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
328 X struct mach_header *the_header,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
329 X struct load_command ***the_commands,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
330 X unsigned *the_commands_len
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
331 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
332 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
333 X struct load_command command;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
334 X struct load_command *buf;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
335 X int i;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
336 X int size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
337 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
338 X if (read(fd, the_header, sizeof(*the_header)) != sizeof(*the_header)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
339 X fatal_unexec("cannot read macho header");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
340 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
341 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
342 X for (i = 0; i < the_header->ncmds; i++) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
343 X if (read(fd, &command, sizeof(struct load_command)) !=
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
344 X sizeof(struct load_command)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
345 X fatal_unexec("cannot read macho load command header");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
346 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
347 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
348 X size = command.cmdsize - sizeof(struct load_command);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
349 X if (size < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
350 X fatal_unexec("bogus load command size");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
351 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
352 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
353 X buf = malloc(command.cmdsize);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
354 X buf->cmd = command.cmd;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
355 X buf->cmdsize = command.cmdsize;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
356 X if (read(fd, ((char *)buf +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
357 X sizeof(struct load_command)),
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
358 X size) != size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
359 X fatal_unexec("cannot read load command data");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
360 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
361 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
362 X save_command(buf, the_commands, the_commands_len);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
363 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
364 X return (1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
365 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
366 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
367 static int
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
368 filldatagap(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
369 X vm_address_t start_address,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
370 X vm_size_t *size,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
371 X vm_address_t end_address
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
372 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
373 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
374 X vm_address_t address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
375 X vm_size_t gapsize;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
376 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
377 X address = (start_address + *size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
378 X gapsize = end_address - address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
379 X *size += gapsize;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
380 X if (vm_allocate(task_self(), &address, gapsize,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
381 X FALSE) != KERN_SUCCESS) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
382 X fatal_unexec("cannot vm_allocate");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
383 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
384 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
385 X return (1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
386 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
387 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
388 static int
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
389 get_data_region(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
390 X vm_address_t *address,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
391 X vm_size_t *size
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
392 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
393 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
394 X region_t region;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
395 X kern_return_t ret;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
396 X struct section *sect;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
397 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
398 X sect = getsectbyname(SEG_DATA, SECT_DATA);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
399 X region.address = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
400 X *address = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
401 X for (;;) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
402 X ret = vm_region(task_self(),
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
403 X &region.address,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
404 X &region.size,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
405 X &region.protection,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
406 X &region.max_protection,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
407 X &region.inheritance,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
408 X &region.shared,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
409 X &region.object_name,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
410 X &region.offset);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
411 X if (ret != KERN_SUCCESS || region.address >= VM_HIGHDATA) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
412 X break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
413 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
414 X if (*address != 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
415 X if (region.address > *address + *size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
416 X if (!filldatagap(*address, size,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
417 X region.address)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
418 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
419 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
420 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
421 X *size += region.size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
422 X } else {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
423 X if (region.address == sect->addr) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
424 X *address = region.address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
425 X *size = region.size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
426 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
427 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
428 X region.address += region.size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
429 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
430 X return (1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
431 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
432 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
433 static char *
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
434 my_malloc(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
435 X vm_size_t size
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
436 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
437 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
438 X vm_address_t address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
439 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
440 X if (vm_allocate(task_self(), &address, size, TRUE) != KERN_SUCCESS) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
441 X return (NULL);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
442 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
443 X return ((char *)address);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
444 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
445 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
446 static void
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
447 my_free(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
448 X char *buf,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
449 X vm_size_t size
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
450 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
451 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
452 X vm_deallocate(task_self(), (vm_address_t)buf, size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
453 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
454 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
455 static int
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
456 unexec_doit(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
457 X int infd,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
458 X int outfd
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
459 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
460 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
461 X int i;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
462 X struct load_command **the_commands = NULL;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
463 X unsigned the_commands_len;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
464 X struct mach_header the_header;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
465 X int fgrowth;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
466 X int fdatastart;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
467 X int fdatasize;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
468 X int size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
469 X struct stat st;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
470 X char *buf;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
471 X vm_address_t data_address;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
472 X vm_size_t data_size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
473 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
474 X struct segment_command *segment;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
475 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
476 X if (!read_macho(infd, &the_header, &the_commands, &the_commands_len)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
477 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
478 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
479 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
480 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
481 X {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
482 X extern int malloc_cookie;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
483 X malloc_cookie = malloc_freezedry();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
484 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
485 X if (!get_data_region(&data_address, &data_size)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
486 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
487 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
488 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
489 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
490 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
491 X * DO NOT USE MALLOC IN THIS SECTION
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
492 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
493 X {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
494 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
495 X * Fix offsets
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
496 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
497 X for (i = 0; i < the_commands_len; i++) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
498 X switch (the_commands[i]->cmd) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
499 X case LC_SEGMENT:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
500 X segment = ((struct segment_command *)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
501 X the_commands[i]);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
502 X if (strcmp(segment->segname, SEG_DATA) == 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
503 X fdatastart = segment->fileoff;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
504 X fdatasize = segment->filesize;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
505 X fgrowth = (data_size -
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
506 X segment->filesize);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
507 X segment->vmsize = data_size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
508 X segment->filesize = data_size;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
509 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
510 X break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
511 X case LC_SYMTAB:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
512 X ((struct symtab_command *)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
513 X the_commands[i])->symoff += fgrowth;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
514 X ((struct symtab_command *)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
515 X the_commands[i])->stroff += fgrowth;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
516 X break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
517 X case LC_SYMSEG:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
518 X ((struct symseg_command *)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
519 X the_commands[i])->offset += fgrowth;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
520 X break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
521 X default:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
522 X break;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
523 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
524 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
525 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
526 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
527 X * Write header
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
528 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
529 X if (write(outfd, &the_header,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
530 X sizeof(the_header)) != sizeof(the_header)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
531 X fatal_unexec("cannot write output file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
532 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
533 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
534 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
535 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
536 X * Write commands
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
537 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
538 X for (i = 0; i < the_commands_len; i++) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
539 X if (write(outfd, the_commands[i],
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
540 X the_commands[i]->cmdsize) !=
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
541 X the_commands[i]->cmdsize) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
542 X fatal_unexec("cannot write output file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
543 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
544 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
545 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
546 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
547 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
548 X * Write original text
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
549 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
550 X if (lseek(infd, the_header.sizeofcmds + sizeof(the_header),
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
551 X L_SET) < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
552 X fatal_unexec("cannot seek input file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
553 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
554 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
555 X size = fdatastart - (sizeof(the_header) +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
556 X the_header.sizeofcmds);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
557 X buf = my_malloc(size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
558 X if (read(infd, buf, size) != size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
559 X my_free(buf, size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
560 X fatal_unexec("cannot read input file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
561 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
562 X if (write(outfd, buf, size) != size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
563 X my_free(buf, size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
564 X fatal_unexec("cannot write output file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
565 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
566 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
567 X my_free(buf, size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
568 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
569 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
570 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
571 X * Write new data
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
572 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
573 X if (write(outfd, (char *)data_address,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
574 X data_size) != data_size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
575 X fatal_unexec("cannot write output file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
576 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
577 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
578 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
579 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
580 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
581 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
582 X * OKAY TO USE MALLOC NOW
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
583 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
584 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
585 X /*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
586 X * Write rest of file
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
587 X */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
588 X fstat(infd, &st);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
589 X if (lseek(infd, fdatasize, L_INCR) < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
590 X fatal_unexec("cannot seek input file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
591 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
592 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
593 X size = st.st_size - lseek(infd, 0, L_INCR);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
594 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
595 X buf = malloc(size);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
596 X if (read(infd, buf, size) != size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
597 X free(buf);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
598 X fatal_unexec("cannot read input file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
599 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
600 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
601 X if (write(outfd, buf, size) != size) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
602 X free(buf);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
603 X fatal_unexec("cannot write output file");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
604 X return (0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
605 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
606 X free(buf);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
607 X return (1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
608 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
609 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
610 void
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
611 unexec(
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
612 X char *outfile,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
613 X char *infile
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
614 X )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
615 {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
616 X int infd;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
617 X int outfd;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
618 X char tmpbuf[L_tmpnam];
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
619 X char *tmpfile;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
620 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
621 X infd = open(infile, O_RDONLY, 0);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
622 X if (infd < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
623 X fatal_unexec("cannot open input file `%s'", infile);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
624 X exit(1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
625 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
626 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
627 X tmpnam(tmpbuf);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
628 X tmpfile = rindex(tmpbuf, '/');
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
629 X if (tmpfile == NULL) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
630 X tmpfile = tmpbuf;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
631 X } else {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
632 X tmpfile++;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
633 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
634 X outfd = open(tmpfile, O_WRONLY|O_TRUNC|O_CREAT, 0755);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
635 X if (outfd < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
636 X close(infd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
637 X fatal_unexec("cannot open tmp file `%s'", tmpfile);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
638 X exit(1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
639 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
640 X if (!unexec_doit(infd, outfd)) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
641 X close(infd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
642 X close(outfd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
643 X unlink(tmpfile);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
644 X exit(1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
645 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
646 X close(infd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
647 X close(outfd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
648 X if (rename(tmpfile, outfile) < 0) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
649 X unlink(tmpfile);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
650 X fatal_unexec("cannot rename `%s' to `%s'", tmpfile, outfile);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
651 X exit(1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
652 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
653 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
654 #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
655 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
656 SHAR_EOF
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
657 chmod 0644 unexNeXT.c ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
658 echo 'restore of unexNeXT.c failed'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
659 Wc_c="`wc -c < 'unexNeXT.c'`"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
660 test 8482 -eq "$Wc_c" ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
661 echo 'unexNeXT.c: original size 8482, current size' "$Wc_c"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
662 fi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
663 # ============= patch-for-NeXT ==============
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
664 if test -f 'patch-for-NeXT' -a X"$1" != X"-c"; then
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
665 echo 'x - skipping patch-for-NeXT (File already exists)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
666 else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
667 echo 'x - extracting patch-for-NeXT (Text)'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
668 sed 's/^X//' << 'SHAR_EOF' > 'patch-for-NeXT' &&
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
669 diff -rc tmp/mule-0.9.4/src/emacs.c mule-0.9.4/src/emacs.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
670 *** tmp/mule-0.9.4/src/emacs.c Thu May 28 16:34:57 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
671 --- mule-0.9.4/src/emacs.c Tue Jun 9 09:05:54 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
672 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
673 *** 229,234 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
674 --- 229,240 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
675 X #endif /* LINK_CRTL_SHARE */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
676 X #endif /* VMS */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
677 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
678 + #ifdef NeXT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
679 + #include <mach.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
680 + int malloc_cookie;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
681 + NXZone *emacszone;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
682 + #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
683 +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
684 X /* ARGSUSED */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
685 X main (argc, argv, envp)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
686 X int argc;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
687 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
688 *** 238,243 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
689 --- 244,260 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
690 X int skip_args = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
691 X extern int errno;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
692 X extern void malloc_warning ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
693 +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
694 + #ifdef NeXT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
695 + if (initialized) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
696 + if (malloc_jumpstart(malloc_cookie) != 0)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
697 + fatal("malloc jumpstart failed!\n");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
698 + } else {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
699 + emacszone = NXCreateZone(ZONESIZE*vm_page_size,vm_page_size,1);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
700 + if(emacszone == NX_NOZONE)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
701 + fatal("can't create emacs zone.\n");
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
702 + }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
703 + #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
704 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
705 X /* Map in shared memory, if we are using that. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
706 X #ifdef HAVE_SHM
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
707 diff -rc tmp/mule-0.9.4/src/fileio.c mule-0.9.4/src/fileio.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
708 *** tmp/mule-0.9.4/src/fileio.c Thu May 28 16:34:58 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
709 --- mule-0.9.4/src/fileio.c Mon Jun 8 18:48:52 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
710 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
711 *** 1586,1592 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
712 --- 1586,1594 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
713 X close (XFASTINT (fd));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
714 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
715 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
716 + #ifndef READ_BUF_SIZE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
717 X #define READ_BUF_SIZE 1048576 /* 92.5.28 by K.Handa */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
718 + #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
719 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
720 X DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
721 X 1, 3, 0,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
722 diff -rc tmp/mule-0.9.4/src/fns.c mule-0.9.4/src/fns.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
723 *** tmp/mule-0.9.4/src/fns.c Thu May 28 16:29:46 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
724 --- mule-0.9.4/src/fns.c Tue Jun 9 09:03:05 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
725 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
726 *** 1118,1123 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
727 --- 1118,1126 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
728 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
729 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
730 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
731 + #ifdef LOAD_AVE_MACH
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
732 + #include <mach.h>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
733 + #else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
734 X /* Avoid static vars inside a function since in HPUX they dump as pure. */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
735 X #ifdef DGUX
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
736 X static struct dg_sys_info_load_info load_info; /* what-a-mouthful! */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
737 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
738 *** 1136,1141 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
739 --- 1139,1145 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
740 X #define initialized ldav_initialized
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
741 X #define nl ldav_nl
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
742 X #endif /* Not DGUX */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
743 + #endif /* not LOAD_AVE_MACH */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
744 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
745 X DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
746 X "Return the current 1 minute, 5 minute and 15 minute load averages\n\
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
747 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
748 *** 1143,1148 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
749 --- 1147,1177 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
750 X and then turned into integers).")
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
751 X ()
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
752 X {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
753 + #ifdef LOAD_AVE_MACH
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
754 + kern_return_t error;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
755 + host_t host;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
756 + unsigned int info_count;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
757 + struct processor_set_basic_info info;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
758 + processor_set_t default_set;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
759 +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
760 + int load_ave = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
761 + /* int mach_fac = 0; mach factor(not used)*/
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
762 +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
763 + error=processor_set_default(host_self(), &default_set);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
764 + if (error==KERN_SUCCESS){
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
765 + info_count=PROCESSOR_SET_BASIC_INFO_COUNT;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
766 + error=processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
767 + &host, (processor_set_info_t)&info, &info_count);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
768 + if (error == KERN_SUCCESS) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
769 + load_ave = (int)((float)info.load_average * 100.0 / LOAD_SCALE);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
770 + /* mach_fac = (int)((float)info.mach_factor * 100.0 / LOAD_SCALE); */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
771 + }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
772 + }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
773 +
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
774 + return Fcons (make_number (load_ave),
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
775 + Fcons (make_number (load_ave),
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
776 + Fcons (make_number (load_ave), Qnil)));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
777 + #else /* not LOAD_AVE_MACH */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
778 X #ifdef DGUX
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
779 X /* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
780 X load_info.one_minute = 0.0; /* just in case there is an error */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
781 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
782 *** 1225,1237 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
783 X strcpy (nl[0].n_name, LDAV_SYMBOL);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
784 X nl[1].n_zeroes = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
785 X #else /* NLIST_STRUCT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
786 ! #ifdef convex
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
787 X nl[0].n_un.n_name = LDAV_SYMBOL;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
788 X nl[1].n_un.n_name = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
789 ! #else /* not convex */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
790 X nl[0].n_name = LDAV_SYMBOL;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
791 X nl[1].n_name = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
792 ! #endif /* not convex */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
793 X #endif /* NLIST_STRUCT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
794 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
795 X #ifdef IRIS_4D
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
796 --- 1254,1266 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
797 X strcpy (nl[0].n_name, LDAV_SYMBOL);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
798 X nl[1].n_zeroes = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
799 X #else /* NLIST_STRUCT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
800 ! #if defined(convex) || defined(NeXT)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
801 X nl[0].n_un.n_name = LDAV_SYMBOL;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
802 X nl[1].n_un.n_name = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
803 ! #else /* not convex, not NeXT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
804 X nl[0].n_name = LDAV_SYMBOL;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
805 X nl[1].n_name = 0;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
806 ! #endif /* not convex, not NeXT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
807 X #endif /* NLIST_STRUCT */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
808 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
809 X #ifdef IRIS_4D
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
810 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
811 *** 1242,1248 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
812 --- 1271,1281 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
813 X nl[0].n_value &= 0x7fffffff;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
814 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
815 X #else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
816 + #ifdef KERN_FILE
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
817 + nlist (KERN_FILE, nl);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
818 + #else
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
819 X nlist (KERNEL_FILE, nl);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
820 + #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
821 X #endif /* IRIS */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
822 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
823 X #ifdef FIXUP_KERNEL_SYMBOL_ADDR
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
824 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
825 *** 1288,1293 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
826 --- 1321,1327 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
827 X Qnil)));
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
828 X #endif /* LOAD_AVE_TYPE */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
829 X #endif /* not DGUX */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
830 + #endif /* not LOAD_AVE_MACH */
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
831 X }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
832 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
833 X #undef channel
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
834 diff -rc tmp/mule-0.9.4/src/lisp.h mule-0.9.4/src/lisp.h
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
835 *** tmp/mule-0.9.4/src/lisp.h Thu May 28 16:29:53 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
836 --- mule-0.9.4/src/lisp.h Tue Jun 9 09:08:30 1992
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
837 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
838 *** 1007,1013 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
839 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
840 X extern void debugger ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
841 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
842 ! extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
843 X extern long *xmalloc (), *xrealloc ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
844 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
845 X #ifdef MAINTAIN_ENVIRONMENT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
846 --- 1007,1016 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
847 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
848 X extern void debugger ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
849 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
850 ! #ifndef malloc
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
851 ! extern char *malloc (), *realloc ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
852 ! #endif
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
853 ! extern char *getenv (), *ctime (), *getwd ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
854 X extern long *xmalloc (), *xrealloc ();
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
855 X
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
856 X #ifdef MAINTAIN_ENVIRONMENT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
857 SHAR_EOF
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
858 chmod 0644 patch-for-NeXT ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
859 echo 'restore of patch-for-NeXT failed'
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
860 Wc_c="`wc -c < 'patch-for-NeXT'`"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
861 test 5202 -eq "$Wc_c" ||
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
862 echo 'patch-for-NeXT: original size 5202, current size' "$Wc_c"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
863 fi
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
864 exit 0
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
865
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
866 --
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
867 $B%-%d%N%s3t<02q<R(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
868 $B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
869 $B=)MU4nG7(B akiba@cbs.canon.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
870
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
871 ============================================================
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
872 Date: Mon, 15 Jun 92 10:20:23 JST
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
873 From: akiba@cbs.canon.co.jp (Yoshiyuki Akiba)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
874 Return-Path: <akiba@cbs.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
875 To: mule@etl.go.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
876 In-Reply-To: Yoshiyuki Akiba's message of Fri, 12 Jun 92 10:22:51 JST <9206120122.AA19043@scarab.cbs.canon.co.jp>
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
877 Subject: Re: Patch for NeXT
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
878
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
879
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
880 *jserver$B$b(BNeXT$B>e$GF0$+$7$?$$J}$K(B*
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
881
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
882 jserver$B$b(BNeXT$B>e$GF0$+$9$3$H$,$G$-$^$9$,!"(Bkill$B$9$k$H$-$K(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
883 PANIC $B$r5/$3$7$^$9!#860x$O!";HMQ$7$F$$$J$$%=%1%C%H$r(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
884 shutdown()$B$7$F$$$k$?$a$G$9!#<!$N%Q%C%A$G2sHr$G$-$^$9!#(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
885
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
886 (Wnn 4.03$B$N;~$N%Q%C%A$J$N$G!"$=$N$^$^$G$O$"$?$i$J$$$+$b(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
887 $BCN$l$^$;$s$,NL$,>/$J$$$N$G$3$l$G4*J[$7$F2<$5$$!#(B:-)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
888
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
889 diff -rcN Wnn/jserver/de.c wnn/jserver/de.c
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
890 *** Wnn/jserver/de.c Fri Aug 30 15:52:39 1991
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
891 --- wnn/jserver/de.c Fri Aug 30 17:26:14 1991
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
892 ***************
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
893 *** 459,465 ****
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
894 shutdown(sock_d_in, 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
895 close(sock_d_in);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
896
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
897 ! for (fd = nofile; fd >= 0; fd--) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
898 shutdown(fd, 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
899 close(fd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
900 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
901 --- 470,477 ----
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
902 shutdown(sock_d_in, 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
903 close(sock_d_in);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
904
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
905 ! for (fd = nofile-1; fd >= 0; fd--) {
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
906 ! if( (fd!=sock_d_in)&&(fd!=sock_d_un)&&sock_tst(all_socks, fd) )
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
907 shutdown(fd, 2);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
908 close(fd);
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
909 }
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
910 --
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
911 $B%-%d%N%s3t<02q<R(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
912 $B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
913 $B=)MU4nG7(B akiba@cbs.canon.co.jp
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
914