ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/Unix/sys_unix.cpp
(Generate patch)

Comparing BasiliskII/src/Unix/sys_unix.cpp (file contents):
Revision 1.7 by cebix, 2000-04-10T18:53:07Z vs.
Revision 1.8 by cebix, 2000-07-24T20:39:34Z

# Line 273 | Line 273 | void *Sys_open(const char *name, bool re
273          }
274  
275          // Open file/device
276 < #if defined(__linux__)
276 > #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__)
277          int fd = open(name, (read_only ? O_RDONLY : O_RDWR) | (is_cdrom ? O_NONBLOCK : 0));
278   #else
279          int fd = open(name, read_only ? O_RDONLY : O_RDWR);
# Line 549 | Line 549 | bool SysIsDiskInserted(void *arg)
549                  lseek(fh->fd, 0, SEEK_SET);
550                  return read(fh->fd, block, 512) == 512;
551          } else if (fh->is_cdrom) {
552 + #ifdef CDROM_MEDIA_CHANGED
553 +                if (fh->cdrom_cap & CDC_MEDIA_CHANGED) {
554 +                        // If we don't do this, all attempts to read from a disc fail
555 +                        // once the tray has been open (altough the TOC reads fine).
556 +                        // Can somebody explain this to me?
557 +                        if (ioctl(fh->fd, CDROM_MEDIA_CHANGED) == 1) {
558 +                                close(fh->fd);
559 +                                fh->fd = open(fh->name, O_RDONLY | O_NONBLOCK);
560 +                        }
561 +                }
562 + #endif
563   #ifdef CDROM_DRIVE_STATUS
564                  if (fh->cdrom_cap & CDC_DRIVE_STATUS) {
565                          return ioctl(fh->fd, CDROM_DRIVE_STATUS, CDSL_CURRENT) == CDS_DISC_OK;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines