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

Bug#650667: kfreebsd-9: problems with reading of /proc/self/maps

retitle 650667 kfreebsd-9: problems with reading of /proc/self/maps


I looked into ktrace of midori, we have problem with
reading of /proc/self/maps.

The kfreebsd-8 kernel handles it sufficiently.
It is possible to read /proc/self/maps in blocks,
It is possible to read more blocks,
given /proc/self/maps is bigger than block.

The kfreebsd-9 kernel allows only read of one block.
Iff the size of /proc/self/maps is bigger, even the first read fails.

Test code is bellow, try to play with BS.
Or even by

  dd if=/proc/self/maps bs=200
  dd if=/proc/self/maps bs=2000


#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>

#define BS 128

int main()
    int i, fd;
    int sum;
    char buf[BS+1];

#if 0		// enable to enlarge /proc/self/maps

    fd = open ("/etc/hosts", O_RDONLY);

    for (i = 0; i < 100; i++)
        mmap(NULL, 4096, PROT_READ, MAP_SHARED, fd, 0);
    close (fd);

    fd = open ("/proc/self/maps", O_RDONLY);
    sum = 0;
    while ((i = read(fd, buf, BS)) > 0)
      sum += i;
      buf[i] = 0;
      printf("%s", buf);
    printf("\n\nTotal %d bytes\n", sum);

Reply to: