Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_mqueue.c
Show First 20 Lines • Show All 2,005 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
static int | static int | ||||
kern_kmq_open(struct thread *td, const char *upath, int flags, mode_t mode, | kern_kmq_open(struct thread *td, const char *upath, int flags, mode_t mode, | ||||
const struct mq_attr *attr) | const struct mq_attr *attr) | ||||
{ | { | ||||
char path[MQFS_NAMELEN + 1]; | char path[MQFS_NAMELEN + 1]; | ||||
struct mqfs_node *pn; | struct mqfs_node *pn; | ||||
struct filedesc *fdp; | struct pathsdesc *pdp; | ||||
struct file *fp; | struct file *fp; | ||||
struct mqueue *mq; | struct mqueue *mq; | ||||
int fd, error, len, cmode; | int fd, error, len, cmode; | ||||
AUDIT_ARG_FFLAGS(flags); | AUDIT_ARG_FFLAGS(flags); | ||||
AUDIT_ARG_MODE(mode); | AUDIT_ARG_MODE(mode); | ||||
fdp = td->td_proc->p_fd; | pdp = td->td_proc->p_pd; | ||||
cmode = (((mode & ~fdp->fd_cmask) & ALLPERMS) & ~S_ISTXT); | cmode = (((mode & ~pdp->pd_cmask) & ALLPERMS) & ~S_ISTXT); | ||||
mq = NULL; | mq = NULL; | ||||
if ((flags & O_CREAT) != 0 && attr != NULL) { | if ((flags & O_CREAT) != 0 && attr != NULL) { | ||||
if (attr->mq_maxmsg <= 0 || attr->mq_maxmsg > maxmsg) | if (attr->mq_maxmsg <= 0 || attr->mq_maxmsg > maxmsg) | ||||
return (EINVAL); | return (EINVAL); | ||||
if (attr->mq_msgsize <= 0 || attr->mq_msgsize > maxmsgsize) | if (attr->mq_msgsize <= 0 || attr->mq_msgsize > maxmsgsize) | ||||
return (EINVAL); | return (EINVAL); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 913 Lines • Show Last 20 Lines |