Commit e5febef5f1811dfd59aa197aad83e96db26a9516
1 parent
2053152b
Conditionalize more syscall implementations, by Mike Frysinger.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2576 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
62 additions
and
2 deletions
linux-user/syscall.c
... | ... | @@ -2057,6 +2057,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2057 | 2057 | case TARGET_NR_fork: |
2058 | 2058 | ret = get_errno(do_fork(cpu_env, SIGCHLD, 0)); |
2059 | 2059 | break; |
2060 | +#ifdef TARGET_NR_waitpid | |
2060 | 2061 | case TARGET_NR_waitpid: |
2061 | 2062 | { |
2062 | 2063 | int status; |
... | ... | @@ -2065,6 +2066,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2065 | 2066 | tput32(arg2, status); |
2066 | 2067 | } |
2067 | 2068 | break; |
2069 | +#endif | |
2068 | 2070 | case TARGET_NR_creat: |
2069 | 2071 | p = lock_user_string(arg1); |
2070 | 2072 | ret = get_errno(creat(p, arg2)); |
... | ... | @@ -2193,11 +2195,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2193 | 2195 | unlock_user(p3, arg3, 0); |
2194 | 2196 | break; |
2195 | 2197 | } |
2198 | +#ifdef TARGET_NR_umount | |
2196 | 2199 | case TARGET_NR_umount: |
2197 | 2200 | p = lock_user_string(arg1); |
2198 | 2201 | ret = get_errno(umount(p)); |
2199 | 2202 | unlock_user(p, arg1, 0); |
2200 | 2203 | break; |
2204 | +#endif | |
2201 | 2205 | case TARGET_NR_stime: |
2202 | 2206 | { |
2203 | 2207 | time_t host_time; |
... | ... | @@ -2217,6 +2221,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2217 | 2221 | case TARGET_NR_pause: |
2218 | 2222 | ret = get_errno(pause()); |
2219 | 2223 | break; |
2224 | +#ifdef TARGET_NR_utime | |
2220 | 2225 | case TARGET_NR_utime: |
2221 | 2226 | { |
2222 | 2227 | struct utimbuf tbuf, *host_tbuf; |
... | ... | @@ -2235,6 +2240,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2235 | 2240 | unlock_user(p, arg1, 0); |
2236 | 2241 | } |
2237 | 2242 | break; |
2243 | +#endif | |
2238 | 2244 | case TARGET_NR_utimes: |
2239 | 2245 | { |
2240 | 2246 | struct timeval *tvp, tv[2]; |
... | ... | @@ -2331,9 +2337,10 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2331 | 2337 | case TARGET_NR_prof: |
2332 | 2338 | goto unimplemented; |
2333 | 2339 | #endif |
2340 | +#ifdef TARGET_NR_signal | |
2334 | 2341 | case TARGET_NR_signal: |
2335 | 2342 | goto unimplemented; |
2336 | - | |
2343 | +#endif | |
2337 | 2344 | case TARGET_NR_acct: |
2338 | 2345 | p = lock_user_string(arg1); |
2339 | 2346 | ret = get_errno(acct(path(p))); |
... | ... | @@ -2391,6 +2398,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2391 | 2398 | case TARGET_NR_setsid: |
2392 | 2399 | ret = get_errno(setsid()); |
2393 | 2400 | break; |
2401 | +#ifdef TARGET_NR_sigaction | |
2394 | 2402 | case TARGET_NR_sigaction: |
2395 | 2403 | { |
2396 | 2404 | #if !defined(TARGET_MIPS) |
... | ... | @@ -2445,6 +2453,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2445 | 2453 | #endif |
2446 | 2454 | } |
2447 | 2455 | break; |
2456 | +#endif | |
2448 | 2457 | case TARGET_NR_rt_sigaction: |
2449 | 2458 | { |
2450 | 2459 | struct target_sigaction *act; |
... | ... | @@ -2486,6 +2495,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2486 | 2495 | ret = target_set; |
2487 | 2496 | } |
2488 | 2497 | break; |
2498 | +#ifdef TARGET_NR_sigprocmask | |
2489 | 2499 | case TARGET_NR_sigprocmask: |
2490 | 2500 | { |
2491 | 2501 | int how = arg1; |
... | ... | @@ -2522,6 +2532,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2522 | 2532 | } |
2523 | 2533 | } |
2524 | 2534 | break; |
2535 | +#endif | |
2525 | 2536 | case TARGET_NR_rt_sigprocmask: |
2526 | 2537 | { |
2527 | 2538 | int how = arg1; |
... | ... | @@ -2558,6 +2569,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2558 | 2569 | } |
2559 | 2570 | } |
2560 | 2571 | break; |
2572 | +#ifdef TARGET_NR_sigpending | |
2561 | 2573 | case TARGET_NR_sigpending: |
2562 | 2574 | { |
2563 | 2575 | sigset_t set; |
... | ... | @@ -2569,6 +2581,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2569 | 2581 | } |
2570 | 2582 | } |
2571 | 2583 | break; |
2584 | +#endif | |
2572 | 2585 | case TARGET_NR_rt_sigpending: |
2573 | 2586 | { |
2574 | 2587 | sigset_t set; |
... | ... | @@ -2580,6 +2593,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2580 | 2593 | } |
2581 | 2594 | } |
2582 | 2595 | break; |
2596 | +#ifdef TARGET_NR_sigsuspend | |
2583 | 2597 | case TARGET_NR_sigsuspend: |
2584 | 2598 | { |
2585 | 2599 | sigset_t set; |
... | ... | @@ -2589,6 +2603,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2589 | 2603 | ret = get_errno(sigsuspend(&set)); |
2590 | 2604 | } |
2591 | 2605 | break; |
2606 | +#endif | |
2592 | 2607 | case TARGET_NR_rt_sigsuspend: |
2593 | 2608 | { |
2594 | 2609 | sigset_t set; |
... | ... | @@ -2630,10 +2645,12 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2630 | 2645 | ret = get_errno(sys_rt_sigqueueinfo(arg1, arg2, &uinfo)); |
2631 | 2646 | } |
2632 | 2647 | break; |
2648 | +#ifdef TARGET_NR_sigreturn | |
2633 | 2649 | case TARGET_NR_sigreturn: |
2634 | 2650 | /* NOTE: ret is eax, so not transcoding must be done */ |
2635 | 2651 | ret = do_sigreturn(cpu_env); |
2636 | 2652 | break; |
2653 | +#endif | |
2637 | 2654 | case TARGET_NR_rt_sigreturn: |
2638 | 2655 | /* NOTE: ret is eax, so not transcoding must be done */ |
2639 | 2656 | ret = do_rt_sigreturn(cpu_env); |
... | ... | @@ -2739,17 +2756,24 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2739 | 2756 | unlock_user(p, arg1, 0); |
2740 | 2757 | } |
2741 | 2758 | break; |
2759 | +#ifdef TARGET_NR_uselib | |
2742 | 2760 | case TARGET_NR_uselib: |
2743 | 2761 | goto unimplemented; |
2762 | +#endif | |
2763 | +#ifdef TARGET_NR_swapon | |
2744 | 2764 | case TARGET_NR_swapon: |
2745 | 2765 | p = lock_user_string(arg1); |
2746 | 2766 | ret = get_errno(swapon(p, arg2)); |
2747 | 2767 | unlock_user(p, arg1, 0); |
2748 | 2768 | break; |
2769 | +#endif | |
2749 | 2770 | case TARGET_NR_reboot: |
2750 | 2771 | goto unimplemented; |
2772 | +#ifdef TARGET_NR_readdir | |
2751 | 2773 | case TARGET_NR_readdir: |
2752 | 2774 | goto unimplemented; |
2775 | +#endif | |
2776 | +#ifdef TARGET_NR_mmap | |
2753 | 2777 | case TARGET_NR_mmap: |
2754 | 2778 | #if defined(TARGET_I386) || defined(TARGET_ARM) || defined(TARGET_M68K) |
2755 | 2779 | { |
... | ... | @@ -2774,6 +2798,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2774 | 2798 | arg6)); |
2775 | 2799 | #endif |
2776 | 2800 | break; |
2801 | +#endif | |
2777 | 2802 | #ifdef TARGET_NR_mmap2 |
2778 | 2803 | case TARGET_NR_mmap2: |
2779 | 2804 | #if defined(TARGET_SPARC) || defined(TARGET_MIPS) |
... | ... | @@ -2793,25 +2818,37 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2793 | 2818 | case TARGET_NR_mprotect: |
2794 | 2819 | ret = get_errno(target_mprotect(arg1, arg2, arg3)); |
2795 | 2820 | break; |
2821 | +#ifdef TARGET_NR_mremap | |
2796 | 2822 | case TARGET_NR_mremap: |
2797 | 2823 | ret = get_errno(target_mremap(arg1, arg2, arg3, arg4, arg5)); |
2798 | 2824 | break; |
2825 | +#endif | |
2799 | 2826 | /* ??? msync/mlock/munlock are broken for softmmu. */ |
2827 | +#ifdef TARGET_NR_msync | |
2800 | 2828 | case TARGET_NR_msync: |
2801 | 2829 | ret = get_errno(msync(g2h(arg1), arg2, arg3)); |
2802 | 2830 | break; |
2831 | +#endif | |
2832 | +#ifdef TARGET_NR_mlock | |
2803 | 2833 | case TARGET_NR_mlock: |
2804 | 2834 | ret = get_errno(mlock(g2h(arg1), arg2)); |
2805 | 2835 | break; |
2836 | +#endif | |
2837 | +#ifdef TARGET_NR_munlock | |
2806 | 2838 | case TARGET_NR_munlock: |
2807 | 2839 | ret = get_errno(munlock(g2h(arg1), arg2)); |
2808 | 2840 | break; |
2841 | +#endif | |
2842 | +#ifdef TARGET_NR_mlockall | |
2809 | 2843 | case TARGET_NR_mlockall: |
2810 | 2844 | ret = get_errno(mlockall(arg1)); |
2811 | 2845 | break; |
2846 | +#endif | |
2847 | +#ifdef TARGET_NR_munlockall | |
2812 | 2848 | case TARGET_NR_munlockall: |
2813 | 2849 | ret = get_errno(munlockall()); |
2814 | 2850 | break; |
2851 | +#endif | |
2815 | 2852 | case TARGET_NR_truncate: |
2816 | 2853 | p = lock_user_string(arg1); |
2817 | 2854 | ret = get_errno(truncate(p, arg2)); |
... | ... | @@ -2889,10 +2926,11 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
2889 | 2926 | case TARGET_NR_ioperm: |
2890 | 2927 | goto unimplemented; |
2891 | 2928 | #endif |
2929 | +#ifdef TARGET_NR_socketcall | |
2892 | 2930 | case TARGET_NR_socketcall: |
2893 | 2931 | ret = do_socketcall(arg1, arg2); |
2894 | 2932 | break; |
2895 | - | |
2933 | +#endif | |
2896 | 2934 | #ifdef TARGET_NR_accept |
2897 | 2935 | case TARGET_NR_accept: |
2898 | 2936 | ret = do_accept(arg1, arg2, arg3); |
... | ... | @@ -3101,11 +3139,13 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3101 | 3139 | } |
3102 | 3140 | } |
3103 | 3141 | break; |
3142 | +#ifdef TARGET_NR_swapoff | |
3104 | 3143 | case TARGET_NR_swapoff: |
3105 | 3144 | p = lock_user_string(arg1); |
3106 | 3145 | ret = get_errno(swapoff(p)); |
3107 | 3146 | unlock_user(p, arg1, 0); |
3108 | 3147 | break; |
3148 | +#endif | |
3109 | 3149 | case TARGET_NR_sysinfo: |
3110 | 3150 | { |
3111 | 3151 | struct target_sysinfo *target_value; |
... | ... | @@ -3133,9 +3173,11 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3133 | 3173 | } |
3134 | 3174 | } |
3135 | 3175 | break; |
3176 | +#ifdef TARGET_NR_ipc | |
3136 | 3177 | case TARGET_NR_ipc: |
3137 | 3178 | ret = do_ipc(arg1, arg2, arg3, arg4, arg5, arg6); |
3138 | 3179 | break; |
3180 | +#endif | |
3139 | 3181 | case TARGET_NR_fsync: |
3140 | 3182 | ret = get_errno(fsync(arg1)); |
3141 | 3183 | break; |
... | ... | @@ -3184,10 +3226,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3184 | 3226 | #endif |
3185 | 3227 | case TARGET_NR_adjtimex: |
3186 | 3228 | goto unimplemented; |
3229 | +#ifdef TARGET_NR_create_module | |
3187 | 3230 | case TARGET_NR_create_module: |
3231 | +#endif | |
3188 | 3232 | case TARGET_NR_init_module: |
3189 | 3233 | case TARGET_NR_delete_module: |
3234 | +#ifdef TARGET_NR_get_kernel_syms | |
3190 | 3235 | case TARGET_NR_get_kernel_syms: |
3236 | +#endif | |
3191 | 3237 | goto unimplemented; |
3192 | 3238 | case TARGET_NR_quotactl: |
3193 | 3239 | goto unimplemented; |
... | ... | @@ -3199,13 +3245,17 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3199 | 3245 | break; |
3200 | 3246 | case TARGET_NR_bdflush: |
3201 | 3247 | goto unimplemented; |
3248 | +#ifdef TARGET_NR_sysfs | |
3202 | 3249 | case TARGET_NR_sysfs: |
3203 | 3250 | goto unimplemented; |
3251 | +#endif | |
3204 | 3252 | case TARGET_NR_personality: |
3205 | 3253 | ret = get_errno(personality(arg1)); |
3206 | 3254 | break; |
3255 | +#ifdef TARGET_NR_afs_syscall | |
3207 | 3256 | case TARGET_NR_afs_syscall: |
3208 | 3257 | goto unimplemented; |
3258 | +#endif | |
3209 | 3259 | case TARGET_NR__llseek: |
3210 | 3260 | { |
3211 | 3261 | #if defined (__x86_64__) |
... | ... | @@ -3319,9 +3369,12 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3319 | 3369 | } |
3320 | 3370 | break; |
3321 | 3371 | #endif /* TARGET_NR_getdents64 */ |
3372 | +#ifdef TARGET_NR__newselect | |
3322 | 3373 | case TARGET_NR__newselect: |
3323 | 3374 | ret = do_select(arg1, arg2, arg3, arg4, arg5); |
3324 | 3375 | break; |
3376 | +#endif | |
3377 | +#ifdef TARGET_NR_poll | |
3325 | 3378 | case TARGET_NR_poll: |
3326 | 3379 | { |
3327 | 3380 | struct target_pollfd *target_pfd; |
... | ... | @@ -3347,6 +3400,7 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3347 | 3400 | unlock_user(target_pfd, arg1, ret); |
3348 | 3401 | } |
3349 | 3402 | break; |
3403 | +#endif | |
3350 | 3404 | case TARGET_NR_flock: |
3351 | 3405 | /* NOTE: the flock constant seems to be the same for every |
3352 | 3406 | Linux platform */ |
... | ... | @@ -3448,10 +3502,14 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
3448 | 3502 | } |
3449 | 3503 | } |
3450 | 3504 | break; |
3505 | +#ifdef TARGET_NR_query_module | |
3451 | 3506 | case TARGET_NR_query_module: |
3452 | 3507 | goto unimplemented; |
3508 | +#endif | |
3509 | +#ifdef TARGET_NR_nfsservctl | |
3453 | 3510 | case TARGET_NR_nfsservctl: |
3454 | 3511 | goto unimplemented; |
3512 | +#endif | |
3455 | 3513 | case TARGET_NR_prctl: |
3456 | 3514 | switch (arg1) |
3457 | 3515 | { |
... | ... | @@ -4004,8 +4062,10 @@ long do_syscall(void *cpu_env, int num, long arg1, long arg2, long arg3, |
4004 | 4062 | case TARGET_NR_gettid: |
4005 | 4063 | ret = get_errno(gettid()); |
4006 | 4064 | break; |
4065 | +#ifdef TARGET_NR_readahead | |
4007 | 4066 | case TARGET_NR_readahead: |
4008 | 4067 | goto unimplemented; |
4068 | +#endif | |
4009 | 4069 | #ifdef TARGET_NR_setxattr |
4010 | 4070 | case TARGET_NR_setxattr: |
4011 | 4071 | case TARGET_NR_lsetxattr: | ... | ... |