Changeset View
Changeset View
Standalone View
Standalone View
head/sys/compat/linux/linux_file.c
Show First 20 Lines • Show All 584 Lines • ▼ Show 20 Lines | linux_unlink(struct thread *td, struct linux_unlink_args *args) | ||||
LCONVPATHEXIST(td, args->path, &path); | LCONVPATHEXIST(td, args->path, &path); | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(unlink)) | if (ldebug(unlink)) | ||||
printf(ARGS(unlink, "%s"), path); | printf(ARGS(unlink, "%s"), path); | ||||
#endif | #endif | ||||
error = kern_unlinkat(td, AT_FDCWD, path, UIO_SYSSPACE, 0); | error = kern_unlinkat(td, AT_FDCWD, path, UIO_SYSSPACE, 0, 0); | ||||
if (error == EPERM) { | if (error == EPERM) { | ||||
/* Introduce POSIX noncompliant behaviour of Linux */ | /* Introduce POSIX noncompliant behaviour of Linux */ | ||||
if (kern_statat(td, 0, AT_FDCWD, path, UIO_SYSSPACE, &st, | if (kern_statat(td, 0, AT_FDCWD, path, UIO_SYSSPACE, &st, | ||||
NULL) == 0) { | NULL) == 0) { | ||||
if (S_ISDIR(st.st_mode)) | if (S_ISDIR(st.st_mode)) | ||||
error = EISDIR; | error = EISDIR; | ||||
} | } | ||||
} | } | ||||
Show All 16 Lines | linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args) | ||||
LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); | LCONVPATHEXIST_AT(td, args->pathname, &path, dfd); | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(unlinkat)) | if (ldebug(unlinkat)) | ||||
printf(ARGS(unlinkat, "%s"), path); | printf(ARGS(unlinkat, "%s"), path); | ||||
#endif | #endif | ||||
if (args->flag & LINUX_AT_REMOVEDIR) | if (args->flag & LINUX_AT_REMOVEDIR) | ||||
error = kern_rmdirat(td, dfd, path, UIO_SYSSPACE); | error = kern_rmdirat(td, dfd, path, UIO_SYSSPACE, 0); | ||||
else | else | ||||
error = kern_unlinkat(td, dfd, path, UIO_SYSSPACE, 0); | error = kern_unlinkat(td, dfd, path, UIO_SYSSPACE, 0, 0); | ||||
if (error == EPERM && !(args->flag & LINUX_AT_REMOVEDIR)) { | if (error == EPERM && !(args->flag & LINUX_AT_REMOVEDIR)) { | ||||
/* Introduce POSIX noncompliant behaviour of Linux */ | /* Introduce POSIX noncompliant behaviour of Linux */ | ||||
if (kern_statat(td, AT_SYMLINK_NOFOLLOW, dfd, path, | if (kern_statat(td, AT_SYMLINK_NOFOLLOW, dfd, path, | ||||
UIO_SYSSPACE, &st, NULL) == 0 && S_ISDIR(st.st_mode)) | UIO_SYSSPACE, &st, NULL) == 0 && S_ISDIR(st.st_mode)) | ||||
error = EISDIR; | error = EISDIR; | ||||
} | } | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
return (error); | return (error); | ||||
▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | linux_rmdir(struct thread *td, struct linux_rmdir_args *args) | ||||
int error; | int error; | ||||
LCONVPATHEXIST(td, args->path, &path); | LCONVPATHEXIST(td, args->path, &path); | ||||
#ifdef DEBUG | #ifdef DEBUG | ||||
if (ldebug(rmdir)) | if (ldebug(rmdir)) | ||||
printf(ARGS(rmdir, "%s"), path); | printf(ARGS(rmdir, "%s"), path); | ||||
#endif | #endif | ||||
error = kern_rmdirat(td, AT_FDCWD, path, UIO_SYSSPACE); | error = kern_rmdirat(td, AT_FDCWD, path, UIO_SYSSPACE, 0); | ||||
LFREEPATH(path); | LFREEPATH(path); | ||||
return (error); | return (error); | ||||
} | } | ||||
int | int | ||||
linux_rename(struct thread *td, struct linux_rename_args *args) | linux_rename(struct thread *td, struct linux_rename_args *args) | ||||
{ | { | ||||
char *from, *to; | char *from, *to; | ||||
▲ Show 20 Lines • Show All 938 Lines • Show Last 20 Lines |