|
>>-fchattr--fd--attribute_list---------------------------------><
Function fchattr invokes
the fchattr callable service to modify the attributes that are associated
with a file represented by a file descriptor. You can change the mode,
owner, access time, modification time, change time, reference time,
audit flags, general attribute flags, and file size.
Parameters - fd
- The file descriptor for the file.
- attribute_list
- A list of attributes to be set and their values. The attributes
are expressed either as numeric values (see REXX predefined variables), or as the predefined variables
beginning with ST_ followed by arguments for that attribute. The attributes
that may be changed and their parameters are:
Variable |
Description |
---|
ST_CCSID |
Coded character set ID; first 4 characters are
the file tag. |
ST_MODE |
1 argument: permission bits as 3
octal digits. |
ST_UID |
2 arguments: UID and GID numbers. |
ST_SIZE |
1 argument: new file size. |
ST_ATIME |
1 argument for access time: new time
or -1 for TOD. |
ST_MTIME |
1 argument for modification time:
new time or -1 for TOD. |
ST_CTIME |
1 argument for change time: new time
or -1 for TOD. |
ST_SETUID |
No arguments. |
ST_SETGID |
No arguments. |
ST_AAUDIT |
1 argument: new auditor audit value. |
ST_UAUDIT |
1 argument: new user audit value. |
ST_STICKY |
No arguments. |
ST_GENVALUE |
2 arguments: names of two variables.
The first variable contains the general attribute mask and the second
contains the general attribute value. |
ST_RTIME |
1 argument for reference time: new
time or -1 for TOD. |
ST_FILEFMT |
Format of the file. To specify the
format, you can specify a numeric value (see REXX predefined variables) or one of the following predefined
variables used to derive the appropriate numeric value: - S_FFBINARY
- Binary data
- S_FFCR
- Text data delimited by a carriage return character
- S_FFCRLF
- Text data delimited by carriage return and line feed characters
- S_FFCRNL
- A text file with lines delimited by carriage-return and newline
characters.
- S_FFLF
- Text data delimited by a line feed character
- S_FFLFCR
- Text data delimited by a line feed and carriage return characters
- S_FFNA
- Text data with the file format not specified
- S_FFNL
- Text data delimited by a newline character
- S_FFRECORD
- File data consisting of records with prefixes. The record prefix
contains the length of the record that follows.
|
Usage notes - Some of the attributes changed by the fchattr service can also
be changed by other services.
- When changing the mode:
- The effective UID of the calling process must match the file's
owner UID, or the caller must have appropriate privileges.
- Setting the set-group-ID-on-execution permission (in mode) means
that when this file is run (through the exec service), the effective
GID of the caller is set to the file's owner GID, so that the caller
seems to be running under the GID of the file, rather than that of
the actual invoker.
The set-group-ID-on-execution permission is
set to zero if both of the following are true: - The caller does not have appropriate privileges.
- The GID of the file's owner does not match the effective GID,
or one of the supplementary GIDs, of the caller.
- Setting the set-user-ID-on-execution permission (in mode) means
that when this file is run, the process's effective UID is set to
the file's owner UID, so that the process seems to be running under
the UID of the file's owner, rather than that of the actual invoker.
- When changing the owner:
- For changing the owner UID of a file, the caller must have appropriate
privileges.
- For changing the owner GID of a file, the caller must have appropriate
privileges, or meet all of these conditions:
- The effective UID of the caller matches the file's owner UID.
- The owner UID value specified in the change request matches the
file's owner UID.
- The GID value specified in the change request is the effective
GID, or one of the supplementary GIDs, of the caller.
- When the owner is changed, the set-user-ID-on-execution and set-group-ID-on-execution
permissions of the file mode are automatically turned off.
- When the owner is changed, both UID and GID must be specified
as they are to be set. If you want to change only one of these values,
you need to set the other to its present value for it to remain unchanged.
- For general attribute bits to be changed, the calling process
must have write permission for the file.
- When changing the file size:
- The change is made beginning from the first byte of the file.
If the file was previously larger than the new size, the data from file_size to
the original end of the file is removed. If the file was previously
shorter than file_size, bytes between the
old and new lengths are read as zeros. The file offset is not changed.
- If file_size is greater than the current
file size limit for the process, the request fails with EFBIG and
the SIGXFSZ signal is generated for the process.
- Successful change clears the set-user-ID, set-group-ID, and save-text
(sticky bit) attributes of the file unless the caller is a superuser.
- When changing times:
- For the access time or the modification time to be set explicitly
(using either st_atime or st_mtime with
the new time), the effective ID must match that of the file's owner,
or the process must have appropriate privileges.
- For the access time or modification time to be set to the current
time (using either st_atime or st_mtime with
-1), the effective ID must match that of the file's owner, the calling
process must have write permission for the file, or the process must
have appropriate privileges.
- For the change time or the reference time to be set explicitly
(using either st_ctime or st_rtime with
the new time) the effective ID must match that of the file's owner,
or the process must have appropriate privileges.
- For the change time or reference time to be set to the current
time (using either st_ctime or st_rtime with
-1), the calling process must have write permission for the file.
- When any attribute field is changed successfully, the file's change
time is also updated.
- For auditor audit flags to be changed, the user must have auditor
authority. The user with auditor authority can set the auditor options
for any file, even those to which they do not have path access or
authority to use for other purposes.
Auditor authority is established
by issuing the TSO/E command ALTUSER AUDITOR.
- For the user audit flags to be changed, the user must have appropriate
privileges or be the owner of the file.
- The tagging of /dev/null, /dev/zero, /dev/random,
and /dev/urandom is ignored.
Example In the following example, assume
that fd was assigned a value earlier in
the exec. This truncates a file to 0 bytes and sets
the file permissions to 600: "fchattr" fd st_size 0 st_mode 600
|