[UP]


Manual Reference Pages  - system_unlink (3)

NAME

system_unlink(3f) - [M_system] remove a directory entry relative to directory file descriptor (LICENSE:PD)

CONTENTS

Synopsis
Description
Return Value
Examples

SYNOPSIS

elemental impure integer function unlink(path);

character(len=*) :: path

DESCRIPTION

The unlink() function shall remove a link to a file. If path names a symbolic link, unlink() shall remove the symbolic link named by path and shall not affect any file or directory named by the contents of the symbolic link. Otherwise, unlink() shall remove the link named by the pathname pointed to by path and shall decrement the link count of the file referenced by the link.

When the file’s link count becomes 0 and no process has the file open, the space occupied by the file shall be freed and the file shall no longer be accessible. If one or more processes have the file open when the last link is removed, the link shall be removed before unlink() returns, but the removal of the file contents shall be postponed until all references to the file are closed.

The path argument shall not name a directory unless the process has appropriate privileges and the implementation supports using unlink() on directories.

Upon successful completion, unlink() shall mark for update the last data modification and last file status change timestamps of the parent directory. Also, if the file’s link count is not 0, the last file status change timestamp of the file shall be marked for update.

Values for flag are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>:

    AT_REMOVEDIR

Remove the directory entry specified by fd and path as a directory, not a normal file.

RETURN VALUE

Upon successful completion, these functions shall return 0. Otherwise, these functions shall return -1 and set errno to indicate the error. If -1 is returned, the named file shall not be changed.

EXAMPLES

Removing a link to a file

   program demo_system_unlink
   use M_system, only : system_unlink, system_perror
   integer :: ierr
   ierr = system_unlink(’myfile1’)
   if(ierr.ne.0)then
      call system_perror(’*demo_system_unlink*’)
   endif
   end program demo_system_unlink


system_unlink (3) July 05, 2020
Generated by manServer 1.08 from f6df02ae-f498-4736-ab26-2613ee663715 using man macros.