Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* Copyright (c) 2005-2011, Google Inc. | 1 /* Copyright (c) 2005-2011, Google Inc. |
| 2 * All rights reserved. | 2 * All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 * Do not access these symbols from outside this file. They are not part | 79 * Do not access these symbols from outside this file. They are not part |
| 80 * of the supported API. | 80 * of the supported API. |
| 81 */ | 81 */ |
| 82 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H | 82 #ifndef SYS_LINUX_SYSCALL_SUPPORT_H |
| 83 #define SYS_LINUX_SYSCALL_SUPPORT_H | 83 #define SYS_LINUX_SYSCALL_SUPPORT_H |
| 84 | 84 |
| 85 /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. | 85 /* We currently only support x86-32, x86-64, ARM, MIPS, and PPC on Linux. |
| 86 * Porting to other related platforms should not be difficult. | 86 * Porting to other related platforms should not be difficult. |
| 87 */ | 87 */ |
| 88 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 88 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
| 89 defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__)) \ | 89 defined(__mips__) || defined(__PPC__) || defined(__ARM_EABI__) || \ |
| 90 defined(__aarch64__)) \ | |
| 90 && (defined(__linux) || defined(__ANDROID__)) | 91 && (defined(__linux) || defined(__ANDROID__)) |
| 91 | 92 |
| 92 #ifndef SYS_CPLUSPLUS | 93 #ifndef SYS_CPLUSPLUS |
| 93 #ifdef __cplusplus | 94 #ifdef __cplusplus |
| 94 /* Some system header files in older versions of gcc neglect to properly | 95 /* Some system header files in older versions of gcc neglect to properly |
| 95 * handle being included from C++. As it appears to be harmless to have | 96 * handle being included from C++. As it appears to be harmless to have |
| 96 * multiple nested 'extern "C"' blocks, just add another one here. | 97 * multiple nested 'extern "C"' blocks, just add another one here. |
| 97 */ | 98 */ |
| 98 extern "C" { | 99 extern "C" { |
| 99 #endif | 100 #endif |
| 100 | 101 |
| 101 #include <errno.h> | 102 #include <errno.h> |
| 102 #include <fcntl.h> | 103 #include <fcntl.h> |
| 104 #include <sched.h> | |
| 103 #include <signal.h> | 105 #include <signal.h> |
| 104 #include <stdarg.h> | 106 #include <stdarg.h> |
| 105 #include <stddef.h> | 107 #include <stddef.h> |
| 106 #include <stdint.h> | 108 #include <stdint.h> |
| 107 #include <string.h> | 109 #include <string.h> |
| 108 #include <sys/ptrace.h> | 110 #include <sys/ptrace.h> |
| 109 #include <sys/resource.h> | 111 #include <sys/resource.h> |
| 110 #include <sys/time.h> | 112 #include <sys/time.h> |
| 111 #include <sys/types.h> | 113 #include <sys/types.h> |
| 112 #include <sys/syscall.h> | 114 #include <sys/syscall.h> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 /* include/linux/dirent.h */ | 167 /* include/linux/dirent.h */ |
| 166 struct kernel_dirent64 { | 168 struct kernel_dirent64 { |
| 167 unsigned long long d_ino; | 169 unsigned long long d_ino; |
| 168 long long d_off; | 170 long long d_off; |
| 169 unsigned short d_reclen; | 171 unsigned short d_reclen; |
| 170 unsigned char d_type; | 172 unsigned char d_type; |
| 171 char d_name[256]; | 173 char d_name[256]; |
| 172 }; | 174 }; |
| 173 | 175 |
| 174 /* include/linux/dirent.h */ | 176 /* include/linux/dirent.h */ |
| 177 #if defined(__aarch64__) | |
| 178 // aarch64 only defines dirent64, just uses that for dirent too. | |
| 179 #define kernel_dirent kernel_dirent64 | |
| 180 #else | |
| 175 struct kernel_dirent { | 181 struct kernel_dirent { |
| 176 long d_ino; | 182 long d_ino; |
| 177 long d_off; | 183 long d_off; |
| 178 unsigned short d_reclen; | 184 unsigned short d_reclen; |
| 179 char d_name[256]; | 185 char d_name[256]; |
| 180 }; | 186 }; |
| 187 #endif | |
| 181 | 188 |
| 182 /* include/linux/uio.h */ | 189 /* include/linux/uio.h */ |
| 183 struct kernel_iovec { | 190 struct kernel_iovec { |
| 184 void *iov_base; | 191 void *iov_base; |
| 185 unsigned long iov_len; | 192 unsigned long iov_len; |
| 186 }; | 193 }; |
| 187 | 194 |
| 188 /* include/linux/socket.h */ | 195 /* include/linux/socket.h */ |
| 189 struct kernel_msghdr { | 196 struct kernel_msghdr { |
| 190 void *msg_name; | 197 void *msg_name; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 union { | 256 union { |
| 250 void (*sa_handler_)(int); | 257 void (*sa_handler_)(int); |
| 251 void (*sa_sigaction_)(int, siginfo_t *, void *); | 258 void (*sa_sigaction_)(int, siginfo_t *, void *); |
| 252 }; | 259 }; |
| 253 unsigned long sa_mask; | 260 unsigned long sa_mask; |
| 254 unsigned long sa_flags; | 261 unsigned long sa_flags; |
| 255 void (*sa_restorer)(void); | 262 void (*sa_restorer)(void); |
| 256 } __attribute__((packed,aligned(4))); | 263 } __attribute__((packed,aligned(4))); |
| 257 #elif (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) | 264 #elif (defined(__mips__) && _MIPS_SIM == _MIPS_SIM_ABI32) |
| 258 #define kernel_old_sigaction kernel_sigaction | 265 #define kernel_old_sigaction kernel_sigaction |
| 266 #elif defined(__aarch64__) | |
| 267 // No kernel_old_sigaction defined for arm64. | |
| 259 #endif | 268 #endif |
| 260 | 269 |
| 261 /* Some kernel functions (e.g. sigaction() in 2.6.23) require that the | 270 /* Some kernel functions (e.g. sigaction() in 2.6.23) require that the |
| 262 * exactly match the size of the signal set, even though the API was | 271 * exactly match the size of the signal set, even though the API was |
| 263 * intended to be extensible. We define our own KERNEL_NSIG to deal with | 272 * intended to be extensible. We define our own KERNEL_NSIG to deal with |
| 264 * this. | 273 * this. |
| 265 * Please note that glibc provides signals [1.._NSIG-1], whereas the | 274 * Please note that glibc provides signals [1.._NSIG-1], whereas the |
| 266 * kernel (and this header) provides the range [1..KERNEL_NSIG]. The | 275 * kernel (and this header) provides the range [1..KERNEL_NSIG]. The |
| 267 * actual number of signals is obviously the same, but the constants | 276 * actual number of signals is obviously the same, but the constants |
| 268 * differ by one. | 277 * differ by one. |
| 269 */ | 278 */ |
| 270 #ifdef __mips__ | 279 #ifdef __mips__ |
| 271 #define KERNEL_NSIG 128 | 280 #define KERNEL_NSIG 128 |
| 272 #else | 281 #else |
| 273 #define KERNEL_NSIG 64 | 282 #define KERNEL_NSIG 64 |
| 274 #endif | 283 #endif |
| 275 | 284 |
| 276 /* include/asm-{arm,i386,mips,x86_64}/signal.h */ | 285 /* include/asm-{arm,aarch64,i386,mips,x86_64}/signal.h */ |
| 277 struct kernel_sigset_t { | 286 struct kernel_sigset_t { |
| 278 unsigned long sig[(KERNEL_NSIG + 8*sizeof(unsigned long) - 1)/ | 287 unsigned long sig[(KERNEL_NSIG + 8*sizeof(unsigned long) - 1)/ |
| 279 (8*sizeof(unsigned long))]; | 288 (8*sizeof(unsigned long))]; |
| 280 }; | 289 }; |
| 281 | 290 |
| 282 /* include/asm-{arm,i386,mips,x86_64,ppc}/signal.h */ | 291 /* include/asm-{arm,i386,mips,x86_64,ppc}/signal.h */ |
| 283 struct kernel_sigaction { | 292 struct kernel_sigaction { |
| 284 #ifdef __mips__ | 293 #ifdef __mips__ |
| 285 unsigned long sa_flags; | 294 unsigned long sa_flags; |
| 286 union { | 295 union { |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 298 struct kernel_sigset_t sa_mask; | 307 struct kernel_sigset_t sa_mask; |
| 299 #endif | 308 #endif |
| 300 }; | 309 }; |
| 301 | 310 |
| 302 /* include/linux/socket.h */ | 311 /* include/linux/socket.h */ |
| 303 struct kernel_sockaddr { | 312 struct kernel_sockaddr { |
| 304 unsigned short sa_family; | 313 unsigned short sa_family; |
| 305 char sa_data[14]; | 314 char sa_data[14]; |
| 306 }; | 315 }; |
| 307 | 316 |
| 308 /* include/asm-{arm,i386,mips,ppc}/stat.h */ | 317 /* include/asm-{arm,aarch64,i386,mips,ppc}/stat.h */ |
| 309 #ifdef __mips__ | 318 #ifdef __mips__ |
| 310 #if _MIPS_SIM == _MIPS_SIM_ABI64 | 319 #if _MIPS_SIM == _MIPS_SIM_ABI64 |
| 311 struct kernel_stat { | 320 struct kernel_stat { |
| 312 #else | 321 #else |
| 313 struct kernel_stat64 { | 322 struct kernel_stat64 { |
| 314 #endif | 323 #endif |
| 315 unsigned st_dev; | 324 unsigned st_dev; |
| 316 unsigned __pad0[3]; | 325 unsigned __pad0[3]; |
| 317 unsigned long long st_ino; | 326 unsigned long long st_ino; |
| 318 unsigned st_mode; | 327 unsigned st_mode; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 371 unsigned st_atime_; | 380 unsigned st_atime_; |
| 372 unsigned st_atime_nsec_; | 381 unsigned st_atime_nsec_; |
| 373 unsigned st_mtime_; | 382 unsigned st_mtime_; |
| 374 unsigned st_mtime_nsec_; | 383 unsigned st_mtime_nsec_; |
| 375 unsigned st_ctime_; | 384 unsigned st_ctime_; |
| 376 unsigned st_ctime_nsec_; | 385 unsigned st_ctime_nsec_; |
| 377 unsigned long long st_ino; | 386 unsigned long long st_ino; |
| 378 }; | 387 }; |
| 379 #endif | 388 #endif |
| 380 | 389 |
| 381 /* include/asm-{arm,i386,mips,x86_64,ppc}/stat.h */ | 390 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc}/stat.h */ |
| 382 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 391 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
| 383 struct kernel_stat { | 392 struct kernel_stat { |
| 384 /* The kernel headers suggest that st_dev and st_rdev should be 32bit | 393 /* The kernel headers suggest that st_dev and st_rdev should be 32bit |
| 385 * quantities encoding 12bit major and 20bit minor numbers in an interleaved | 394 * quantities encoding 12bit major and 20bit minor numbers in an interleaved |
| 386 * format. In reality, we do not see useful data in the top bits. So, | 395 * format. In reality, we do not see useful data in the top bits. So, |
| 387 * we'll leave the padding in here, until we find a better solution. | 396 * we'll leave the padding in here, until we find a better solution. |
| 388 */ | 397 */ |
| 389 unsigned short st_dev; | 398 unsigned short st_dev; |
| 390 short pad1; | 399 short pad1; |
| 391 unsigned st_ino; | 400 unsigned st_ino; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 long st_atime_; | 474 long st_atime_; |
| 466 long st_atime_nsec_; | 475 long st_atime_nsec_; |
| 467 long st_mtime_; | 476 long st_mtime_; |
| 468 long st_mtime_nsec_; | 477 long st_mtime_nsec_; |
| 469 long st_ctime_; | 478 long st_ctime_; |
| 470 long st_ctime_nsec_; | 479 long st_ctime_nsec_; |
| 471 int st_blksize; | 480 int st_blksize; |
| 472 int st_blocks; | 481 int st_blocks; |
| 473 int st_pad4[14]; | 482 int st_pad4[14]; |
| 474 }; | 483 }; |
| 484 #elif defined(__aarch64__) | |
| 485 struct kernel_stat { | |
| 486 unsigned long st_dev; | |
| 487 unsigned long st_ino; | |
| 488 unsigned int st_mode; | |
| 489 unsigned int st_nlink; | |
| 490 unsigned int st_uid; | |
| 491 unsigned int st_gid; | |
| 492 unsigned long st_rdev; | |
| 493 unsigned long __pad1; | |
| 494 long st_size; | |
| 495 int st_blksize; | |
| 496 int __pad2; | |
| 497 long st_blocks; | |
| 498 long st_atime; | |
|
Mark Seaborn
2014/04/08 16:52:45
All the other defs of st_[amc]time{,_nsec} have a
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 499 unsigned long st_atime_nsec; | |
| 500 long st_mtime; | |
| 501 unsigned long st_mtime_nsec; | |
| 502 long st_ctime; | |
| 503 unsigned long st_ctime_nsec; | |
| 504 unsigned int __unused4; | |
| 505 unsigned int __unused5; | |
| 506 }; | |
| 475 #endif | 507 #endif |
| 476 | 508 |
| 477 /* include/asm-{arm,i386,mips,x86_64,ppc}/statfs.h */ | 509 /* include/asm-{arm,aarch64,i386,mips,x86_64,ppc}/statfs.h */ |
| 478 #ifdef __mips__ | 510 #ifdef __mips__ |
| 479 #if _MIPS_SIM != _MIPS_SIM_ABI64 | 511 #if _MIPS_SIM != _MIPS_SIM_ABI64 |
| 480 struct kernel_statfs64 { | 512 struct kernel_statfs64 { |
| 481 unsigned long f_type; | 513 unsigned long f_type; |
| 482 unsigned long f_bsize; | 514 unsigned long f_bsize; |
| 483 unsigned long f_frsize; | 515 unsigned long f_frsize; |
| 484 unsigned long __pad; | 516 unsigned long __pad; |
| 485 unsigned long long f_blocks; | 517 unsigned long long f_blocks; |
| 486 unsigned long long f_bfree; | 518 unsigned long long f_bfree; |
| 487 unsigned long long f_files; | 519 unsigned long long f_files; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 struct { int val[2]; } f_fsid; | 584 struct { int val[2]; } f_fsid; |
| 553 unsigned long f_namelen; | 585 unsigned long f_namelen; |
| 554 unsigned long f_frsize; | 586 unsigned long f_frsize; |
| 555 unsigned long f_spare[5]; | 587 unsigned long f_spare[5]; |
| 556 }; | 588 }; |
| 557 #endif | 589 #endif |
| 558 | 590 |
| 559 | 591 |
| 560 /* Definitions missing from the standard header files */ | 592 /* Definitions missing from the standard header files */ |
| 561 #ifndef O_DIRECTORY | 593 #ifndef O_DIRECTORY |
| 562 #if defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 594 #if defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) || defined(__aarch64__) |
| 563 #define O_DIRECTORY 0040000 | 595 #define O_DIRECTORY 0040000 |
| 564 #else | 596 #else |
| 565 #define O_DIRECTORY 0200000 | 597 #define O_DIRECTORY 0200000 |
| 566 #endif | 598 #endif |
| 567 #endif | 599 #endif |
| 568 #ifndef NT_PRXFPREG | 600 #ifndef NT_PRXFPREG |
| 569 #define NT_PRXFPREG 0x46e62b7f | 601 #define NT_PRXFPREG 0x46e62b7f |
| 570 #endif | 602 #endif |
| 571 #ifndef PTRACE_GETFPXREGS | 603 #ifndef PTRACE_GETFPXREGS |
| 572 #define PTRACE_GETFPXREGS ((enum __ptrace_request)18) | 604 #define PTRACE_GETFPXREGS ((enum __ptrace_request)18) |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 906 #ifndef __NR_ioprio_get | 938 #ifndef __NR_ioprio_get |
| 907 #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) | 939 #define __NR_ioprio_get (__NR_SYSCALL_BASE + 315) |
| 908 #endif | 940 #endif |
| 909 #ifndef __NR_move_pages | 941 #ifndef __NR_move_pages |
| 910 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) | 942 #define __NR_move_pages (__NR_SYSCALL_BASE + 344) |
| 911 #endif | 943 #endif |
| 912 #ifndef __NR_getcpu | 944 #ifndef __NR_getcpu |
| 913 #define __NR_getcpu (__NR_SYSCALL_BASE + 345) | 945 #define __NR_getcpu (__NR_SYSCALL_BASE + 345) |
| 914 #endif | 946 #endif |
| 915 /* End of ARM 3/EABI definitions */ | 947 /* End of ARM 3/EABI definitions */ |
| 948 #elif defined(__aarch64__) | |
| 949 #ifndef __NR_setxattr | |
| 950 #define __NR_setxattr 5 | |
| 951 #endif | |
| 952 #ifndef __NR_lsetxattr | |
| 953 #define __NR_lsetxattr 6 | |
| 954 #endif | |
| 955 #ifndef __NR_getxattr | |
| 956 #define __NR_getxattr 8 | |
| 957 #endif | |
| 958 #ifndef __NR_lgetxattr | |
| 959 #define __NR_lgetxattr 9 | |
| 960 #endif | |
| 961 #ifndef __NR_listxattr | |
| 962 #define __NR_listxattr 11 | |
| 963 #endif | |
| 964 #ifndef __NR_llistxattr | |
| 965 #define __NR_llistxattr 12 | |
| 966 #endif | |
| 967 #ifndef __NR_ioprio_set | |
| 968 #define __NR_ioprio_set 30 | |
| 969 #endif | |
| 970 #ifndef __NR_ioprio_get | |
| 971 #define __NR_ioprio_get 31 | |
| 972 #endif | |
| 973 #ifndef __NR_unlinkat | |
| 974 #define __NR_unlinkat 35 | |
| 975 #endif | |
| 976 #ifndef __NR_fallocate | |
| 977 #define __NR_fallocate 47 | |
| 978 #endif | |
| 979 #ifndef __NR_openat | |
| 980 #define __NR_openat 56 | |
| 981 #endif | |
| 982 #ifndef __NR_quotactl | |
| 983 #define __NR_quotactl 60 | |
| 984 #endif | |
| 985 #ifndef __NR_getdents64 | |
| 986 #define __NR_getdents64 61 | |
| 987 #endif | |
| 988 #ifndef __NR_getdents | |
| 989 #define __NR_getdents __NR_getdents64 | |
| 990 #endif | |
| 991 #ifndef __NR_pread64 | |
| 992 #define __NR_pread64 67 | |
| 993 #endif | |
| 994 #ifndef __NR_pwrite64 | |
| 995 #define __NR_pwrite64 68 | |
| 996 #endif | |
| 997 #ifndef __NR_ppoll | |
| 998 #define __NR_ppoll 73 | |
| 999 #endif | |
| 1000 #ifndef __NR_readlinkat | |
| 1001 #define __NR_readlinkat 78 | |
| 1002 #endif | |
| 1003 #ifndef __NR_newfstatat | |
| 1004 #define __NR_newfstatat 79 | |
| 1005 #endif | |
| 1006 #ifndef __NR_set_tid_address | |
| 1007 #define __NR_set_tid_address 96 | |
| 1008 #endif | |
| 1009 #ifndef __NR_futex | |
| 1010 #define __NR_futex 98 | |
| 1011 #endif | |
| 1012 #ifndef __NR_clock_gettime | |
| 1013 #define __NR_clock_gettime 113 | |
| 1014 #endif | |
| 1015 #ifndef __NR_clock_getres | |
| 1016 #define __NR_clock_getres 114 | |
| 1017 #endif | |
| 1018 #ifndef __NR_sched_setaffinity | |
| 1019 #define __NR_sched_setaffinity 122 | |
| 1020 #define __NR_sched_getaffinity 123 | |
| 1021 #endif | |
| 1022 #ifndef __NR_tkill | |
| 1023 #define __NR_tkill 130 | |
| 1024 #endif | |
| 1025 #ifndef __NR_setresuid | |
| 1026 #define __NR_setresuid 147 | |
| 1027 #define __NR_getresuid 148 | |
| 1028 #define __NR_setresgid 149 | |
| 1029 #define __NR_getresgid 150 | |
| 1030 #endif | |
| 1031 #ifndef __NR_gettid | |
| 1032 #define __NR_gettid 178 | |
| 1033 #endif | |
| 1034 #ifndef __NR_readahead | |
| 1035 #define __NR_readahead 213 | |
| 1036 #endif | |
| 1037 #ifndef __NR_fadvise64 | |
| 1038 #define __NR_fadvise64 223 | |
| 1039 #endif | |
| 1040 #ifndef __NR_move_pages | |
| 1041 #define __NR_move_pages 239 | |
| 1042 #endif | |
| 1043 /* End of aarch64 definitions */ | |
| 916 #elif defined(__x86_64__) | 1044 #elif defined(__x86_64__) |
| 917 #ifndef __NR_pread64 | 1045 #ifndef __NR_pread64 |
| 918 #define __NR_pread64 17 | 1046 #define __NR_pread64 17 |
| 919 #endif | 1047 #endif |
| 920 #ifndef __NR_pwrite64 | 1048 #ifndef __NR_pwrite64 |
| 921 #define __NR_pwrite64 18 | 1049 #define __NR_pwrite64 18 |
| 922 #endif | 1050 #endif |
| 923 #ifndef __NR_setresuid | 1051 #ifndef __NR_setresuid |
| 924 #define __NR_setresuid 117 | 1052 #define __NR_setresuid 117 |
| 925 #define __NR_getresuid 118 | 1053 #define __NR_getresuid 118 |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1425 #elif defined(SYS_PREFIX) && SYS_PREFIX == 7 | 1553 #elif defined(SYS_PREFIX) && SYS_PREFIX == 7 |
| 1426 #define LSS_NAME(name) sys7_##name | 1554 #define LSS_NAME(name) sys7_##name |
| 1427 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 | 1555 #elif defined(SYS_PREFIX) && SYS_PREFIX == 8 |
| 1428 #define LSS_NAME(name) sys8_##name | 1556 #define LSS_NAME(name) sys8_##name |
| 1429 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 | 1557 #elif defined(SYS_PREFIX) && SYS_PREFIX == 9 |
| 1430 #define LSS_NAME(name) sys9_##name | 1558 #define LSS_NAME(name) sys9_##name |
| 1431 #endif | 1559 #endif |
| 1432 | 1560 |
| 1433 #undef LSS_RETURN | 1561 #undef LSS_RETURN |
| 1434 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ | 1562 #if (defined(__i386__) || defined(__x86_64__) || defined(__ARM_ARCH_3__) \ |
| 1435 || defined(__ARM_EABI__)) | 1563 || defined(__ARM_EABI__) || defined(__aarch64__)) |
| 1436 /* Failing system calls return a negative result in the range of | 1564 /* Failing system calls return a negative result in the range of |
| 1437 * -1..-4095. These are "errno" values with the sign inverted. | 1565 * -1..-4095. These are "errno" values with the sign inverted. |
| 1438 */ | 1566 */ |
| 1439 #define LSS_RETURN(type, res) \ | 1567 #define LSS_RETURN(type, res) \ |
| 1440 do { \ | 1568 do { \ |
| 1441 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ | 1569 if ((unsigned long)(res) >= (unsigned long)(-4095)) { \ |
| 1442 LSS_ERRNO = -(res); \ | 1570 LSS_ERRNO = -(res); \ |
| 1443 res = -1; \ | 1571 res = -1; \ |
| 1444 } \ | 1572 } \ |
| 1445 return (type) (res); \ | 1573 return (type) (res); \ |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2234 long __res; | 2362 long __res; |
| 2235 { | 2363 { |
| 2236 register int __flags __asm__("r0") = flags; | 2364 register int __flags __asm__("r0") = flags; |
| 2237 register void *__stack __asm__("r1") = child_stack; | 2365 register void *__stack __asm__("r1") = child_stack; |
| 2238 register void *__ptid __asm__("r2") = parent_tidptr; | 2366 register void *__ptid __asm__("r2") = parent_tidptr; |
| 2239 register void *__tls __asm__("r3") = newtls; | 2367 register void *__tls __asm__("r3") = newtls; |
| 2240 register int *__ctid __asm__("r4") = child_tidptr; | 2368 register int *__ctid __asm__("r4") = child_tidptr; |
| 2241 __asm__ __volatile__(/* if (fn == NULL || child_stack == NULL) | 2369 __asm__ __volatile__(/* if (fn == NULL || child_stack == NULL) |
| 2242 * return -EINVAL; | 2370 * return -EINVAL; |
| 2243 */ | 2371 */ |
| 2244 #ifdef __thumb2__» » » | 2372 #ifdef __thumb2__ |
| 2245 "push {r7}\n" | 2373 "push {r7}\n" |
| 2246 #endif» » » | 2374 #endif |
| 2247 "cmp %2,#0\n" | 2375 "cmp %2,#0\n" |
| 2248 "it ne\n" | 2376 "it ne\n" |
| 2249 "cmpne %3,#0\n" | 2377 "cmpne %3,#0\n" |
| 2250 "it eq\n" | 2378 "it eq\n" |
| 2251 "moveq %0,%1\n" | 2379 "moveq %0,%1\n" |
| 2252 "beq 1f\n" | 2380 "beq 1f\n" |
| 2253 | 2381 |
| 2254 /* Push "arg" and "fn" onto the stack that will be | 2382 /* Push "arg" and "fn" onto the stack that will be |
| 2255 * used by the child. | 2383 * used by the child. |
| 2256 */ | 2384 */ |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2294 "ldr pc,[sp]\n" | 2422 "ldr pc,[sp]\n" |
| 2295 #endif | 2423 #endif |
| 2296 | 2424 |
| 2297 /* Call _exit(%r0). | 2425 /* Call _exit(%r0). |
| 2298 */ | 2426 */ |
| 2299 "mov r7, %10\n" | 2427 "mov r7, %10\n" |
| 2300 "swi 0x0\n" | 2428 "swi 0x0\n" |
| 2301 "1:\n" | 2429 "1:\n" |
| 2302 #ifdef __thumb2__ | 2430 #ifdef __thumb2__ |
| 2303 "pop {r7}" | 2431 "pop {r7}" |
| 2304 #endif» » » | 2432 #endif |
| 2305 : "=r" (__res) | 2433 : "=r" (__res) |
| 2306 : "i"(-EINVAL), | 2434 : "i"(-EINVAL), |
| 2307 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), | 2435 "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), |
| 2308 "r"(__ptid), "r"(__tls), "r"(__ctid), | 2436 "r"(__ptid), "r"(__tls), "r"(__ctid), |
| 2309 "i"(__NR_clone), "i"(__NR_exit) | 2437 "i"(__NR_clone), "i"(__NR_exit) |
| 2310 #ifdef __thumb2__ | 2438 #ifdef __thumb2__ |
| 2311 : "cc", "lr", "memory"); | 2439 : "cc", "lr", "memory"); |
| 2312 #else | 2440 #else |
| 2313 : "cc", "r7", "lr", "memory"); | 2441 : "cc", "r7", "lr", "memory"); |
| 2314 #endif | 2442 #endif |
| 2315 } | 2443 } |
| 2316 LSS_RETURN(int, __res); | 2444 LSS_RETURN(int, __res); |
| 2317 } | 2445 } |
| 2446 #elif defined(__aarch64__) | |
| 2447 /* Most definitions of _syscallX() neglect to mark "memory" as being | |
| 2448 * clobbered. This causes problems with compilers, that do a better job | |
| 2449 * at optimizing across __asm__ calls. | |
| 2450 * So, we just have to redefine all of the _syscallX() macros. | |
| 2451 */ | |
| 2452 #undef LSS_REG | |
| 2453 #define LSS_REG(r,a) register long __r##r __asm__("x"#r) = (long)a | |
|
jbramley
2014/04/15 10:16:42
Something like int64_t would be better.
rmcilroy
2014/04/15 11:50:29
Done.
| |
| 2454 #undef LSS_BODY | |
| 2455 #define LSS_BODY(type,name,args...) \ | |
| 2456 register long __res_x0 __asm__("x0"); \ | |
| 2457 long __res; \ | |
| 2458 __asm__ __volatile__ ("mov x8, %1\n" \ | |
| 2459 "svc 0x0\n" \ | |
| 2460 : "=r"(__res_x0) \ | |
| 2461 : "i"(__NR_##name) , ## args \ | |
| 2462 : "x8", "x30", "memory"); \ | |
|
jbramley
2014/04/15 10:16:42
The kernel preserves everything except x0, so x30
rmcilroy
2014/04/15 11:50:29
Done.
| |
| 2463 __res = __res_x0; \ | |
| 2464 LSS_RETURN(type, __res) | |
| 2465 #undef _syscall0 | |
| 2466 #define _syscall0(type, name) \ | |
| 2467 type LSS_NAME(name)(void) { \ | |
| 2468 LSS_BODY(type, name); \ | |
| 2469 } | |
| 2470 #undef _syscall1 | |
| 2471 #define _syscall1(type, name, type1, arg1) \ | |
| 2472 type LSS_NAME(name)(type1 arg1) { \ | |
| 2473 LSS_REG(0, arg1); LSS_BODY(type, name, "r"(__r0)); \ | |
| 2474 } | |
| 2475 #undef _syscall2 | |
| 2476 #define _syscall2(type, name, type1, arg1, type2, arg2) \ | |
| 2477 type LSS_NAME(name)(type1 arg1, type2 arg2) { \ | |
| 2478 LSS_REG(0, arg1); LSS_REG(1, arg2); \ | |
| 2479 LSS_BODY(type, name, "r"(__r0), "r"(__r1)); \ | |
| 2480 } | |
| 2481 #undef _syscall3 | |
| 2482 #define _syscall3(type, name, type1, arg1, type2, arg2, type3, arg3) \ | |
| 2483 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3) { \ | |
| 2484 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ | |
| 2485 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2)); \ | |
| 2486 } | |
| 2487 #undef _syscall4 | |
| 2488 #define _syscall4(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4) \ | |
| 2489 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4) { \ | |
| 2490 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ | |
| 2491 LSS_REG(3, arg4); \ | |
| 2492 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3)); \ | |
| 2493 } | |
| 2494 #undef _syscall5 | |
| 2495 #define _syscall5(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ | |
| 2496 type5,arg5) \ | |
| 2497 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ | |
| 2498 type5 arg5) { \ | |
| 2499 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ | |
| 2500 LSS_REG(3, arg4); LSS_REG(4, arg5); \ | |
| 2501 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3), \ | |
| 2502 "r"(__r4)); \ | |
| 2503 } | |
| 2504 #undef _syscall6 | |
| 2505 #define _syscall6(type,name,type1,arg1,type2,arg2,type3,arg3,type4,arg4, \ | |
| 2506 type5,arg5,type6,arg6) \ | |
| 2507 type LSS_NAME(name)(type1 arg1, type2 arg2, type3 arg3, type4 arg4, \ | |
| 2508 type5 arg5, type6 arg6) { \ | |
| 2509 LSS_REG(0, arg1); LSS_REG(1, arg2); LSS_REG(2, arg3); \ | |
| 2510 LSS_REG(3, arg4); LSS_REG(4, arg5); LSS_REG(5, arg6); \ | |
| 2511 LSS_BODY(type, name, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3), \ | |
| 2512 "r"(__r4), "r"(__r5)); \ | |
| 2513 } | |
| 2514 | |
| 2515 LSS_INLINE int LSS_NAME(clone)(int (*fn)(void *), void *child_stack, | |
| 2516 int flags, void *arg, int *parent_tidptr, | |
| 2517 void *newtls, int *child_tidptr) { | |
| 2518 long __res; | |
|
jbramley
2014/04/15 10:16:42
Something like int64_t would be better.
rmcilroy
2014/04/15 11:50:29
Done.
| |
| 2519 if (fn == NULL || child_stack == NULL) { | |
| 2520 return -EINVAL; | |
|
Mark Seaborn
2014/04/08 16:52:45
Shouldn't this be setting errno, as LSS_RETURN doe
rmcilroy
2014/04/09 12:37:07
Good point - dropped the NULL checks.
| |
| 2521 } | |
| 2522 { | |
| 2523 register int __flags __asm__("x0") = flags; | |
|
jbramley
2014/04/15 10:16:42
`flags` is W-sized. Does this work? Perhaps make i
rmcilroy
2014/04/15 11:50:29
It does work, but I agree making flags uint64_t si
| |
| 2524 register void *__stack __asm__("x1") = child_stack; | |
| 2525 register void *__ptid __asm__("x2") = parent_tidptr; | |
| 2526 register void *__tls __asm__("x3") = newtls; | |
| 2527 register int *__ctid __asm__("x4") = child_tidptr; | |
| 2528 __asm__ __volatile__(/* Push "arg" and "fn" onto the stack that will be | |
| 2529 * used by the child. | |
| 2530 */ | |
| 2531 "stp %1, %4, [%2, #-16]!\n" | |
|
jbramley
2014/04/15 10:16:42
Named assembly arguments would make this easier to
rmcilroy
2014/04/15 11:50:29
If you mean named registers, I'm not sure this wou
| |
| 2532 | |
| 2533 /* %x0 = syscall(%x0 = flags, | |
| 2534 * %x1 = child_stack, | |
| 2535 * %x2 = parent_tidptr, | |
| 2536 * %x3 = newtls, | |
| 2537 * %x4 = child_tidptr) | |
| 2538 */ | |
| 2539 "mov x8, %8\n" | |
| 2540 "svc 0x0\n" | |
| 2541 | |
| 2542 /* if (%r0 != 0) | |
| 2543 * return %r0; | |
| 2544 */ | |
| 2545 "adds %0, xzr, x0\n" | |
|
jbramley
2014/04/15 10:16:42
You can use cbnz for this:
cbnz x0, 1f
rmcilroy
2014/04/15 11:50:29
That wouldn't move x0 to __res though.
| |
| 2546 "bne 1f\n" | |
| 2547 | |
| 2548 /* In the child, now. Call "fn(arg)". | |
| 2549 */ | |
| 2550 "ldp x1, x0, [sp], #16\n" | |
| 2551 "blr x1\n" | |
| 2552 | |
| 2553 /* Call _exit(%r0). | |
| 2554 */ | |
| 2555 "mov x8, %9\n" | |
| 2556 "svc 0x0\n" | |
| 2557 "1:\n" | |
| 2558 : "=r" (__res) | |
| 2559 : "r"(fn), "r"(__stack), "r"(__flags), "r"(arg), | |
| 2560 "r"(__ptid), "r"(__tls), "r"(__ctid), | |
| 2561 "i"(__NR_clone), "i"(__NR_exit) | |
| 2562 : "cc", "x8", "x30", "memory"); | |
| 2563 } | |
| 2564 LSS_RETURN(int, __res); | |
| 2565 } | |
| 2318 #elif defined(__mips__) | 2566 #elif defined(__mips__) |
| 2319 #undef LSS_REG | 2567 #undef LSS_REG |
| 2320 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ | 2568 #define LSS_REG(r,a) register unsigned long __r##r __asm__("$"#r) = \ |
| 2321 (unsigned long)(a) | 2569 (unsigned long)(a) |
| 2322 #undef LSS_BODY | 2570 #undef LSS_BODY |
| 2323 #define LSS_BODY(type,name,r7,...) \ | 2571 #define LSS_BODY(type,name,r7,...) \ |
| 2324 register unsigned long __v0 __asm__("$2") = __NR_##name; \ | 2572 register unsigned long __v0 __asm__("$2") = __NR_##name; \ |
| 2325 __asm__ __volatile__ ("syscall\n" \ | 2573 __asm__ __volatile__ ("syscall\n" \ |
| 2326 : "+r"(__v0), r7 (__r7) \ | 2574 : "+r"(__v0), r7 (__r7) \ |
| 2327 : "0"(__v0), ##__VA_ARGS__ \ | 2575 : "0"(__v0), ##__VA_ARGS__ \ |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2721 #define __NR__gettid __NR_gettid | 2969 #define __NR__gettid __NR_gettid |
| 2722 #define __NR__mremap __NR_mremap | 2970 #define __NR__mremap __NR_mremap |
| 2723 LSS_INLINE _syscall1(void *, brk, void *, e) | 2971 LSS_INLINE _syscall1(void *, brk, void *, e) |
| 2724 LSS_INLINE _syscall1(int, chdir, const char *,p) | 2972 LSS_INLINE _syscall1(int, chdir, const char *,p) |
| 2725 LSS_INLINE _syscall1(int, close, int, f) | 2973 LSS_INLINE _syscall1(int, close, int, f) |
| 2726 LSS_INLINE _syscall2(int, clock_getres, int, c, | 2974 LSS_INLINE _syscall2(int, clock_getres, int, c, |
| 2727 struct kernel_timespec*, t) | 2975 struct kernel_timespec*, t) |
| 2728 LSS_INLINE _syscall2(int, clock_gettime, int, c, | 2976 LSS_INLINE _syscall2(int, clock_gettime, int, c, |
| 2729 struct kernel_timespec*, t) | 2977 struct kernel_timespec*, t) |
| 2730 LSS_INLINE _syscall1(int, dup, int, f) | 2978 LSS_INLINE _syscall1(int, dup, int, f) |
| 2731 LSS_INLINE _syscall2(int, dup2, int, s, | 2979 #if !defined(__aarch64__) |
| 2732 int, d) | 2980 // The dup2 syscall has been deprecated on aarch64. We polyfill it below. |
| 2981 LSS_INLINE _syscall2(int, dup2, int, s, | |
| 2982 int, d) | |
| 2983 #endif | |
| 2733 LSS_INLINE _syscall3(int, execve, const char*, f, | 2984 LSS_INLINE _syscall3(int, execve, const char*, f, |
| 2734 const char*const*,a,const char*const*, e) | 2985 const char*const*,a,const char*const*, e) |
| 2735 LSS_INLINE _syscall1(int, _exit, int, e) | 2986 LSS_INLINE _syscall1(int, _exit, int, e) |
| 2736 LSS_INLINE _syscall1(int, exit_group, int, e) | 2987 LSS_INLINE _syscall1(int, exit_group, int, e) |
| 2737 LSS_INLINE _syscall3(int, fcntl, int, f, | 2988 LSS_INLINE _syscall3(int, fcntl, int, f, |
| 2738 int, c, long, a) | 2989 int, c, long, a) |
| 2739 LSS_INLINE _syscall0(pid_t, fork) | 2990 #if !defined(__aarch64__) |
| 2991 // The fork syscall has been deprecated on aarch64. We polyfill it below. | |
| 2992 LSS_INLINE _syscall0(pid_t, fork) | |
| 2993 #endif | |
| 2740 LSS_INLINE _syscall2(int, fstat, int, f, | 2994 LSS_INLINE _syscall2(int, fstat, int, f, |
| 2741 struct kernel_stat*, b) | 2995 struct kernel_stat*, b) |
| 2742 LSS_INLINE _syscall2(int, fstatfs, int, f, | 2996 LSS_INLINE _syscall2(int, fstatfs, int, f, |
| 2743 struct kernel_statfs*, b) | 2997 struct kernel_statfs*, b) |
| 2744 #if defined(__x86_64__) | 2998 #if defined(__x86_64__) |
| 2745 /* Need to make sure off_t isn't truncated to 32-bits under x32. */ | 2999 /* Need to make sure off_t isn't truncated to 32-bits under x32. */ |
| 2746 LSS_INLINE int LSS_NAME(ftruncate)(int f, off_t l) { | 3000 LSS_INLINE int LSS_NAME(ftruncate)(int f, off_t l) { |
| 2747 LSS_BODY(2, int, ftruncate, LSS_SYSCALL_ARG(f), (uint64_t)(l)); | 3001 LSS_BODY(2, int, ftruncate, LSS_SYSCALL_ARG(f), (uint64_t)(l)); |
| 2748 } | 3002 } |
| 2749 #else | 3003 #else |
| 2750 LSS_INLINE _syscall2(int, ftruncate, int, f, | 3004 LSS_INLINE _syscall2(int, ftruncate, int, f, |
| 2751 off_t, l) | 3005 off_t, l) |
| 2752 #endif | 3006 #endif |
| 2753 LSS_INLINE _syscall4(int, futex, int*, a, | 3007 LSS_INLINE _syscall4(int, futex, int*, a, |
| 2754 int, o, int, v, | 3008 int, o, int, v, |
| 2755 struct kernel_timespec*, t) | 3009 struct kernel_timespec*, t) |
| 2756 LSS_INLINE _syscall3(int, getdents, int, f, | 3010 LSS_INLINE _syscall3(int, getdents, int, f, |
| 2757 struct kernel_dirent*, d, int, c) | 3011 struct kernel_dirent*, d, int, c) |
| 2758 LSS_INLINE _syscall3(int, getdents64, int, f, | 3012 LSS_INLINE _syscall3(int, getdents64, int, f, |
| 2759 struct kernel_dirent64*, d, int, c) | 3013 struct kernel_dirent64*, d, int, c) |
| 2760 LSS_INLINE _syscall0(gid_t, getegid) | 3014 LSS_INLINE _syscall0(gid_t, getegid) |
| 2761 LSS_INLINE _syscall0(uid_t, geteuid) | 3015 LSS_INLINE _syscall0(uid_t, geteuid) |
| 2762 LSS_INLINE _syscall0(pid_t, getpgrp) | 3016 #if !defined(__aarch64__) |
| 3017 // The getgprp syscall has been deprecated on aarch64. | |
| 3018 LSS_INLINE _syscall0(pid_t, getpgrp) | |
| 3019 #endif | |
| 2763 LSS_INLINE _syscall0(pid_t, getpid) | 3020 LSS_INLINE _syscall0(pid_t, getpid) |
| 2764 LSS_INLINE _syscall0(pid_t, getppid) | 3021 LSS_INLINE _syscall0(pid_t, getppid) |
| 2765 LSS_INLINE _syscall2(int, getpriority, int, a, | 3022 LSS_INLINE _syscall2(int, getpriority, int, a, |
| 2766 int, b) | 3023 int, b) |
| 2767 LSS_INLINE _syscall3(int, getresgid, gid_t *, r, | 3024 LSS_INLINE _syscall3(int, getresgid, gid_t *, r, |
| 2768 gid_t *, e, gid_t *, s) | 3025 gid_t *, e, gid_t *, s) |
| 2769 LSS_INLINE _syscall3(int, getresuid, uid_t *, r, | 3026 LSS_INLINE _syscall3(int, getresuid, uid_t *, r, |
| 2770 uid_t *, e, uid_t *, s) | 3027 uid_t *, e, uid_t *, s) |
| 2771 #if !defined(__ARM_EABI__) | 3028 #if !defined(__ARM_EABI__) |
| 2772 LSS_INLINE _syscall2(int, getrlimit, int, r, | 3029 LSS_INLINE _syscall2(int, getrlimit, int, r, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2811 LSS_INLINE _syscall2(int, munmap, void*, s, | 3068 LSS_INLINE _syscall2(int, munmap, void*, s, |
| 2812 size_t, l) | 3069 size_t, l) |
| 2813 LSS_INLINE _syscall6(long, move_pages, pid_t, p, | 3070 LSS_INLINE _syscall6(long, move_pages, pid_t, p, |
| 2814 unsigned long, n, void **,g, int *, d, | 3071 unsigned long, n, void **,g, int *, d, |
| 2815 int *, s, int, f) | 3072 int *, s, int, f) |
| 2816 LSS_INLINE _syscall3(int, mprotect, const void *,a, | 3073 LSS_INLINE _syscall3(int, mprotect, const void *,a, |
| 2817 size_t, l, int, p) | 3074 size_t, l, int, p) |
| 2818 LSS_INLINE _syscall5(void*, _mremap, void*, o, | 3075 LSS_INLINE _syscall5(void*, _mremap, void*, o, |
| 2819 size_t, os, size_t, ns, | 3076 size_t, os, size_t, ns, |
| 2820 unsigned long, f, void *, a) | 3077 unsigned long, f, void *, a) |
| 2821 LSS_INLINE _syscall3(int, open, const char*, p, | 3078 #if !defined(__aarch64__) |
| 2822 int, f, int, m) | 3079 // The open and poll syscalls have been deprecated on aarch64. We polyfill |
| 2823 LSS_INLINE _syscall3(int, poll, struct kernel_pollfd*, u, | 3080 // them below. |
| 2824 unsigned int, n, int, t) | 3081 LSS_INLINE _syscall3(int, open, const char*, p, |
| 3082 int, f, int, m) | |
| 3083 LSS_INLINE _syscall3(int, poll, struct kernel_pollfd*, u, | |
| 3084 unsigned int, n, int, t) | |
| 3085 #endif | |
| 2825 LSS_INLINE _syscall5(int, prctl, int, option, | 3086 LSS_INLINE _syscall5(int, prctl, int, option, |
| 2826 unsigned long, arg2, | 3087 unsigned long, arg2, |
| 2827 unsigned long, arg3, | 3088 unsigned long, arg3, |
| 2828 unsigned long, arg4, | 3089 unsigned long, arg4, |
| 2829 unsigned long, arg5) | 3090 unsigned long, arg5) |
| 2830 LSS_INLINE _syscall4(long, ptrace, int, r, | 3091 LSS_INLINE _syscall4(long, ptrace, int, r, |
| 2831 pid_t, p, void *, a, void *, d) | 3092 pid_t, p, void *, a, void *, d) |
| 2832 #if defined(__NR_quotactl) | 3093 #if defined(__NR_quotactl) |
| 2833 // Defined on x86_64 / i386 only | 3094 // Defined on x86_64 / i386 only |
| 2834 LSS_INLINE _syscall4(int, quotactl, int, cmd, const char *, special, | 3095 LSS_INLINE _syscall4(int, quotactl, int, cmd, const char *, special, |
| 2835 int, id, caddr_t, addr) | 3096 int, id, caddr_t, addr) |
| 2836 #endif | 3097 #endif |
| 2837 LSS_INLINE _syscall3(ssize_t, read, int, f, | 3098 LSS_INLINE _syscall3(ssize_t, read, int, f, |
| 2838 void *, b, size_t, c) | 3099 void *, b, size_t, c) |
| 2839 LSS_INLINE _syscall3(int, readlink, const char*, p, | 3100 #if !defined(__aarch64__) |
| 2840 char*, b, size_t, s) | 3101 // The readlink syscall has been deprecated on aarch64. We polyfill below. |
| 3102 LSS_INLINE _syscall3(int, readlink, const char*, p, | |
| 3103 char*, b, size_t, s) | |
| 3104 #endif | |
| 2841 LSS_INLINE _syscall4(int, rt_sigaction, int, s, | 3105 LSS_INLINE _syscall4(int, rt_sigaction, int, s, |
| 2842 const struct kernel_sigaction*, a, | 3106 const struct kernel_sigaction*, a, |
| 2843 struct kernel_sigaction*, o, size_t, c) | 3107 struct kernel_sigaction*, o, size_t, c) |
| 2844 LSS_INLINE _syscall2(int, rt_sigpending, struct kernel_sigset_t *, s, | 3108 LSS_INLINE _syscall2(int, rt_sigpending, struct kernel_sigset_t *, s, |
| 2845 size_t, c) | 3109 size_t, c) |
| 2846 LSS_INLINE _syscall4(int, rt_sigprocmask, int, h, | 3110 LSS_INLINE _syscall4(int, rt_sigprocmask, int, h, |
| 2847 const struct kernel_sigset_t*, s, | 3111 const struct kernel_sigset_t*, s, |
| 2848 struct kernel_sigset_t*, o, size_t, c) | 3112 struct kernel_sigset_t*, o, size_t, c) |
| 2849 LSS_INLINE _syscall2(int, rt_sigsuspend, | 3113 LSS_INLINE _syscall2(int, rt_sigsuspend, |
| 2850 const struct kernel_sigset_t*, s, size_t, c) | 3114 const struct kernel_sigset_t*, s, size_t, c) |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2865 LSS_INLINE _syscall3(int, setresgid, gid_t, r, | 3129 LSS_INLINE _syscall3(int, setresgid, gid_t, r, |
| 2866 gid_t, e, gid_t, s) | 3130 gid_t, e, gid_t, s) |
| 2867 LSS_INLINE _syscall3(int, setresuid, uid_t, r, | 3131 LSS_INLINE _syscall3(int, setresuid, uid_t, r, |
| 2868 uid_t, e, uid_t, s) | 3132 uid_t, e, uid_t, s) |
| 2869 LSS_INLINE _syscall2(int, setrlimit, int, r, | 3133 LSS_INLINE _syscall2(int, setrlimit, int, r, |
| 2870 const struct kernel_rlimit*, l) | 3134 const struct kernel_rlimit*, l) |
| 2871 LSS_INLINE _syscall0(pid_t, setsid) | 3135 LSS_INLINE _syscall0(pid_t, setsid) |
| 2872 LSS_INLINE _syscall2(int, sigaltstack, const stack_t*, s, | 3136 LSS_INLINE _syscall2(int, sigaltstack, const stack_t*, s, |
| 2873 const stack_t*, o) | 3137 const stack_t*, o) |
| 2874 #if defined(__NR_sigreturn) | 3138 #if defined(__NR_sigreturn) |
| 2875 LSS_INLINE _syscall1(int, sigreturn, unsigned long, u) | 3139 LSS_INLINE _syscall1(int, sigreturn, unsigned long, u) |
| 2876 #endif | 3140 #endif |
| 2877 LSS_INLINE _syscall2(int, stat, const char*, f, | 3141 #if !defined(__aarch64__) |
| 2878 struct kernel_stat*, b) | 3142 // The stat syscall has been deprecated on aarch64. We polyfill it below. |
| 3143 LSS_INLINE _syscall2(int, stat, const char*, f, | |
| 3144 struct kernel_stat*, b) | |
| 3145 #endif | |
| 2879 LSS_INLINE _syscall2(int, statfs, const char*, f, | 3146 LSS_INLINE _syscall2(int, statfs, const char*, f, |
| 2880 struct kernel_statfs*, b) | 3147 struct kernel_statfs*, b) |
| 2881 LSS_INLINE _syscall3(int, tgkill, pid_t, p, | 3148 LSS_INLINE _syscall3(int, tgkill, pid_t, p, |
| 2882 pid_t, t, int, s) | 3149 pid_t, t, int, s) |
| 2883 LSS_INLINE _syscall2(int, tkill, pid_t, p, | 3150 LSS_INLINE _syscall2(int, tkill, pid_t, p, |
| 2884 int, s) | 3151 int, s) |
| 2885 LSS_INLINE _syscall1(int, unlink, const char*, f) | 3152 #if !defined(__aarch64__) |
| 3153 // The unlink syscall has been deprecated on aarch64. We polyfill it below. | |
| 3154 LSS_INLINE _syscall1(int, unlink, const char*, f) | |
| 3155 #endif | |
| 2886 LSS_INLINE _syscall3(ssize_t, write, int, f, | 3156 LSS_INLINE _syscall3(ssize_t, write, int, f, |
| 2887 const void *, b, size_t, c) | 3157 const void *, b, size_t, c) |
| 2888 LSS_INLINE _syscall3(ssize_t, writev, int, f, | 3158 LSS_INLINE _syscall3(ssize_t, writev, int, f, |
| 2889 const struct kernel_iovec*, v, size_t, c) | 3159 const struct kernel_iovec*, v, size_t, c) |
| 2890 #if defined(__NR_getcpu) | 3160 #if defined(__NR_getcpu) |
| 2891 LSS_INLINE _syscall3(long, getcpu, unsigned *, cpu, | 3161 LSS_INLINE _syscall3(long, getcpu, unsigned *, cpu, |
| 2892 unsigned *, node, void *, unused) | 3162 unsigned *, node, void *, unused) |
| 2893 #endif | 3163 #endif |
| 2894 #if defined(__x86_64__) || \ | 3164 #if defined(__x86_64__) || \ |
| 2895 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) | 3165 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2984 const struct kernel_sigset_t *set, | 3254 const struct kernel_sigset_t *set, |
| 2985 struct kernel_sigset_t *oldset) { | 3255 struct kernel_sigset_t *oldset) { |
| 2986 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); | 3256 return LSS_NAME(rt_sigprocmask)(how, set, oldset, (KERNEL_NSIG+7)/8); |
| 2987 } | 3257 } |
| 2988 | 3258 |
| 2989 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { | 3259 LSS_INLINE int LSS_NAME(sigsuspend)(const struct kernel_sigset_t *set) { |
| 2990 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); | 3260 return LSS_NAME(rt_sigsuspend)(set, (KERNEL_NSIG+7)/8); |
| 2991 } | 3261 } |
| 2992 #endif | 3262 #endif |
| 2993 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ | 3263 #if defined(__x86_64__) || defined(__ARM_ARCH_3__) || \ |
| 2994 defined(__ARM_EABI__) || \ | 3264 defined(__ARM_EABI__) || defined(__aarch64__) || \ |
| 2995 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) | 3265 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI32) |
| 2996 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, | 3266 LSS_INLINE _syscall4(pid_t, wait4, pid_t, p, |
| 2997 int*, s, int, o, | 3267 int*, s, int, o, |
| 2998 struct kernel_rusage*, r) | 3268 struct kernel_rusage*, r) |
| 2999 | 3269 |
| 3000 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ | 3270 LSS_INLINE pid_t LSS_NAME(waitpid)(pid_t pid, int *status, int options){ |
| 3001 return LSS_NAME(wait4)(pid, status, options, 0); | 3271 return LSS_NAME(wait4)(pid, status, options, 0); |
| 3002 } | 3272 } |
| 3003 #endif | 3273 #endif |
| 3004 #if defined(__i386__) || defined(__x86_64__) | 3274 #if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) |
| 3005 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) | 3275 LSS_INLINE _syscall4(int, openat, int, d, const char *, p, int, f, int, m) |
| 3006 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) | 3276 LSS_INLINE _syscall3(int, unlinkat, int, d, const char *, p, int, f) |
| 3007 #endif | 3277 #endif |
| 3008 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) | 3278 #if defined(__i386__) || defined(__ARM_ARCH_3__) || defined(__ARM_EABI__) |
| 3009 #define __NR__getresgid32 __NR_getresgid32 | 3279 #define __NR__getresgid32 __NR_getresgid32 |
| 3010 #define __NR__getresuid32 __NR_getresuid32 | 3280 #define __NR__getresuid32 __NR_getresuid32 |
| 3011 #define __NR__setfsgid32 __NR_setfsgid32 | 3281 #define __NR__setfsgid32 __NR_setfsgid32 |
| 3012 #define __NR__setfsuid32 __NR_setfsuid32 | 3282 #define __NR__setfsuid32 __NR_setfsuid32 |
| 3013 #define __NR__setresgid32 __NR_setresgid32 | 3283 #define __NR__setresgid32 __NR_setresgid32 |
| 3014 #define __NR__setresuid32 __NR_setresuid32 | 3284 #define __NR__setresuid32 __NR_setresuid32 |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3382 | 3652 |
| 3383 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { | 3653 LSS_INLINE int LSS_NAME(socket)(int domain, int type, int protocol) { |
| 3384 LSS_SC_BODY(3, int, 1, domain, type, protocol); | 3654 LSS_SC_BODY(3, int, 1, domain, type, protocol); |
| 3385 } | 3655 } |
| 3386 | 3656 |
| 3387 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, | 3657 LSS_INLINE int LSS_NAME(socketpair)(int d, int type, int protocol, |
| 3388 int sv[2]) { | 3658 int sv[2]) { |
| 3389 LSS_SC_BODY(4, int, 8, d, type, protocol, sv); | 3659 LSS_SC_BODY(4, int, 8, d, type, protocol, sv); |
| 3390 } | 3660 } |
| 3391 #endif | 3661 #endif |
| 3392 #if defined(__ARM_EABI__) | 3662 #if defined(__ARM_EABI__) || defined (__aarch64__) |
| 3393 LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg, | 3663 LSS_INLINE _syscall3(ssize_t, recvmsg, int, s, struct kernel_msghdr*, msg, |
| 3394 int, flags) | 3664 int, flags) |
| 3395 LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*, | 3665 LSS_INLINE _syscall3(ssize_t, sendmsg, int, s, const struct kernel_msghdr*, |
| 3396 msg, int, flags) | 3666 msg, int, flags) |
| 3397 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, | 3667 LSS_INLINE _syscall6(ssize_t, sendto, int, s, const void*, buf, size_t,len, |
| 3398 int, flags, const struct kernel_sockaddr*, to, | 3668 int, flags, const struct kernel_sockaddr*, to, |
| 3399 unsigned int, tolen) | 3669 unsigned int, tolen) |
| 3400 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) | 3670 LSS_INLINE _syscall2(int, shutdown, int, s, int, how) |
| 3401 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) | 3671 LSS_INLINE _syscall3(int, socket, int, domain, int, type, int, protocol) |
| 3402 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, | 3672 LSS_INLINE _syscall4(int, socketpair, int, d, int, type, int, protocol, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3473 if (__r7) { | 3743 if (__r7) { |
| 3474 unsigned long __errnovalue = __v0; | 3744 unsigned long __errnovalue = __v0; |
| 3475 LSS_ERRNO = __errnovalue; | 3745 LSS_ERRNO = __errnovalue; |
| 3476 return -1; | 3746 return -1; |
| 3477 } else { | 3747 } else { |
| 3478 p[0] = __v0; | 3748 p[0] = __v0; |
| 3479 p[1] = __v1; | 3749 p[1] = __v1; |
| 3480 return 0; | 3750 return 0; |
| 3481 } | 3751 } |
| 3482 } | 3752 } |
| 3483 #else | 3753 #elif !defined(__aarch64__) |
| 3754 // The unlink syscall has been deprecated on aarch64. We polyfill it below. | |
| 3484 LSS_INLINE _syscall1(int, pipe, int *, p) | 3755 LSS_INLINE _syscall1(int, pipe, int *, p) |
| 3485 #endif | 3756 #endif |
| 3486 /* TODO(csilvers): see if ppc can/should support this as well */ | 3757 /* TODO(csilvers): see if ppc can/should support this as well */ |
| 3487 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ | 3758 #if defined(__i386__) || defined(__ARM_ARCH_3__) || \ |
| 3488 defined(__ARM_EABI__) || \ | 3759 defined(__ARM_EABI__) || \ |
| 3489 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) | 3760 (defined(__mips__) && _MIPS_SIM != _MIPS_SIM_ABI64) |
| 3490 #define __NR__statfs64 __NR_statfs64 | 3761 #define __NR__statfs64 __NR_statfs64 |
| 3491 #define __NR__fstatfs64 __NR_fstatfs64 | 3762 #define __NR__fstatfs64 __NR_fstatfs64 |
| 3492 LSS_INLINE _syscall3(int, _statfs64, const char*, p, | 3763 LSS_INLINE _syscall3(int, _statfs64, const char*, p, |
| 3493 size_t, s,struct kernel_statfs64*, b) | 3764 size_t, s,struct kernel_statfs64*, b) |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3651 return LSS_NAME(_pwrite64)(fd, buf, count, | 3922 return LSS_NAME(_pwrite64)(fd, buf, count, |
| 3652 LSS_LLARG_PAD o.arg[0], o.arg[1]); | 3923 LSS_LLARG_PAD o.arg[0], o.arg[1]); |
| 3653 } | 3924 } |
| 3654 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { | 3925 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { |
| 3655 union { loff_t off; unsigned arg[2]; } o = { off }; | 3926 union { loff_t off; unsigned arg[2]; } o = { off }; |
| 3656 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); | 3927 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); |
| 3657 } | 3928 } |
| 3658 #endif | 3929 #endif |
| 3659 #endif | 3930 #endif |
| 3660 | 3931 |
| 3932 #if defined(__aarch64__) | |
|
Mark Seaborn
2014/04/08 16:52:45
All of this added block can be indented by 2 space
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 3933 LSS_INLINE _syscall3(int, dup3, int, s, int, d, int, f) | |
| 3934 LSS_INLINE _syscall6(void*, mmap, void*, addr, size_t, length, int, prot, | |
| 3935 int, flags, int, fd, off64_t, offset) | |
|
Mark Seaborn
2014/04/08 16:52:45
You might need to change off64_t to int64_t (see t
rmcilroy
2014/04/09 12:37:07
Looks like it does - updated to int64_t.
| |
| 3936 LSS_INLINE _syscall4(int, newfstatat, int, dirfd, const char*, pathname, | |
| 3937 struct kernel_stat*, buf, int, flags) | |
| 3938 LSS_INLINE _syscall2(int, pipe2, int *, pipefd, int, flags) | |
|
Mark Seaborn
2014/04/08 16:52:45
You've got a mix of "type *" and "type*" spacing s
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 3939 LSS_INLINE _syscall5(int, ppoll, struct kernel_pollfd*, u, | |
| 3940 unsigned int, n, const struct kernel_timespec*, t, | |
| 3941 const kernel_sigset_t*, sigmask, size_t, s) | |
| 3942 LSS_INLINE _syscall4(int, readlinkat, int, d, const char *, p, char *, b, | |
| 3943 size_t, s) | |
| 3944 #endif | |
| 3945 | |
| 3946 /* | |
| 3947 * Polyfills for deprecated syscalls. | |
| 3948 */ | |
| 3949 | |
| 3950 #if defined(__aarch64__) | |
| 3951 LSS_INLINE int LSS_NAME(dup2) (int s, int d) { | |
|
Mark Seaborn
2014/04/08 16:52:45
Nit: remove space between ") (". Same in some oth
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 3952 return LSS_NAME(dup3)(s, d, 0); | |
| 3953 } | |
| 3954 | |
| 3955 LSS_INLINE int LSS_NAME(open)(const char* pathname, int flags, int mode) { | |
|
Mark Seaborn
2014/04/08 16:52:45
Similar comment about "*" spacing. Most of the ex
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 3956 return LSS_NAME(openat)(AT_FDCWD, pathname, flags, mode); | |
| 3957 } | |
| 3958 | |
| 3959 LSS_INLINE int LSS_NAME(unlink)(const char* pathname) { | |
| 3960 return LSS_NAME(unlinkat)(AT_FDCWD, pathname, 0); | |
| 3961 } | |
| 3962 | |
| 3963 LSS_INLINE int LSS_NAME(readlink)(const char* pathname, char* buffer, | |
| 3964 size_t size) { | |
| 3965 return LSS_NAME(readlinkat)(AT_FDCWD, pathname, buffer, size); | |
| 3966 } | |
| 3967 | |
| 3968 LSS_INLINE pid_t LSS_NAME(pipe)(int* pipefd) { | |
| 3969 return LSS_NAME(pipe2)(pipefd, 0); | |
| 3970 } | |
| 3971 | |
| 3972 LSS_INLINE int LSS_NAME(poll) (struct kernel_pollfd* fds, unsigned int nfds, | |
| 3973 int timeout) { | |
| 3974 struct kernel_timespec timeout_ts; | |
| 3975 struct kernel_timespec* timeout_ts_p = NULL; | |
| 3976 | |
| 3977 if (timeout >= 0) { | |
| 3978 timeout_ts.tv_sec = timeout / 1000; | |
| 3979 timeout_ts.tv_nsec = (timeout % 1000) * 1000000; | |
| 3980 timeout_ts_p = &timeout_ts; | |
| 3981 } | |
| 3982 return LSS_NAME(ppoll) (fds, nfds, timeout_ts_p, NULL, 0); | |
|
Mark Seaborn
2014/04/08 16:52:45
Shouldn't the last arg be NULL too, since it's a p
rmcilroy
2014/04/09 12:37:07
It's not a pointer, it's "size_t s" (the size of t
| |
| 3983 } | |
| 3984 | |
| 3985 LSS_INLINE int LSS_NAME(stat) (const char *pathname, | |
| 3986 struct kernel_stat *buf) { | |
|
Mark Seaborn
2014/04/08 16:52:45
Nit: align arg to match "("
rmcilroy
2014/04/09 12:37:07
Done.
| |
| 3987 return LSS_NAME(newfstatat) (AT_FDCWD, pathname, buf, 0); | |
| 3988 } | |
| 3989 | |
| 3990 LSS_INLINE pid_t LSS_NAME(fork)(void) { | |
| 3991 // No fork syscall on aarch64 - implement by means of the clone syscall. | |
| 3992 pid_t pid = LSS_NAME(getpid)(); | |
|
Mark Seaborn
2014/04/08 16:52:45
It's not obvious to me why you'd need this...
rmcilroy
2014/04/09 12:37:07
See below
| |
| 3993 | |
| 3994 int flags = CLONE_CHILD_SETTID | CLONE_CHILD_CLEARTID | SIGCHLD; | |
| 3995 void *child_stack = NULL; | |
| 3996 void *parent_tidptr = NULL; | |
| 3997 void *newtls = NULL; | |
| 3998 void *child_tidptr = &pid; | |
|
Mark Seaborn
2014/04/08 16:52:45
...or this, since you don't return pid, you return
rmcilroy
2014/04/09 12:37:07
Yeah, this was for the CLONE_CHILD_SETTID and CLON
Mark Seaborn
2014/04/14 19:15:21
Hmm, I see what you mean. I suppose you got this
rmcilroy
2014/04/15 09:18:48
Yes exactly. I added the comment.
| |
| 3999 | |
| 4000 LSS_REG(0, flags); | |
| 4001 LSS_REG(1, child_stack); | |
| 4002 LSS_REG(2, parent_tidptr); | |
| 4003 LSS_REG(3, newtls); | |
| 4004 LSS_REG(4, child_tidptr); | |
| 4005 LSS_BODY(pid_t, clone, "r"(__r0), "r"(__r1), "r"(__r2), "r"(__r3), | |
| 4006 "r"(__r4)); | |
| 4007 } | |
| 4008 #endif | |
| 4009 | |
| 3661 #ifdef __ANDROID__ | 4010 #ifdef __ANDROID__ |
| 3662 /* These restore the original values of these macros saved by the | 4011 /* These restore the original values of these macros saved by the |
| 3663 * corresponding #pragma push_macro near the top of this file. */ | 4012 * corresponding #pragma push_macro near the top of this file. */ |
| 3664 # pragma pop_macro("stat64") | 4013 # pragma pop_macro("stat64") |
| 3665 # pragma pop_macro("fstat64") | 4014 # pragma pop_macro("fstat64") |
| 3666 # pragma pop_macro("lstat64") | 4015 # pragma pop_macro("lstat64") |
| 3667 #endif | 4016 #endif |
| 3668 | 4017 |
| 3669 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 4018 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
| 3670 } | 4019 } |
| 3671 #endif | 4020 #endif |
| 3672 | 4021 |
| 3673 #endif | 4022 #endif |
| 3674 #endif | 4023 #endif |
| OLD | NEW |