This is the mail archive of the ecos-patches@sourceware.org mailing list for the eCos 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] |
On Sat, Nov 05, 2005 at 06:46:52PM +0100, Andrew Lunn wrote: > > So how about cyg_hal_sys_ftok() ? > > Im working on it, but it crashes horribly, becasue it corrupts the > stack. > > It looks like your implementations of cyg_hal_sys_?stat() are passing > the wrong structure to the kernel. So i first need to fix this before > i can test your ftok() implementation. Turns out to be more interesting than i expected. First off i cleaned up the cyg_hal_sys_*stat functions. There was various breaking of naming conventions going on to start with. There are now two sets of functions: cyg_hal_sys_{old|new}*stat, which correspond to the two sets of kernel system calls. Similarly there are now struct cyg_hal_sys_{old|new}_stat structures. I've synchronised these structures with the linux 2.6.14 kernel. Looking at http://lxr.linux.no they might will also work OK with older kernels, back to 2.0.40, but since i only have 2.6.14, thats all i've tested. So please report any breakages to me... Once stat worked i then went back to your ftok() implementation and tested it. In the patch you can find my test program. On native linux is produces: ftok("/etc/passwd",0x12)) = 0x12052e51 ftok("/etc/passwd",0x72)) = 0x72052e51 ftok("/boot/vmlinuz",0x72)) = 0x7201001a ftok("/boot/vmlinuz",0x12)) = 0x1201001a Your implementation in eCos produced: ftok("/etc/passwd",0x12)) = 0x12052e51 ftok("/etc/passwd",0x72)) = 0x72052e51 ftok("/boot/vmlinuz",0x72)) = 0x7201000d ftok("/boot/vmlinuz",0x12)) = 0x1201000d So the FreeBSD version is not compatible with the glibc version. I can imagine people wanting a native Linux application to talk to an eCos synthetic system using shared memory, semaphores, or message queues. So the keys have to be compatible. Playing around i bit more i fixed it. Doing various ls -i is became obvious that linux uses the inode of what a symbolic link points to, not the inode of the symbolic link. So changing *_lstat to *_stat and it produced compatible values. Attached is the overall patch. Andrew
Attachment:
ftok.diff
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |