creat man page on Ultrix

Man page or keyword search:  
man Server   3690 pages
apropos Keyword Search (all sections)
Output format
Ultrix logo
[printable version]

creat(2)							      creat(2)

Name
       creat - create a new file

Syntax
       #include <sys/types.h>
       #include <sys/stat.h>
       #include <fcntl.h>

       #include <limits.h> /*Definition of OPEN_MAX*/
       creat(name, mode)
       char *name;
       mode_t mode;

Description
       The  system  call creates a new file or prepares to rewrite an existing
       file called name, given as the address of a null-terminated string.  If
       the  file  did  not  exist,  it	is given mode mode, as modified by the
       process's mode mask.  For further information, see Also,	 see  for  the
       construction of the mode argument.

       If  the	file did exist, its mode and owner remain unchanged, but it is
       truncated to zero length.

       The file is also	 opened	 for  writing,	and  its  file	descriptor  is
       returned.

       The  mode  given is arbitrary; it need not allow writing.  This feature
       has been used in the past by programs to construct a  simple  exclusive
       locking	mechanism.   It is replaced by the O_EXCL open mode, or facil‐
       ity.

       No process may have more than OPEN_MAX files simultaneously.

Return Values
       The value -1 is returned if  an	error  occurs.	 Otherwise,  the  call
       returns a non-negative descriptor that permits only writing.

Environment
       Differs from the System V definition in that ELOOP and ENXIO are possi‐
       ble error conditions, but ENFILE and ENOSPC are not.

Diagnostics
       The system call fails and the file is not created  or  truncated	 under
       the following conditions:

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

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

       [EACCES]	      The file does not exist, and the directory in  which  it
		      is to be created is not writable.

       [EACCES]	      The file exists, but it is unwritable.

       [EISDIR]	      The file is a directory.

       [EMFILE]	      Too many files are open.

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

       [ENXIO]	      The  file	 is a character special or block special file,
		      and the associated device does not exist.

       [ETXTBSY]      The file is a pure procedure (shared text) file that  is
		      being executed.

       [EFAULT]	      The  name points outside the process's allocated address
		      space.

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

       [EOPNOTSUPP]   The file is a socket, which is not implemented.

       [ENAMETOOLONG] A component of a pathname exceeded 255 characters, or an
		      entire pathname exceeded 1023 characters.

       [ENOENT]	      The named file does not exist.

       [ENFILE]	      The system file table is full.

       [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.

       [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 containing the direc‐
		      tory has been exhausted.

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

       [EIO]	      An  I/O  error occurred while making the directory entry
		      or allocating the inode.

       [ESTALE]	      The ``file handle'' given in the	argument  is  invalid.
		      The  file	 referred  to  by  that	 file handle no longer
		      exists or has been revoked.

       [ETIMEDOUT]    A	 connect  request  or  remote  file  operation	failed
		      because  the  connected  party  did not properly respond
		      after a period of time that is dependent on the communi‐
		      cations protocol.

See Also
       close(2), chmod(2), open(2), umask(2), write(2)

								      creat(2)
[top]

List of man pages available for Ultrix

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
...................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net