unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

MKNOD(2V)                                                            MKNOD(2V)



NAME
       mknod, mkfifo - make a special file

SYNOPSIS
       #include <&lt;sys/types.h>&gt;
       #include <&lt;sys/stat.h>&gt;

       int mknod(path, mode, dev)
       char *path;
       int mode, dev;

       int mkfifo(path, mode)
       char *path;
       mode_t mode;

DESCRIPTION
       mknod()  creates  a new file named by the path name pointed to by path.
       The mode of the new file (including file type bits) is initialized from
       mode.  The values of the file type bits which are permitted are:

              #define    S_IFCHR       0020000/* character special */
              #define    S_IFBLK       0060000/* block special */
              #define    S_IFREG       0100000/* regular */
              #define    S_IFIFO       0010000/* FIFO special */

       Values  of  mode other than those above are undefined and should not be
       used.

       The access permissions of the mode are modified by the  process's  mode
       mask (see umask(2V)).

       The  owner  ID  of  the  file  is  set  to the effective user ID of the
       process.  The group ID of the file is set to either:

              o  the effective group ID of the process, if the filesystem  was
                 not  mounted  with  the BSD file-creation semantics flag (see
                 mount(2V)) and the set-gid bit of  the  parent  directory  is
                 clear, or

              o  the group ID of the directory in which the file is created.

       If  mode indicates a block or character special file, dev is a configu-
       ration dependent specification of a character or block I/O device.   If
       mode does not indicate a block special or character special device, dev
       is ignored.

       mknod() may be invoked only by the super-user for file types other than
       FIFO special.

       mkfifo()  creates a new FIFO special file named by the pathname pointed
       to by path.  The access permissions of the  new  FIFO  are  initialized
       from  mode.   The  access  permissions  of  mode  are  modified  by the
       process's file creation mask, see umask(2V).  Bits in mode  other  than
       the access permissions are ignored.

       The  FIFO's  owner  ID  is set to the process's effective user ID.  The
       FIFO's group ID is set to the group ID of the directory  in  which  the
       FIFO is being created or to the process's effective group ID.

       Upon  successful completion, the mkfifo() function marks for update the
       st_atime, st_ctime,  and  st_mtime  fields  of  the  file.   Also,  the
       st_ctime  and  st_mtime  fields  of the directory that contains the new
       entry are marked for update.

RETURN VALUES
       mknod() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

       mkfifo() returns:

       0      on success.

       -1     on failure and sets errno to indicate the  error.   No  FIFO  is
              created.

ERRORS
       mknod() fails and the file mode remains unchanged if:

       EACCES              Search  permission is denied for a component of the
                           path prefix of path.

       EDQUOT              The directory in which the entry for the  new  file
                           is  being  placed  cannot  be  extended because the
                           user's quota of disk blocks on the file system con-
                           taining the directory has been exhausted.

       EDQUOT              The  user's  quota  of inodes on the file system on
                           which the node is being created has been exhausted.

       EEXIST              The file referred to by path exists.

       EFAULT              path points outside the process's allocated address
                           space.

       EIO                 An I/O error occurred while reading from or writing
                           to the file system.

       EISDIR              The specified mode would have created a directory.

       ELOOP               Too many symbolic links were encountered in  trans-
                           lating path.

       ENAMETOOLONG        The length of the path argument exceeds {PATH_MAX}.

                           A pathname component is longer than {NAME_MAX} (see
                           sysconf(2V)) while {_POSIX_NO_TRUNC} is  in  effect
                           (see pathconf(2V)).

       ENOENT              A  component  of  the  path prefix of path does not
                           exist.

       ENOSPC              The directory in which the entry for the  new  file
                           is being placed cannot be extended because there is
                           no space left on the  file  system  containing  the
                           directory.

       ENOSPC              There  are  no  free  inodes  on the file system on
                           which the file is being created.

       ENOTDIR             A component of the path prefix of  path  is  not  a
                           directory.

       EPERM               An  attempt was made to create a file of type other
                           than FIFO special and the process's effective  user
                           ID is not super-user.

       EROFS               The file referred to by path resides on a read-only
                           file system.

       mkfifo() may set errno to:

       EACCES              A component of the path prefix denies  search  per-
                           mission.

       EEXIST              The named file already exists.

       ENAMETOOLONG        The length of the path string exceeds {PATH_MAX}.

                           A  pathname  component  is  longer  than {NAME_MAX}
                           while {_POSIX_NO_TRUNC} is  in  effect  (see  path-
                           conf(2V)).

       ENOENT              A component of the path prefix does not exist.

                           path points to an empty string.

       ENOSPC              The  directory that would contain the new file can-
                           not be extended.

                           The  file  system  is  out   of   file   allocation
                           resources.

       ENOTDIR             A component of the path prefix is not a directory.

       EROFS               The named file resides on a read-only file system.

SEE ALSO
       chmod(2V), execve(2V), pipe(2V), stat(2V), umask(2V), write(2V)



                                21 January 1990                      MKNOD(2V)