This file is indexed.

/usr/share/xemacs21/mule-packages/etc/mule-doc/NeXT.ja is in xemacs21-mulesupport 2009.02.17.dfsg.2-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
This is an article posted to Mule mailing-list by Yoshiyuki Akiba.
It describes what changes were necessary to install Mule on NeXT.
Since the current Mule has already been patched for NeXT,
all you have to do is (in config.h):
#include <s-bsd4-3.h>
#include <m-NeXT.h>

============================================================
Date: Fri, 12 Jun 92 10:22:51 JST
From: akiba@cbs.canon.co.jp (Yoshiyuki Akiba)
Return-Path: <akiba@cbs.canon.co.jp>
To: mule@etl.go.jp
In-Reply-To: Yoshiyuki Akiba's message of Thu, 4 Jun 92 10:00:35 JST <9206040100.AA17372@scarab.cbs.canon.co.jp>
Subject: Patch for NeXT (Re: GNUS cause SEGV on NeXT)


*$B$*$7$^$$$K(BNeXT$BMQ$N%Q%C%A(B(shar$B7A<0(B)$B$,$D$$$F$$$^$9(B*

>>>>> akiba@cbs.canon.co.jp (Yoshiyuki Akiba) writes:
akiba> $B:#=5$O$A$g$C$H!";~4V$,$H$l$^$;$s$,!"Mh=5Cf$K$OK\7o$NBP:v$b4^(B
akiba> $B$a$F(BNeXT$BMQ%Q%C%A%-%C%H$r$*FO$1$G$-$k$H;W$$$^$9!#(B 

NeXT$B>e$G(BGNUS$B$r5/F0$9$k$H(Bsegmentation fault$B$r5/$3$9860x$,(B
$B$o$+$j$^$7$?!#0J2<$KD4$Y$?7k2L$r$^$H$a$F$*$-$^$9!#$*$7$^(B
$B$$$K!"(Bmule$B$r(BNeXT$B>e$GF0$+$9$?$a$N%Q%C%A$r$D$1$F$*$-$^$9!#(B 

$B%-%d%N%s3t<02q<R(B
$B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
$B=)MU4nG7(B akiba@cbs.canon.co.jp

-----
[GNUS$B$,F0$+$J$+$C$?$o$1(B]

GNUS$B$,(Bsegmentation fault$B$r5/$3$9860x$O(Bdump$B$7$?$"$H$N(Bmule
(xemacs)$B$,(Bdump$BA0(B(temacs)$B$H0[$J$k%>!<%s$r;HMQ$7$F$?$?$a$G(B
$B$7$?!#(B 

[$B%>!<%s$H$O(B]

NeXT$B$O%a%b%j3dEv$r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B:-)$B@5$7$$Dj5A$K$7$F$"$j$^$9!#(B

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 06/09/1992 00:49 UTC by akiba@scarab
# Source directory /clients/UnderConstruction/mule-0.9.4/src
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   2819 -rw-r--r-- m-NeXT.h
#   8482 -rw-r--r-- unexNeXT.c
#   5202 -rw-r--r-- patch-for-NeXT
#
# ============= m-NeXT.h ==============
if test -f 'm-NeXT.h' -a X"$1" != X"-c"; then
	echo 'x - skipping m-NeXT.h (File already exists)'
else
echo 'x - extracting m-NeXT.h (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'm-NeXT.h' &&
/* Configuration file for the NeXT machine. */
/*    Copyright (C) 1985, 1986 Free Software Foundation, Inc.
X
This file is part of GNU Emacs.
X
GNU Emacs is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY.  No author or distributor
accepts responsibility to anyone for the consequences of using it
or for whether it serves any particular purpose or works at all,
unless he says so in writing.  Refer to the GNU Emacs General Public
License for full details.
X
Everyone is granted permission to copy, modify and redistribute
GNU Emacs, but only under the conditions described in the
GNU Emacs General Public License.   A copy of this license is
supposed to have been given to you along with GNU Emacs so you
can know your rights and responsibilities.  It should be in a
file named COPYING.  Among other things, the copyright notice
and this notice must be preserved on all copies.  */
X
X
/* The following three symbols give information on
X the size of various data types.  */
X
#define SHORTBITS 16		/* Number of bits in a short */
X
#define INTBITS 32		/* Number of bits in an int */
X
#define LONGBITS 32		/* Number of bits in a long */
X
/* 68000 has lowest-numbered byte as most significant */
X
#define BIG_ENDIAN
X
/* Define how to take a char and sign-extend into an int.
X   On machines where char is signed, this is a no-op.  */
X
#define SIGN_EXTEND_CHAR(c) (c)
X
/* Say this machine is a 68000 */
X
#ifndef m68000
#define m68000
#endif
X
/* Use type int rather than a union, to represent Lisp_Object */
X
#define NO_UNION_TYPE
X
/* XINT must explicitly sign-extend */
X
#define EXPLICIT_SIGN_EXTEND
X
#define LIB_STANDARD -lsys_s
X
/* define LOAD_AVE_MACH, load average to be obtained from other than kmem */
X
#define LOAD_AVE_MACH
X
/* Data type of load average, as read out of kmem.  */
X
#define LOAD_AVE_TYPE long
X
/* Convert that into an integer that is 100 for a load average of 1.0  */
#define	LSCALE	1000		/* defined in <sys/kernel.h> */
#define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / LSCALE)
X
/* KERNEL_FILE conflicts with some system header files */
#undef	KERNEL_FILE
#define	KERN_FILE "/mach"
X
#define environ _environ
X
#define NO_REMAP
#define UNEXEC unexNeXT.o
X
/* not used in unexNeXT.c */
#define TEXT_START 0 /* wrong: but nobody uses it anyway */
#define TEXT_END get_etext()
#define DATA_END get_edata()
X
#define HAVE_ALLOCA
X
#define SYSTEM_MALLOC
X
/* shoud be in s-mach.h */
#define LD_SWITCH_SYSTEM -X -noseglinkedit
#define C_SWITCH_SYSTEM -bsd
X
/* not to be included in ymakefile */
#ifdef emacs
#include <zone.h>
extern NXZone *emacszone;
#define malloc(size) NXZoneMalloc(emacszone,size)
#define	realloc(ptr,size) NXZoneRealloc(emacszone,ptr,size)
#define free(ptr) NXZoneFree(emacszone,ptr)
#endif
X
/* quick hack */
#define	READ_BUF_SIZE (1024*128)
#define ZONESIZE 128
SHAR_EOF
chmod 0644 m-NeXT.h ||
echo 'restore of m-NeXT.h failed'
Wc_c="`wc -c < 'm-NeXT.h'`"
test 2819 -eq "$Wc_c" ||
	echo 'm-NeXT.h: original size 2819, current size' "$Wc_c"
fi
# ============= unexNeXT.c ==============
if test -f 'unexNeXT.c' -a X"$1" != X"-c"; then
	echo 'x - skipping unexNeXT.c (File already exists)'
else
echo 'x - extracting unexNeXT.c (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'unexNeXT.c' &&
/*
X * unexec for the NeXT Mach environment.
X *
X * Bradley Taylor (btaylor@NeXT.COM) 
X * February 28, 1990
X */
#ifdef NeXT
X
#undef __STRICT_BSD__
X
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <mach.h>
#include <sys/loader.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <libc.h>
X
X
extern struct section *getsectbyname(char *, char *);
X
/*
X * Kludge: we don't expect any program data beyond VM_HIGHDATA
X * What is really needed is a way to find out from malloc() which
X * pages it vm_allocated and write only those out into the data segment.
X *
X * This kludge may break when we stop using fixed virtual address
X * shared libraries. Actually, emacs will probably continue working, but be 
X * much larger on disk than it needs to be (because non-malloced data will
X * be in the file).
X */
static const unsigned VM_HIGHDATA = 0x2000000;
X
typedef struct region_t {
X	vm_address_t address;
X	vm_size_t size;
X	vm_prot_t protection;
X	vm_prot_t max_protection;
X	vm_inherit_t inheritance;
X	boolean_t shared;
X	port_t object_name;
X	vm_offset_t offset;
} region_t;
X
X
static void
grow(
X     struct load_command ***the_commands,
X     unsigned *the_commands_len
X     )
{
X	if (*the_commands == NULL) {
X		*the_commands_len = 1;
X		*the_commands = malloc(sizeof(*the_commands));
X	} else {
X		(*the_commands_len)++;
X		*the_commands = realloc(*the_commands, 
X					(*the_commands_len *
X					 sizeof(**the_commands)));
X	}
}
X
X
static void
save_command(
X	     struct load_command *command,
X	     struct load_command ***the_commands,
X	     unsigned *the_commands_len
X	     )
{
X	struct load_command **tmp;
X
X	grow(the_commands, the_commands_len);
X	tmp = &(*the_commands)[*the_commands_len - 1];
X	*tmp = malloc(command->cmdsize);
X	bcopy(command, *tmp, command->cmdsize);
}
X
static void
fatal_unexec(char *format, ...)
{
X	va_list ap;
X
X	va_start(ap, format);
X	fprintf(stderr, "unexec: ");
X	vfprintf(stderr, format, ap);
X	fprintf(stderr, "\n");
X	va_end(ap);
}
X
static int
read_macho(
X	   int fd,
X	   struct mach_header *the_header,
X	   struct load_command ***the_commands,
X	   unsigned *the_commands_len
X	   )
{
X	struct load_command command;
X	struct load_command *buf;
X	int i;
X	int size;
X
X	if (read(fd, the_header, sizeof(*the_header)) != sizeof(*the_header)) {
X		fatal_unexec("cannot read macho header");
X		return (0);
X	}
X	for (i = 0; i < the_header->ncmds; i++) {
X		if (read(fd, &command, sizeof(struct load_command)) != 
X		    sizeof(struct load_command)) {
X		  	fatal_unexec("cannot read macho load command header");
X			return (0);
X		}
X		size = command.cmdsize - sizeof(struct load_command);
X		if (size < 0) {
X		  	fatal_unexec("bogus load command size");
X			return (0);
X		}
X		buf = malloc(command.cmdsize);
X		buf->cmd = command.cmd;
X		buf->cmdsize = command.cmdsize;
X		if (read(fd, ((char *)buf + 
X			      sizeof(struct load_command)), 
X			 size) != size) {
X		  	fatal_unexec("cannot read load command data");
X			return (0);
X		}
X		save_command(buf, the_commands, the_commands_len);
X	}
X	return (1);
}
X
static int
filldatagap(
X	    vm_address_t start_address,
X	    vm_size_t *size,
X	    vm_address_t end_address
X	    )
{
X	vm_address_t address;
X	vm_size_t gapsize;
X
X	address = (start_address + *size);
X	gapsize = end_address - address;
X	*size += gapsize;
X	if (vm_allocate(task_self(), &address, gapsize,
X			FALSE) != KERN_SUCCESS) {
X		fatal_unexec("cannot vm_allocate");
X	        return (0);
X	}
X	return (1);
}
X
static int
get_data_region(
X		vm_address_t *address,
X		vm_size_t *size
X		)
{
X	region_t region;
X	kern_return_t ret;
X	struct section *sect;
X
X	sect = getsectbyname(SEG_DATA, SECT_DATA);
X	region.address = 0;
X	*address = 0;
X	for (;;) {
X		ret = vm_region(task_self(), 
X				&region.address, 
X				&region.size, 
X				&region.protection, 
X				&region.max_protection, 
X				&region.inheritance,
X				&region.shared, 
X				&region.object_name, 
X				&region.offset);
X		if (ret != KERN_SUCCESS || region.address >= VM_HIGHDATA) {
X			break;
X		}
X		if (*address != 0) {
X			if (region.address > *address + *size) {
X				if (!filldatagap(*address, size, 
X						 region.address)) {
X					return (0);
X				}
X			} 
X			*size += region.size;
X		} else {
X			if (region.address == sect->addr) {
X				*address = region.address;
X				*size = region.size;
X			} 
X		}
X		region.address += region.size;
X	}
X	return (1);
}
X
static char *
my_malloc(
X	  vm_size_t size
X	  )
{
X	vm_address_t address;
X
X	if (vm_allocate(task_self(), &address, size, TRUE) != KERN_SUCCESS) {
X		return (NULL);
X	}
X	return ((char *)address);
}
X
static void
my_free(
X	char *buf,
X	vm_size_t size
X	)
{
X	vm_deallocate(task_self(), (vm_address_t)buf, size);
}
X
static int
unexec_doit(
X	    int infd,
X	    int outfd
X	    )
{
X	int i;
X	struct load_command **the_commands = NULL;
X	unsigned the_commands_len;
X	struct mach_header the_header;
X	int fgrowth;
X	int fdatastart;
X	int fdatasize;
X	int size;
X	struct stat st;
X	char *buf;
X	vm_address_t data_address;
X	vm_size_t data_size;
X
X	struct segment_command *segment;
X
X	if (!read_macho(infd, &the_header, &the_commands, &the_commands_len)) {
X		return (0);
X	}
X
X
X	{
X	  extern int malloc_cookie;
X	  malloc_cookie = malloc_freezedry();
X	}
X	if (!get_data_region(&data_address, &data_size)) {
X		return (0);
X	}
X
X
X	/*
X	 * DO NOT USE MALLOC IN THIS SECTION
X	 */
X	{
X		/*
X		 * Fix offsets
X		 */
X		for (i = 0; i < the_commands_len; i++) {
X			switch (the_commands[i]->cmd) {
X			case LC_SEGMENT:
X				segment = ((struct segment_command *)
X					   the_commands[i]);
X				if (strcmp(segment->segname, SEG_DATA) == 0) {
X					fdatastart = segment->fileoff;
X					fdatasize = segment->filesize;
X					fgrowth = (data_size - 
X						   segment->filesize);
X					segment->vmsize = data_size;
X					segment->filesize = data_size;
X				}
X				break;
X			case LC_SYMTAB:
X				((struct symtab_command *)
X				 the_commands[i])->symoff += fgrowth;
X				((struct symtab_command *)
X				 the_commands[i])->stroff += fgrowth;
X				break;
X			case LC_SYMSEG:
X				((struct symseg_command *)
X				 the_commands[i])->offset += fgrowth;
X				break;
X			default:
X				break;
X			}
X		}
X		
X		/*
X		 * Write header
X		 */
X		if (write(outfd, &the_header, 
X			  sizeof(the_header)) != sizeof(the_header)) {
X			fatal_unexec("cannot write output file");
X			return (0);
X		}
X		
X		/*
X		 * Write commands
X		 */
X		for (i = 0; i < the_commands_len; i++) {
X			if (write(outfd, the_commands[i], 
X				  the_commands[i]->cmdsize) != 
X			    the_commands[i]->cmdsize) {
X			  	fatal_unexec("cannot write output file");
X				return (0);
X			}
X		}
X		
X		/*
X		 * Write original text
X		 */
X		if (lseek(infd, the_header.sizeofcmds + sizeof(the_header), 
X			  L_SET) < 0) {
X		  	fatal_unexec("cannot seek input file");
X			return (0);
X		}
X		size = fdatastart - (sizeof(the_header) + 
X				     the_header.sizeofcmds);
X		buf = my_malloc(size);
X		if (read(infd, buf, size) != size) {
X			my_free(buf, size);
X		  	fatal_unexec("cannot read input file");
X		}
X		if (write(outfd, buf, size) != size) {
X			my_free(buf, size);
X			fatal_unexec("cannot write output file");
X			return (0);
X		}
X		my_free(buf, size);
X		
X		
X		/*
X		 * Write new data
X		 */
X		if (write(outfd, (char *)data_address, 
X			  data_size) != data_size) {
X			fatal_unexec("cannot write output file");
X			return (0);
X		}
X		
X	}
X
X	/*
X	 * OKAY TO USE MALLOC NOW
X	 */
X
X	/*
X	 * Write rest of file
X	 */
X	fstat(infd, &st);
X	if (lseek(infd, fdatasize, L_INCR) < 0) {
X		fatal_unexec("cannot seek input file");
X		return (0);
X	}
X	size = st.st_size - lseek(infd, 0, L_INCR);
X
X	buf = malloc(size);
X	if (read(infd, buf, size) != size) {
X		free(buf);
X		fatal_unexec("cannot read input file");
X		return (0);
X	}
X	if (write(outfd, buf, size) != size) {
X		free(buf);
X		fatal_unexec("cannot write output file");
X		return (0);
X	}
X	free(buf);
X	return (1);
}
X
void
unexec(
X       char *outfile,
X       char *infile
X       )
{
X	int infd;
X	int outfd;
X	char tmpbuf[L_tmpnam];
X	char *tmpfile;
X
X	infd = open(infile, O_RDONLY, 0);
X	if (infd < 0) {
X	  	fatal_unexec("cannot open input file `%s'", infile);
X		exit(1);
X	}
X	
X	tmpnam(tmpbuf);
X	tmpfile = rindex(tmpbuf, '/');
X	if (tmpfile == NULL) {
X		tmpfile = tmpbuf;
X	} else {
X		tmpfile++;
X	}
X	outfd = open(tmpfile, O_WRONLY|O_TRUNC|O_CREAT, 0755);
X	if (outfd < 0) {
X		close(infd);
X		fatal_unexec("cannot open tmp file `%s'", tmpfile);
X		exit(1);
X	}
X	if (!unexec_doit(infd, outfd)) {
X		close(infd);
X		close(outfd);
X		unlink(tmpfile);
X		exit(1);
X	}
X	close(infd);
X	close(outfd);
X	if (rename(tmpfile, outfile) < 0) {
X		unlink(tmpfile);
X		fatal_unexec("cannot rename `%s' to `%s'", tmpfile, outfile);
X		exit(1);
X	}
}
#endif
X
SHAR_EOF
chmod 0644 unexNeXT.c ||
echo 'restore of unexNeXT.c failed'
Wc_c="`wc -c < 'unexNeXT.c'`"
test 8482 -eq "$Wc_c" ||
	echo 'unexNeXT.c: original size 8482, current size' "$Wc_c"
fi
# ============= patch-for-NeXT ==============
if test -f 'patch-for-NeXT' -a X"$1" != X"-c"; then
	echo 'x - skipping patch-for-NeXT (File already exists)'
else
echo 'x - extracting patch-for-NeXT (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'patch-for-NeXT' &&
diff -rc tmp/mule-0.9.4/src/emacs.c mule-0.9.4/src/emacs.c
*** tmp/mule-0.9.4/src/emacs.c	Thu May 28 16:34:57 1992
--- mule-0.9.4/src/emacs.c	Tue Jun  9 09:05:54 1992
***************
*** 229,234 ****
--- 229,240 ----
X  #endif /* LINK_CRTL_SHARE */
X  #endif /* VMS */
X  
+ #ifdef NeXT
+ #include <mach.h>
+ int malloc_cookie;
+ NXZone *emacszone;
+ #endif
+ 
X  /* ARGSUSED */
X  main (argc, argv, envp)
X       int argc;
***************
*** 238,243 ****
--- 244,260 ----
X    int skip_args = 0;
X    extern int errno;
X    extern void malloc_warning ();
+ 
+ #ifdef NeXT
+   if (initialized) {
+     if (malloc_jumpstart(malloc_cookie) != 0)
+       fatal("malloc jumpstart failed!\n");
+   } else {
+     emacszone = NXCreateZone(ZONESIZE*vm_page_size,vm_page_size,1);
+     if(emacszone == NX_NOZONE)
+       fatal("can't create emacs zone.\n");
+   }
+ #endif
X  
X  /* Map in shared memory, if we are using that.  */
X  #ifdef HAVE_SHM
diff -rc tmp/mule-0.9.4/src/fileio.c mule-0.9.4/src/fileio.c
*** tmp/mule-0.9.4/src/fileio.c	Thu May 28 16:34:58 1992
--- mule-0.9.4/src/fileio.c	Mon Jun  8 18:48:52 1992
***************
*** 1586,1592 ****
--- 1586,1594 ----
X    close (XFASTINT (fd));
X  }
X  
+ #ifndef READ_BUF_SIZE
X  #define READ_BUF_SIZE 1048576	/* 92.5.28 by K.Handa */
+ #endif
X  
X  DEFUN ("insert-file-contents", Finsert_file_contents, Sinsert_file_contents,
X    1, 3, 0,
diff -rc tmp/mule-0.9.4/src/fns.c mule-0.9.4/src/fns.c
*** tmp/mule-0.9.4/src/fns.c	Thu May 28 16:29:46 1992
--- mule-0.9.4/src/fns.c	Tue Jun  9 09:03:05 1992
***************
*** 1118,1123 ****
--- 1118,1126 ----
X      }
X  }
X  
+ #ifdef LOAD_AVE_MACH
+ #include <mach.h>
+ #else
X  /* Avoid static vars inside a function since in HPUX they dump as pure.  */
X  #ifdef DGUX
X  static struct dg_sys_info_load_info load_info;  /* what-a-mouthful! */
***************
*** 1136,1141 ****
--- 1139,1145 ----
X  #define initialized ldav_initialized
X  #define nl ldav_nl
X  #endif /* Not DGUX */
+ #endif /* not LOAD_AVE_MACH */
X  
X  DEFUN ("load-average", Fload_average, Sload_average, 0, 0, 0,
X    "Return the current 1 minute, 5 minute and 15 minute load averages\n\
***************
*** 1143,1148 ****
--- 1147,1177 ----
X  and then turned into integers).")
X    ()
X  {
+ #ifdef	LOAD_AVE_MACH
+    kern_return_t                    error;
+    host_t                           host;
+    unsigned int                     info_count;
+    struct processor_set_basic_info  info;
+    processor_set_t                  default_set;
+    
+    int load_ave = 0;
+ /* int mach_fac = 0; mach factor(not used)*/
+ 
+    error=processor_set_default(host_self(), &default_set);
+    if (error==KERN_SUCCESS){
+ 	info_count=PROCESSOR_SET_BASIC_INFO_COUNT;
+ 	error=processor_set_info(default_set, PROCESSOR_SET_BASIC_INFO,
+ 	   &host, (processor_set_info_t)&info, &info_count);
+ 	if (error == KERN_SUCCESS) {
+ 	   load_ave = (int)((float)info.load_average * 100.0 / LOAD_SCALE);
+ /*	   mach_fac = (int)((float)info.mach_factor  * 100.0 / LOAD_SCALE); */
+ 	}
+    }
+ 
+    return Fcons (make_number (load_ave),
+ 		Fcons (make_number (load_ave),
+ 		       Fcons (make_number (load_ave), Qnil)));
+ #else /* not LOAD_AVE_MACH */
X  #ifdef DGUX
X    /* perhaps there should be a "sys_load_avg" call in sysdep.c?! - DJB */
X    load_info.one_minute     = 0.0;	/* just in case there is an error */
***************
*** 1225,1237 ****
X        strcpy (nl[0].n_name, LDAV_SYMBOL);
X        nl[1].n_zeroes = 0;
X  #else /* NLIST_STRUCT */
! #ifdef convex
X        nl[0].n_un.n_name = LDAV_SYMBOL;
X        nl[1].n_un.n_name = 0;
! #else /* not convex */
X        nl[0].n_name = LDAV_SYMBOL;
X        nl[1].n_name = 0;
! #endif /* not convex */
X  #endif /* NLIST_STRUCT */
X  
X  #ifdef IRIS_4D
--- 1254,1266 ----
X        strcpy (nl[0].n_name, LDAV_SYMBOL);
X        nl[1].n_zeroes = 0;
X  #else /* NLIST_STRUCT */
! #if defined(convex) || defined(NeXT)
X        nl[0].n_un.n_name = LDAV_SYMBOL;
X        nl[1].n_un.n_name = 0;
! #else /* not convex, not NeXT */
X        nl[0].n_name = LDAV_SYMBOL;
X        nl[1].n_name = 0;
! #endif /* not convex, not NeXT */
X  #endif /* NLIST_STRUCT */
X  
X  #ifdef IRIS_4D
***************
*** 1242,1248 ****
--- 1271,1281 ----
X  	    nl[0].n_value &= 0x7fffffff;
X  	}
X  #else
+ #ifdef KERN_FILE
+       nlist (KERN_FILE, nl);
+ #else
X        nlist (KERNEL_FILE, nl);
+ #endif
X  #endif /* IRIS */
X  
X  #ifdef FIXUP_KERNEL_SYMBOL_ADDR
***************
*** 1288,1293 ****
--- 1321,1327 ----
X  			      Qnil)));
X  #endif /* LOAD_AVE_TYPE */
X  #endif /* not DGUX */
+ #endif /* not LOAD_AVE_MACH */
X  }
X  
X  #undef channel
diff -rc tmp/mule-0.9.4/src/lisp.h mule-0.9.4/src/lisp.h
*** tmp/mule-0.9.4/src/lisp.h	Thu May 28 16:29:53 1992
--- mule-0.9.4/src/lisp.h	Tue Jun  9 09:08:30 1992
***************
*** 1007,1013 ****
X  
X  extern void debugger ();
X  
! extern char *malloc (), *realloc (), *getenv (), *ctime (), *getwd ();
X  extern long *xmalloc (), *xrealloc ();
X  
X  #ifdef MAINTAIN_ENVIRONMENT
--- 1007,1016 ----
X  
X  extern void debugger ();
X  
! #ifndef malloc
! extern char *malloc (), *realloc ();
! #endif
! extern char *getenv (), *ctime (), *getwd ();
X  extern long *xmalloc (), *xrealloc ();
X  
X  #ifdef MAINTAIN_ENVIRONMENT
SHAR_EOF
chmod 0644 patch-for-NeXT ||
echo 'restore of patch-for-NeXT failed'
Wc_c="`wc -c < 'patch-for-NeXT'`"
test 5202 -eq "$Wc_c" ||
	echo 'patch-for-NeXT: original size 5202, current size' "$Wc_c"
fi
exit 0

--
$B%-%d%N%s3t<02q<R(B
$B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
$B=)MU4nG7(B akiba@cbs.canon.co.jp

============================================================
Date: Mon, 15 Jun 92 10:20:23 JST
From: akiba@cbs.canon.co.jp (Yoshiyuki Akiba)
Return-Path: <akiba@cbs.canon.co.jp>
To: mule@etl.go.jp
In-Reply-To: Yoshiyuki Akiba's message of Fri, 12 Jun 92 10:22:51 JST <9206120122.AA19043@scarab.cbs.canon.co.jp>
Subject: Re: Patch for NeXT


*jserver$B$b(BNeXT$B>e$GF0$+$7$?$$J}$K(B*

jserver$B$b(BNeXT$B>e$GF0$+$9$3$H$,$G$-$^$9$,!"(Bkill$B$9$k$H$-$K(B 
PANIC $B$r5/$3$7$^$9!#860x$O!";HMQ$7$F$$$J$$%=%1%C%H$r(B
shutdown()$B$7$F$$$k$?$a$G$9!#<!$N%Q%C%A$G2sHr$G$-$^$9!#(B 

(Wnn 4.03$B$N;~$N%Q%C%A$J$N$G!"$=$N$^$^$G$O$"$?$i$J$$$+$b(B
$BCN$l$^$;$s$,NL$,>/$J$$$N$G$3$l$G4*J[$7$F2<$5$$!#(B:-)

diff -rcN Wnn/jserver/de.c wnn/jserver/de.c
*** Wnn/jserver/de.c	Fri Aug 30 15:52:39 1991
--- wnn/jserver/de.c	Fri Aug 30 17:26:14 1991
***************
*** 459,465 ****
      shutdown(sock_d_in, 2);
      close(sock_d_in);
  
!     for (fd = nofile; fd >= 0; fd--) {
  	shutdown(fd, 2);
  	close(fd);
      }
--- 470,477 ----
      shutdown(sock_d_in, 2);
      close(sock_d_in);
  
!     for (fd = nofile-1; fd >= 0; fd--) {
!       if( (fd!=sock_d_in)&&(fd!=sock_d_un)&&sock_tst(all_socks, fd) )
  	shutdown(fd, 2);
  	close(fd);
      }
--
$B%-%d%N%s3t<02q<R(B
$B%3%s%T%e!<%?1~MQ%7%9%F%`5;=Q3+H/%;%s%?!<(B
$B=)MU4nG7(B akiba@cbs.canon.co.jp