stat_flags(3)
- NetBSD Manual Pages
STAT_FLAGS(3) NetBSD Library Functions Manual STAT_FLAGS(3)
NAME
string_to_flags, flags_to_string -- Stat flags parsing and printing func-
tions
LIBRARY
System Utilities Library (libutil, -lutil)
SYNOPSIS
#include <util.h>
char *
flags_to_string(u_long flags, const char *def);
int
string_to_flags(char **stringp, u_long *setp, u_long *clrp);
DESCRIPTION
The flags_to_string() and string_to_flags() functions are used by pro-
grams such as chflags(1), ls(1), makefs(8), mtree(8), etc., to parse
and/or print the st_flags field in the stat(2) structure.
They recognize the following flags:
arch, archived (SF_ARCHIVED)
file is archived (legacy/compat flag for mount_msdos(8)
filesystems)
nodump (UF_NODUMP)
do not dump(8) file
opaque (UF_OPAQUE)
directory is opaque in mount_union(8) filesystems
sappnd, sappend (SF_APPEND)
writes to the file may only append (flag can be changed
by the superuser only)
schg, schange, simmutable (SF_IMMUTABLE)
file cannot be changed; it is immutable (flag can be
changed by the superuser only)
snap (SF_SNAPSHOT)
file is an fss(4) snapshot inode
uappnd, uappend (UF_APPEND)
writes to the file may only append
uchg, uchange, uimmutable (UF_IMMUTABLE)
file cannot be changed; it is immutable
The flags_to_string() function converts the bits set in the flags argu-
ment to a comma-separated string and returns it. If no flags are set,
then the def string is returned. The returned string is allocated via
malloc(3) and it is the responsibility of the caller to free(3) it.
Where the above list has several flag names for a flag, the first of the
listed names is returned.
The string_to_flags() function takes a stringp of space, comma, or tab
separated flag names and places their bit value on the setp argument.
If the flag name is prefixed by `no', then the bit value is placed on the
clrp argument. Both nonodump and dump are recognized as negative forms
of the nodump flag name.
Where the above list has several flag names for a flag, all of them are
recognized. The snap flag name is not recognized (as its flag cannot be
changed anyway).
RETURN VALUES
flags_to_string() returns the symbolic representation of flags, the
default string, or NULL if allocation failed.
string_to_flags() returns 0 on success and 1 if it fails to parse the
string, setting stringp to point to the first name that it failed to
parse.
SEE ALSO
chflags(2), stat(2)
NetBSD 10.99 May 31, 2023 NetBSD 10.99
Powered by man-cgi (2024-03-20).
Maintained for NetBSD
by Kimmo Suominen.
Based on man-cgi by Panagiotis Christias.