summaryrefslogtreecommitdiffstats
path: root/bin/chflags
Commit message (Collapse)AuthorAgeFilesLines
* MFC r282208:smh2015-06-012-29/+37
| | | | | | | Standardise chmod, chflags, chown and chgrp recursive symlink processing Relnotes: Yes Sponsored by: Multiplay
* Expand the use of stat(2) flags to allow storing some Windows/DOSken2013-08-211-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* - Make 'flags' argument to chflags(2), fchflags(2) and lchflags(2) of typepjd2013-03-211-5/+1
| | | | | | | | | | | u_long. Before this change it was of type int for syscalls, but prototypes in sys/stat.h and documentation for chflags(2) and fchflags(2) (but not for lchflags(2)) stated that it was u_long. Now some related functions use u_long type for flags (strtofflags(3), fflagstostr(3)). - Make path argument of type 'const char *' for consistency. Discussed on: arch Sponsored by: The FreeBSD Foundation
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-081-1/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
* Staticify internal routines.delphij2009-06-231-2/+2
|
* Fix chflags -h in various cases: do not use link target's flags as original.jilles2009-05-241-1/+1
| | | | | | | | | Patch slightly changed to align more with chmod.c. PR: bin/131999 Submitted by: bde Approved by: ed (mentor) MFC after: 3 weeks
* Make chflags(1) more chmod(1)-like (and more feature complete):rwatson2008-03-092-17/+43
| | | | | | | | | | | | | | - Add -v to print file names as they are processed; -vv prints the flags change as well. - Add -f to ignore failures with the same semantics as chflags(1), neither printing an error nor affecting the return code. - Don't try to set the flags if they won't change. I made minor cosmetic tweaks to the code in the patch. MFC after: 1 week PR: 112827 Submitted by: Ighighi <ighighi at gmail.com>
* Fix probably copy&paste from chmod(1) - we change file flags here, not mode.pjd2007-05-281-1/+1
|
* Use .Cm for all key words, not just the ones I added. More in line withtrhodes2006-03-101-12/+12
| | | | | | mdoc(7) according to ru. Requested by: ru
* Slightly better markup.trhodes2006-03-061-8/+8
| | | | Discussed with: ru
* Instead of just hinting at available octets, list some.trhodes2006-03-041-1/+43
| | | | | | Mention that the setting of securelevel may affect one's ability to alter flags. Xref security.7. Bump doc date.
* Sort sections.ru2005-06-141-5/+5
| | | | Approved by: re (blanket)
* Add an interface to the lchflags(2) syscall. The new -h option isdd2005-05-142-12/+35
| | | | | | | | analogous to chmod(1)'s -h. It allows setting flags on symbolic links, which *do* exist in 5.x+ despite a claim to the contrary in the chflags(1) man page. Suggested by: Chris Dillon
* Fix a few markup nits in previous commit.trhodes2005-02-251-6/+6
| | | | Noticed by: ru, who else? :)
* Add information on utilities which may or may not be aware of file flags.trhodes2005-02-231-1/+18
| | | | | PR: 55653 Submitted by: Tony Maher <tonymaher@optushome.com.au> (original version)
* WARNS?=6 is already in bin/Makefile.inc, so remove this one.delphij2005-01-271-1/+0
|
* Add the new standard EXIT STATUS section where appropriate.ru2005-01-161-1/+1
| | | | Sort standard sections in the (documented) preferred order.
* /*- or .\"- or #- to begin license clauses.imp2005-01-102-1/+2
|
* chflags compiles with WARNS?=6.stefanf2004-10-031-0/+1
|
* Garbage collect a variable whose value was never read.stefanf2004-10-031-5/+4
|
* Group equivalent flags together and delete the `aliases' section.keramida2004-09-211-13/+8
| | | | | PR: docs/70856 Submitted by: Rostislav Krasny <rosti_bsd@yahoo.com>
* Remove clause 3 from the UCB licenses.markm2004-04-062-8/+0
| | | | OK'ed by: imp, core
* Only call chflags() on directories once.ceri2004-02-181-5/+4
| | | | | Approved by: ru MFC after: 1 week
* mdoc(7) police: Fix document date.ru2003-05-161-1/+1
| | | | Approved by: re (blanket)
* Make GCC 3.3 STFU about copyright[].obrien2003-05-011-1/+1
|
* Document how to clear flags with negative-logic, currently onlyjohan2003-03-241-4/+9
| | | | | | | | the nodump flag. PR: 46912 Reported by: dave@syix.com <dave@syix.com> MFC after: 2 weeks
* We can simplify this Makefile down to a single line now.obrien2003-02-191-4/+0
|
* ANSIify function definitions.dwmalone2002-09-041-4/+2
| | | | | | | | | Add some constness to avoid some warnings. Remove use register keyword. Deal with missing/unneeded extern/prototypes. Some minor type changes/casts to avoid warnings. Reviewed by: md5
* Remove local prototypes for main().jmallett2002-08-191-1/+0
|
* Reorder for style.markm2002-04-281-3/+3
|
* remove __Pimp2002-03-221-2/+2
|
* Remove leaf node WARNS?=2 (that mainly I added). This shouldmarkm2002-02-081-1/+0
| | | | help the GCC3 transition and CURRENT in general.
* Style improvements recommended by Bruce as a follow up to somedwmalone2001-12-101-5/+6
| | | | | | | | of the recent WARNS commits. The idea is: 1) FreeBSD id tags should follow vendor tags. 2) Vendor tags should not be compiled (though copyrights probably should). 3) There should be no blank line between including cdefs and __FBSDIF.
* Slight makefile style.markm2001-12-022-7/+7
| | | | Use __FBSDID().
* mdoc(7) police: utilize the new .Ex macro.ru2001-08-151-3/+1
|
* WARNS= -> WARNS?=dd2001-06-221-1/+1
| | | | Submitted by: Mike Barcroft <mike@q9media.com>
* Follow symbolic links named as command line arguments if run without -R.ru2001-05-281-2/+3
| | | | | | | | | | | | | | This is required by symlink(7), ``Commands not traversing a file tree'' subsection, third paragraph: : It is important to realize that this rule includes commands which may : optionally traverse file trees, e.g. the command ``chown file'' is : included in this rule, while the command ``chown -R file'' is not. For chown(8) and chgrp(1), this is also is compliance with the latest POSIX 1003.1-200x draft. MFC after: 1 week
* Make it clear that -P is the default.ru2001-05-251-0/+1
| | | | PR: docs/27629
* Silence WARNS=2 and BDECFLAGS on alpha and i386kris2001-05-202-2/+3
| | | | MFC after: 1 week
* Prepare for mdoc(7)NG.ru2000-12-191-18/+31
|
* mdoc(7) police: use the new features of the Nm macro.ru2000-11-201-1/+1
|
* Install `chflags' in the root partition, NOT /usr where it is not availableobrien2000-11-101-0/+1
| | | | in single user mode.
* Switch over to using the new fflagstostr and strtofflags library calls.joe2000-06-172-5/+2
|
* Fixed prototype for setflags(). setflags() returns int, not u_long,bde2000-04-041-1/+1
| | | | | | and "extern" in function prototypes is a style bug. The type mismatch broke chflags(1) on i386's with 64-bit longs and may have broken it on alphas.
* Document that the flags can be specified as an octal number.jdp2000-04-031-1/+2
|
* Revert part of the last commit, remove {g|s}etflags from the libcjoe2000-02-052-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | interface, and statically link them to the programs using them. These functions, upon reflection and discussion, are too generically named for a library interface with such specific functionality. Also the api that they use, whilst ok for private use, isn't good enough for a libc function. Additionally there were complications with the build/install-world process. It depends heavily upon xinstall, which got broken by the change in api, and caused bootstrap problems and general mayhem. There is work in progress to address future problems that may be caused by changes in install-chain tools, and better names for {g|s}etflags can be derived when some future program requires them. For now the code has been left in src/lib/libc/gen (it started off in src/bin/ls). It's important to provide library functions for manipulating file flag strings if we ever want this interface to be adopted outside of the source tree, but now isn't necessarily the right moment with 4.0-release just around the corner. Approved: jkh
* Historically file flags (schg, uschg, etc) have been converted fromjoe2000-01-272-4/+1
| | | | | | | | | | | | | | | | | string to u_long and back using two functions, flags_to_string and string_to_flags, which co-existed with 'ls'. As time has progressed more and more other tools have used these private functions to manipulate the file flags. Recently I moved these functions from /usr/src/bin/ls to libutil, but after some discussion with bde it's been decided that they really ought to go in libc. There are two already existing libc functions for manipulating file modes: setmode and getmode. In keeping with these flags_to_string has been renamed getflags and string_to_flags to setflags. The manual page could probably be improved upon ;)
* Added missing DPADD's. Removed unrequired SRCS's.joe2000-01-011-1/+1
| | | | Obtained from: bde
* Moved flags_to_string and string_to_flags into libutil. It's used injoe1999-12-301-2/+3
| | | | many places nowadays.
* Correct use of .Nm. Add DIAGNOSTICS section. Add rcsidcharnier1999-11-212-8/+12
|
OpenPOWER on IntegriCloud