xref: /netbsd-src/lib/libc/sys/undelete.2 (revision d48f14661dda8638fee055ba15d35bdfb29b9fa8)
1.\"	$NetBSD: undelete.2,v 1.12 2004/05/13 10:20:58 wiz Exp $
2.\"
3.\" Copyright (c) 1994
4.\"	The Regents of the University of California.  All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\" 3. Neither the name of the University nor the names of its contributors
15.\"    may be used to endorse or promote products derived from this software
16.\"    without specific prior written permission.
17.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\" Copyright (c) 1994
31.\"	Jan-Simon Pendry
32.\"
33.\" Redistribution and use in source and binary forms, with or without
34.\" modification, are permitted provided that the following conditions
35.\" are met:
36.\" 1. Redistributions of source code must retain the above copyright
37.\"    notice, this list of conditions and the following disclaimer.
38.\" 2. Redistributions in binary form must reproduce the above copyright
39.\"    notice, this list of conditions and the following disclaimer in the
40.\"    documentation and/or other materials provided with the distribution.
41.\" 3. All advertising materials mentioning features or use of this software
42.\"    must display the following acknowledgement:
43.\"	This product includes software developed by the University of
44.\"	California, Berkeley and its contributors.
45.\" 4. Neither the name of the University nor the names of its contributors
46.\"    may be used to endorse or promote products derived from this software
47.\"    without specific prior written permission.
48.\"
49.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
50.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
51.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
52.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
53.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
54.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
55.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
56.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
57.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
58.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
59.\" SUCH DAMAGE.
60.\"
61.\"     @(#)undelete.2	8.4 (Berkeley) 10/18/94
62.\"
63.Dd October 18, 1994
64.Dt UNDELETE 2
65.Os
66.Sh NAME
67.Nm undelete
68.Nd attempt to recover a deleted file
69.Sh LIBRARY
70.Lb libc
71.Sh SYNOPSIS
72.In unistd.h
73.Ft int
74.Fn undelete "const char *path"
75.Sh DESCRIPTION
76The
77.Fn undelete
78function attempts to recover the deleted file named by
79.Fa path .
80Currently, this works only when the named object
81is a whiteout in a union filesystem.
82The system call removes the whiteout causing
83any objects in a lower layer of the
84union stack to become visible once more.
85.Pp
86Eventually, the
87.Nm undelete
88functionality may be expanded to other filesystems able to recover
89deleted files such as the log-structured filesystem.
90.Sh RETURN VALUES
91Upon successful completion, a value of 0 is returned.
92Otherwise, a value of \-1 is returned and
93.Va errno
94is set to indicate the error.
95.Sh ERRORS
96The
97.Fn undelete
98succeeds unless:
99.Bl -tag -width ENAMETOOLONGAA
100.It Bq Er ENOTDIR
101A component of the path prefix is not a directory.
102.It Bq Er EINVAL
103The pathname contains a character with the high-order bit set.
104.It Bq Er ENAMETOOLONG
105A component of a pathname exceeded 255 characters,
106or an entire path name exceeded 1023 characters.
107.It Bq Er EEXIST
108The path does not reference a whiteout.
109.It Bq Er ENOENT
110The named whiteout does not exist.
111.It Bq Er EACCES
112Search permission is denied for a component of the path prefix, or
113write permission is denied on the directory containing the name
114to be undeleted.
115.It Bq Er ELOOP
116Too many symbolic links were encountered in translating the pathname.
117.It Bq Er EPERM
118The directory containing the name is marked sticky,
119and the containing directory is not owned by the effective user ID.
120.It Bq Er EIO
121An I/O error occurred while updating the directory entry.
122.It Bq Er EROFS
123The name resides on a read-only file system.
124.It Bq Er EFAULT
125.Fa path
126points outside the process's allocated address space.
127.El
128.Sh SEE ALSO
129.Xr unlink 2 ,
130.Xr mount_union 8
131.Sh HISTORY
132An
133.Nm undelete
134function call first appeared in
135.Bx 4.4 -Lite .
136