Revision 95c09828 linux-user/syscall.c

b/linux-user/syscall.c
218 218
#if defined(TARGET_NR_getdents64) && defined(__NR_getdents64)
219 219
_syscall3(int, sys_getdents64, uint, fd, struct linux_dirent64 *, dirp, uint, count);
220 220
#endif
221
_syscall2(int, sys_getpriority, int, which, int, who);
222 221
#if defined(TARGET_NR__llseek) && defined(__NR_llseek)
223 222
_syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
224 223
          loff_t *, res, uint, wh);
......
6445 6444
        break;
6446 6445
#endif
6447 6446
    case TARGET_NR_getpriority:
6448
        /* libc does special remapping of the return value of
6449
         * sys_getpriority() so it's just easiest to call
6450
         * sys_getpriority() directly rather than through libc. */
6451
        ret = get_errno(sys_getpriority(arg1, arg2));
6447
        /* Note that negative values are valid for getpriority, so we must
6448
           differentiate based on errno settings.  */
6449
        errno = 0;
6450
        ret = getpriority(arg1, arg2);
6451
        if (ret == -1 && errno != 0) {
6452
            ret = -host_to_target_errno(errno);
6453
            break;
6454
        }
6455
#ifdef TARGET_ALPHA
6456
        /* Return value is the unbiased priority.  Signal no error.  */
6457
        ((CPUAlphaState *)cpu_env)->ir[IR_V0] = 0;
6458
#else
6459
        /* Return value is a biased priority to avoid negative numbers.  */
6460
        ret = 20 - ret;
6461
#endif
6452 6462
        break;
6453 6463
    case TARGET_NR_setpriority:
6454 6464
        ret = get_errno(setpriority(arg1, arg2, arg3));

Also available in: Unified diff