Mailing List Archive

mkdep patch
Hi!
I'm using 4-cpu sparc server with solaris to cross compile linux kernels for
sparc station (which is slow).
I encountered a problem with mkdep failing on certain files. It seems to be
caused by the fact that solaris (2.5) does not allow to map into memory more
than size of the file rounded up to page boundary. Thus files with size from
N*pagesize-3 to N*pagesize cause mkdep to fail.
The following patch fixes the problem for me. It relies on the fact that
aligned word does not cross page boundary.
--- mkdep.c.1 Thu Dec 24 19:32:20 1998
+++ mkdep.c Thu Dec 24 19:37:16 1998
@@ -208,9 +208,9 @@
#define GETNEXT { \
next_byte(__buf); \
if ((unsigned long) next % sizeof(unsigned long) == 0) { \
- __buf = * (unsigned long *) next; \
- if (!__buf) \
+ if (next >= end) \
break; \
+ __buf = * (unsigned long *) next; \
} \
next++; \
}
@@ -249,7 +249,7 @@
* per memory read. The MAX6 and MIN6 tests dispose of most
* input characters with 1 or 2 comparisons.
*/
-void state_machine(const char * map)
+void state_machine(const char * map, const char * end)
{
const char * next = map;
const char * map_dot;
@@ -441,7 +441,7 @@
return;
}

- mapsize = st.st_size + 2*sizeof(unsigned long);
+ mapsize = st.st_size;
mapsize = (mapsize+pagesizem1) & ~pagesizem1;
map = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, fd, 0);
if ((long) map == -1) {
@@ -457,7 +457,7 @@

hasdep = 0;
clear_config();
- state_machine(map);
+ state_machine(map, map+st.st_size);
if (hasdep)
puts(command);

Alexander.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
Re: mkdep patch [ In reply to ]
On Tue, Jan 05, 1999 at 07:47:09PM +0300, Alexander V. Lukyanov wrote:
> I encountered a problem with mkdep failing on certain files. It seems to be
> caused by the fact that solaris (2.5) does not allow to map into memory more
> than size of the file rounded up to page boundary. Thus files with size from
> N*pagesize-3 to N*pagesize cause mkdep to fail.
It's hits other Unices at least from the SysV family as well. When I
reported this last Ulrich Drepper sent me cites from standard specs which
indicate that Linux's mmap(2) behaviour is wrong; it should behave like
SysV's in that respect.
Ralf
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/