git: 3be2225fc845 - main - Remove fflag argument from getsock_cap
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 10 Sep 2022 19:51:38 UTC
The branch main has been updated by mjg:
URL: https://cgit.FreeBSD.org/src/commit/?id=3be2225fc845de2fe503f0c1e49c98d6756500ac
commit 3be2225fc845de2fe503f0c1e49c98d6756500ac
Author: Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2022-09-10 19:45:24 +0000
Commit: Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2022-09-10 19:47:47 +0000
Remove fflag argument from getsock_cap
Interested callers can obtain in other own easily enough
and there is no reason to branch on it.
---
sys/kern/uipc_syscalls.c | 7 +++----
sys/sys/socketvar.h | 2 +-
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index c269bd09f139..c2ba9535472a 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -90,7 +90,7 @@ static int sockargs(struct mbuf **, char *, socklen_t, int);
*/
int
getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
- struct file **fpp, u_int *fflagp, struct filecaps *havecapsp)
+ struct file **fpp, struct filecaps *havecapsp)
{
struct file *fp;
int error;
@@ -104,8 +104,6 @@ getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
filecaps_free(havecapsp);
return (ENOTSOCK);
}
- if (fflagp != NULL)
- *fflagp = fp->f_flag;
*fpp = fp;
return (0);
}
@@ -347,9 +345,10 @@ kern_accept4(struct thread *td, int s, struct sockaddr **name,
AUDIT_ARG_FD(s);
error = getsock_cap(td, s, &cap_accept_rights,
- &headfp, &fflag, &fcaps);
+ &headfp, &fcaps);
if (error != 0)
return (error);
+ fflag = atomic_load_int(&fp->f_flag);
head = headfp->f_data;
if (!SOLISTENING(head)) {
error = EINVAL;
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 101c6f3f4513..e46eb0520e47 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -449,7 +449,7 @@ struct uio;
int getsockaddr(struct sockaddr **namp, const struct sockaddr *uaddr,
size_t len);
int getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp,
- struct file **fpp, u_int *fflagp, struct filecaps *havecaps);
+ struct file **fpp, struct filecaps *havecaps);
int getsock(struct thread *td, int fd, cap_rights_t *rightsp,
struct file **fpp);
void soabort(struct socket *so);