Avoid use of cap_rights_t

This commit is contained in:
Sebastian Huber 2016-04-18 14:50:39 +02:00
parent c5fde4960c
commit 22257c7d81
3 changed files with 11 additions and 4 deletions

View File

@ -1033,18 +1033,22 @@ kern_sendit(td, s, mp, flags, control, segflg)
struct socket *so; struct socket *so;
int i, error; int i, error;
ssize_t len; ssize_t len;
#ifndef __rtems__
cap_rights_t rights; cap_rights_t rights;
#endif /* __rtems__ */
#ifdef KTRACE #ifdef KTRACE
struct uio *ktruio = NULL; struct uio *ktruio = NULL;
#endif #endif
AUDIT_ARG_FD(s); AUDIT_ARG_FD(s);
#ifndef __rtems__
rights = CAP_WRITE; rights = CAP_WRITE;
if (mp->msg_name != NULL) if (mp->msg_name != NULL)
rights |= CAP_CONNECT; rights |= CAP_CONNECT;
error = getsock_cap(td->td_proc->p_fd, s, rights, &fp, NULL); error = getsock_cap(td->td_proc->p_fd, s, rights, &fp, NULL);
if (error) if (error)
return (error); return (error);
#endif /* __rtems__ */
so = (struct socket *)fp->f_data; so = (struct socket *)fp->f_data;
#ifdef KTRACE #ifdef KTRACE

View File

@ -309,17 +309,16 @@ int fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp);
struct file *rtems_bsd_get_file(int fd); struct file *rtems_bsd_get_file(int fd);
static inline int static inline int
fget(struct thread *td, int fd, cap_rights_t rights, struct file **fpp) rtems_bsd_do_fget(int fd, struct file **fpp)
{ {
struct file *fp = rtems_bsd_get_file(fd); struct file *fp = rtems_bsd_get_file(fd);
(void) td;
(void) rights;
*fpp = fp; *fpp = fp;
return fp != NULL ? 0 : EBADF; return fp != NULL ? 0 : EBADF;
} }
#define fget(td, fd, rights, fpp) rtems_bsd_do_fget(fd, fpp)
#endif /* __rtems__ */ #endif /* __rtems__ */
int fget_mmap(struct thread *td, int fd, cap_rights_t rights, int fget_mmap(struct thread *td, int fd, cap_rights_t rights,
u_char *maxprotp, struct file **fpp); u_char *maxprotp, struct file **fpp);

View File

@ -327,6 +327,7 @@ struct kinfo_ofile {
#endif #endif
struct kinfo_file { struct kinfo_file {
#ifndef __rtems__
int kf_structsize; /* Variable size of record. */ int kf_structsize; /* Variable size of record. */
int kf_type; /* Descriptor type. */ int kf_type; /* Descriptor type. */
int kf_fd; /* Array index. */ int kf_fd; /* Array index. */
@ -397,6 +398,9 @@ struct kinfo_file {
int _kf_ispare[4]; /* Space for more stuff. */ int _kf_ispare[4]; /* Space for more stuff. */
/* Truncated before copyout in sysctl */ /* Truncated before copyout in sysctl */
char kf_path[PATH_MAX]; /* Path to file, if any. */ char kf_path[PATH_MAX]; /* Path to file, if any. */
#else /* __rtems__ */
int kf_dummy;
#endif /* __rtems__ */
}; };
/* /*