Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

fdetach - cancel assignment to STREAMS file

&pagelevel(4)&pagelevel


Syntax

#include <stropts.h>

int fdetach(const char *path); 

Description

The fdetach() function cancels the assignment of a file descriptor under STREAMS to a name in the file system. path is the pathname of the object (file or directory) in the name space of the file system to which the file descriptor was previously assigned with fattach(). The user must be the owner of the file or a user with special permissions.

A successful fdetach() call has the following effects: all pathnames that have identified the assigned STREAMS file then identify again the original object to which the STREAMS file was assigned. All subsequent operations on path work with the node in the file system and not with the STREAMS file.

The access permissions and the node status are restored as they were before the assignment.

All open file descriptors established while the STREAMS file was assigned to the file identified by path continue to refer to the STREAMS file after the fdetach() has taken effect.

If there are no open file descriptors or other references to the STREAMS file, a successful fdetach() has the effect on the assigned file of a final close() call on this file.

Return val.

0

-1

if successful.

if an error occurs. errno is set to indicate the error.

Errors

fdetach() will fail if: 

 

EACCES

Search permission is denied for a component of the path.

 

EPERM

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.

 

ENOTDIR

A component of the pathname prefix is not a directory.

 

ENOENT

A component of the pathname does not exist, or path points to an empty string.

 

EINVAL

path is not assigned to a STREAMS file.

 

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.

 

ELOOP

Too many symbolic links were encountered in resolving path.

See also

close(), fattach(), stropts.h.