Linux中可用于删除文件的系统调用 [英] System calls in Linux that can be used to delete files

查看:163
本文介绍了Linux中可用于删除文件的系统调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上可以用来删除文件的系统调用是什么?我指的不是libc-wrapper使用的系统调用(依次由命令行工具使用)。

What are the system calls that can be used to delete a file on Linux? I am not referring to just the system calls used by the libc-wrapper(which in-turn are used by command line tools).

除了 unlink unlinkat 可以用来删除Linux计算机上文件的系统调用是什么?

Other than unlink and unlinkat what are the system calls that could be used to delete files on a Linux machine?

推荐答案

rename() renameat()可以通过在文件上重命名另一个文件来删除文件。

rename() and renameat() can be used to delete a file by renaming another file over it.

如果您考虑将文件清空为删除的一种形式,则各种系统调用,包括 truncate() open() O_TRUNC 都可以

If you consider making a file empty to be a form of deletion, a variety of system calls, including truncate() and open() with O_TRUNC, can do that.

这篇关于Linux中可用于删除文件的系统调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆