2 * getflags.c - Get a file flags on an ext2 file system
4 * Copyright (C) 1993, 1994 Remy Card <card@masi.ibp.fr>
5 * Laboratoire MASI, Institut Blaise Pascal
6 * Universite Pierre et Marie Curie (Paris VI)
8 * This file can be redistributed under the terms of the GNU Library General
23 #include <sys/ioctl.h>
28 int getflags (int fd, unsigned long * flags)
33 if (fstat (fd, &buf) == -1)
38 if (buf.st_flags & UF_IMMUTABLE)
39 *flags |= EXT2_IMMUTABLE_FL;
42 if (buf.st_flags & UF_APPEND)
43 *flags |= EXT2_APPEND_FL;
46 if (buf.st_flags & UF_NODUMP)
47 *flags |= EXT2_NODUMP_FL;
55 r = ioctl (fd, EXT2_IOC_GETFLAGS, &f);
58 #else /* ! HAVE_EXT2_IOCTLS */
62 #endif /* ! HAVE_EXT2_IOCTLS */