unlink(2) System Calls Manual unlink(2) NAAM unlink, unlinkat - verwijder een naam en mogelijk het bestand waarnaar het wijst BIBLIOTHEEK Standard C bibliotheek (libc, -lc) SAMENVATTING #include int unlink(const char *path); #include /* Definitie van AT_* constanten */ #include int unlinkat(int dirfd, const char *path, int flags); Feature Test Macro's eisen in glibc (zie feature_test_macros(7)): unlinkat(): Vanaf glibc 2.10: _POSIX_C_SOURCE >= 200809L Voor glibc 2.10: _ATFILE_SOURCE BESCHRIJVING unlink() verwijderd een naam uit een bestandssysteem. Als die naam de laatste koppeling was van een bestand en geen enkel proces heeft 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() De unlinkat() systeem aanroep werkt op exact dezelfde manier zoals unlink() of rmdir(2) (afhankelijk van of de flags wel of niet de AT_REMOVEDIR vlag bevat) behalve voor de verschillen zoals hier beschreven. If path 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 path is relative and dirfd is the special value AT_FDCWD, then path is interpreted relative to the current working directory of the calling process (like unlink() and rmdir(2)). Als padnaam absoluut is, dan wordt mapbi genegeerd. vlaggen is een bit masker dat ofwel gespecificeerd worden als 0, of door de logische OF-bewerking op de waarden van de vlag die de operatie van unlinkat() bepalen. Op dit moment is alleen een zo'n vlag gedefinieerd: AT_REMOVEDIR By default, unlinkat() performs the equivalent of unlink() on path. If the AT_REMOVEDIR flag is specified, it performs the equivalent of rmdir(2) on path. Zie openat(2) voor een uitleg over het gebruik van unlinkat(). EIND WAARDE Bij succes wordt nul teruggegeven. Bij falen wordt -1 teruggegeven en wordt errno overeenkomstig gezet. FOUTEN EACCES Write access to the directory containing path is not allowed for the process's effective UID, or one of the directories in path did not allow search permission. (See also path_resolution(7).) EBUSY path 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 pad wijst buiten door u toegankelijke adres ruimte. EIO Een Invoer/Uitvoer fout trad op. EISDIR path refers to a directory. (This is the non-POSIX value returned since Linux 2.1.132.) ELOOP Too many symbolic links were encountered in translating path. ENAMETOOLONG pad was te lang. ENOENT A component in path does not exist or is a dangling symbolic link, or path is empty. ENOMEM Onvoldoende kernelgeheugen voorhanden. ENOTDIR Een onderdeel gebruikt als map in pad is in feite geen map. EPERM Het systeem staat ontkoppelen van mappen niet toe, of het ontkoppelen van mappen behoeft privileges die het aanroepende proces niet heeft. (Dit is de voorgeschreven POSIX fout waarde; zoals hierboven beschreven zal Linux in dit geval EISDIR terug geven.) EPERM (alleen Linux) Het bestandssysteem staat ontkoppeling van bestanden niet toe. EPERM of EACCES The directory containing path 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 Het te ontkoppelen bestand is gemarkeerd als onveranderlijk of alleen-toevoegen. (Zie FS_IOC_SETFLAGS(2const).) EROFS pad verwijst naar een bestand op een alleen-lezen bestandsysteem. Dezelfde fouten die optreden in unlink() en rmdir(2) kunnen ook optreden in unlinkat(). De volgende additionele fouten kunnen optreden in unlinkat(): EBADF pad is relatief en mapbi is noch AT_FDCWD noch een geldige bestandsindicator. EINVAL Een ongeldige vlag werd opgegeven in vlaggen. EISDIR path refers to a directory, and AT_REMOVEDIR was not specified in flags. ENOTDIR path is relative and dirfd is a file descriptor referring to a file other than a directory. VOLDOET AAN POSIX.1-2008. GESCHIEDENIS unlink() SVr4, 4.3BSD, POSIX.1-2001. unlinkat() POSIX.1-2008. Linux 2.6.16, glibc 2.4. glibc On older kernels where unlinkat() is unavailable, the glibc wrapper function falls back to the use of unlink() or rmdir(2). When path is relative, 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) VERTALING De Nederlandse vertaling van deze handleiding is geschreven door Jos Boersema , Mario Blattermann en Luc Castermans 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 . Linux man-pages 6.15 17 mei 2025 unlink(2)