File:sysent.c - ikarishinjieva/unixV6-code-analyze-chs GitHub Wiki
2900 #
2901 /*
2902 */
2903
2904 /*
2905 * This table is the switch used to transfer
2906 * to the appropriate routine for processing a system call.
2907 * Each row contains the number of arguments expected
2908 * and a pointer to the routine.
2909 */
2910 int sysent[]
2911 {
- 系统调用函数入口
- 每项包括 函数参数个数 和 函数地址
2912 0, &nullsys, /* 0 = indir */
2913 0, &rexit, /* 1 = exit */
2914 0, &fork, /* 2 = fork */
2915 2, &read, /* 3 = read */
2916 2, &write, /* 4 = write */
2917 2, &open, /* 5 = open */
2918 0, &close, /* 6 = close */
2919 0, &wait, /* 7 = wait */
2920 2, &creat, /* 8 = creat */
2921 2, &link, /* 9 = link */
2922 1, &unlink, /* 10 = ulink */
2923 2, &exec, /* 11 = exec */
2924 1, &chdir, /* 12 = chdir */
2925 0, >ime, /* 13 = time */
2926 3, &mknod, /* 14 = mknod */
2927 2, &chmod, /* 15 = chmod */
2928 2, &chown, /* 16 = chown */
2929 1, &sbreak, /* 17 = break */
2930 2, &stat, /* 18 = stat */
2931 2, &seek, /* 19 = seek */
2932 0, &getpid, /* 20 = getpid */
2933 3, &smount, /* 21 = mount */
2934 1, &sumount, /* 22 = unmount */
2935 0, &setuid, /* 23 = setuid */
2936 0, &getuid, /* 24 = getuid */
2937 0, &stime, /* 25 = stime */
2938 3, &ptrace, /* 26 = ptrace */
2939 0, &nosys, /* 27 = x */
2940 1, &fstat, /* 28 = fstat */
2941 0, &nosys, /* 29 = x */
2942 1, &nullsys, /* inoperative /* 30 = smdate */
2943 1, &stty, /* 31 = stty */
2944 1, >ty, /* 32 = gtty */
2945 0, &nosys, /* 33 = x */
2946 0, &nice, /* 34 = nice */
2947 0, &sslep, /* 35 = sleep */
2948 0, &sync, /* 36 = sync */
2949 1, &kill, /* 37 = kill */
2950 0, &getswit, /* 38 = switch */
2951 0, &nosys, /* 39 = x */
2952 0, &nosys, /* 40 = x */
2953 0, &dup, /* 41 = dup */
2954 0, &pipe, /* 42 = pipe */
2955 1, ×, /* 43 = times */
2956 4, &profil, /* 44 = prof */
2957 0, &nosys, /* 45 = tui */
2958 0, &setgid, /* 46 = setgid */
2959 0, &getgid, /* 47 = getgid */
2960 2, &ssig, /* 48 = sig */
2961 0, &nosys, /* 49 = x */
2962 0, &nosys, /* 50 = x */
2963 0, &nosys, /* 51 = x */
2964 0, &nosys, /* 52 = x */
2965 0, &nosys, /* 53 = x */
2966 0, &nosys, /* 54 = x */
2967 0, &nosys, /* 55 = x */
2968 0, &nosys, /* 56 = x */
2969 0, &nosys, /* 57 = x */
2970 0, &nosys, /* 58 = x */
2971 0, &nosys, /* 59 = x */
2972 0, &nosys, /* 60 = x */
2973 0, &nosys, /* 61 = x */
2974 0, &nosys, /* 62 = x */
2975 0, &nosys, /* 63 = x */
2976 };
2977 /* ------------------------- */
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999