Skip to content

Latest commit

 

History

History
27 lines (15 loc) · 991 Bytes

unlink.md

File metadata and controls

27 lines (15 loc) · 991 Bytes

Syscall unlink

User Mode

#include <unistd.h>
int32_t unlink(const char *pathname);

Remove a link from a file, the last unlink() will also delete the file if there is no reference to that inode anymore. This means that if some process still has the file open, it will continue to exist until the process closes it (then it will be effectively deleted).

User Apps

The app rm exposes this syscall.

Kernel Mode

Implemented in sys_file.c as sys_unlink().

See also

Syscall rmdir to delete directories.

Overview: syscalls

File Management Syscalls: mkdir | rmdir | get_dirent | mknod | open | close | read | write | lseek | dup | link | unlink | fstat