Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mkdir(1)

chmod(2)

exec(2)

umask(2)

fs(4)



  mknod(2)                            CLIX                            mknod(2)



  NAME

    mknod - Makes a directory, or a special or ordinary file

  LIBRARY

    Standard C Library (libc.a)

  SYNOPSIS

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

  PARAMETERS

    path   Specifies the pathname of the file to be created.

    mode   Specifies the access permissions and file flags.

    dev    Specifies the major and minor device number for special devices.

  DESCRIPTION

    The mknod() function creates a new file named by the pathname pointed to
    by path.  The mode of the new file is initialized from mode, where the
    value of mode is interpreted as follows:

    0170000   File type; one of the following:

              0010000
                     FIFO special.

              0020000
                     Character special.

              0040000
                     Directory.

              0060000
                     Block special.

              0070000
                     Socket.

              0100000 or 0000000
                     Ordinary file.

              0120000
                     Symbolic link.



  2/94 - Intergraph Corporation                                              1






  mknod(2)                            CLIX                            mknod(2)



    0004000   Set-user-ID on execution

    00020#0   Set-group-ID on execution if # is 7, 5, 3, or 1

              Enable mandatory file/record locking if # is 6, 4, 2, or 0

    0001000   Save text image after execution

    0000777   Access permissions; constructed from the following:

              0000400   Read by owner

              0000200   Write by owner

              0000100   Execute (search on directory) by owner

              0000070   Read, write, execute (search) by group

              0000007   Read, write, execute (search) by others

    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 the effective group ID of the process.

    Values of mode other than those above are undefined and should not be
    used.  The low-order 9 bits of mode are modified by the process's file
    mode creation mask:  all bits set in the process's file mode creation mask
    are cleared.  (See the umask() function.)  If mode indicates a block or
    character special file type, dev is a configuration-dependent
    specification of a character or block I/O device.  If mode does not
    indicate a block special or character special file type, dev is ignored.

    The mknod() function may be invoked only by the superuser for file types
    other than FIFO special.

  EXAMPLES

    To create a character special file with read-only permission for all
    users:

    if (mknod("/dev/newdevice", 0020444, device_number) != 0)
         perror("mknod failed");


  CAUTIONS

    If mknod() is used to create a device in a remote directory (Remote File
    Sharing), the major and minor device numbers are interpreted by the
    server.

  RETURN VALUES




  2                                              Intergraph Corporation - 2/94






  mknod(2)                            CLIX                            mknod(2)



    Upon successful completion a value of 0 is returned.  Otherwise, a value
    of -1 is returned and errno is set to indicate the error.

  ERRORS

    The mknod() function fails and the new file will not be created if one or
    more of the following are true:

    [EPERM]
           The effective user ID of the process is not superuser.

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

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

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

    [EEXIST]
           The named file exists.

    [EFAULT]
           The path parameter points outside the allocated address space of
           the process.

    [ENOSPC]
           No space is available.

    [EINTR]
           A signal was caught during the mknod() function.

    [ENOLINK]
           The path parameter points to a remote machine and the link to that
           machine is no longer active.

    [EMULTIHOP]
           Components of path require hopping to multiple remote machines.

  RELATED INFORMATION

    Commands:  mkdir(1)

    Functions:  chmod(2), exec(2), umask(2)

    Files:  fs(4)






  2/94 - Intergraph Corporation                                              3




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026