On Wed, May 20, 2020 at 9:29 PM Peter Zijlstra wrote:
>
> On Wed, May 20, 2020 at 09:17:45PM +0900, Masahiro Yamada wrote:
>
> > The specification [1] says this:
> >
> > "The value returned may be less than nbyte if the number of bytes
> > left in the file is less than nbyte, if the read()
On Wed, May 20, 2020 at 09:17:45PM +0900, Masahiro Yamada wrote:
> The specification [1] says this:
>
> "The value returned may be less than nbyte if the number of bytes
> left in the file is less than nbyte, if the read() request was
> interrupted by a signal, or if the file is a pipe or FIFO
On Tue, May 19, 2020 at 7:21 PM Peter Zijlstra wrote:
>
> On Sun, May 17, 2020 at 06:48:33PM +0900, Masahiro Yamada wrote:
>
> > +char *read_text_file(const char *filename)
> > +{
> > + struct stat st;
> > + int fd;
> > + char *buf;
> > +
> > + fd = open(filename, O_RDONLY);
> > +
On Sun, May 17, 2020 at 06:48:33PM +0900, Masahiro Yamada wrote:
> +char *read_text_file(const char *filename)
> +{
> + struct stat st;
> + int fd;
> + char *buf;
> +
> + fd = open(filename, O_RDONLY);
> + if (fd < 0)
> + return NULL;
> +
> + if (fstat(fd, ) <
modpost uses grab_file() to open a file, but it is not suitable for
a text file because the mmaped file is not terminated by null byte.
Actually, I see some issues for the use of grab_file().
The new helper, read_text_file() loads the whole file content into a
malloc'ed buffer, and appends a null
5 matches
Mail list logo