*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> fattach (3)              



NAME    [Toc]    [Back]

       fattach - Attach a STREAMS-based file descriptor to a file
       in the file system name space

SYNOPSIS    [Toc]    [Back]

       #include <stropts.h>

       int fattach(
               int fd,
               const char *path );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

STANDARDS    [Toc]    [Back]

       Interfaces documented on this reference  page  conform  to
       industry standards as follows:

       fattach():  XSH4.0, XSH4.2, XSH5.0

       Refer  to standards(5) for more information about industry
       standards and associated tags.

PARAMETERS    [Toc]    [Back]

       Specifies a valid open file descriptor that is  associated
       with a STREAMS  file.  Specifies the pathname of an existing
 regular file or directory.

DESCRIPTION    [Toc]    [Back]

       The fattach() function  associates  a  STREAMS-based  file
       descriptor to the file pointed to by the path parameter.

       A  successful  call  to  the fattach() function causes all
       pathnames that name the file named by the  path  parameter
       to  name the STREAMS file associated with the fd parameter
       until the STREAMS file is  detached  from  the  file.  The
       STREAMS  file  is detached from the file by using the fdetach()
 function.  A STREAMS file can be attached  to  more
       than  one  file  and can have several pathnames associated
       with it.

       The attributes of the named STREAMS file  are  initialized
       as  follows: The group ID, user ID, times, and permissions
       are set to those of the file pointed to by the path parameter.
   The number of links is set to 1.  The size and the
       device identifier are set to those  of  the  STREAMS  file
       that is associated with the fd parameter.

       If  any  of  the  attributes of the named STREAMS file are
       subsequently changed, for example by the chmod() function,
       the  change affects neither the attributes of the underlying
 file nor the attributes of the STREAMS file  to  which
       the fd parameter refers.

       Any file descriptors referring to the underlying file that
       were opened prior to an fattach() call continue  to  refer
       to the underlying file.

       The  fattach()  function  uses  the  File-on-File Mounting
       (FFM) file system.  Instead of mounting a file system on a
       mount  point,  the  fattach()  function  ffm mounts a file
       descriptor on  a  mount  point,  which  can  be  either  a
       directory or a regular file.  See ffm(4).

RESTRICTIONS    [Toc]    [Back]

       [Tru64  UNIX]  The  fattach()  function  requires that the
       FFM_FS kernel option be configured.  See  System  Administration
 for information on configuring kernel options.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the fattach() function returns
       a value of 0 (zero). Otherwise, it returns a value of  -1,
       and errno is set to indicate the error.

ERRORS    [Toc]    [Back]

       If  any  of the following conditions occurs, the fattach()
       function sets errno to the value that corresponds  to  the

       Although  the  user  is the owner of path, the user has no
       write permissions for it, or the object designated  by  fd
       is  locked.   The fd parameter is an invalid file descriptor.
  The existing object specified by the path  parameter
       is  already  mounted  or  has  a  STREAMS  file descriptor
       attached to it.  [Tru64 UNIX]  The path  parameter  points
       to  a  location  outside of the allocated address space of
       the process.  The fd parameter refers to a socket and  not
       a STREAMS file.

              [Tru64  UNIX]  The  superblock  for the file system
              had an incorrect magic number or an  out  of  range
              block size.

              [Tru64 UNIX]  The pathname is incorrect.  When path
              was translated, too many symbolic links were found.
              [Tru64  UNIX]  There  are too many file descriptors
              attached (system-wide).  An  element  of  the  path
              parameter  does  not  exist  or is an empty string.
              [Tru64  UNIX]  The  system  resources   have   been
              exhausted.   The  directory  portion  of  the  path
              parameter does not exist.  [Tru64  UNIX]  The  size
              of  a  pathname  component  is longer than NAME_MAX
              when _POSIX_NO_TRUNC is in effect.

              The pathname length is longer than PATH_MAX or  the
              length  of  the  intermediate  result of a pathname
              resolution  of  a  symbolic  link  is  longer  than
              PATH_MAX.  The current effective user ID is not the
              owner of the existing file specified  by  the  path
              parameter.  Another  cause  of  the error is if the
              current effective user ID does not specify  a  user
              with  the  correct privileges.  A link to a file on
              another file system has been attempted.

EXAMPLES    [Toc]    [Back]

       The following example shows  a  program  that  attaches  a
       STREAMS file to a regular file and results in a df display
       that indicates the  File-on-File  Mounting  (FFM)  is  the
       mounted file system.

       #include    <fcntl.h>   #include   <sys/stat.h>   #include
       <sys/types.h>  #include  <stropts.h>  #include   <stdio.h>
       #include <errno.h> #include <unistd.h>

       main (int argc, char **argv) {
               int     fd;
               int     error;

               if  ((fd  =  open("/tmp/astream", O_RDONLY, 0)) ==
       -1) {
                       perror ("open");


               if ((error = isastream(fd)) != 1) {
                    printf("not a stream\n");                  if
       (error == -1)

               printf("is a stream\n");

               if ((error = fattach(fd, "/tmp/afile")) == -1) {
                       perror ("fattach");


                 exit(0); }

       %  df /tmp/afile Filesystem        512-blocks Used  Available
 Capacity  Mounted  on  file-on-file  mount          0
       0          0     100%  /tmp/afile

SEE ALSO    [Toc]    [Back]

       Functions:  fdetach(3),  isastream(3),  chmod(2), stat(2),

       Commands: fdetach(8)

       Interfaces: streamio(7)

       Files: ffm(4)

       Standards: standards(5)

       Network Programmer's Guide

[ Back ]
 Similar pages
Name OS Title
fattach IRIX attach a STREAMS-based file descriptor to an object in the filesystem name space
fdetach Tru64 Detach a STREAMS-based file descriptor from a file in the file system name space
fdetach Tru64 Detaches a STREAMS-based file descriptor from a file
fdetach IRIX detach a name from a STREAMS-based file descriptor
fdetach IRIX detach a name from a STREAMS-based file descriptor
fdetach HP-UX detach a STREAMS-based file descriptor from a filename
isastream Tru64 Determine if a file descriptor refers to a STREAMS file
usopenpollsema IRIX attach a file descriptor to a pollable semaphore
endfsent FreeBSD get file system descriptor file entry
getfsent OpenBSD get file system descriptor file entry
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service