freebsd-dev/lib/libc/sys
Kenneth D. Merry 7da1a731c6 Expand the use of stat(2) flags to allow storing some Windows/DOS
and CIFS file attributes as BSD stat(2) flags.

This work is intended to be compatible with ZFS, the Solaris CIFS
server's interaction with ZFS, somewhat compatible with MacOS X,
and of course compatible with Windows.

The Windows attributes that are implemented were chosen based on
the attributes that ZFS already supports.

The summary of the flags is as follows:

UF_SYSTEM:	Command line name: "system" or "usystem"
		ZFS name: XAT_SYSTEM, ZFS_SYSTEM
		Windows: FILE_ATTRIBUTE_SYSTEM

		This flag means that the file is used by the
		operating system.  FreeBSD does not enforce any
		special handling when this flag is set.

UF_SPARSE:	Command line name: "sparse" or "usparse"
		ZFS name: XAT_SPARSE, ZFS_SPARSE
		Windows: FILE_ATTRIBUTE_SPARSE_FILE

		This flag means that the file is sparse.  Although
		ZFS may modify this in some situations, there is
		not generally any special handling for this flag.

UF_OFFLINE:	Command line name: "offline" or "uoffline"
		ZFS name: XAT_OFFLINE, ZFS_OFFLINE
		Windows: FILE_ATTRIBUTE_OFFLINE

		This flag means that the file has been moved to
		offline storage.  FreeBSD does not have any special
		handling for this flag.

UF_REPARSE:	Command line name: "reparse" or "ureparse"
		ZFS name: XAT_REPARSE, ZFS_REPARSE
		Windows: FILE_ATTRIBUTE_REPARSE_POINT

		This flag means that the file is a Windows reparse
		point.  ZFS has special handling code for reparse
		points, but we don't currently have the other
		supporting infrastructure for them.

UF_HIDDEN:	Command line name: "hidden" or "uhidden"
		ZFS name: XAT_HIDDEN, ZFS_HIDDEN
		Windows: FILE_ATTRIBUTE_HIDDEN

		This flag means that the file may be excluded from
		a directory listing if the application honors it.
		FreeBSD has no special handling for this flag.

		The name and bit definition for UF_HIDDEN are
		identical to the definition in MacOS X.

UF_READONLY:	Command line name: "urdonly", "rdonly", "readonly"
		ZFS name: XAT_READONLY, ZFS_READONLY
		Windows: FILE_ATTRIBUTE_READONLY

		This flag means that the file may not written or
		appended, but its attributes may be changed.

		ZFS currently enforces this flag, but Illumos
		developers have discussed disabling enforcement.

		The behavior of this flag is different than MacOS X.
		MacOS X uses UF_IMMUTABLE to represent the DOS
		readonly permission, but that flag has a stronger
		meaning than the semantics of DOS readonly permissions.

UF_ARCHIVE:	Command line name: "uarch", "uarchive"
		ZFS_NAME: XAT_ARCHIVE, ZFS_ARCHIVE
		Windows name: FILE_ATTRIBUTE_ARCHIVE

		The UF_ARCHIVED flag means that the file has changed and
		needs to be archived.  The meaning is same as
		the Windows FILE_ATTRIBUTE_ARCHIVE attribute, and
		the ZFS XAT_ARCHIVE and ZFS_ARCHIVE attribute.

		msdosfs and ZFS have special handling for this flag.
		i.e. they will set it when the file changes.

sys/param.h:		Bump __FreeBSD_version to 1000047 for the
			addition of new stat(2) flags.

chflags.1:		Document the new command line flag names
			(e.g. "system", "hidden") available to the
			user.

ls.1:			Reference chflags(1) for a list of file flags
			and their meanings.

strtofflags.c:		Implement the mapping between the new
			command line flag names and new stat(2)
			flags.

chflags.2:		Document all of the new stat(2) flags, and
			explain the intended behavior in a little
			more detail.  Explain how they map to
			Windows file attributes.

			Different filesystems behave differently
			with respect to flags, so warn the
			application developer to take care when
			using them.

zfs_vnops.c:		Add support for getting and setting the
			UF_ARCHIVE, UF_READONLY, UF_SYSTEM, UF_HIDDEN,
			UF_REPARSE, UF_OFFLINE, and UF_SPARSE flags.

			All of these flags are implemented using
			attributes that ZFS already supports, so
			the on-disk format has not changed.

			ZFS currently doesn't allow setting the
			UF_REPARSE flag, and we don't really have
			the other infrastructure to support reparse
			points.

msdosfs_denode.c,
msdosfs_vnops.c:	Add support for getting and setting
			UF_HIDDEN, UF_SYSTEM and UF_READONLY
			in MSDOSFS.

			It supported SF_ARCHIVED, but this has been
			changed to be UF_ARCHIVE, which has the same
			semantics as the DOS archive attribute instead
			of inverse semantics like SF_ARCHIVED.

			After discussion with Bruce Evans, change
			several things in the msdosfs behavior:

			Use UF_READONLY to indicate whether a file
			is writeable instead of file permissions, but
			don't actually enforce it.

			Refuse to change attributes on the root
			directory, because it is special in FAT
			filesystems, but allow most other attribute
			changes on directories.

			Don't set the archive attribute on a directory
			when its modification time is updated.
			Windows and DOS don't set the archive attribute
			in that scenario, so we are now bug-for-bug
			compatible.

smbfs_node.c,
smbfs_vnops.c:		Add support for UF_HIDDEN, UF_SYSTEM,
			UF_READONLY and UF_ARCHIVE in SMBFS.

			This is similar to changes that Apple has
			made in their version of SMBFS (as of
			smb-583.8, posted on opensource.apple.com),
			but not quite the same.

			We map SMB_FA_READONLY to UF_READONLY,
			because UF_READONLY is intended to match
			the semantics of the DOS readonly flag.
			The MacOS X code maps both UF_IMMUTABLE
			and SF_IMMUTABLE to SMB_FA_READONLY, but
			the immutable flags have stronger meaning
			than the DOS readonly bit.

stat.h:			Add definitions for UF_SYSTEM, UF_SPARSE,
			UF_OFFLINE, UF_REPARSE, UF_ARCHIVE, UF_READONLY
			and UF_HIDDEN.

			The definition of UF_HIDDEN is the same as
			the MacOS X definition.

			Add commented-out definitions of
			UF_COMPRESSED and UF_TRACKED.  They are
			defined in MacOS X (as of 10.8.2), but we
			do not implement them (yet).

ufs_vnops.c:		Add support for getting and setting
			UF_ARCHIVE, UF_HIDDEN, UF_OFFLINE, UF_READONLY,
			UF_REPARSE, UF_SPARSE, and UF_SYSTEM in UFS.
			Alphabetize the flags that are supported.

			These new flags are only stored, UFS does
			not take any action if the flag is set.

Sponsored by:	Spectra Logic
Reviewed by:	bde (earlier version)
2013-08-21 23:04:48 +00:00
..
__error.c
__vdso_gettimeofday.c Rework the __vdso_* symbols attributes to only make the symbols weak, 2013-01-30 12:48:16 +00:00
_exit.2
abort2.2
accept.2 accept(2), pipe(2): Fix .Dd. 2013-05-01 22:47:47 +00:00
access.2 mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the 2010-05-13 12:07:55 +00:00
acct.2
adjtime.2
aio_cancel.2
aio_error.2
aio_mlock.2 Minor mdoc fixes. 2013-06-09 07:15:43 +00:00
aio_read.2
aio_return.2
aio_suspend.2
aio_waitcomplete.2
aio_write.2
bind.2
bindat.2 - Implement two new system calls: 2013-03-02 21:11:30 +00:00
brk.2
cap_enter.2 Merge Capsicum overhaul: 2013-03-02 00:53:12 +00:00
cap_fcntls_limit.2 mdoc: remove superfluous paragraph macro. 2013-03-02 06:55:55 +00:00
cap_ioctls_limit.2 Correct function name and return value. 2013-08-17 14:55:31 +00:00
cap_rights_limit.2 cap_rights_limit(2): CAP_ACCEPT also permits accept4(2). 2013-05-27 21:37:19 +00:00
chdir.2
chflags.2 Expand the use of stat(2) flags to allow storing some Windows/DOS 2013-08-21 23:04:48 +00:00
chmod.2
chown.2
chroot.2 - Use standard RETURN VALUES section. 2013-01-15 14:09:08 +00:00
clock_gettime.2 mdoc: drop redundant .Pp and .LP calls 2010-10-08 12:40:16 +00:00
clock_gettime.c
close.2
closefrom.2
connect.2 Add ECONNRESET to list of possible errors in connect(2). 2010-09-06 21:39:54 +00:00
connectat.2 - Implement two new system calls: 2013-03-02 21:11:30 +00:00
cpuset_getaffinity.2 Remove cross-references to nonexistent CPU_SET(3) manpage. 2013-04-21 06:46:41 +00:00
cpuset.2 Remove cross-references to nonexistent CPU_SET(3) manpage. 2013-04-21 06:46:41 +00:00
dup.2 Add man page dup3(3). 2013-08-16 13:16:27 +00:00
execve.2
extattr_get_file.2 Fix return type of extattr_set_* and fix rmextattr(8) utility. 2013-04-02 05:30:41 +00:00
fcntl.2 Make the F_READAHEAD option to fcntl(2) work as documented: a value of zero 2013-02-13 15:09:16 +00:00
fcntl.c
ffclock.2
fhopen.2
flock.2
fork.2 fork(2): Add information about fork() in multi-threaded processes. 2013-05-31 20:46:08 +00:00
fsync.2
ftruncate.c Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate to 2007-07-04 23:27:38 +00:00
getdirentries.2
getdtablesize.2 getdtablesize(2): Describe what this function actually does. 2013-04-24 21:24:35 +00:00
getfh.2
getfsstat.2
getgid.2
getgroups.2
getitimer.2
getlogin.2
getloginclass.2
getpeername.2
getpgrp.2
getpid.2
getpriority.2
getrlimit.2
getrusage.2
getsid.2 mdoc(7) police: Tidy up the syscall language. 2002-12-18 09:22:32 +00:00
getsockname.2
getsockopt.2 Correct the returned message lengths for timeval and bintime control 2013-04-05 18:09:43 +00:00
gettimeofday.2
gettimeofday.c Rework the __vdso_* symbols attributes to only make the symbols weak, 2013-01-30 12:48:16 +00:00
getuid.2
intro.2 POSIX 1003.1-2008: add ENOTRECOVERABLE, EOWNERDEAD errnos. 2013-05-04 19:07:22 +00:00
ioctl.2
issetugid.2 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
jail.2
kenv.2
kill.2
kldfind.2
kldfirstmod.2 mdoc(7) police: Tidy up the syscall language. 2002-12-18 09:22:32 +00:00
kldload.2
kldnext.2
kldstat.2
kldsym.2
kldunload.2
kqueue.2 Enhance the description of NOTE_TRACK: 2013-07-25 19:34:24 +00:00
kse.2
ktrace.2
link.2
lio_listio.2
listen.2
lseek.2
lseek.c
madvise.2
Makefile.inc Add new system call - aio_mlock(). The name speaks for itself. It allows 2013-06-08 13:27:57 +00:00
mincore.2
minherit.2
mkdir.2
mkfifo.2
mknod.2
mlock.2 There are actually two different cases when mlock(2) returns 2013-03-19 05:44:25 +00:00
mlockall.2 - Update manual pages accordingly to r244384 and r244385. 2012-12-25 13:43:01 +00:00
mmap.2 Add new mmap(2) flags to permit applications to request specific virtual 2013-08-16 21:13:55 +00:00
mmap.c
modfind.2
modnext.2
modstat.2
mount.2
mprotect.2
mq_close.2
mq_getattr.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_notify.2
mq_open.2
mq_receive.2
mq_send.2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
mq_setattr.2 mq_setattr(2): Add missing const to man page. 2011-05-17 21:03:34 +00:00
msgctl.2
msgget.2
msgrcv.2
msgsnd.2
msync.2
munmap.2
nanosleep.2
nfssvc.2 Globally replace u_int*_t from (non-contributed) man pages. 2012-02-12 18:29:56 +00:00
ntp_adjtime.2
open.2 Document the ERESTART translation to EINTR for devfs nodes. 2013-02-07 15:11:43 +00:00
pathconf.2
pdfork.2
pipe.2 accept(2), pipe(2): Fix .Dd. 2013-05-01 22:47:47 +00:00
poll.2
posix_fadvise.2 posix_fadvise(2) first appeared in FreeBSD 9.1 2013-01-23 10:50:52 +00:00
posix_fallocate.2
posix_openpt.2 Allow O_CLOEXEC in posix_openpt() flags. 2013-03-21 21:39:15 +00:00
pread.c
profil.2 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
pselect.2 pselect(2): Add xref to sigsuspend(2). 2013-08-16 14:06:29 +00:00
ptrace.2 Document EINVAL error return from PT_LWPINFO 2013-07-22 18:18:21 +00:00
pwrite.c Change the C wrappers for mmap/lseek/pread/pwrite/truncate/ftruncate to 2007-07-04 23:27:38 +00:00
quotactl.2
read.2 pread(2) might fail with EBUSY, so document it 2012-04-29 22:23:00 +00:00
readlink.2 Man pages for the openat(2), fexecve(2) and related syscalls. 2008-04-16 13:03:12 +00:00
reboot.2
recv.2 Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. 2013-03-19 20:58:17 +00:00
rename.2 Add one more EACCES clause to rename.2. 2008-11-07 15:01:40 +00:00
revoke.2
rfork.2 Document RFTSIGZMB. Fix spelling of SIGCHLD. Note that signals are 2011-07-12 20:38:42 +00:00
rmdir.2
rtprio.2
sched_get_priority_max.2
sched_setparam.2
sched_setscheduler.2
sched_yield.2
sctp_generic_recvmsg.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
sctp_generic_sendmsg.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
sctp_peeloff.2 Remove the advertising clause from the Regents of the University of 2013-05-28 21:05:06 +00:00
select.2
semctl.2
semget.2
semop.2
send.2
sendfile.2
setfib.2 Update the setfib man page to reflect recent changes. 2013-05-20 20:47:40 +00:00
setgroups.2
setpgid.2
setregid.2 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
setresuid.2
setreuid.2
setsid.2
setuid.2
shm_open.2
shmat.2
shmctl.2
shmget.2
shutdown.2
sigaction.2 sigaction(2): Document various non-POSIX functions as async-signal safe. 2013-06-08 13:45:43 +00:00
sigaltstack.2
sigpending.2
sigprocmask.2
sigqueue.2 sigqueue(2): Fix typo (EEPERM -> EPERM). 2013-02-10 13:20:23 +00:00
sigreturn.2 sigreturn(2): Remove ancient compatibility warning about 4.2BSD. 2013-05-25 13:59:40 +00:00
sigstack.2
sigsuspend.2 sigsuspend(2): Add xrefs to pselect(2) and sigwait-alikes. 2013-08-15 22:33:27 +00:00
sigwait.2
sigwait.c
sigwaitinfo.2
socket.2 Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. 2013-03-19 20:58:17 +00:00
socketpair.2 Implement SOCK_CLOEXEC, SOCK_NONBLOCK and MSG_CMSG_CLOEXEC. 2013-03-19 20:58:17 +00:00
stack_protector_compat.c Move the __stack_chk_fail_local@FBSD_1.0 compat symbol definition into 2010-08-24 12:58:54 +00:00
stack_protector.c
stat.2
statfs.2 Per Regents of the University of Calfornia letter, remove advertising 2007-01-09 00:28:16 +00:00
swapon.2
Symbol.map Add new system call - aio_mlock(). The name speaks for itself. It allows 2013-06-08 13:27:57 +00:00
symlink.2 Man pages for the openat(2), fexecve(2) and related syscalls. 2008-04-16 13:03:12 +00:00
sync.2
sysarch.2
syscall.2
timer_create.2 General mdoc(7) and typo fixes. 2012-05-08 18:56:21 +00:00
timer_delete.2
timer_settime.2
truncate.2
truncate.c
umask.2
undelete.2
unlink.2
utimes.2
utrace.2
uuidgen.2
vfork.2
wait.2
write.2