UNDELETE(2)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’… UNDELETE(2) β€” System Calls Manual, but make it cute ✨

✨ NAME ✨

undelete β€” attempt to recover a deleted file 🫢


πŸ“š LIBRARY πŸ“š

Standard C Library (libc, -lc) β€” yes bestie, that’s the one πŸ’–


🧾 SYNOPSIS 🧾

#include <unistd.h>

int
undelete(const char *path);

πŸ’« DESCRIPTION πŸ’«

Okay so the undelete() system call attempts to recover the deleted file named by path. That’s the whole main-character mission 🌸.

Currently, this works only when the named object is a whiteout in a union file system. The system call removes the whiteout causing any objects in a lower layer of the union stack to become visible once more. Literally bringing the lower-layer vibes back into view πŸ¦‹.

Eventually, the undelete() functionality may be expanded to other file systems able to recover deleted files such as the log-structured file system. Future icon behavior, no cap ✨.


πŸŽ€ RETURN VALUES πŸŽ€

The undelete() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. Classic success/fail energy πŸ’….


πŸ’€ ERRORS πŸ’€

The undelete() succeeds unless one of these gremlins shows up:

  • [ENOTDIR] β€” A component of the path prefix is not a directory.
  • [ENAMETOOLONG] β€” A component of a pathname exceeded 255 characters, or an entire path name exceeded 1023 characters.
  • [EEXIST] β€” The path does not reference a whiteout.
  • [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.
  • [EINVAL] β€” The last component of the path is β€˜..’.
  • [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.
  • [EFAULT] β€” The path argument points outside the process's allocated address space.
Yes, there are two [EACCES] entries β€” both are real, both matter, not me making it up πŸ’…

πŸ‘€ SEE ALSO πŸ‘€

Go peek, iykyk 🧚


🌸 HISTORY 🌸

The undelete() system call first appeared in 4.4BSD-Lite. Vintage but still iconic πŸ”₯.

xoxo, Debian πŸ’– March 30, 2020 β€” UNDELETE(2) out. πŸŽ€

πŸ“¦ where this page comes from
  • freebsd 15.1: base 15.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms