OLD | NEW |
1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dartino project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 part of os; | 5 part of os; |
6 | 6 |
7 class LinuxSystem extends PosixSystem { | 7 class LinuxSystem extends PosixSystem { |
8 static final ForeignFunction _lseekLinux = | 8 static final ForeignFunction _lseekLinux = |
9 ForeignLibrary.main.lookup("lseek64"); | 9 ForeignLibrary.main.lookup("lseek64"); |
10 static final ForeignFunction _openLinux = | 10 static final ForeignFunction _openLinux = |
11 ForeignLibrary.main.lookup("open64"); | 11 ForeignLibrary.main.lookup("open64"); |
12 | 12 |
| 13 static final bool isMips = sys.info().machine == 'mips'; |
| 14 |
13 int get AF_INET6 => 10; | 15 int get AF_INET6 => 10; |
14 | 16 |
15 int get O_CREAT => 64; | 17 int get O_CREAT => isMips ? 256 : 64; |
16 int get O_TRUNC => 512; | 18 int get O_TRUNC => 512; |
17 int get O_APPEND => 1024; | 19 int get O_APPEND => isMips ? 8 : 1024; |
18 int get O_NONBLOCK => 2048; | 20 int get O_NONBLOCK => isMips ? 128 : 2048; |
19 int get O_CLOEXEC => 524288; | 21 int get O_CLOEXEC => 524288; |
20 | 22 |
21 int get FIONREAD => 0x541B; | 23 int get FIONREAD => isMips ? 0x467f : 0x541b; |
22 | 24 |
23 int get SOL_SOCKET => 1; | 25 int get SOL_SOCKET => isMips ? 65535 : 1; |
24 | 26 |
25 int get SO_REUSEADDR => 2; | 27 int get SO_REUSEADDR => isMips ? 4 : 2; |
26 | 28 |
27 // The size of fields and the struct used by uname. | 29 // The size of fields and the struct used by uname. |
28 // From /usr/include/sys/utsname.h | 30 // From /usr/include/sys/utsname.h |
29 int get UTSNAME_LENGTH => 65; | 31 int get UTSNAME_LENGTH => 65; |
30 int get SIZEOF_UTSNAME => 6 * UTSNAME_LENGTH; | 32 int get SIZEOF_UTSNAME => 6 * UTSNAME_LENGTH; |
31 | 33 |
32 ForeignFunction get _lseek => _lseekLinux; | 34 ForeignFunction get _lseek => _lseekLinux; |
33 ForeignFunction get _open => _openLinux; | 35 ForeignFunction get _open => _openLinux; |
34 } | 36 } |
OLD | NEW |