Commit 60cd49d5d7e6dd3858f72916fbcf462ba60bbd6e
1 parent
a300e691
added stat64
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@31 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
65 additions
and
27 deletions
linux-user/syscall.c
... | ... | @@ -1002,10 +1002,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
1002 | 1002 | case TARGET_NR_sigaction: |
1003 | 1003 | #if 1 |
1004 | 1004 | { |
1005 | - int signum = arg1; | |
1006 | - struct target_old_sigaction *tact = arg2, *toldact = arg3; | |
1007 | 1005 | ret = 0; |
1008 | - | |
1009 | 1006 | } |
1010 | 1007 | break; |
1011 | 1008 | #else |
... | ... | @@ -1464,9 +1461,37 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
1464 | 1461 | case TARGET_NR_ugetrlimit: |
1465 | 1462 | case TARGET_NR_truncate64: |
1466 | 1463 | case TARGET_NR_ftruncate64: |
1464 | + goto unimplemented; | |
1467 | 1465 | case TARGET_NR_stat64: |
1466 | + ret = get_errno(stat((const char *)arg1, &st)); | |
1467 | + goto do_stat64; | |
1468 | 1468 | case TARGET_NR_lstat64: |
1469 | + ret = get_errno(lstat((const char *)arg1, &st)); | |
1470 | + goto do_stat64; | |
1469 | 1471 | case TARGET_NR_fstat64: |
1472 | + { | |
1473 | + ret = get_errno(fstat(arg1, &st)); | |
1474 | + do_stat64: | |
1475 | + if (!is_error(ret)) { | |
1476 | + struct target_stat64 *target_st = (void *)arg2; | |
1477 | + target_st->st_dev = tswap16(st.st_dev); | |
1478 | + target_st->st_ino = tswapl(st.st_ino); | |
1479 | + target_st->st_mode = tswap16(st.st_mode); | |
1480 | + target_st->st_nlink = tswap16(st.st_nlink); | |
1481 | + target_st->st_uid = tswap16(st.st_uid); | |
1482 | + target_st->st_gid = tswap16(st.st_gid); | |
1483 | + target_st->st_rdev = tswap16(st.st_rdev); | |
1484 | + /* XXX: better use of kernel struct */ | |
1485 | + target_st->st_size = tswapl(st.st_size); | |
1486 | + target_st->st_blksize = tswapl(st.st_blksize); | |
1487 | + target_st->st_blocks = tswapl(st.st_blocks); | |
1488 | + target_st->st_atime = tswapl(st.st_atime); | |
1489 | + target_st->st_mtime = tswapl(st.st_mtime); | |
1490 | + target_st->st_ctime = tswapl(st.st_ctime); | |
1491 | + } | |
1492 | + } | |
1493 | + break; | |
1494 | + | |
1470 | 1495 | case TARGET_NR_lchown32: |
1471 | 1496 | case TARGET_NR_getuid32: |
1472 | 1497 | case TARGET_NR_getgid32: |
... | ... | @@ -1490,7 +1515,20 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
1490 | 1515 | case TARGET_NR_mincore: |
1491 | 1516 | case TARGET_NR_madvise: |
1492 | 1517 | case TARGET_NR_getdents64: |
1518 | + goto unimplemented; | |
1519 | +#if TARGET_LONG_BITS == 32 | |
1493 | 1520 | case TARGET_NR_fcntl64: |
1521 | + switch(arg2) { | |
1522 | + case F_GETLK64: | |
1523 | + case F_SETLK64: | |
1524 | + case F_SETLKW64: | |
1525 | + goto unimplemented; | |
1526 | + default: | |
1527 | + ret = get_errno(fcntl(arg1, arg2, arg3)); | |
1528 | + break; | |
1529 | + } | |
1530 | + break; | |
1531 | +#endif | |
1494 | 1532 | case TARGET_NR_security: |
1495 | 1533 | goto unimplemented; |
1496 | 1534 | case TARGET_NR_gettid: | ... | ... |
syscall-i386.h
... | ... | @@ -245,24 +245,24 @@ |
245 | 245 | struct target_stat { |
246 | 246 | unsigned short st_dev; |
247 | 247 | unsigned short __pad1; |
248 | - unsigned long st_ino; | |
248 | + target_ulong st_ino; | |
249 | 249 | unsigned short st_mode; |
250 | 250 | unsigned short st_nlink; |
251 | 251 | unsigned short st_uid; |
252 | 252 | unsigned short st_gid; |
253 | 253 | unsigned short st_rdev; |
254 | 254 | unsigned short __pad2; |
255 | - unsigned long st_size; | |
256 | - unsigned long st_blksize; | |
257 | - unsigned long st_blocks; | |
258 | - unsigned long st_atime; | |
259 | - unsigned long __unused1; | |
260 | - unsigned long st_mtime; | |
261 | - unsigned long __unused2; | |
262 | - unsigned long st_ctime; | |
263 | - unsigned long __unused3; | |
264 | - unsigned long __unused4; | |
265 | - unsigned long __unused5; | |
255 | + target_ulong st_size; | |
256 | + target_ulong st_blksize; | |
257 | + target_ulong st_blocks; | |
258 | + target_ulong st_atime; | |
259 | + target_ulong __unused1; | |
260 | + target_ulong st_mtime; | |
261 | + target_ulong __unused2; | |
262 | + target_ulong st_ctime; | |
263 | + target_ulong __unused3; | |
264 | + target_ulong __unused4; | |
265 | + target_ulong __unused5; | |
266 | 266 | }; |
267 | 267 | |
268 | 268 | /* This matches struct stat64 in glibc2.1, hence the absolutely |
... | ... | @@ -273,31 +273,31 @@ struct target_stat64 { |
273 | 273 | unsigned char __pad0[10]; |
274 | 274 | |
275 | 275 | #define STAT64_HAS_BROKEN_ST_INO 1 |
276 | - unsigned long __st_ino; | |
276 | + target_ulong __st_ino; | |
277 | 277 | |
278 | 278 | unsigned int st_mode; |
279 | 279 | unsigned int st_nlink; |
280 | 280 | |
281 | - unsigned long st_uid; | |
282 | - unsigned long st_gid; | |
281 | + target_ulong st_uid; | |
282 | + target_ulong st_gid; | |
283 | 283 | |
284 | 284 | unsigned short st_rdev; |
285 | 285 | unsigned char __pad3[10]; |
286 | 286 | |
287 | 287 | long long st_size; |
288 | - unsigned long st_blksize; | |
288 | + target_ulong st_blksize; | |
289 | 289 | |
290 | - unsigned long st_blocks; /* Number 512-byte blocks allocated. */ | |
291 | - unsigned long __pad4; /* future possible st_blocks high bits */ | |
290 | + target_ulong st_blocks; /* Number 512-byte blocks allocated. */ | |
291 | + target_ulong __pad4; /* future possible st_blocks high bits */ | |
292 | 292 | |
293 | - unsigned long st_atime; | |
294 | - unsigned long __pad5; | |
293 | + target_ulong st_atime; | |
294 | + target_ulong __pad5; | |
295 | 295 | |
296 | - unsigned long st_mtime; | |
297 | - unsigned long __pad6; | |
296 | + target_ulong st_mtime; | |
297 | + target_ulong __pad6; | |
298 | 298 | |
299 | - unsigned long st_ctime; | |
300 | - unsigned long __pad7; /* will be high 32 bits of ctime someday */ | |
299 | + target_ulong st_ctime; | |
300 | + target_ulong __pad7; /* will be high 32 bits of ctime someday */ | |
301 | 301 | |
302 | 302 | unsigned long long st_ino; |
303 | 303 | }; | ... | ... |