본문 바로가기

Programming/C Programming

해더파일을 통한 배열 입력

Linux 바닐라 커널에 다음과 같은 코드가 있다.


struct sysent {
 int nargs;
 int sys_flags;
 int (*sys_func)();
 const char *sys_name;
 long native_scno; /* Match against SYS_* constants.  */
};

const struct sysent *sysent;

static const struct sysent sysent0[] = {
#include "syscallent.h"
};

// "syscallent.h"

 { 0, 0, sys_restart_syscall, "restart_syscall"}, /* 0 */
 { 1, TP, sys_exit,  "exit"  }, /* 1 */
 { 0, TP, sys_fork,  "fork"  }, /* 2 */
 { 3, 0, sys_read,  "read"  }, /* 3 */
 { 3, 0, sys_write,  "write"  }, /* 4 */
 { 3, TF, sys_open,  "open"  }, /* 5 */
 { 1, 0, sys_close,  "close"  }, /* 6 */
...




'Programming > C Programming' 카테고리의 다른 글

__read_mostly keyword  (0) 2010.06.29
전처리기 사용 : define ##  (0) 2010.02.23
struct 변수 사용 bit 한계 설정하기  (0) 2009.12.02
[TIP] easy mistake casting buffer  (0) 2009.09.21
AtoH function  (0) 2009.09.11