Revision 0c866a7e

b/linux-user/alpha/syscall_nr.h
412 412
#define TARGET_NR_timerfd			477
413 413
#define TARGET_NR_eventfd			478
414 414

  
415
/* The following aliases are defined in order to match up with the
416
   standard i386 syscalls implemented in syscalls.c.  */
417
#define TARGET_NR_chown32	TARGET_NR_chown
418
#define TARGET_NR_setuid32	TARGET_NR_setuid
419
#define TARGET_NR_setgid32	TARGET_NR_setgid
420
#define TARGET_NR_setfsuid32	TARGET_NR_setfsuid
421
#define TARGET_NR_setfsgid32	TARGET_NR_setfsgid
b/linux-user/syscall.c
328 328
  return (fchmodat(dirfd, pathname, mode, 0));
329 329
}
330 330
#endif
331
#if defined(TARGET_NR_fchownat) && defined(USE_UID16)
331
#if defined(TARGET_NR_fchownat)
332 332
static int sys_fchownat(int dirfd, const char *pathname, uid_t owner,
333 333
    gid_t group, int flags)
334 334
{
......
437 437
#if defined(TARGET_NR_fchmodat) && defined(__NR_fchmodat)
438 438
_syscall3(int,sys_fchmodat,int,dirfd,const char *,pathname, mode_t,mode)
439 439
#endif
440
#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat) && defined(USE_UID16)
440
#if defined(TARGET_NR_fchownat) && defined(__NR_fchownat)
441 441
_syscall5(int,sys_fchownat,int,dirfd,const char *,pathname,
442 442
          uid_t,owner,gid_t,group,int,flags)
443 443
#endif
......
4164 4164
    else
4165 4165
        return gid;
4166 4166
}
4167

  
4167
static inline int tswapid(int id)
4168
{
4169
    return tswap16(id);
4170
}
4171
#else /* !USE_UID16 */
4172
static inline int high2lowuid(int uid)
4173
{
4174
    return uid;
4175
}
4176
static inline int high2lowgid(int gid)
4177
{
4178
    return gid;
4179
}
4180
static inline int low2highuid(int uid)
4181
{
4182
    return uid;
4183
}
4184
static inline int low2highgid(int gid)
4185
{
4186
    return gid;
4187
}
4188
static inline int tswapid(int id)
4189
{
4190
    return tswap32(id);
4191
}
4168 4192
#endif /* USE_UID16 */
4169 4193

  
4170 4194
void syscall_init(void)
......
6765 6789
            ret = host_to_target_stat64(cpu_env, arg3, &st);
6766 6790
        break;
6767 6791
#endif
6768
#ifdef USE_UID16
6769 6792
    case TARGET_NR_lchown:
6770 6793
        if (!(p = lock_user_string(arg1)))
6771 6794
            goto efault;
6772 6795
        ret = get_errno(lchown(p, low2highuid(arg2), low2highgid(arg3)));
6773 6796
        unlock_user(p, arg1, 0);
6774 6797
        break;
6798
#ifdef TARGET_NR_getuid
6775 6799
    case TARGET_NR_getuid:
6776 6800
        ret = get_errno(high2lowuid(getuid()));
6777 6801
        break;
6802
#endif
6803
#ifdef TARGET_NR_getgid
6778 6804
    case TARGET_NR_getgid:
6779 6805
        ret = get_errno(high2lowgid(getgid()));
6780 6806
        break;
6807
#endif
6808
#ifdef TARGET_NR_geteuid
6781 6809
    case TARGET_NR_geteuid:
6782 6810
        ret = get_errno(high2lowuid(geteuid()));
6783 6811
        break;
6812
#endif
6813
#ifdef TARGET_NR_getegid
6784 6814
    case TARGET_NR_getegid:
6785 6815
        ret = get_errno(high2lowgid(getegid()));
6786 6816
        break;
6817
#endif
6787 6818
    case TARGET_NR_setreuid:
6788 6819
        ret = get_errno(setreuid(low2highuid(arg1), low2highuid(arg2)));
6789 6820
        break;
......
6793 6824
    case TARGET_NR_getgroups:
6794 6825
        {
6795 6826
            int gidsetsize = arg1;
6796
            uint16_t *target_grouplist;
6827
            target_id *target_grouplist;
6797 6828
            gid_t *grouplist;
6798 6829
            int i;
6799 6830

  
......
6806 6837
                if (!target_grouplist)
6807 6838
                    goto efault;
6808 6839
                for(i = 0;i < ret; i++)
6809
                    target_grouplist[i] = tswap16(grouplist[i]);
6840
                    target_grouplist[i] = tswapid(high2lowgid(grouplist[i]));
6810 6841
                unlock_user(target_grouplist, arg2, gidsetsize * 2);
6811 6842
            }
6812 6843
        }
......
6814 6845
    case TARGET_NR_setgroups:
6815 6846
        {
6816 6847
            int gidsetsize = arg1;
6817
            uint16_t *target_grouplist;
6848
            target_id *target_grouplist;
6818 6849
            gid_t *grouplist;
6819 6850
            int i;
6820 6851

  
......
6825 6856
                goto fail;
6826 6857
            }
6827 6858
            for(i = 0;i < gidsetsize; i++)
6828
                grouplist[i] = tswap16(target_grouplist[i]);
6859
                grouplist[i] = low2highgid(tswapid(target_grouplist[i]));
6829 6860
            unlock_user(target_grouplist, arg2, 0);
6830 6861
            ret = get_errno(setgroups(gidsetsize, grouplist));
6831 6862
        }
......
6901 6932
    case TARGET_NR_setfsgid:
6902 6933
        ret = get_errno(setfsgid(arg1));
6903 6934
        break;
6904
#endif /* USE_UID16 */
6905 6935

  
6906 6936
#ifdef TARGET_NR_lchown32
6907 6937
    case TARGET_NR_lchown32:
b/linux-user/syscall_defs.h
49 49
#define TARGET_IOC_TYPEBITS	8
50 50

  
51 51
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SPARC) \
52
    || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS) || defined(TARGET_PPC) || defined(TARGET_MIPS)
52
    || defined(TARGET_M68K) || defined(TARGET_SH4) || defined(TARGET_CRIS)
53 53
    /* 16 bit uid wrappers emulation */
54 54
#define USE_UID16
55
#define target_id uint16_t
56
#else
57
#define target_id uint32_t
55 58
#endif
56 59

  
57 60
#if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_SH4) \

Also available in: Unified diff