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.13 by cebix, 2002-02-22T17:48:31Z

# Line 1 | Line 1
1   /*
2   *  sys_unix.cpp - System dependent routines, Unix implementation
3   *
4 < *  Basilisk II (C) 1997-2000 Christian Bauer
4 > *  Basilisk II (C) 1997-2002 Christian Bauer
5   *
6   *  This program is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by
# Line 33 | Line 33
33   #include <linux/unistd.h>
34  
35   #ifdef __NR__llseek
36 < _syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh);
36 > _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, loff_t *, res, unsigned int, wh);
37   #else
38 < static int _llseek(uint fd, ulong hi, ulong lo, loff_t *res, uint wh)
38 > static int _llseek(unsigned int fd, unsigned long hi, unsigned long lo, loff_t *res, unsigned int wh)
39   {
40          if (hi)
41                  return -1;
# Line 120 | Line 120 | void SysMountFirstFloppy(void)
120   void SysAddFloppyPrefs(void)
121   {
122   #if defined(__linux__)
123 <        PrefsAddString("floppy", "/dev/fd0H1440");
124 <        PrefsAddString("floppy", "/dev/fd1H1440");
123 >        PrefsAddString("floppy", "/dev/fd0u1440");
124 >        PrefsAddString("floppy", "/dev/fd1u1440");
125   #elif defined(__NetBSD__)
126          PrefsAddString("floppy", "/dev/fd0a");
127          PrefsAddString("floppy", "/dev/fd1a");
# Line 146 | Line 146 | void SysAddDiskPrefs(void)
146                  while(fgets(line, 255, f)) {
147                          // Read line
148                          int len = strlen(line);
149 <                        if (len == 0)
149 >                        if (len == 0 || line[0] == '#')
150                                  continue;
151                          line[len-1] = 0;
152  
# 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