syscall.c (6fb883e8e3ce8fc661e4bb9f068565b4ccd97abf) syscall.c (c596ed17139b50a45a75a5491797d3b920385566)
1/*
2 * Linux syscalls
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 196 unchanged lines hidden (view full) ---

205 k++;
206 }
207 target_fds[i] = tswapl(v);
208 }
209 }
210#endif
211}
212
1/*
2 * Linux syscalls
3 *
4 * Copyright (c) 2003 Fabrice Bellard
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 196 unchanged lines hidden (view full) ---

205 k++;
206 }
207 target_fds[i] = tswapl(v);
208 }
209 }
210#endif
211}
212
213#if defined(__alpha__)
214#define HOST_HZ 1024
215#else
216#define HOST_HZ 100
217#endif
218
219static inline long host_to_target_clock_t(long ticks)
220{
221#if HOST_HZ == TARGET_HZ
222 return ticks;
223#else
224 return ((int64_t)ticks * TARGET_HZ) / HOST_HZ;
225#endif
226}
227
213static inline void host_to_target_rusage(struct target_rusage *target_rusage,
214 const struct rusage *rusage)
215{
216 target_rusage->ru_utime.tv_sec = tswapl(rusage->ru_utime.tv_sec);
217 target_rusage->ru_utime.tv_usec = tswapl(rusage->ru_utime.tv_usec);
218 target_rusage->ru_stime.tv_sec = tswapl(rusage->ru_stime.tv_sec);
219 target_rusage->ru_stime.tv_usec = tswapl(rusage->ru_stime.tv_usec);
220 target_rusage->ru_maxrss = tswapl(rusage->ru_maxrss);

--- 1197 unchanged lines hidden (view full) ---

1418 }
1419 break;
1420 case TARGET_NR_times:
1421 {
1422 struct target_tms *tmsp = (void *)arg1;
1423 struct tms tms;
1424 ret = get_errno(times(&tms));
1425 if (tmsp) {
228static inline void host_to_target_rusage(struct target_rusage *target_rusage,
229 const struct rusage *rusage)
230{
231 target_rusage->ru_utime.tv_sec = tswapl(rusage->ru_utime.tv_sec);
232 target_rusage->ru_utime.tv_usec = tswapl(rusage->ru_utime.tv_usec);
233 target_rusage->ru_stime.tv_sec = tswapl(rusage->ru_stime.tv_sec);
234 target_rusage->ru_stime.tv_usec = tswapl(rusage->ru_stime.tv_usec);
235 target_rusage->ru_maxrss = tswapl(rusage->ru_maxrss);

--- 1197 unchanged lines hidden (view full) ---

1433 }
1434 break;
1435 case TARGET_NR_times:
1436 {
1437 struct target_tms *tmsp = (void *)arg1;
1438 struct tms tms;
1439 ret = get_errno(times(&tms));
1440 if (tmsp) {
1426 tmsp->tms_utime = tswapl(tms.tms_utime);
1427 tmsp->tms_stime = tswapl(tms.tms_stime);
1428 tmsp->tms_cutime = tswapl(tms.tms_cutime);
1429 tmsp->tms_cstime = tswapl(tms.tms_cstime);
1441 tmsp->tms_utime = tswapl(host_to_target_clock_t(tms.tms_utime));
1442 tmsp->tms_stime = tswapl(host_to_target_clock_t(tms.tms_stime));
1443 tmsp->tms_cutime = tswapl(host_to_target_clock_t(tms.tms_cutime));
1444 tmsp->tms_cstime = tswapl(host_to_target_clock_t(tms.tms_cstime));
1430 }
1445 }
1446 if (!is_error(ret))
1447 ret = host_to_target_clock_t(ret);
1431 }
1432 break;
1433 case TARGET_NR_prof:
1434 goto unimplemented;
1435 case TARGET_NR_setgid:
1436 ret = get_errno(setgid(low2highgid(arg1)));
1437 break;
1438 case TARGET_NR_getgid:

--- 1105 unchanged lines hidden ---
1448 }
1449 break;
1450 case TARGET_NR_prof:
1451 goto unimplemented;
1452 case TARGET_NR_setgid:
1453 ret = get_errno(setgid(low2highgid(arg1)));
1454 break;
1455 case TARGET_NR_getgid:

--- 1105 unchanged lines hidden ---