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

  man pages->HP-UX 11i man pages -> mknod (2)              
Title
Content
Arch
Section
 

Contents


 mknod(2)                                                           mknod(2)




 NAME    [Toc]    [Back]
      mknod() - make directory, special, or ordinary file

 SYNOPSIS    [Toc]    [Back]
      #include <sys/stat.h>

      int mknod(const char *path, mode_t mode, dev_t dev);

 DESCRIPTION    [Toc]    [Back]
      The mknod() system call creates a new file named by the path name
      pointed to by path.  The mode of the new file is specified by the mode
      argument.

      Symbolic constants that define the file type and file access
      permission bits are found in the <sys/stat.h> header file and are used
      to construct the mode argument.  The value of the mode argument should
      be the bit-wise inclusive OR of the values of the desired file type,
      miscellaneous mode bits, and access permissions.  See stat(5) for a
      description of the components of the file mode.

      The owner ID of the file is set to the effective-user-ID of the
      process.  If the set-group-ID bit of the parent directory is set, the
      new file's group ID is set to the group ID of the parent directory.
      Otherwise, the new file's group ID is set to the effective-group-ID of
      the process.

      The file access permission bits of mode are modified by the process's
      file mode creation mask: for each bit set in the process's file mode
      creation mask, the corresponding bit in the file's mode is cleared
      (see umask(2)).

      In HFS file systems, the new file is created with three base accesscontrol-list
 (ACL) entries, corresponding to the file access
      permission bits (see acl(5)).  On JFS file systems that support access
      control lists, when creating a directory or regular file, optional ACL
      entries are created corresponding to the parent directory's default
      ACL entries (see aclv(5)).  When creating a directory, the parent's
      default ACL entries are also copied as the new directory's default ACL
      entries.

      The dev argument is meaningful only if mode indicates a block or
      character special file, and is ignored otherwise.  It is an
      implementation- and configuration-dependent specification of a
      character or block I/O device.  The value of dev is created by using
      the makedev() macro defined in <sys/mknod.h>.  The makedev() macro
      takes as arguments the major and minor device numbers, and returns a
      device identification number which is of type dev_t.  The value and
      interpretation of the major and minor device numbers are
      implementation-dependent.  For more information, see mknod(5) and the
      System Administration manuals for your system.




 Hewlett-Packard Company            - 1 -   HP-UX 11i Version 2: August 2003






 mknod(2)                                                           mknod(2)




      Only users having appropriate privileges can invoke mknod() for file
      types other than FIFO files.

 RETURN VALUE    [Toc]    [Back]
      mknod() returns the following values:

            0   Successful completion.
           -1   Failure.  The new file is not created.  errno is set to
                indicate the error.

 ERRORS    [Toc]    [Back]
      If mknod() fails, errno is set to one of the following values.

           [EACCES]       The directory in which path would be created
                          denies write permission, mode is for a FIFO file
                          and the caller does not have appropriate
                          privileges.

           [EACCES]       A component of the path prefix denies search
                          permission.

           [EDQUOT]       The user's disk quota block or inode limit has
                          been reached for this file system.

           [EEXIST]       The named path already exists.

           [EFAULT]       The path argument points outside the process's
                          allocated address space.  The reliable detection
                          of this error is implementation dependent.

           [ELOOP]        Too many symbolic links were encountered in
                          translating the path name.

           [ENAMETOOLONG] The length of the specified path name exceeds
                          PATH_MAX bytes, or the length of a component of
                          the path name exceeds NAME_MAX bytes while
                          _POSIX_NO_TRUNC is in effect.

           [ENOENT]       The path argument is null.

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

           [ENOSPC]       Not enough space on the file system.

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

           [EPERM]        The effective-user-ID of the process does not
                          match that of a user who has appropriate
                          privileges, and the file type is not FIFO special.





 Hewlett-Packard Company            - 2 -   HP-UX 11i Version 2: August 2003






 mknod(2)                                                           mknod(2)




           [EROFS]        The directory in which the file is to be created
                          is located on a read-only file system.

 AUTHOR    [Toc]    [Back]
      mknod() was developed by AT&T and HP.

 SEE ALSO    [Toc]    [Back]
      mknod(1M), acl(2), chmod(2), exec(2), mkdir(2), setacl(2), umask(2),
      acl(5), aclv(5), mknod(5), stat(5), types(5).

 STANDARDS CONFORMANCE    [Toc]    [Back]
      mknod(): SVID2, SVID3, XPG2


 Hewlett-Packard Company            - 3 -   HP-UX 11i Version 2: August 2003
[ Back ]
      
      
 Similar pages
Name OS Title
mknod IRIX make a directory, or a special or ordinary file
mknod Linux create a special or ordinary file
mkfifo IRIX make FIFO special file
mkfifo IRIX make a FIFO special file
mknod OpenBSD make a special file node
mknod FreeBSD make a special file node
mknod NetBSD make a special file node
mksf HP-UX make a special (device) file
mkfifo Linux make a FIFO special file (a named pipe)
mkdir HP-UX make a directory file
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service