rename() function
Chris Johns
chrisj at rtems.org
Wed May 18 22:15:06 UTC 2011
On 19/05/11 5:38 AM, Robert S. Grimes wrote:
> Does the rename() function really work for the IMFS? I am using 4.9/4.10
> on sparc, and the following code crashes my app immediately on entry
> into the rename() function:
>
> printf("About to call\n");
>
> rename("hello.txt", "goodby.txt");
>
> printf("rename done\n");
>
> The first printf() works, then the system crashes. And yes, the source
> file exists, and the destination does not.
>
I just tried the 4.10 branch (the to be released 4.10.1) on the SIS
simulator. For 4.10 there has been IMFS eval code changes.
chris at takapu sis $ sparc-rtems4.10-run $(find
sparc-rtems4.10/c/sis/testsuites/ -name fileio.exe)
*** FILE I/O SAMPLE AND TEST ***
=========================
RTEMS FILE I/O Test Menu
=========================
p -> part_table_initialize
f -> mount all disks in fs_table
l -> list file
r -> read file
w -> write file
s -> start shell
Enter your selection ==>s
Creating /etc/passwd and group with three useable accounts
root/pwd , test/pwd, rtems/NO PASSWORD
=========================
starting shell
=========================
RTEMS SHELL (Ver.1.0-FRC):/dev/console. May 13 2011. 'help' to list
commands.
[/] # ls
dev etc scripts
[/] # ls -las
total 0
0 drwxr-xr-x 1 root root 560 Jan 1 00:00 dev
0 drwxr-xr-x 1 root root 560 Jan 1 00:00 etc
0 drwxr-xr-x 1 root root 840 Jan 1 00:00 scripts
[/] # ls -las scripts
total 0
0 -rwxrwxrwx 1 root root 34 Jan 1 00:00 j1
0 -rw-r--r-- 1 root root 102 Jan 1 00:00 j2
0 -rwxrwxrwx 1 root root 57 Jan 1 00:00 js
[/] # mv scripts/j2 chris
[/] # ls -las
total 0
0 -rw-r--r-- 1 root root 102 Jan 1 00:00 chris
0 drwxr-xr-x 1 root root 560 Jan 1 00:00 dev
0 drwxr-xr-x 1 root root 560 Jan 1 00:00 etc
0 drwxr-xr-x 1 root root 560 Jan 1 00:00 scripts
[/] #
And the mv command implements the move I did as:
if (!rename(from, to)) {
if (vflg)
printf("%s -> %s\n", from, to);
return (0);
}
Chris
More information about the users
mailing list