From owner-freebsd-emulation@FreeBSD.ORG Mon Mar 16 11:06:53 2009 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 481CD1065689 for ; Mon, 16 Mar 2009 11:06:53 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 358448FC31 for ; Mon, 16 Mar 2009 11:06:53 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id n2GB6rTD043209 for ; Mon, 16 Mar 2009 11:06:53 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id n2GB6qwp043205 for freebsd-emulation@FreeBSD.org; Mon, 16 Mar 2009 11:06:52 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 16 Mar 2009 11:06:52 GMT Message-Id: <200903161106.n2GB6qwp043205@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-emulation@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-emulation@FreeBSD.org X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 11:06:53 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o kern/130724 emulation [linprocfs] [patch] cpuinfo in linprocfs is dated, cau o kern/129169 emulation [linux] [patch] Linux Emulation ENOTCONN error using n f ports/127018 emulation Linuxulator incapable of using FreeBSD's LDAP environm o kern/126232 emulation [linux] Linux ioctl TCGETS (0x5401) always fails o ports/121800 emulation x11-toolkits/linux-openmotif - OpenMotif upgrade to 2. o kern/97326 emulation [linux] file descriptor leakage in linux emulation o ports/91318 emulation [fix] graphics/linux_dri: works on amd64 too o kern/91293 emulation [svr4] [patch] *Experimental* Update to the SVR4 emula o kern/73777 emulation [linux] [patch] linux emulation: root dir special hand a kern/72920 emulation [linux]: path "prefixing" is not done on unix domain s o kern/41543 emulation [patch] [request] easier wine/w23 support o kern/39201 emulation [linux] [patch] ptrace(2) and rfork(RFLINUXTHPN) confu o kern/29698 emulation [linux] [patch] linux ipcs doesn'work o kern/21463 emulation [linux] Linux compatability mode should not allow setu o kern/11165 emulation [ibcs2] IBCS2 doesn't work correctly with PID_MAX 9999 15 problems total. From owner-freebsd-emulation@FreeBSD.ORG Mon Mar 16 17:06:47 2009 Return-Path: Delivered-To: freebsd-emulation@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 44D2C1065672 for ; Mon, 16 Mar 2009 17:06:47 +0000 (UTC) (envelope-from bds@waywood.co.uk) Received: from v-smtp-auth-relay-3.gradwell.net (v-smtp-auth-relay-3.gradwell.net [79.135.125.42]) by mx1.freebsd.org (Postfix) with ESMTP id ABE7E8FC2F for ; Mon, 16 Mar 2009 17:06:46 +0000 (UTC) (envelope-from bds@waywood.co.uk) Received: from v-grad-web-1.gradwell.net ([195.74.61.63] helo=webmail.gradwell.net country=GB ident=bds#pop3&waywood*co*uk) by v-smtp-auth-relay-3.gradwell.net with esmtpa (Gradwell gwh-smtpd 1.290) id 49be84c7.58e0.54b for freebsd-emulation@freebsd.org; Mon, 16 Mar 2009 16:56:39 +0000 (envelope-sender ) Received: from 81.179.6.169 (SquirrelMail authenticated user bds@pop3.waywood.co.uk) by webmail.gradwell.net with HTTP; Mon, 16 Mar 2009 16:56:39 -0000 (UTC) Message-ID: <33eaa170b754b20e442a5b99acac280a.squirrel@webmail.gradwell.net> Date: Mon, 16 Mar 2009 16:56:39 -0000 (UTC) From: "Barnaby Scott" To: freebsd-emulation@freebsd.org User-Agent: SquirrelMail/1.4.15 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal Subject: wine without X X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Mar 2009 17:06:47 -0000 I hope this is the right place to be asking... I have been trying to figure out a way to install wine, but without X. I tried installing from ports, but I couldn't see an obvious way to to avoid all the mainly X-related dependencies being built. Searching around I see there is some talk of being able to do this with Linux, but I am not nearly knowledgeable enough to be confident mucking about with Makefiles etc to try and reproduce the necessary steps. Surely someone else (who knows what they're doing!) has trodden this path before me? In case you're wondering why I want to do this, it is for a render slave for the renderer Vray. It consists of a single Windows executable which has absolutely no visible output at all for the user - it is not strictly a Windows service, but is more or less daemon-like. I know it works with wine under Linux, so assume it will work under FreeBSD, but I *really* want to avoid installing X on all the boxes in question, as it is so clearly unnecessary in this case. Any pointers gratefully received. Barnaby Scott From owner-freebsd-emulation@FreeBSD.ORG Sat Mar 21 20:20:35 2009 Return-Path: Delivered-To: freebsd-emulation@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CD5FF1065689 for ; Sat, 21 Mar 2009 20:20:35 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: from smtp.kn-bremen.de (gelbbaer.kn-bremen.de [78.46.108.116]) by mx1.freebsd.org (Postfix) with ESMTP id 3EBC68FC13 for ; Sat, 21 Mar 2009 20:20:34 +0000 (UTC) (envelope-from nox@saturn.kn-bremen.de) Received: by smtp.kn-bremen.de (Postfix, from userid 10) id 79B901E005DD; Sat, 21 Mar 2009 21:20:33 +0100 (CET) Received: from saturn.kn-bremen.de (noident@localhost [127.0.0.1]) by saturn.kn-bremen.de (8.14.2/8.13.8) with ESMTP id n2LKHCDw070765; Sat, 21 Mar 2009 21:17:12 +0100 (CET) (envelope-from nox@saturn.kn-bremen.de) Received: (from nox@localhost) by saturn.kn-bremen.de (8.14.2/8.13.6/Submit) id n2LKHCuq070764; Sat, 21 Mar 2009 21:17:12 +0100 (CET) (envelope-from nox) Date: Sat, 21 Mar 2009 21:17:12 +0100 (CET) From: Juergen Lock Message-Id: <200903212017.n2LKHCuq070764@saturn.kn-bremen.de> To: freebsd-emulation@FreeBSD.org X-Newsgroups: local.list.freebsd.emulation In-Reply-To: <200903092235.n29MZCFF014159@saturn.kn-bremen.de> References: <49B46A29.7020500@FreeBSD.org> <20090309103706.0a44fb26@ernst.jennejohn.org> Organization: home Cc: Gary Jennejohn Subject: want to test a patch? (was: Re: qemu 0.10.0 - cd/dvd drive access problems) X-BeenThere: freebsd-emulation@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Development of Emulators of other operating systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Mar 2009 20:20:38 -0000 In article <200903092235.n29MZCFF014159@saturn.kn-bremen.de> I write: >In article you write: >>On Mon, 9 Mar 2009, Gary Jennejohn wrote: >> >>> On Sun, 08 Mar 2009 18:00:25 -0700 >>> Doug Barton wrote: >[...] >>> One thing I've noticed is that the DVD drive is locked and I can't open >>> the drawer once qemu starts, even if there is no disc in the drive. >>> Apparently openSUSE acceses the drive (i.e. locks it) even when it's >>> empty. >> I'm not sure but this seems to be a bug in our acd driver, it seems to lock the door when you open the device node regardless if there is a disc in the drive or not... >>I forgot to mention this bit. If I click the eject menu option on the >>CD/DVD in windows it doesn't actually eject it like native windows does, >>but it does allow me to remove the disc manually. After that even if I do >>reinsert a disc the windows guest doesn't "see" it. >> > Have you tried the mentioned `change ide1-cd0' in qemu's monitor? >(This probably would benefit from scsi passthru as well...) After finding out that there actually is code in qemu now that attempts to support these things on Linux I played with that a bit and came up with the patch below that adds some FreeBSD support. You will still have to tell the guest to eject the disc when you want to take it out/change it (or do the mentioned change command in the monitor if the guest doesnt have an eject command), but other than that a passed cd drive should now work like it now does on Linux hosts. I also did some fixes to the scsi cdrom emulation while I was at it (eject/load command support was missing too), so passing a cd drive as -drive if=scsi,media=cdrom,file=/dev/acd0 (or also /dev/cd0) should now work as well. (It is still readonly tho, scsi passthru support would be the next thing to be ported i.e. so you could do file=/dev/pass0...) Enjoy, Juergen Index: qemu/block-raw-posix.c @@ -55,6 +55,7 @@ #ifdef __FreeBSD__ #include #include +#include #endif #ifdef __OpenBSD__ @@ -105,6 +106,9 @@ int fd_got_error; int fd_media_changed; #endif +#if defined(__FreeBSD__) + int cd_open_flags; +#endif uint8_t* aligned_buf; } BDRVRawState; @@ -112,6 +116,12 @@ static int fd_open(BlockDriverState *bs); +#if defined(__FreeBSD__) +static int cd_open(BlockDriverState *bs); +#endif + +static int raw_is_inserted(BlockDriverState *bs); + static int raw_open(BlockDriverState *bs, const char *filename, int flags) { BDRVRawState *s = bs->opaque; @@ -747,6 +757,9 @@ int64_t size; #ifdef _BSD struct stat sb; +#ifdef __FreeBSD__ + int reopened = 0; +#endif #endif #ifdef __sun__ struct dk_minfo minfo; @@ -759,6 +772,9 @@ return ret; #ifdef _BSD +#ifdef __FreeBSD__ +again: +#endif if (!fstat(fd, &sb) && (S_IFCHR & sb.st_mode)) { #ifdef DIOCGMEDIASIZE if (ioctl(fd, DIOCGMEDIASIZE, (off_t *)&size)) @@ -768,6 +784,19 @@ #else size = lseek(fd, 0LL, SEEK_END); #endif +#ifdef __FreeBSD__ + switch(s->type) { + case FTYPE_CD: + /* XXX FreeBSD acd returns UINT_MAX sectors for an empty drive */ + if (size == 2048LL * (unsigned)-1) + size = 0; + /* XXX no disc? maybe we need to reopen... */ + if (size <= 0 && !reopened && cd_open(bs) >= 0) { + reopened = 1; + goto again; + } + } +#endif } else #endif #ifdef __sun__ @@ -958,6 +987,14 @@ bs->sg = 1; } #endif +#if defined(__FreeBSD__) + if (strstart(filename, "/dev/cd", NULL) || + strstart(filename, "/dev/acd", NULL)) { + s->type = FTYPE_CD; + s->cd_open_flags = open_flags; + } +#endif + s->fd = -1; fd = open(filename, open_flags, 0644); if (fd < 0) { ret = -errno; @@ -966,6 +1003,11 @@ return ret; } s->fd = fd; +#if defined(__FreeBSD__) + /* make sure the door isnt locked at this time */ + if (s->type == FTYPE_CD) + ioctl (s->fd, CDIOCALLOW); +#endif #if defined(__linux__) /* close fd so that we can reopen it as needed */ if (s->type == FTYPE_FD) { @@ -1132,7 +1174,116 @@ return ioctl(s->fd, req, buf); } -#else +#elif defined(__FreeBSD__) + +static int fd_open(BlockDriverState *bs) +{ + BDRVRawState *s = bs->opaque; + + /* this is just to ensure s->fd is sane (its called by io ops) */ + if (s->fd >= 0) + return 0; + return -EIO; +} + +static int cd_open(BlockDriverState *bs) +{ +#if defined(__FreeBSD__) + BDRVRawState *s = bs->opaque; + int fd; + + switch(s->type) { + case FTYPE_CD: + /* XXX force reread of possibly changed/newly loaded disc, + * FreeBSD seems to not notice sometimes... */ + if (s->fd >= 0) + close (s->fd); + fd = open(bs->filename, s->cd_open_flags, 0644); + if (fd < 0) { + s->fd = -1; + return -EIO; + } + s->fd = fd; + /* make sure the door isnt locked at this time */ + ioctl (s->fd, CDIOCALLOW); + } +#endif + return 0; +} + +static int raw_is_inserted(BlockDriverState *bs) +{ + BDRVRawState *s = bs->opaque; + + switch(s->type) { + case FTYPE_CD: + return (raw_getlength(bs) > 0); + case FTYPE_FD: + /* XXX handle this */ + /* FALLTHRU */ + default: + return 1; + } +} + +static int raw_media_changed(BlockDriverState *bs) +{ + return -ENOTSUP; +} + +static int raw_eject(BlockDriverState *bs, int eject_flag) +{ + BDRVRawState *s = bs->opaque; + + switch(s->type) { + case FTYPE_CD: + if (s->fd < 0) + return -ENOTSUP; + (void) ioctl (s->fd, CDIOCALLOW); + if (eject_flag) { + if (ioctl (s->fd, CDIOCEJECT) < 0) + perror("CDIOCEJECT"); + } else { + if (ioctl (s->fd, CDIOCCLOSE) < 0) + perror("CDIOCCLOSE"); + } + if (cd_open(bs) < 0) + return -ENOTSUP; + break; + case FTYPE_FD: + /* XXX handle this */ + /* FALLTHRU */ + default: + return -ENOTSUP; + } + return 0; +} + +static int raw_set_locked(BlockDriverState *bs, int locked) +{ + BDRVRawState *s = bs->opaque; + + switch(s->type) { + case FTYPE_CD: + if (s->fd < 0) + return -ENOTSUP; + if (ioctl (s->fd, (locked ? CDIOCPREVENT : CDIOCALLOW)) < 0) { + /* Note: an error can happen if the distribution automatically + mounts the CD-ROM */ + // perror("CDROM_LOCKDOOR"); + } + break; + default: + return -ENOTSUP; + } + return 0; +} + +static int raw_ioctl(BlockDriverState *bs, unsigned long int req, void *buf) +{ + return -ENOTSUP; +} +#else /* !linux && !FreeBSD */ static int fd_open(BlockDriverState *bs) { @@ -1163,7 +1314,7 @@ { return -ENOTSUP; } -#endif /* !linux */ +#endif /* !linux && !FreeBSD */ BlockDriver bdrv_host_device = { "host_device", Index: qemu/hw/scsi-disk.c @@ -417,16 +417,26 @@ switch (command) { case 0x0: DPRINTF("Test Unit Ready\n"); + if (!bdrv_is_inserted(s->bdrv)) + goto notready; break; case 0x03: DPRINTF("Request Sense (len %d)\n", len); if (len < 4) goto fail; memset(outbuf, 0, 4); + r->buf_len = 4; + if (s->sense == SENSE_NOT_READY && len >= 18) { + memset(outbuf, 0, 18); + r->buf_len = 18; + outbuf[7] = 10; + /* asc 0x3a, ascq 0: Medium not present */ + outbuf[12] = 0x3a; + outbuf[13] = 0; + } outbuf[0] = 0xf0; outbuf[1] = 0; outbuf[2] = s->sense; - r->buf_len = 4; break; case 0x12: DPRINTF("Inquiry (len %d)\n", len); @@ -725,6 +735,10 @@ break; case 0x1b: DPRINTF("Start Stop Unit\n"); + if (bdrv_get_type_hint(s->bdrv) == BDRV_TYPE_CDROM && + (buf[4] & 2)) + /* load/eject medium */ + bdrv_eject(s->bdrv, !(buf[4] & 1)); break; case 0x1e: DPRINTF("Prevent Allow Medium Removal (prevent = %d)\n", buf[4] & 3); @@ -754,6 +768,7 @@ outbuf[7] = 0; r->buf_len = 8; } else { + notready: scsi_command_complete(r, STATUS_CHECK_CONDITION, SENSE_NOT_READY); return 0; } @@ -790,6 +805,7 @@ start_track = buf[6]; bdrv_get_geometry(s->bdrv, &nb_sectors); DPRINTF("Read TOC (track %d format %d msf %d)\n", start_track, format, msf >> 1); + nb_sectors /= s->cluster_size; switch(format) { case 0: toclen = cdrom_read_toc(nb_sectors, outbuf, msf, start_track);