mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[smart] 修复用户态 mq_receive 不能阻塞 (#7836)
This commit is contained in:
@@ -43,28 +43,29 @@ struct mqueue_file *dfs_mqueue_lookup(const char *path, rt_size_t *size) {
|
||||
return RT_NULL;
|
||||
}
|
||||
|
||||
int dfs_mqueue_mount(struct dfs_filesystem *fs, unsigned long rwflag, const void *data) {
|
||||
int dfs_mqueue_mount(struct dfs_mnt *mnt, unsigned long rwflag, const void *data) {
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int dfs_mqueue_umount(struct dfs_filesystem *fs) { return RT_EOK; }
|
||||
int dfs_mqueue_umount(struct dfs_mnt *mnt) {
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int dfs_mqueue_statfs(struct dfs_filesystem *fs, struct statfs *buf) { return RT_EOK; }
|
||||
int dfs_mqueue_statfs(struct dfs_mnt *mnt, struct statfs *buf) {
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int dfs_mqueue_close(struct dfs_file *file) { return RT_EOK; }
|
||||
int dfs_mqueue_close(struct dfs_file *file) {
|
||||
return RT_EOK;
|
||||
}
|
||||
|
||||
int dfs_mqueue_open(struct dfs_file *file) {
|
||||
rt_size_t size;
|
||||
if ((file->dentry->pathname[0] == '/') && (file->dentry->pathname[1] == '\0'))
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dfs_mqueue_stat(struct dfs_dentry *dentry, struct stat *st) {
|
||||
const char *path = RT_NULL;
|
||||
struct dfs_vnode *vnode = RT_NULL;
|
||||
if (dentry && dentry->vnode) {
|
||||
path = dentry->pathname;
|
||||
vnode = dentry->vnode;
|
||||
st->st_dev = 0;
|
||||
st->st_gid = vnode->gid;
|
||||
@@ -140,7 +141,7 @@ static struct dfs_vnode *dfs_mqueue_create_vnode(struct dfs_dentry *dentry, int
|
||||
if (mq_file == RT_NULL) {
|
||||
mq_file = (struct mqueue_file *)rt_malloc(sizeof(struct mqueue_file));
|
||||
if (mq_file == RT_NULL) {
|
||||
return -ENFILE;
|
||||
return NULL;
|
||||
}
|
||||
mq_file->msg_size = 8192;
|
||||
mq_file->max_msgs = 10;
|
||||
@@ -156,7 +157,6 @@ static struct dfs_vnode *dfs_mqueue_create_vnode(struct dfs_dentry *dentry, int
|
||||
vnode->data = mq_file;
|
||||
vnode->size = 0;
|
||||
}
|
||||
|
||||
return vnode;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,6 +180,8 @@ ssize_t mq_timedreceive(mqd_t id,
|
||||
}
|
||||
if (abs_timeout != RT_NULL)
|
||||
tick = rt_timespec_to_tick(abs_timeout);
|
||||
else
|
||||
tick = RT_WAITING_FOREVER;
|
||||
|
||||
result = rt_mq_recv_prio(mq, msg_ptr, msg_len, (rt_int32_t *)msg_prio, tick, RT_UNINTERRUPTIBLE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user