Mercurial > emacs
comparison src/unexec.c @ 13107:fab67884f69a
(write_segment): Use pagesize as unit of writing instead of 128.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 03 Oct 1995 09:15:49 +0000 |
parents | 0b471201bbd4 |
children | a7e0445bd152 |
comparison
equal
deleted
inserted
replaced
13106:22011e724596 | 13107:fab67884f69a |
---|---|
1012 register char *ptr, *end; | 1012 register char *ptr, *end; |
1013 { | 1013 { |
1014 register int i, nwrite, ret; | 1014 register int i, nwrite, ret; |
1015 char buf[80]; | 1015 char buf[80]; |
1016 extern int errno; | 1016 extern int errno; |
1017 char zeros[128]; | 1017 int pagesize = getpagesize (); |
1018 | 1018 char *zeros = (char *) alloca (pagesize); |
1019 bzero (zeros, sizeof zeros); | 1019 |
1020 bzero (zeros, pagesize); | |
1020 | 1021 |
1021 for (i = 0; ptr < end;) | 1022 for (i = 0; ptr < end;) |
1022 { | 1023 { |
1023 /* distance to next multiple of 128. */ | 1024 /* distance to next multiple of pagesize. */ |
1024 nwrite = (((int) ptr + 128) & -128) - (int) ptr; | 1025 nwrite = (((int) ptr + pagesize) & -pagesize) - (int) ptr; |
1025 /* But not beyond specified end. */ | 1026 /* But not beyond specified end. */ |
1026 if (nwrite > end - ptr) nwrite = end - ptr; | 1027 if (nwrite > end - ptr) nwrite = end - ptr; |
1027 ret = write (new, ptr, nwrite); | 1028 ret = write (new, ptr, nwrite); |
1028 /* If write gets a page fault, it means we reached | 1029 /* If write gets a page fault, it means we reached |
1029 a gap between the old text segment and the old data segment. | 1030 a gap between the old text segment and the old data segment. |