Re: [PATCH] fixdep: faster CONFIG_ search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 24, 2016 at 07:01:08AM +0200, Sam Ravnborg wrote:
> > -	map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
> > -	if ((long) map == -1) {
> > -		perror("fixdep: mmap");
> > +	map = malloc(st.st_size + 1);
> > +	if (!map) {
> > +		perror("fixdep: malloc");
> >  		close(fd);
> >  		return;
> >  	}
> > +	if (read(fd, map, st.st_size) != st.st_size) {
> > +		perror("fixdep: read");
> > +		close(fd);
> > +		return;
> > +	}
> > +	map[st.st_size] = '\0';
> > +	close(fd);
> >  
> > -	parse_config_file(map, st.st_size);
> > -
> > -	munmap(map, st.st_size);
> > +	parse_config_file(map);
> >  
> > -	close(fd);
> > +	free(map);
> >  }
> This change is not described in the changelog..
> What is the rationale?

There is no raw memory equivalent of strstr(), so a file is made into
a string.
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux