Revision dab2ed99 linux-user/syscall.c

b/linux-user/syscall.c
53 53
#include <linux/cdrom.h>
54 54
#include <linux/hdreg.h>
55 55
#include <linux/soundcard.h>
56
#include <linux/dirent.h>
56 57

  
57 58
#include "gemu.h"
58 59

  
......
63 64
#define PAGE_MASK ~(PAGE_SIZE - 1)
64 65
#endif
65 66

  
66
struct dirent {
67
        long            d_ino;
68
        long            d_off;
69
        unsigned short  d_reclen;
70
        char            d_name[256]; /* We must not include limits.h! */
71
};
72

  
73 67
//#include <linux/msdos_fs.h>
74 68
#define	VFAT_IOCTL_READDIR_BOTH		_IOR('r', 1, struct dirent [2])
75 69
#define	VFAT_IOCTL_READDIR_SHORT	_IOR('r', 2, struct dirent [2])
......
86 80
#define __NR_sys_statfs __NR_statfs
87 81
#define __NR_sys_fstatfs __NR_fstatfs
88 82
#define __NR_sys_getdents __NR_getdents
83
#define __NR_sys_getdents64 __NR_getdents64
89 84

  
90 85
#ifdef __NR_gettid
91 86
_syscall0(int, gettid)
......
97 92
_syscall1(int,sys_uname,struct new_utsname *,buf)
98 93
_syscall2(int,sys_getcwd1,char *,buf,size_t,size)
99 94
_syscall3(int, sys_getdents, uint, fd, struct dirent *, dirp, uint, count);
95
_syscall3(int, sys_getdents64, uint, fd, struct dirent64 *, dirp, uint, count);
100 96
_syscall5(int, _llseek,  uint,  fd, ulong, hi, ulong, lo,
101 97
          loff_t *, res, uint, wh);
102 98
_syscall2(int,sys_statfs,const char *,path,struct kernel_statfs *,buf)
......
1005 1001
        ret = get_errno(setsid());
1006 1002
        break;
1007 1003
    case TARGET_NR_sigaction:
1008
#if 0
1004
#if 1
1009 1005
        {
1010 1006
            ret = 0;
1011 1007
        }
......
1336 1332
        {
1337 1333
            struct dirent *dirp = (void *)arg2;
1338 1334
            long count = arg3;
1335

  
1339 1336
            ret = get_errno(sys_getdents(arg1, dirp, count));
1340 1337
            if (!is_error(ret)) {
1341 1338
                struct dirent *de;
......
1355 1352
            }
1356 1353
        }
1357 1354
        break;
1355
    case TARGET_NR_getdents64:
1356
        {
1357
            struct dirent64 *dirp = (void *)arg2;
1358
            long count = arg3;
1359
            ret = get_errno(sys_getdents64(arg1, dirp, count));
1360
            if (!is_error(ret)) {
1361
                struct dirent64 *de;
1362
                int len = ret;
1363
                int reclen;
1364
                de = dirp;
1365
                while (len > 0) {
1366
                    reclen = tswap16(de->d_reclen);
1367
                    if (reclen > len)
1368
                        break;
1369
                    de->d_reclen = reclen;
1370
                    tswap64s(&de->d_ino);
1371
                    tswap64s(&de->d_off);
1372
                    de = (struct dirent64 *)((char *)de + reclen);
1373
                    len -= reclen;
1374
                }
1375
            }
1376
        }
1377
        break;
1358 1378
    case TARGET_NR__newselect:
1359 1379
        ret = do_select(arg1, (void *)arg2, (void *)arg3, (void *)arg4, 
1360 1380
                        (void *)arg5);
......
1519 1539
    case TARGET_NR_pivot_root:
1520 1540
    case TARGET_NR_mincore:
1521 1541
    case TARGET_NR_madvise:
1522
    case TARGET_NR_getdents64:
1523 1542
        goto unimplemented;
1524 1543
#if TARGET_LONG_BITS == 32
1525 1544
    case TARGET_NR_fcntl64:

Also available in: Unified diff