167536Spendry.\" Copyright (c) 1994 267536Spendry.\" Jan-Simon Pendry 367536Spendry.\" The Regents of the University of California. All rights reserved. 467536Spendry.\" 567536Spendry.\" %sccs.include.redist.man% 667536Spendry.\" 7*67834Smckusick.\" @(#)undelete.2 8.4 (Berkeley) 10/18/94 867536Spendry.\" 967536Spendry.Dd 10*67834Smckusick.Dt UNDELETE 2 1167536Spendry.Os BSD 4 1267536Spendry.Sh NAME 13*67834Smckusick.Nm undelete 14*67834Smckusick.Nd attempt to recover a deleted file 1567536Spendry.Sh SYNOPSIS 1667536Spendry.Fd #include <unistd.h> 1767536Spendry.Ft int 18*67834Smckusick.Fn undelete "const char *path" 1967536Spendry.Sh DESCRIPTION 2067536SpendryThe 21*67834Smckusick.Fn undelete 22*67834Smckusickfunction attempts to recover the deleted file named by 23*67834Smckusick.Fa path . 24*67834SmckusickCurrently, this works only when the named object 25*67834Smckusickis a whiteout in a union filesystem. 26*67834SmckusickThe system call removes the whiteout causing 27*67834Smckusickany objects in a lower layer of the 28*67834Smckusickunion stack to become visible once more. 29*67834Smckusick.Pp 30*67834SmckusickEventually, the 31*67834Smckusick.Nm undelete 32*67834Smckusickfunctionality may be expanded to other filesystems able to recover 33*67834Smckusickdeleted files such as the log-structured filesystem. 3467536Spendry.Sh RETURN VALUES 3567536SpendryUpon successful completion, a value of 0 is returned. 3667536SpendryOtherwise, a value of -1 is returned and 3767536Spendry.Va errno 3867536Spendryis set to indicate the error. 3967536Spendry.Sh ERRORS 4067536SpendryThe 41*67834Smckusick.Fn undelete 4267536Spendrysucceeds unless: 4367536Spendry.Bl -tag -width ENAMETOOLONGAA 4467536Spendry.It Bq Er ENOTDIR 4567536SpendryA component of the path prefix is not a directory. 4667536Spendry.It Bq Er EINVAL 4767536SpendryThe pathname contains a character with the high-order bit set. 4867536Spendry.It Bq Er ENAMETOOLONG 4967536SpendryA component of a pathname exceeded 255 characters, 5067536Spendryor an entire path name exceeded 1023 characters. 5167740Spendry.It Bq Er EEXIST 5267536SpendryThe path does not reference a whiteout. 5367536Spendry.It Bq Er ENOENT 54*67834SmckusickThe named whiteout does not exist. 5567536Spendry.It Bq Er EACCES 5667536SpendrySearch permission is denied for a component of the path prefix. 5767536Spendry.It Bq Er EACCES 58*67834SmckusickWrite permission is denied on the directory containing the name 59*67834Smckusickto be undeleted. 6067536Spendry.It Bq Er ELOOP 6167536SpendryToo many symbolic links were encountered in translating the pathname. 6267536Spendry.It Bq Er EPERM 63*67834SmckusickThe directory containing the name is marked sticky, 6467536Spendryand the containing directory is not owned by the effective user ID. 6567536Spendry.It Bq Er EIO 66*67834SmckusickAn I/O error occurred while updating the directory entry. 6767536Spendry.It Bq Er EROFS 68*67834SmckusickThe name resides on a read-only file system. 6967536Spendry.It Bq Er EFAULT 7067536Spendry.Fa Path 7167536Spendrypoints outside the process's allocated address space. 7267536Spendry.El 7367536Spendry.Sh SEE ALSO 7467536Spendry.Xr unlink 2 , 7567536Spendry.Xr mount_union 8 7667536Spendry.Sh HISTORY 7767536SpendryAn 78*67834Smckusick.Nm undelete 7967536Spendryfunction call first appeared in 4.4BSD-Lite. 80