On Sun, Dec 14, 2008 at 11:34 PM, Sergiu Ivanov
<unlimitedscol...@gmail.com>wrote:

> [...] I
> supply the source file I used to test this thing as an attachment, so
> that there should not be ambiguities.


Please excuse my forgetfulness... The file is attached to this mail.

Also, I checked it again: the lookup simply fails, nothing is copied,
as I said in the mail.

Regards,
scolobb
/* This program must have a file called 'input' in it's working
   directory.*/

#define _GNU_SOURCE 1
#include <hurd.h>
#include <hurd/hurd_types.h>
#include <fcntl.h>
#include <stdio.h>

int
main(void)
{
  error_t err;
  size_t len;

  mach_port_t p = file_name_lookup ("input", 0, 0);
  
  char buf[256], * _buf = buf;
  len = 256;
  err = io_read (p, &_buf, &len, 0, len);

  if(err)
    printf("Could not read from the file (%X)\n", (unsigned)p);

  p = file_name_lookup_under (p, "", O_READ, 0);

  err = io_read (p, &_buf, &len, 0, len);
  if(err)
    printf("Could not read from the file (%X)\n", (unsigned)p);

  mach_port_deallocate(mach_task_self(), p);

  return 0;
}/*main*/

Reply via email to