- 论坛徽章:
- 0
|
本帖最后由 libran108 于 2011-06-30 19:57 编辑
回复 4# cjaizss
# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.0 (Santiago)
# ps -ef | grep -w vim
kkk 10071 9970 0 19:37 pts/0 00:00:00 vim tmp2
root 10073 9997 0 19:37 pts/1 00:00:00 grep -w vim
strace 的输出显示vi使用了unlink删除,但因为此文件还在被vi进程打开,所以kernel不会删除该文件,vi随后写入了修改的内容,这应该是为什么inode没有变化的原因。
多谢cjaizss!!!
# strace -p 10071
Process 10071 attached - interrupt to quit
select(1, [0], NULL, [0], NULL) = 1 (in [0])
read(0, ":", 250) = 1
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "\33[?25l\33[49;122H\33[K\33[49;1H:", 26) = 26
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost -isig -icanon -echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost -isig -icanon -echo ...}) = 0
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "\33[?12l\33[?25h", 12) = 12
select(1, [0], NULL, [0], {4, 0}) = 1 (in [0], left {3, 248919})
select(1, [0], NULL, [0], NULL) = 1 (in [0])
read(0, "w", 250) = 1
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "w\33[?25l\33[?12l\33[?25h", 19) = 19
select(1, [0], NULL, [0], {4, 0}) = 1 (in [0], left {3, 632294})
select(1, [0], NULL, [0], NULL) = 1 (in [0])
read(0, "q", 250) = 1
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "q\33[?25l\33[?12l\33[?25h", 19) = 19
select(1, [0], NULL, [0], {4, 0}) = 1 (in [0], left {3, 184105})
select(1, [0], NULL, [0], NULL) = 1 (in [0])
read(0, "!", 250) = 1
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "!\33[?25l\33[?12l\33[?25h", 19) = 19
select(1, [0], NULL, [0], {4, 0}) = 1 (in [0], left {3, 248979})
select(1, [0], NULL, [0], NULL) = 1 (in [0])
read(0, "\r", 250) = 1
select(1, [0], NULL, [0], {0, 0}) = 0 (Timeout)
write(1, "\r", 1) = 1
write(1, "\33[?25l", 6) = 6
ioctl(0, SNDCTL_TMR_START or TCSETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, SNDCTL_TMR_TIMEBASE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
getcwd("/home/kkk/tmp", 4096) = 14
write(1, "\"tmp2\"", 6) = 6
stat("tmp2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
access("tmp2", W_OK) = -1 EACCES (Permission denied)
getxattr("tmp2", "system.posix_acl_access", 0x7fff65ca3770, 132) = -1 ENODATA (No data available)
stat("tmp2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("tmp2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
lstat("4913", 0x7fff65ca3a70) = -1 ENOENT (No such file or directory)
open("4913", O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW, 0100644) = 4
fchown(4, 0, 0) = -1 EPERM (Operation not permitted)
stat("4913", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
close(4) = 0
unlink("4913" = 0
open("tmp2", O_RDONLY) = 4
stat("tmp2~", 0x7fff65ca39e0) = -1 ENOENT (No such file or directory)
unlink("tmp2~" = -1 ENOENT (No such file or directory)
open("tmp2~", O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW, 0644) = 5
chmod("tmp2~", 0644) = 0
getxattr("tmp2", "security.selinux", "unconfined_u bject_r:user_home_t:s0", 255) = 37
getxattr("tmp2~", "security.selinux", "unconfined_u bject_r:user_home_t:s0", 255) = 37
read(4, "", 8192) = 0
close(5) = 0
utime("tmp2~", [2011/06/30-19:36:13, 2011/06/30-19:35:27]) = 0
setxattr("tmp2~", "system.posix_acl_access", "\x02\x00\x00\x00\x01\x00\x06\x00\xff\xff\xff\xff\x04\x00\x04\x00\xff\xff\xff\xff \x00\x04\x00\xff\xff\xff\xff", 28, 0) = 0
getxattr("tmp2", "security.selinux", "unconfined_u bject_r:user_home_t:s0", 255) = 37
getxattr("tmp2~", "security.selinux", "unconfined_u bject_r:user_home_t:s0", 255) = 37
close(4) = 0
open("tmp2", O_WRONLY|O_CREAT|O_TRUNC, 0644) = -1 EACCES (Permission denied)
lstat("tmp2", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
getuid() = 501
unlink("tmp2" = 0
open("tmp2", O_WRONLY|O_CREAT|O_TRUNC, 0644) = 4
write(4, "kkkk\n", 5) = 5
fsync(4) = 0
close(4) = 0
chmod("tmp2", 0644) = 0
write(1, " 1L, 5C written", 15) = 15
lseek(3, 0, SEEK_SET) = 0
write(3, "b0VIM 7.2\0\0\0\0\20\0\0\177_\fN\253[\10\0W'\0\0kkk\0"..., 4096) = 4096
stat("/home/kkk/tmp/tmp2", {st_mode=S_IFREG|0644, st_size=5, ...}) = 0
unlink("tmp2~" = 0
getcwd("/home/kkk/tmp", 4096) = 14
open("/home/kkk/.viminfo", O_RDONLY) = 4
stat("/home/kkk/.viminfo", {st_mode=S_IFREG|0600, st_size=600, ...}) = 0
getuid() = 501
getuid() = 501
stat("/home/kkk/.viminfo.tmp", 0x7fff65ca3d00) = -1 ENOENT (No such file or directory)
umask(0) = 02
open("/home/kkk/.viminfo.tmp", O_WRONLY|O_CREAT|O_EXCL|O_NOFOLLOW, 0600) = 5
umask(02) = 0
fcntl(5, F_GETFL) = 0x28001 (flags O_WRONLY|O_LARGEFILE|O_NOFOLLOW)
fstat(5, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc9d42ba000
lseek(5, 0, SEEK_CUR) = 0
fchown(5, 501, 501) = 0
fstat(4, {st_mode=S_IFREG|0600, st_size=600, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc9d42b9000
read(4, "# This viminfo file was generate"..., 4096) = 600
read(4, "", 4096) = 0
write(5, "# This viminfo file was generate"..., 604) = 604
close(5) = 0
munmap(0x7fc9d42ba000, 4096) = 0
close(4) = 0
munmap(0x7fc9d42b9000, 4096) = 0
stat("/home/kkk/.viminfo.tmp", {st_mode=S_IFREG|0600, st_size=604, ...}) = 0
stat("/home/kkk/.viminfo", {st_mode=S_IFREG|0600, st_size=600, ...}) = 0
unlink("/home/kkk/.viminfo" = 0
rename("/home/kkk/.viminfo.tmp", "/home/kkk/.viminfo" = 0
write(1, "\r\r\n\33[?1l\33>", 10) = 10
write(1, "\33[?12l\33[?25h\33[?1049l", 20) = 20
close(3) = 0
unlink(".tmp2.swp" = 0
exit_group(0) = ?
Process 10071 detached |
|