Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
OPEN(2)			      System Calls Manual		       OPEN(2)

NAME
       open - open for reading or writing

SYNOPSIS
       #include	<sys/types.h>
       #include	<sys/file.h>

       open(name, mode)
       char *name;

DESCRIPTION
       Open  opens the file name for reading (if mode is FATT_RDONLY), writing
       (if mode	is FATT_WRONLY)	or for both reading and	writing	 (if  mode  is
       FATT_RDWR).  Name is the	address	of a string of ASCII characters	repre-
       senting a path name, terminated by a null character.

       The file	is positioned at the beginning (byte 0).   The	returned  file
       descriptor  must	 be  used  for subsequent calls	for other input-output
       functions on the	file.

ERRORS
       The named file is opened	unless one or more of the following is true:

       [EINVAL]		   The path name contains a non-ASCII byte.

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

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

       [ENOENT]		   The named file does not exist.

       [EISDIR]		   The	named  file  is	 a directory and the arguments
			   specify it is to be opened for writing.

       [EROFS]		   The named file resides on a read-only  file	system
			   and the file	is to be modified.

       [EMFILE]		   The	maximum	number of file descriptors allowed are
			   already open.

       [ETXTBSY]	   The file is a pure  procedure  (shared  text)  file
			   that	 is  being executed and	the open call requests
			   write access.

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

       [ELOOP]		   Too	many symbolic links were encountered in	trans-
			   lating the path name.

SEE ALSO
       close(2), creat(2), dup(2), read(2), write(2)

ASSEMBLER
       (open = 5.)
       sys open; name; mode
       (file descriptor	in r0)

3rd Berkeley Distribution					       OPEN(2)

NAME | SYNOPSIS | DESCRIPTION | ERRORS | SEE ALSO | ASSEMBLER

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=open&sektion=2&manpath=2.9.1+BSD>

home | help