xref: /original-bsd/lib/libc/sys/undelete.2 (revision 948d00a2)
1.\" Copyright (c) 1994
2.\"	Jan-Simon Pendry
3.\"	The Regents of the University of California.  All rights reserved.
4.\"
5.\" %sccs.include.redist.man%
6.\"
7.\"     @(#)undelete.2	8.4 (Berkeley) 10/18/94
8.\"
9.Dd
10.Dt UNDELETE 2
11.Os BSD 4
12.Sh NAME
13.Nm undelete
14.Nd attempt to recover a deleted file
15.Sh SYNOPSIS
16.Fd #include <unistd.h>
17.Ft int
18.Fn undelete "const char *path"
19.Sh DESCRIPTION
20The
21.Fn undelete
22function attempts to recover the deleted file named by
23.Fa path .
24Currently, this works only when the named object
25is a whiteout in a union filesystem.
26The system call removes the whiteout causing
27any objects in a lower layer of the
28union stack to become visible once more.
29.Pp
30Eventually, the
31.Nm undelete
32functionality may be expanded to other filesystems able to recover
33deleted files such as the log-structured filesystem.
34.Sh RETURN VALUES
35Upon successful completion, a value of 0 is returned.
36Otherwise, a value of -1 is returned and
37.Va errno
38is set to indicate the error.
39.Sh ERRORS
40The
41.Fn undelete
42succeeds unless:
43.Bl -tag -width ENAMETOOLONGAA
44.It Bq Er ENOTDIR
45A component of the path prefix is not a directory.
46.It Bq Er EINVAL
47The pathname contains a character with the high-order bit set.
48.It Bq Er ENAMETOOLONG
49A component of a pathname exceeded 255 characters,
50or an entire path name exceeded 1023 characters.
51.It Bq Er EEXIST
52The path does not reference a whiteout.
53.It Bq Er ENOENT
54The named whiteout does not exist.
55.It Bq Er EACCES
56Search permission is denied for a component of the path prefix.
57.It Bq Er EACCES
58Write permission is denied on the directory containing the name
59to be undeleted.
60.It Bq Er ELOOP
61Too many symbolic links were encountered in translating the pathname.
62.It Bq Er EPERM
63The directory containing the name is marked sticky,
64and the containing directory is not owned by the effective user ID.
65.It Bq Er EIO
66An I/O error occurred while updating the directory entry.
67.It Bq Er EROFS
68The name resides on a read-only file system.
69.It Bq Er EFAULT
70.Fa Path
71points outside the process's allocated address space.
72.El
73.Sh SEE ALSO
74.Xr unlink 2 ,
75.Xr mount_union 8
76.Sh HISTORY
77An
78.Nm undelete
79function call first appeared in 4.4BSD-Lite.
80