[cs631apue] whiteout question
Jan Schaumann
jschauma at stevens.edu
Mon Sep 24 17:16:17 EDT 2012
zwang34 <zwang34 at stevens.edu> wrote:
> In the -F option, we should identify whiteout, but it seems there is no
> such option in stat function in Linux.
Correct, Linux does not implement the concept of whiteout files. I'll
cover in class today what exactly that is.
> I did this:
> #define S_IFWHT 160000 (this value is in stat(2))
> if (file.st_mode & S_IFWHT)
> //do something here..
>
> It still doesn't work. What can I do?
You should be able to do the following:
#ifdef S_ISWHT
if (S_ISWHT(file.st_mode)) {
/* white-out related code goes here */
}
#endif
On Linux, you will never trigger this code block, but by having a
pre-processor directive conditionally including the code based on the
definition, your code would do the right thing on a platform that _does_
implement it.
-Jan
More information about the cs631apue
mailing list