文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>unlink 的讨论

unlink 的讨论

时间:2010-08-18  来源:海上的帆

1,unlink is a system call, rm is a shell utility that calls unlink.
2,On some flavors of Unix, unlink can delete things that rm can't, such as
directories, if you're running as superuser
3,In the ancient past, creating a directory consisted of three steps
(now done with mkdir()):

1). create an empty directory node with mknod().
2). Link (hard) a "." entry to that directory node.
3). Link (hard) a ".." entry to the directory's parent.

Removing a directory consisted of three steps (now done with rmdir(),
which also does some type checks first):

1). unlink() the ".." entry
2). unlink() the "." entry
3). unlink() the directory itself

unlink (run as root) would remove a name entry regardless of its type.

With a combination of link() and unlink() you could do all sorts
of evil things to the directory tree by repointing "." and ".."
entries. You could also orphan subtrees that take disk space but
have no references from the outside.
相关阅读 更多 +
排行榜 更多 +
猎枪行动

猎枪行动

飞行射击 下载
导弹袭击

导弹袭击

飞行射击 下载
猫猫突围封锁要塞新手打法

猫猫突围封锁要塞新手打法

飞行射击 下载