UNDELETE(2)
β¨ UNDELETE(2) β¨
okay bestie, welcome to the System Calls Manual π this is undelete, a 2nd-section system call, and honestly? she's a niche queen. let's get into it π«Ά
πΈ NAME πΈ
undelete β the whole mission is: attempt to recover a deleted file π¦
π LIBRARY π
Standard C Library (libc, -lc) β yeah she lives in libc, no cap π
β¨ SYNOPSIS β¨
#include <unistd.h>
int
undelete(const char *path);
look at her. one path. one int. so clean. so demure. π§
π DESCRIPTION π
so the undelete() system call attempts to recover the deleted file named by path. π
and here's the tea, bestie: currently, this only works when the named object is a whiteout in a union file system. what happens is the system call removes that whiteout, which makes any objects in a lower layer of the union stack become visible once more. π like... the file was hiding behind a lil "nothing to see here" sign and you just yanked the sign away. iconic.
eventually, the undelete() functionality may be expanded to other file systems that are able to recover deleted files β for example the log-structured file system. π so watch this space, but for rn? whiteouts only. periodt.
π RETURN VALUES π
- if it works:
undelete()returns the value0. slay. π - if it doesn't: the value
-1is returned, and the global variableerrnogets set to indicate the error. π
π₯ ERRORS π₯
the undelete() call succeeds unless one of these lil guys happens:
[ENOTDIR]β a component of the path prefix is not a directory. π[ENAMETOOLONG]β a component of a pathname exceeded255characters, or an entire path name exceeded1023characters. bestie that's a lot of letters, pls chill π[EEXIST]β the path does not reference a whiteout. (rude, but okay)[ENOENT]β the named whiteout does not exist. π[EACCES]β search permission is denied for a component of the path prefix.[EACCES]β write permission is denied on the directory containing the name to be undeleted.[ELOOP]β too many symbolic links were encountered in translating the pathname. π[EPERM]β the directory containing the name is marked sticky, and the containing directory is not owned by the effective user ID. not your directory, not your business π«[EINVAL]β the last component of the path is'..'. no going up, ma'am π[EIO]β an I/O error occurred while updating the directory entry.[EINTEGRITY]β corrupted data was detected while reading from the file system. ππ[EROFS]β the name resides on a read-only file system. frozen. can't touch. βοΈ[EFAULT]β thepathargument points outside the process's allocated address space. that pointer is literally in the void, bestie π
π¦ SEE ALSO π¦
go read those, iykyk π
β HISTORY β
the undelete() system call first appeared in 4.4BSD-Lite. a true vintage icon π°οΈβ¨
okay that's the whole page, mwah π this one came from Debian, dated March 30, 2020, and it's filed under UNDELETE(2). go recover something (a whiteout, specifically, because that's literally the only thing this does rn) π«Άππ
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1994 Jan-Simon Pendry
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms