patch: fix apache-ant in linux emulation

看板DFBSD_submit作者時間15年前 (2010/04/09 05:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/3 (看更多)
ant does not compile any .java files when run under linux emulation. The reason is missing support for the O_DIRECTORY flag in open(2). The patch below adds this and makes ant work. However it would probabely better - though more invasive to add O_DIRECTORY to native open(2) and simply pass the flag. Cheers, Johannes diff --git a/sys/emulation/linux/i386/linux.h b/sys/emulation/linux/i386/linux.h index 2e9a238..a0ba8ef 100644 --- a/sys/emulation/linux/i386/linux.h +++ b/sys/emulation/linux/i386/linux.h @@ -494,6 +494,7 @@ extern struct ioctl_map linux_ioctl_map; #define LINUX_O_NDELAY LINUX_O_NONBLOCK #define LINUX_O_SYNC 010000 #define LINUX_FASYNC 020000 +#define LINUX_O_DIRECTORY 00200000 #define LINUX_F_DUPFD 0 #define LINUX_F_GETFD 1 diff --git a/sys/emulation/linux/linux_file.c b/sys/emulation/linux/linux_file.c index bb0ba0a..3d6f39e 100644 --- a/sys/emulation/linux/linux_file.c +++ b/sys/emulation/linux/linux_file.c @@ -160,6 +160,20 @@ sys_linux_open(struct linux_open_args *args) fdrop(fp); } } + + if (error == 0 && args->flags & LINUX_O_DIRECTORY) { + struct file *fp; + struct vnode *vp; + + fp = holdfp(p->p_fd, args->sysmsg_iresult, -1); + if (fp) { + vp = (struct vnode *) fp->f_data; + if (vp->v_type != VDIR) + error = ENOTDIR; + fdrop(fp); + } + } + rel_mplock(); #ifdef DEBUG if (ldebug(open))
文章代碼(AID): #1BlaGIqZ (DFBSD_submit)
文章代碼(AID): #1BlaGIqZ (DFBSD_submit)