Skip to content

Instantly share code, notes, and snippets.

@chenshuo
Created March 12, 2011 10:14
Show Gist options
  • Save chenshuo/867174 to your computer and use it in GitHub Desktop.
Save chenshuo/867174 to your computer and use it in GitHub Desktop.
If Linux kernel were exposed as COM interfaces
class Linux_0_01
{
int restart_syscall(); //0
int exit(); //1
int fork(); //2
int read(); //3
int write(); //4
int open(); //5
int close(); //6
int waitpid(); //7
int creat(); //8
int link(); //9
int unlink(); //10
int execve(); //11
int chdir(); //12
int time(); //13
int mknod(); //14
int chmod(); //15
int lchown(); //16
int break(); //17
int oldstat(); //18
int lseek(); //19
int getpid(); //20
int mount(); //21
int umount(); //22
int setuid(); //23
int getuid(); //24
int stime(); //25
int ptrace(); //26
int alarm(); //27
int oldfstat(); //28
int pause(); //29
int utime(); //30
int stty(); //31
int gtty(); //32
int access(); //33
int nice(); //34
int ftime(); //35
int sync(); //36
int kill(); //37
int rename(); //38
int mkdir(); //39
int rmdir(); //40
int dup(); //41
int pipe(); //42
int times(); //43
int prof(); //44
int brk(); //45
int setgid(); //46
int getgid(); //47
int signal(); //48
int geteuid(); //49
int getegid(); //50
int acct(); //51
int umount2(); //52
int lock(); //53
int ioctl(); //54
int fcntl(); //55
int mpx(); //56
int setpgid(); //57
int ulimit(); //58
int oldolduname(); //59
int umask(); //60
int chroot(); //61
int ustat(); //62
int dup2(); //63
int getppid(); //64
int getpgrp(); //65
int setsid(); //66
};
class Linux_0_10 : public Linux_0_01
{
int sigaction(); //67
};
class Linux_0_11 : public Linux_0_10
{
int sgetmask(); //68
int ssetmask(); //69
int setreuid(); //70
int setregid(); //71
};
class Linux_0_12 : public Linux_0_11
{
int sigsuspend(); //72
int sigpending(); //73
int sethostname(); //74
int setrlimit(); //75
int getrlimit(); //76
int getrusage(); //77
int gettimeofday(); //78
int settimeofday(); //79
int getgroups(); //80
int setgroups(); //81
int select(); //82
int symlink(); //83
int oldlstat(); //84
int readlink(); //85
int uselib(); //86
};
class Linux_0_95 : public Linux_0_12
{
int swapon(); //87
int reboot(); //88
};
class Linux_0_95c : public Linux_0_95
{
int readdir(); //89
};
class Linux_0_96a : public Linux_0_95c
{
int mmap(); //90
int munmap(); //91
int truncate(); //92
int ftruncate(); //93
int fchmod(); //94
int fchown(); //95
int getpriority(); //96
int setpriority(); //97
int profil(); //98
int statfs(); //99
int fstatfs(); //100
int ioperm(); //101
int socketcall(); //102
int syslog(); //103
};
class Linux_0_96a2p : public Linux_0_96a
{
int setitimer(); //104
int getitimer(); //105
};
class Linux_0_96b : public Linux_0_96a2p
{
int stat(); //106
int lstat(); //107
int fstat(); //108
int olduname(); //109
};
class Linux_0_96c : public Linux_0_96b
{
int iopl(); //110
};
class Linux_0_97_1 : public Linux_0_96c
{
int vhangup(); //111
int idle(); //112
};
class Linux_0_97_2 : public Linux_0_97_1
{
int vm86old(); //113
};
class Linux_0_97_3 : public Linux_0_97_2
{
int wait4(); //114
int swapoff(); //115
};
class Linux_0_97_6 : public Linux_0_97_3
{
int sysinfo(); //116
};
class Linux_0_99_7 : public Linux_0_97_6
{
int ipc(); //117
int fsync(); //118
int sigreturn(); //119
int clone(); //120
int setdomainname(); //121
int uname(); //122
int modify_ldt(); //123
int adjtimex(); //124
int mprotect(); //125
int sigprocmask(); //126
};
class Linux_0_99_14d : public Linux_0_99_7
{
int create_module(); //127
int init_module(); //128
int delete_module(); //129
int get_kernel_syms(); //130
};
class Linux_0_99_14s : public Linux_0_99_14d
{
int quotactl(); //131
int getpgid(); //132
};
class Linux_0_99_14t : public Linux_0_99_14s
{
int fchdir(); //133
};
class Linux_0_99_14y : public Linux_0_99_14t
{
int bdflush(); //134
};
class Linux_1_1_11 : public Linux_0_99_14y
{
int sysfs(); //135
};
class Linux_1_1_20 : public Linux_1_1_11
{
int personality(); //136
};
class Linux_1_1_33 : public Linux_1_1_20
{
int afs_syscall(); //137
};
class Linux_1_1_44 : public Linux_1_1_33
{
int setfsuid(); //138
int setfsgid(); //139
};
class Linux_1_1_46 : public Linux_1_1_44
{
int _llseek(); //140
};
class Linux_1_3_0 : public Linux_1_1_46
{
int getdents(); //141
int _newselect(); //142
int flock(); //143
};
class Linux_1_3_21 : public Linux_1_3_0
{
int msync(); //144
};
class Linux_1_3_31 : public Linux_1_3_21
{
int readv(); //145
int writev(); //146
};
class Linux_1_3_44 : public Linux_1_3_31
{
int getsid(); //147
};
class Linux_1_3_55 : public Linux_1_3_44
{
int fdatasync(); //148
};
class Linux_1_3_57 : public Linux_1_3_55
{
int _sysctl(); //149
};
class Linux_1_3_43 : public Linux_1_3_57
{
int mlock(); //150
int munlock(); //151
int mlockall(); //152
int munlockall(); //153
};
class Linux_1_3_55 : public Linux_1_3_43
{
int sched_setparam(); //154
int sched_getparam(); //155
int sched_setscheduler(); //156
int sched_getscheduler(); //157
int sched_yield(); //158
int sched_get_priority_max(); //159
int sched_get_priority_min(); //160
int sched_rr_get_interval(); //161
};
class Linux_1_3_67 : public Linux_1_3_55
{
int nanosleep(); //162
};
class Linux_1_3_78 : public Linux_1_3_67
{
int mremap(); //163
};
class Linux_2_1_4 : public Linux_1_3_78
{
int setresuid(); //164
int getresuid(); //165
};
class Linux_2_1_19 : public Linux_2_1_4
{
int vm86(); //166
int query_module(); //167
};
class Linux_2_1_23 : public Linux_2_1_19
{
int poll(); //168
};
class Linux_2_1_31 : public Linux_2_1_23
{
int nfsservctl(); //169
};
class Linux_2_1_44 : public Linux_2_1_31
{
int setresgid(); //170
int getresgid(); //171
};
class Linux_2_1_57 : public Linux_2_1_44
{
int prctl(); //172
};
class Linux_2_1_68 : public Linux_2_1_57
{
int rt_sigreturn(); //173
int rt_sigaction(); //174
int rt_sigprocmask(); //175
int rt_sigpending(); //176
int rt_sigtimedwait(); //177
int rt_sigqueueinfo(); //178
int rt_sigsuspend(); //179
};
class Linux_2_1_86 : public Linux_2_1_68
{
int pread64(); //180
int pwrite64(); //181
};
class Linux_2_1_87 : public Linux_2_1_86
{
int chown(); //182
};
class Linux_2_1_92 : public Linux_2_1_87
{
int getcwd(); //183
};
class Linux_2_1_100 : public Linux_2_1_92
{
int capget(); //184
int capset(); //185
};
class Linux_2_1_106 : public Linux_2_1_100
{
int sigaltstack(); //186
};
class Linux_2_1_108 : public Linux_2_1_106
{
int sendfile(); //187
};
class Linux_2_1_125 : public Linux_2_1_108
{
int getpmsg(); //188
int putpmsg(); //189
};
class Linux_2_2_0 : public Linux_2_1_125
{
int vfork(); //190
};
class Linux_2_3_25 : public Linux_2_2_0
{
int ugetrlimit(); //191
};
class Linux_2_3_30 : public Linux_2_3_25
{
int mmap2(); //192
};
class Linux_2_3_31 : public Linux_2_3_30
{
int truncate64(); //193
int ftruncate64(); //194
};
class Linux_2_3_34 : public Linux_2_3_31
{
int stat64(); //195
int lstat64(); //196
int fstat64(); //197
};
class Linux_2_3_39 : public Linux_2_3_34
{
int lchown32(); //198
int getuid32(); //199
int getgid32(); //200
int geteuid32(); //201
int getegid32(); //202
int setreuid32(); //203
int setregid32(); //204
int getgroups32(); //205
int setgroups32(); //206
int fchown32(); //207
int setresuid32(); //208
int getresuid32(); //209
int setresgid32(); //210
int getresgid32(); //211
int chown32(); //212
int setuid32(); //213
int setgid32(); //214
int setfsuid32(); //215
int setfsgid32(); //216
};
class Linux_2_3_41 : public Linux_2_3_39
{
int pivot_root(); //217
};
class Linux_2_3_52 : public Linux_2_3_41
{
int mincore(); //218
};
class Linux_2_3_99 : public Linux_2_3_52
{
int madvise(); //219
int madvise1(); //219
};
class Linux_2_4_0 : public Linux_2_3_99
{
int getdents64(); //220
int fcntl64(); //221
};
class Linux_2_4_10 : public Linux_2_4_0
{
int gettid(); //224
};
class Linux_2_4_12 : public Linux_2_4_10
{
int readahead(); //225
};
class Linux_2_5_3 : public Linux_2_4_12
{
int setxattr(); //226
int lsetxattr(); //227
int fsetxattr(); //228
int getxattr(); //229
int lgetxattr(); //230
int fgetxattr(); //231
int listxattr(); //232
int llistxattr(); //233
int flistxattr(); //234
int removexattr(); //235
int lremovexattr(); //236
int fremovexattr(); //237
};
class Linux_2_5_4 : public Linux_2_5_3
{
int tkill(); //238
};
class Linux_2_5_5 : public Linux_2_5_4
{
int sendfile64(); //239
};
class Linux_2_5_6 : public Linux_2_5_5
{
int futex(); //240
};
class Linux_2_5_8 : public Linux_2_5_6
{
int sched_setaffinity(); //241
int sched_getaffinity(); //242
};
class Linux_2_5_31 : public Linux_2_5_8
{
int set_thread_area(); //243
int get_thread_area(); //244
};
@buptsb
Copy link

buptsb commented Sep 18, 2019

cool

@roc1
Copy link

roc1 commented Aug 7, 2020

Windows 也有 syscall 吧?COM 在 Windows 上不是作为内核接口吧?

@g101418
Copy link

g101418 commented Aug 29, 2021

好家伙

@Jamishon
Copy link

Jamishon commented Oct 9, 2021

为什么Windows不用COM作为内核接口,而用他来坑用户呢,只能说明不同的场景有不同的需求,有优点就有缺点

@Stephan14
Copy link

🤦‍♀️

@icecoobe
Copy link

icecoobe commented Oct 5, 2022

自带diff效果,清晰,一目了然!

@SingleRun
Copy link

一代传一代哈哈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment