Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
fattach - assign file descriptor under STREAMS to object in name space of file system
&pagelevel(4)&pagelevel
Syntax | #include <stropts.h> int fattach (int fildes, const char *path); |
Description | The fattach() function assigns a file descriptor under STREAMS to an object (file or directory) in the name space of the file system, and fildes is assigned a pathname. fildes must be a valid, open file descriptor which represents a STREAMS file. path is a pathname of an existing object. The process must have appropriate privileges, or must be the owner of the file path and have write permission. All subsequent operations on path work with the STREAMS file until the assignment of the STREAMS file to the node is canceled. fildes can be assigned to more than one path, i.e. the file descriptor can be assigned more than one name. The attributes of the given stream are initialized as follows (see also stat() ): access rights, user and group IDs and file times are the same as those of path, the number of links is set to 1 and the size and device identifier are set to the same values as the STREAMS device of fildes. If any attributes of the given are then subsequently modified (e.g. with
chmod() ), neither the attributes of the underlying object nor the attributes of the STREAMS file referred to by fildes are affected. File descriptors which refer to the underlying object and were opened before an fattach() call continue to refer to the underlying object. |
Return val. | 0 -1 | if successful. if an error occurs. errno is set to indicate the error. |
Errors | fattach() will fail if:
|
EACCES
| Search permission is denied for a component of the path, or if the user is the owner of path but does not have write permission for path. |
EBADF
ENOENT
| fildes is not a valid open file descriptor. A component of the pathname does not exist, or path points to an empty string. |
ENOTDIR
EPERM
| A component of the pathname prefix is not a directory. The effective user ID of the process is not that of the owner of the file identified by path and the process does not have the appropriate access permissions. |
EBUSY
| path is currently a mount point or a STREAMS file is assigned to this path. |
ENAMETOOLONG
|
| The length of path exceeds {PATH_MAX} , or a component of the pathname is longer than {NAME_MAX} , while {_POSIX_NO_TRUNC} is active; or The resolving of a symbolic link of the pathname generates an interim result which is longer than {PATH_MAX} . |
ELOOP
EINVAL
EREMOTE
| Too many symbolic links were encountered in resolving path. fildes does not represent a STREAMS file. path is a file in a remotely mounted directory. |
Notes | fattach() behaves similarly to the older mount() function in that an object is temporarily replaced by the root directory of the mounted file system. With fattach() , the replaced object need not be a directory and the replacing file is a STREAMS file.
|
See also | fdetach() , isastream() , stropts.h .
|