This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: testrun.sh broken



On 08-01-2016 00:21, Andi Kleen wrote:
> 
> In recent glibc versions testrun.sh doesn't actually use the libc
> in the build directory anymore, which makes it fairly useless.
> Is that expected?
> 
> -Andi
> 

Are you sure? I just tested:

$ cat test.c
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int CopyFdToFd(int in_fd, int out_fd) {
#define kBufSize 0x10000
  static char buf[kBufSize];
  while (1) {
    ssize_t got = read(in_fd, buf, kBufSize);
    if (got > 0) {
      write(out_fd, buf, got);
    } else if (got == 0) {
      break;
    } else if (errno != EAGAIN || errno != EWOULDBLOCK || errno != EINTR) {
      fprintf(stderr, "error reading file, errno %d\n", errno);
      return -1;
    }
  }
  return 0;
}

int main ()
{
  int fd = open("/proc/self/maps", O_RDONLY);
  int res = CopyFdToFd(fd, STDOUT_FILENO);
  close(fd);
  return res;
}
$ gcc test.c -o test
$ ./testrun.sh ./test | grep libc.so
7fa9b9d75000-7fa9b9f33000 r-xp 00000000 fc:00 7997401                    /home/azanella/Projects/glibc/glibc-git-build-m64/libc.so
7fa9b9f33000-7fa9ba132000 ---p 001be000 fc:00 7997401                    /home/azanella/Projects/glibc/glibc-git-build-m64/libc.so
7fa9ba132000-7fa9ba136000 r--p 001bd000 fc:00 7997401                    /home/azanella/Projects/glibc/glibc-git-build-m64/libc.so
7fa9ba136000-7fa9ba138000 rw-p 001c1000 fc:00 7997401                    /home/azanella/Projects/glibc/glibc-git-build-m64/libc.so


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]