sftp in chroot

I’m using QNX 6.5 and my assignment is to get sftp working with the ChrootDirectory directive. I’m wondering if anyone else had been successful doing this. I’ve overcome one challenge already. sshd requires a pipe, but in a chroot jail, there is no /dev/pipe device. The solution was to start pipe in the same chroot jail from a program running as root.

Now I can login and have some functionality, for example, if there’s a file xyz in my directory I can do this:

sftp> get /xyz

or if there is a directory abc I can do this

sftp> ls /abc

However a lot of stuff doesn’t work. For example, If my chroot jail is /usr/test then

sftp> pwd

gives

/usr/test

which is wrong, it should be /

If I do this:

sftp> ls

I get an error that /usr/test doesn’t exist.

And finally if I try

sftp> cd /abc
I get an error
Couldn’t stat remote file: No such file or directory

Clearly something is broken. Can anyone help?