file I/O from target - VxWorks

This is a discussion on file I/O from target - VxWorks ; Hi, I'm running an RTP (VxWorks 6.6) on a PPC target. I'm trying to write out a log file from the target to a host directory. It appears the file descriptor returned is ok and when I call write() it ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: file I/O from target

  1. file I/O from target

    Hi,

    I'm running an RTP (VxWorks 6.6) on a PPC target. I'm trying to write
    out a log file from the target to a host directory. It appears the
    file descriptor returned is ok and when I call write() it returns the
    correct number of bytes. Unfortunately the file is never created.

    I'm not using NFS but just relying on using the server name. The
    location is the same as where the boot kernel resides so I know the
    target has access to it.


    const char* LOG_NAME = "myserver:~myusrid/log.txt";

    fd = open(LOG_NAME, O_CREAT | O_WRONLY);

    bytes = write(fd, "test", 4);


    Any idea why the file never gets created?

    Thanks in advance.

  2. Re: file I/O from target


    May be you need to close your file descriptor?

    Note that your booted kernel may have a different view of its
    environment from that of the bootloader and may not be able to access
    "myserver:~myusrid/log.txt" when the bootloader can.

    --
    PAD

  3. Re: file I/O from target

    Rocketman wrote:
    > Hi,
    >
    > I'm running an RTP (VxWorks 6.6) on a PPC target. I'm trying to write
    > out a log file from the target to a host directory. It appears the
    > file descriptor returned is ok and when I call write() it returns the
    > correct number of bytes. Unfortunately the file is never created.
    >
    > I'm not using NFS but just relying on using the server name. The
    > location is the same as where the boot kernel resides so I know the
    > target has access to it.
    >
    >
    > const char* LOG_NAME = "myserver:~myusrid/log.txt";
    >
    > fd = open(LOG_NAME, O_CREAT | O_WRONLY);
    >
    > bytes = write(fd, "test", 4);
    >


    I've never tried using '~' in a path under vxworks. Is your boot kernel
    also under ~myuserid?

    From the target shell, type 'devs' to check what devices it really
    knows about. See if you can cd "~myuserid" and ls. All of these should
    work from the target shell.

    Cheers,

    Iain

  4. Re: file I/O from target

    Ah, found it.

    The target only had read access to the directory. When I changed it
    to allow write access everything worked fine.
    I'm surprised I didn't get an error returned on the open()

    The name "myserver:~myusrid/log.txt" is working.

    My understanding is the ~myuserid takes you to that user's home
    directory.

    Thanks for the replies.


+ Reply to Thread