OLD | NEW |
1 /* Copyright (c) 2005-2010, 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 |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
(...skipping 2996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3008 int signum) { | 3008 int signum) { |
3009 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { | 3009 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { |
3010 LSS_ERRNO = EINVAL; | 3010 LSS_ERRNO = EINVAL; |
3011 return -1; | 3011 return -1; |
3012 } else { | 3012 } else { |
3013 set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] | 3013 set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] |
3014 &= ~(1UL << ((signum - 1) % (8*sizeof(set->sig[0])))); | 3014 &= ~(1UL << ((signum - 1) % (8*sizeof(set->sig[0])))); |
3015 return 0; | 3015 return 0; |
3016 } | 3016 } |
3017 } | 3017 } |
3018 | 3018 |
3019 LSS_INLINE int LSS_NAME(sigismember)(struct kernel_sigset_t *set, | 3019 LSS_INLINE int LSS_NAME(sigismember)(struct kernel_sigset_t *set, |
3020 int signum) { | 3020 int signum) { |
3021 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { | 3021 if (signum < 1 || signum > (int)(8*sizeof(set->sig))) { |
3022 LSS_ERRNO = EINVAL; | 3022 LSS_ERRNO = EINVAL; |
3023 return -1; | 3023 return -1; |
3024 } else { | 3024 } else { |
3025 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & | 3025 return !!(set->sig[(signum - 1)/(8*sizeof(set->sig[0]))] & |
3026 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); | 3026 (1UL << ((signum - 1) % (8*sizeof(set->sig[0]))))); |
3027 } | 3027 } |
3028 } | 3028 } |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3457 loff_t, o) | 3457 loff_t, o) |
3458 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, | 3458 LSS_INLINE _syscall4(ssize_t, pwrite64, int, f, |
3459 const void *, b, size_t, c, | 3459 const void *, b, size_t, c, |
3460 loff_t, o) | 3460 loff_t, o) |
3461 LSS_INLINE _syscall3(int, readahead, int, f, | 3461 LSS_INLINE _syscall3(int, readahead, int, f, |
3462 loff_t, o, unsigned, c) | 3462 loff_t, o, unsigned, c) |
3463 #else | 3463 #else |
3464 #define __NR__pread64 __NR_pread64 | 3464 #define __NR__pread64 __NR_pread64 |
3465 #define __NR__pwrite64 __NR_pwrite64 | 3465 #define __NR__pwrite64 __NR_pwrite64 |
3466 #define __NR__readahead __NR_readahead | 3466 #define __NR__readahead __NR_readahead |
3467 LSS_INLINE _syscall5(ssize_t, _pread64, int, f, | 3467 #if defined(__ARM_EABI__) |
3468 void *, b, size_t, c, unsigned, o1, | 3468 /* On ARM, a 64-bit parameter has to be in an even-odd register pair. |
3469 unsigned, o2) | 3469 * Hence these calls ignore their fourth argument (r3) so that their |
3470 LSS_INLINE _syscall5(ssize_t, _pwrite64, int, f, | 3470 * fifth and sixth make such a pair (r4,r5). |
3471 const void *, b, size_t, c, unsigned, o1, | 3471 */ |
3472 long, o2) | 3472 #define LSS_LLARG_PAD 0, |
3473 LSS_INLINE _syscall4(int, _readahead, int, f, | 3473 LSS_INLINE _syscall6(ssize_t, _pread64, int, f, |
3474 unsigned, o1, unsigned, o2, size_t, c) | 3474 void *, b, size_t, c, |
| 3475 unsigned, skip, unsigned, o1, unsigned, o2) |
| 3476 LSS_INLINE _syscall6(ssize_t, _pwrite64, int, f, |
| 3477 const void *, b, size_t, c, |
| 3478 unsigned, skip, unsigned, o1, unsigned, o2) |
| 3479 LSS_INLINE _syscall5(int, _readahead, int, f, |
| 3480 unsigned, skip, |
| 3481 unsigned, o1, unsigned, o2, size_t, c) |
| 3482 #else |
| 3483 #define LSS_LLARG_PAD |
| 3484 LSS_INLINE _syscall5(ssize_t, _pread64, int, f, |
| 3485 void *, b, size_t, c, unsigned, o1, |
| 3486 unsigned, o2) |
| 3487 LSS_INLINE _syscall5(ssize_t, _pwrite64, int, f, |
| 3488 const void *, b, size_t, c, unsigned, o1, |
| 3489 long, o2) |
| 3490 LSS_INLINE _syscall4(int, _readahead, int, f, |
| 3491 unsigned, o1, unsigned, o2, size_t, c) |
| 3492 #endif |
3475 /* We force 64bit-wide parameters onto the stack, then access each | 3493 /* We force 64bit-wide parameters onto the stack, then access each |
3476 * 32-bit component individually. This guarantees that we build the | 3494 * 32-bit component individually. This guarantees that we build the |
3477 * correct parameters independent of the native byte-order of the | 3495 * correct parameters independent of the native byte-order of the |
3478 * underlying architecture. | 3496 * underlying architecture. |
3479 */ | 3497 */ |
3480 LSS_INLINE ssize_t LSS_NAME(pread64)(int fd, void *buf, size_t count, | 3498 LSS_INLINE ssize_t LSS_NAME(pread64)(int fd, void *buf, size_t count, |
3481 loff_t off) { | 3499 loff_t off) { |
3482 union { loff_t off; unsigned arg[2]; } o = { off }; | 3500 union { loff_t off; unsigned arg[2]; } o = { off }; |
3483 return LSS_NAME(_pread64)(fd, buf, count, o.arg[0], o.arg[1]); | 3501 return LSS_NAME(_pread64)(fd, buf, count, |
| 3502 LSS_LLARG_PAD o.arg[0], o.arg[1]); |
3484 } | 3503 } |
3485 LSS_INLINE ssize_t LSS_NAME(pwrite64)(int fd, const void *buf, | 3504 LSS_INLINE ssize_t LSS_NAME(pwrite64)(int fd, const void *buf, |
3486 size_t count, loff_t off) { | 3505 size_t count, loff_t off) { |
3487 union { loff_t off; unsigned arg[2]; } o = { off }; | 3506 union { loff_t off; unsigned arg[2]; } o = { off }; |
3488 return LSS_NAME(_pwrite64)(fd, buf, count, o.arg[0], o.arg[1]); | 3507 return LSS_NAME(_pwrite64)(fd, buf, count, |
| 3508 LSS_LLARG_PAD o.arg[0], o.arg[1]); |
3489 } | 3509 } |
3490 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { | 3510 LSS_INLINE int LSS_NAME(readahead)(int fd, loff_t off, int len) { |
3491 union { loff_t off; unsigned arg[2]; } o = { off }; | 3511 union { loff_t off; unsigned arg[2]; } o = { off }; |
3492 return LSS_NAME(_readahead)(fd, o.arg[0], o.arg[1], len); | 3512 return LSS_NAME(_readahead)(fd, LSS_LLARG_PAD o.arg[0], o.arg[1], len); |
3493 } | 3513 } |
3494 #endif | 3514 #endif |
3495 #endif | 3515 #endif |
3496 | 3516 |
3497 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) | 3517 #if defined(__cplusplus) && !defined(SYS_CPLUSPLUS) |
3498 } | 3518 } |
3499 #endif | 3519 #endif |
3500 | 3520 |
3501 #endif | 3521 #endif |
3502 #endif | 3522 #endif |
OLD | NEW |