Scroll to navigation

UNLINK(2) Linux Programmeurs Handleiding UNLINK(2)

NAAM

unlink, unlinkat - verwijder een naam en mogelijk het bestand waarnaar het wijst

SAMENVATTING

#include <unistd.h>
int unlink(const char *padnaam);
#include <fcntl.h>           /* Definitie van AT_* constanten */
#include <unistd.h>
int unlinkat(int mapbi, const char *padnaam, int vlaggen);


Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

unlinkat():

Sinds glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Vóór glibc 2.10:
_ATFILE_SOURCE

BESCHRIJVING

unlink() verwijderd een naam uit een bestandsysteem. Als die naam de laatste koppeling was van een bestand en geen enkel proces heef het bestand open, dan wordt het bestand verwijderd en de ruimte die het innam wordt vrijgemaakt om hergebruikt te worden.

Als de naam de laatste koppeling was naar het bestand maar er zijn nog processen die het bestand nog steeds open hebben, dan zal het bestand blijven bestaan totdat de laatste bestandindicator die ernaar verwijst gesloten is.

Als de naam wijst naar een symbolische koppeling dan wordt die koppeling verwijderd.

Als de naam wijst naar een `socket', een fifo of een apparaat dan wordt de naam ervoor verwijderd maar processen die het voorwerp open hebben mogen het blijven gebruiken.

unlinkat()

The unlinkat() system call operates in exactly the same way as either unlink() or rmdir(2) (depending on whether or not flags includes the AT_REMOVEDIR flag) except for the differences described here.

If the pathname given in pathname is relative, then it is interpreted relative to the directory referred to by the file descriptor dirfd (rather than relative to the current working directory of the calling process, as is done by unlink() and rmdir(2) for a relative pathname).

If the pathname given in pathname is relative and dirfd is the special value AT_FDCWD, then pathname is interpreted relative to the current working directory of the calling process (like unlink() and rmdir(2)).

Als pathname absoluut is, dan wordt mapbi genegeerd.

flags is a bit mask that can either be specified as 0, or by ORing together flag values that control the operation of unlinkat(). Currently, only one such flag is defined:

AT_REMOVEDIR
By default, unlinkat() performs the equivalent of unlink() on pathname. If the AT_REMOVEDIR flag is specified, then performs the equivalent of rmdir(2) on pathname.

See openat(2) for an explanation of the need for unlinkat().

EIND WAARDE

Bij succes wordt nul teruggegeven. Bij falen wordt -1 teruggegeven en wordt errno naar behoren gezet.

FOUTEN

EACCES
Schrijf toegang in de map die padnaam bevat wordt niet toegestaan voor het geldende uid van het proces, of een van de mappen in padnaam liet zoek (voer-uit) toestemming niet toe. (Zie ook path_resolution(7).)
EBUSY
The file pathname cannot be unlinked because it is being used by the system or another process; for example, it is a mount point or the NFS client software created it to represent an active but otherwise nameless inode ("NFS silly renamed").
EFAULT
padnaam wijst buiten de voor u toegankelijke adresruimte.
EIO
Een In/Uit fout trad op.
EISDIR
pathname refers to a directory. (This is the non-POSIX value returned by Linux since 2.1.132.)
ELOOP
Teveel symbolische koppelingen werden tegengekomen bij het vertalen van padnaam.
ENAMETOOLONG
padnaam was te lang.
ENOENT
Een deel in padnaam bestaat niet of is een loshangende symbolische koppeling, of padnaam is leeg.
ENOMEM
Onvoldoende kernelgeheugen voorhanden.
ENOTDIR
Een deel gebruikt als map in padnaam is in feite geen map.
EPERM
The system does not allow unlinking of directories, or unlinking of directories requires privileges that the calling process doesn't have. (This is the POSIX prescribed error return; as noted above, Linux returns EISDIR for this case.)
EPERM (alleen Linux)
The filesystem does not allow unlinking of files.
EPERM of EACCES
The directory containing pathname has the sticky bit (S_ISVTX) set and the process's effective UID is neither the UID of the file to be deleted nor that of the directory containing it, and the process is not privileged (Linux: does not have the CAP_FOWNER capability).
EPERM
The file to be unlinked is marked immutable or append-only. (See ioctl_iflags(2).)
EROFS
padnaam verwijst naar een bestand op een alleen-lezen bestandsysteem.

The same errors that occur for unlink() and rmdir(2) can also occur for unlinkat(). The following additional errors can occur for unlinkat():

EBADF
mapbi is geen geldige bestandindicator.
EINVAL
Een ongeldig vlag werd in vlaggen opgegeven.
EISDIR
mapbi wijst naar een map, en AT_REMOVEDIR werd in vlaggen niet opgegeven.
ENOTDIR
padnaam is relatief en mapbi is een bestandsindicatoor die naar een bestand wijst die geen map is.

VERSIES

unlinkat() was added to Linux in kernel 2.6.16; library support was added to glibc in version 2.4.

VOLDOET AAN

unlink(): SVr4, 4.3BSD, POSIX.1-2001, POSIX.1-2008.

unlinkat(): POSIX.1-2008.

OPMERKINGEN

Glibc-opmerkingen

On older kernels where unlinkat() is unavailable, the glibc wrapper function falls back to the use of unlink() or rmdir(2). When pathname is a relative pathname, glibc constructs a pathname based on the symbolic link in /proc/self/fd that corresponds to the dirfd argument.

BUGS

Ongelukkigheden in het protocol waar NFS op is gebaseerd kunnen het onverwacht verdwijnen van bestanden veroorzaken die nog steeds gebruikt worden.

ZIE OOK

rm(1), unlink(1), chmod(2), link(2), mknod(2), open(2), rename(2), rmdir(2), mkfifo(3), remove(3), path_resolution(7), symlink(7)

COLOFON

Deze pagina is onderdeel van release 5.04 van het Linux man-pages-project. Een beschrijving van het project, informatie over het melden van bugs en de nieuwste versie van deze pagina zijn op https://www.kernel.org/doc/man-pages/ te vinden.

VERTALING

De Nederlandse vertaling van deze handleiding is geschreven door Jos Boersema <joshb@xs4all.nl> en Mario Blättermann <mario.blaettermann@gmail.com>

Deze vertaling is vrije documentatie; lees de GNU General Public License Version 3 of later over de Copyright-voorwaarden. Er is geen AANSPRAKELIJKHEID.

Indien U fouten in de vertaling van deze handleiding zou vinden, stuur een e-mail naar <debian-l10n-dutch@lists.debian.org>.

15 september 2017 Linux