diff options
author | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2019-04-06 09:34:26 +0000 |
---|---|---|
committer | Mariusz Zaborski <oshogbo@FreeBSD.org> | 2019-04-06 09:34:26 +0000 |
commit | a1304030b815cf1c7dbc934cbd994d8f333eb9cd (patch) | |
tree | a2167ee95d958b53b6c38b68b6965f8ae217db41 /sys/sys | |
parent | 44b0f624aee0d43179bf3874c70e03b6ae49a4db (diff) | |
download | src-a1304030b815cf1c7dbc934cbd994d8f333eb9cd.tar.gz src-a1304030b815cf1c7dbc934cbd994d8f333eb9cd.zip |
Introduce funlinkat syscall that always us to check if we are removing
the file associated with the given file descriptor.
Reviewed by: kib, asomers
Reviewed by: cem, jilles, brooks (they reviewed previous version)
Discussed with: pjd, and many others
Differential Revision: https://reviews.freebsd.org/D14567
Notes
Notes:
svn path=/head/; revision=345982
Diffstat (limited to 'sys/sys')
-rw-r--r-- | sys/sys/fcntl.h | 10 | ||||
-rw-r--r-- | sys/sys/syscallsubr.h | 4 |
2 files changed, 12 insertions, 2 deletions
diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h index 04eab5e27ed1..b2e7f94199d0 100644 --- a/sys/sys/fcntl.h +++ b/sys/sys/fcntl.h @@ -316,6 +316,16 @@ struct __oflock { #define POSIX_FADV_NOREUSE 5 /* access data only once */ #endif + +#ifdef __BSD_VISIBLE +/* + * Magic value that specify that corresponding file descriptor to filename + * is unknown and sanitary check should be omitted in the funlinkat() and + * similar syscalls. + */ +#define FD_NONE -200 +#endif + #ifndef _KERNEL __BEGIN_DECLS int open(const char *, int, ...); diff --git a/sys/sys/syscallsubr.h b/sys/sys/syscallsubr.h index 3545745f5a7f..f82500087f08 100644 --- a/sys/sys/syscallsubr.h +++ b/sys/sys/syscallsubr.h @@ -218,7 +218,7 @@ int kern_recvit(struct thread *td, int s, struct msghdr *mp, enum uio_seg fromseg, struct mbuf **controlp); int kern_renameat(struct thread *td, int oldfd, const char *old, int newfd, const char *new, enum uio_seg pathseg); -int kern_rmdirat(struct thread *td, int fd, const char *path, +int kern_frmdirat(struct thread *td, int dfd, const char *path, int fd, enum uio_seg pathseg, int flag); int kern_sched_getparam(struct thread *td, struct thread *targettd, struct sched_param *param); @@ -285,7 +285,7 @@ int kern_thr_new(struct thread *td, struct thr_param *param); int kern_thr_suspend(struct thread *td, struct timespec *tsp); int kern_truncate(struct thread *td, const char *path, enum uio_seg pathseg, off_t length); -int kern_unlinkat(struct thread *td, int fd, const char *path, +int kern_funlinkat(struct thread *td, int dfd, const char *path, int fd, enum uio_seg pathseg, int flag, ino_t oldinum); int kern_utimesat(struct thread *td, int fd, const char *path, enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg); |