aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/linuxkpi
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2020-02-04 17:08:00 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2020-02-04 17:08:00 +0000
commit41a1e96567ba33ec46a0443042062d24ad50b971 (patch)
tree93c1a8da12dbb2eaaa89fb34bf3909c70c2b4ec4 /sys/compat/linuxkpi
parent818bccc14c0044001461afb552a66501da41bad2 (diff)
Notes
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r--sys/compat/linuxkpi/common/src/linux_compat.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
index 56c747864534..95dfe9fa1ea4 100644
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -1530,7 +1530,9 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
struct linux_file *filp;
const struct file_operations *fop;
struct linux_cdev *ldev;
- int error;
+ struct fiodgname_arg *fgn;
+ const char *p;
+ int error, i;
error = 0;
filp = (struct linux_file *)fp->f_data;
@@ -1558,6 +1560,20 @@ linux_file_ioctl(struct file *fp, u_long cmd, void *data, struct ucred *cred,
case FIOGETOWN:
*(int *)data = fgetown(&filp->f_sigio);
break;
+ case FIODGNAME:
+ if (filp->f_cdev == NULL || filp->f_cdev->cdev == NULL) {
+ error = ENXIO;
+ break;
+ }
+ fgn = data;
+ p = devtoname(filp->f_cdev->cdev);
+ i = strlen(p) + 1;
+ if (i > fgn->len) {
+ error = EINVAL;
+ break;
+ }
+ error = copyout(p, fgn->buf, i);
+ break;
default:
error = linux_file_ioctl_sub(fp, filp, fop, cmd, data, td);
break;