CHHIDDEN(2,L) AIX Technical Reference CHHIDDEN(2,L)
-------------------------------------------------------------------------------
chhidden
PURPOSE
Changes the hidden attribute of a directory.
SYNTAX
int chhidden(dirname,hideflag)
char *dirname;
int hideflag;
DESCRIPTION
The chhidden system call allows the superuser to turn a normal directory into a
hidden directory or vice versa. If hideflag is not zero, the directory pointed
to by dirname is converted to a hidden directory. If it is zero, the directory
is converted to a normal directory.
When using chhidden to reference a directory which is already a hidden
directory it is unnecessary for dirname to explicitly name the hidden directory
(using the @ notation) as chhidden does not expand hidden directory references.
The chhidden system call does not enforce the restriction that only regular and
special files can appear in a hidden directory. Applications which use this
call are required to make the necessary checks and enforce this rule.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of -1
is returned, and errno is set to indicate the error.
ERROR CONDITIONS
Possible errors:
EPERM The calling process lacks superuser privileges.
ENOTDIR dirname does not name a directory.
EROFS The named directory resides on a read-only file system.
ENOTDIR A component of the path prefix of dirname is not a directory.
ENOENT The named file does not exist.
ENOENT A null path name was provided.
Processed November 7, 1990 CHHIDDEN(2,L) 1
CHHIDDEN(2,L) AIX Technical Reference CHHIDDEN(2,L)
ENOENT A symbolic link was named, but the file to which it refers does not
exist.
EACCES Search permission is denied on a component of the path prefix of
dirname.
EFAULT dirname points outside the process's allocated address space.
ELOOP A loop of symbolic links was detected.
If the Transparent Computing Facility is installed on your system, chhidden can
also fail if one or more of the following are true:
ESITEDN1 dirname cannot be accessed because a site went down.
ESITEDN2 The operation was terminated because a site failed.
ENOSTORE dirname is a name relative to the working directory, but no site
which stores this directory is currently up.
ENOSTORE A component of dirname is replicated but is not stored on any site
which is currently up.
EROFS Write access is requested for a file on a replicated file system in
which the primary copy is unavailable.
EINTR A signal was caught during the system call.
EXAMPLES
In the example below an @ is given at the end of the directory name. This is
necessary for the statx system call but not for chhidden, since chhidden does
not pass through hidden directories.
Processed November 7, 1990 CHHIDDEN(2,L) 2
CHHIDDEN(2,L) AIX Technical Reference CHHIDDEN(2,L)
/* This program changes a hidden directory into a regular
directory or changes a regular directory into a hidden directory. */
#include <sys/types.h>
#include <sys/stat.h>
main()
{
char fname[50];
struct stat stat;
strcpy(fname,"/tmp/hidtest@");
if (statx(fname, &stat, sizeof(struct stat), STX_HIDDEN) != 0) {
printf("bad statx\n");
exit(1);
}
if (S_ISHIDDEN (stat.st_mode))
chhidden(fname,0);
else
chhidden(fname,1);
}
RELATED INFORMATION
In this book: "stat.h" and "mkdir."
Processed November 7, 1990 CHHIDDEN(2,L) 3