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.23 by gbeauche, 2004-06-27T22:06:02Z vs.
Revision 1.26 by gbeauche, 2005-08-01T05:23:02Z

# Line 1 | Line 1
1   /*
2   *  sys_unix.cpp - System dependent routines, Unix implementation
3   *
4 < *  Basilisk II (C) 1997-2004 Christian Bauer
4 > *  Basilisk II (C) 1997-2005 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 34 | Line 34
34   #include <linux/fd.h>
35   #include <linux/major.h>
36   #include <linux/kdev_t.h>
37 #include <linux/unistd.h>
37   #include <dirent.h>
39
40 #ifdef __NR__llseek
41 _syscall5(int, _llseek, unsigned int, fd, unsigned long, hi, unsigned long, lo, loff_t *, res, unsigned int, wh);
42 #else
43 static int _llseek(unsigned int fd, unsigned long hi, unsigned long lo, loff_t *res, unsigned int wh)
44 {
45        if (hi)
46                return -1;
47        *res = lseek(fd, lo, wh);
48        if (*res == -1)
49                return -1;
50        return 0;
51 }
52 #endif
38   #endif
39  
40   #if defined(__FreeBSD__) || defined(__NetBSD__)
# Line 149 | Line 134 | void SysAddFloppyPrefs(void)
134          PrefsAddString("floppy", "/dev/fd0a");
135          PrefsAddString("floppy", "/dev/fd1a");
136   #elif defined(__APPLE__) && defined(__MACH__)
137 <  #if defined(AQUA) || defined(HAVE_FRAMEWORK_IOKIT)
137 >  #if defined(AQUA) || defined(HAVE_FRAMEWORK_COREFOUNDATION)
138          extern  void DarwinAddFloppyPrefs(void);
139  
140          DarwinAddFloppyPrefs();
# Line 229 | Line 214 | void SysAddCDROMPrefs(void)
214                  }
215          }
216   #elif defined(__APPLE__) && defined(__MACH__)
217 <  #if defined(AQUA) || defined(HAVE_FRAMEWORK_IOKIT)
217 >  #if defined(AQUA) || defined(HAVE_FRAMEWORK_COREFOUNDATION)
218          extern  void DarwinAddCDROMPrefs(void);
219  
220          DarwinAddCDROMPrefs();
# Line 264 | Line 249 | void SysAddSerialPrefs(void)
249          PrefsAddString("seriala", "/dev/tty00");
250          PrefsAddString("serialb", "/dev/tty01");
251   #elif defined(__APPLE__) && defined(__MACH__)
252 <  #if defined(AQUA) || defined(HAVE_FRAMEWORK_IOKIT)
252 >  #if defined(AQUA) || defined(HAVE_FRAMEWORK_COREFOUNDATION)
253          extern  void DarwinAddSerialPrefs(void);
254  
255          DarwinAddSerialPrefs();
# Line 389 | Line 374 | void *Sys_open(const char *name, bool re
374                  if (fh->is_file) {
375                          // Detect disk image file layout
376                          loff_t size = 0;
392 #if defined(__linux__)
393                        _llseek(fh->fd, 0, 0, &size, SEEK_END);
394 #else
377                          size = lseek(fd, 0, SEEK_END);
396 #endif
378                          uint8 data[256];
379                          lseek(fd, 0, SEEK_SET);
380                          read(fd, data, 256);
# Line 498 | Line 479 | size_t Sys_read(void *arg, void *buffer,
479                  return 0;
480  
481          // Seek to position
501 #if defined(__linux__)
502        loff_t pos = offset + fh->start_byte, res;
503        if (_llseek(fh->fd, pos >> 32, pos, &res, SEEK_SET) < 0)
504                return 0;
505 #else
482          if (lseek(fh->fd, offset + fh->start_byte, SEEK_SET) < 0)
483                  return 0;
508 #endif
484  
485          // Read data
486          return read(fh->fd, buffer, length);
# Line 524 | Line 499 | size_t Sys_write(void *arg, void *buffer
499                  return 0;
500  
501          // Seek to position
527 #if defined(__linux__)
528        loff_t pos = offset + fh->start_byte, res;
529        if (_llseek(fh->fd, pos >> 32, pos, &res, SEEK_SET) < 0)
530                return 0;
531 #else
502          if (lseek(fh->fd, offset + fh->start_byte, SEEK_SET) < 0)
503                  return 0;
534 #endif
504  
505          // Write data
506          return write(fh->fd, buffer, length);
# Line 827 | Line 796 | bool SysCDReadTOC(void *arg, uint8 *toc)
796                  *toc++ = toc_size >> 8;
797                  *toc++ = toc_size & 0xff;
798                  return true;
799 < #elif defined(__APPLE__) && defined(__MACH__) && defined(MAC_OS_X_VERSION_10_2)
799 > #elif defined(__APPLE__) && defined(__MACH__) && defined(MAC_OS_X_VERSION_10_2) && defined(HAVE_FRAMEWORK_COREFOUNDATION)
800                  extern  bool    DarwinCDReadTOC(char *name, uint8 *toc);
801  
802                  return  DarwinCDReadTOC(fh->name, toc);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines