95 lines
3.2 KiB
Plaintext
95 lines
3.2 KiB
Plaintext
'\"macro stdmacro
|
|
.if n .pH g3c.fattach @(#)fattach 41.5 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} fattach 3C "" "\&"
|
|
.if \nX=1 .ds x} fattach 3C ""
|
|
.if \nX=2 .ds x} fattach 3C "" "\&"
|
|
.if \nX=3 .ds x} fattach "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4fattach\fP \- attach a STREAMS-based file descriptor to an object
|
|
in the filesystem name space
|
|
.SH SYNOPSIS
|
|
.nf
|
|
\f4#include <unistd.h>\f1
|
|
.sp .6v
|
|
\f4int fattach(int fildes, const char *path);\f1
|
|
.fi
|
|
.SH DESCRIPTION
|
|
The \f4fattach\f1 routine attaches a STREAMS-based file descriptor to an
|
|
object in the filesystem name space, effectively associating a name with
|
|
\f2fildes\f1.
|
|
\f2fildes\f1 must be a valid open file descriptor representing a STREAMS file.
|
|
\f2path\f1 is a pathname of an existing object, and the effective user
|
|
ID of the calling process must be the owner of the file and have
|
|
write permissions, or
|
|
the calling process must have appropriate privilege (\f4P_OWNER\fP).
|
|
All subsequent operations on \f2path\f1 will operate on the
|
|
STREAMS file until the STREAMS file is detached from the node.
|
|
\f2fildes\f1 can be attached to more than one \f2path\f1; that is, a stream can
|
|
have several names associated with it.
|
|
.PP
|
|
The attributes of the named stream (see \f4stat\f1(2)), are initialized as follows:
|
|
the permissions, user ID, group ID, and times are set to those of
|
|
\f2path\f1, the number of links is set to 1, and the size and device
|
|
identifier are set to those of the streams device associated with \f2fildes\f1.
|
|
If any attributes of the named stream are subsequently changed
|
|
(for example, \f4chmod\f1(2)), the attributes of the underlying object are
|
|
not affected.
|
|
.SH "RETURN VALUE"
|
|
If successful, \f4fattach\f1 returns 0; otherwise it returns -1 and sets
|
|
\f4errno\f1 to indicate an error.
|
|
.SH ERRORS
|
|
Under the following conditions,
|
|
the function \f4fattach\f1 fails and sets \f4errno\f1 to:
|
|
.TP 13
|
|
\f4EACCES\fP
|
|
Search permission is denied on a component of the path prefix.
|
|
.TP
|
|
\f4EACCES\fP
|
|
The user is the owner of the filenamed by \f2path\f1 but does not
|
|
have write permissions on \f2path\f1 or \f2fildes\f1 is locked.
|
|
.\".TP
|
|
.\"\f4EACCES\fP
|
|
.\"The Mandatory Access Control level of the filenamed by \f2path\fP
|
|
.\"is not equal to the level of the device associated with \f2fildes\fP.
|
|
.TP 13
|
|
\f4EBADF\fP
|
|
\f2fildes\f1 is not a valid open file descriptor.
|
|
.TP 13
|
|
\f4ENOENT\fP
|
|
\f2path\f1 does not exist.
|
|
.TP 13
|
|
\f4ENOTDIR\fP
|
|
A component of a path prefix is not a directory.
|
|
.TP 13
|
|
\f4EINVAL\fP
|
|
\f2fildes\f1 does not represent a STREAMS file.
|
|
.TP 13
|
|
\f4EPERM\fP
|
|
The effective user ID of the calling process
|
|
is not the owner of the filenamed by \f2path\f1.
|
|
.\"nor does the process have appropriate privilege (\f4P_OWNER\fP).
|
|
.TP 13
|
|
\f4EBUSY\fP
|
|
\f2path\f1 is currently a mount point or has a STREAMS file
|
|
descriptor attached it.
|
|
.TP 13
|
|
\f4ENAMETOOLONG\fP
|
|
The size of \f2path\f1 exceeds \f4{PATH_MAX}\fP, or the component of
|
|
a pathname is longer than \f4{NAME_MAX}\fP while \f4{_POSIX_NO_TRUNC}\fP
|
|
is in effect.
|
|
.TP 13
|
|
\f4ELOOP\fP
|
|
Too many symbolic links were encountered in translating \f2path\f1.
|
|
.TP 13
|
|
\f4EREMOTE\fP
|
|
\f2path\fP is a file in a remotely mounted directory.
|
|
.SH "SEE ALSO"
|
|
fdetach(1M),
|
|
fdetach(3C),
|
|
isastream(3C),
|
|
streamio(7)
|