plymouth on ppc patch

Hollis Blanchard hollis at penguinppc.org
Sun Dec 26 05:28:50 UTC 2010


The getpagesize() man page clearly explains why the original code
should not be using PAGE_SIZE. However, it also says getpagesize()
itself is deprecated and instead you should use sysconf(_SC_PAGESIZE).

-Hollis

On Sat, Dec 25, 2010 at 3:30 PM, Adrian Reber <adrian at lisas.de> wrote:
> To build plymouth (plymouth-0.8.4-0.20101119.2) on ppc I had to create
> following patch. Before sending it to the maintainer I wanted to present
> it here to make sure it is the correct way to fix it.
>
> PAGE_SIZE seems to be not defined on ppc and following patch fixes
> building plymouth:
>
> @@ -46,7 +46,7 @@
>  #include <time.h>
>  #include <linux/fs.h>
>  #include <linux/vt.h>
> -
> +#include <unistd.h>
>  #include <dlfcn.h>
>
>  #include "ply-logger.h"
> @@ -971,6 +971,7 @@
>   char *command_line;
>   ssize_t bytes_read;
>   int fd;
> +  int ps;
>   ssize_t i;
>
>   path = NULL;
> @@ -986,8 +987,9 @@
>       goto error;
>     }
>
> -  command_line = calloc (PAGE_SIZE, sizeof (char));
> -  bytes_read = read (fd, command_line, PAGE_SIZE - 1);
> +  ps = getpagesize();
> +  command_line = calloc (ps, sizeof (char));
> +  bytes_read = read (fd, command_line, ps - 1);
>   if (bytes_read < 0)
>     {
>       ply_trace ("Could not read %s: %m", path);
>
> Is that the correct way to solve it?
>
>                Adrian
>
> _______________________________________________
> Fedora-ppc mailing list
> Fedora-ppc at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/fedora-ppc
>




More information about the ppc mailing list