diff --git a/include/sys/syscall.h b/include/sys/syscall.h index f5c0837519..fd86367ec1 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -55,81 +55,83 @@ /* System call numbers */ -#define SYS_accept (CONFIG_SYS_RESERVED+0) -#define SYS_bind (CONFIG_SYS_RESERVED+1) -#define SYS_chdir (CONFIG_SYS_RESERVED+2) -#define SYS_clock_getres (CONFIG_SYS_RESERVED+3) -#define SYS_clock_gettime (CONFIG_SYS_RESERVED+4) -#define SYS_clock_settime (CONFIG_SYS_RESERVED+5) -#define SYS_close (CONFIG_SYS_RESERVED+6) -#define SYS_connect (CONFIG_SYS_RESERVED+7) -#define SYS_creat (CONFIG_SYS_RESERVED+8) -#define SYS_dup (CONFIG_SYS_RESERVED+9) -#define SYS_dup2 (CONFIG_SYS_RESERVED+10) -#define SYS_exit (CONFIG_SYS_RESERVED+11) -#define SYS_fcntl (CONFIG_SYS_RESERVED+12) -#define SYS_fstat (CONFIG_SYS_RESERVED+13) -#define SYS_fstatfs (CONFIG_SYS_RESERVED+14) -#define SYS_fsync (CONFIG_SYS_RESERVED+15) -#define SYS_getcwd (CONFIG_SYS_RESERVED+16) -#define SYS_getpid (CONFIG_SYS_RESERVED+17) -#define SYS_getsockopt (CONFIG_SYS_RESERVED+18) -#define SYS_gettimeofday (CONFIG_SYS_RESERVED+19) -#define SYS_ioctl (CONFIG_SYS_RESERVED+20) -#define SYS_kill (CONFIG_SYS_RESERVED+21) -#define SYS_listen (CONFIG_SYS_RESERVED+22) -#define SYS_lseek (CONFIG_SYS_RESERVED+23) -#define SYS_mkdir (CONFIG_SYS_RESERVED+24) -#define SYS_mmap (CONFIG_SYS_RESERVED+25) -#define SYS_mount (CONFIG_SYS_RESERVED+26) -#define SYS_mq_notify (CONFIG_SYS_RESERVED+27) -#define SYS_mq_open (CONFIG_SYS_RESERVED+28) -#define SYS_mq_timedreceive (CONFIG_SYS_RESERVED+29) -#define SYS_mq_timedsend (CONFIG_SYS_RESERVED+30) -#define SYS_mq_unlink (CONFIG_SYS_RESERVED+31) -#define SYS_munmap (CONFIG_SYS_RESERVED+32) -#define SYS_open (CONFIG_SYS_RESERVED+33) -#define SYS_pipe (CONFIG_SYS_RESERVED+34) -#define SYS_poll (CONFIG_SYS_RESERVED+35) -#define SYS_read (CONFIG_SYS_RESERVED+36) -#define SYS_readdir (CONFIG_SYS_RESERVED+37) -#define SYS_reboot (CONFIG_SYS_RESERVED+38) -#define SYS_recvfrom (CONFIG_SYS_RESERVED+39) -#define SYS_rename (CONFIG_SYS_RESERVED+40) -#define SYS_rmdir (CONFIG_SYS_RESERVED+41) -#define SYS_sched_getparam (CONFIG_SYS_RESERVED+42) -#define SYS_sched_get_priority_max (CONFIG_SYS_RESERVED+43) -#define SYS_sched_get_priority_min (CONFIG_SYS_RESERVED+44) -#define SYS_sched_getscheduler (CONFIG_SYS_RESERVED+45) -#define SYS_sched_rr_get_interval (CONFIG_SYS_RESERVED+46) -#define SYS_sched_setparam (CONFIG_SYS_RESERVED+47) -#define SYS_sched_setscheduler (CONFIG_SYS_RESERVED+48) -#define SYS_sched_yield (CONFIG_SYS_RESERVED+49) -#define SYS_select (CONFIG_SYS_RESERVED+50) -#define SYS_sendto (CONFIG_SYS_RESERVED+51) -#define SYS_setsockopt (CONFIG_SYS_RESERVED+52) -#define SYS_sigaction (CONFIG_SYS_RESERVED+53) -#define SYS_signal (CONFIG_SYS_RESERVED+54) -#define SYS_sigpending (CONFIG_SYS_RESERVED+55) -#define SYS_sigprocmask (CONFIG_SYS_RESERVED+56) -#define SYS_sigsuspend (CONFIG_SYS_RESERVED+57) -#define SYS_socket (CONFIG_SYS_RESERVED+58) -#define SYS_stat (CONFIG_SYS_RESERVED+59) -#define SYS_statfs (CONFIG_SYS_RESERVED+60) -#define SYS_task_create (CONFIG_SYS_RESERVED+61) -#define SYS_task_delete (CONFIG_SYS_RESERVED+62) -#define SYS_task_init (CONFIG_SYS_RESERVED+63) -#define SYS_task_restart (CONFIG_SYS_RESERVED+64) -#define SYS_timer_create (CONFIG_SYS_RESERVED+65) -#define SYS_timer_delete (CONFIG_SYS_RESERVED+66) -#define SYS_timer_getoverrun (CONFIG_SYS_RESERVED+67) -#define SYS_timer_gettime (CONFIG_SYS_RESERVED+68) -#define SYS_timer_settime (CONFIG_SYS_RESERVED+69) -#define SYS_umount (CONFIG_SYS_RESERVED+70) -#define SYS_unlink (CONFIG_SYS_RESERVED+71) -#define SYS_waitid (CONFIG_SYS_RESERVED+72) -#define SYS_waitpid (CONFIG_SYS_RESERVED+73) -#define SYS_write (CONFIG_SYS_RESERVED+74) +#define SYS__exit (CONFIG_SYS_RESERVED+0) +#define SYS_accept (CONFIG_SYS_RESERVED+1) +#define SYS_bind (CONFIG_SYS_RESERVED+2) +#define SYS_clearenv (CONFIG_SYS_RESERVED+3) +#define SYS_clock_getres (CONFIG_SYS_RESERVED+4) +#define SYS_clock_gettime (CONFIG_SYS_RESERVED+5) +#define SYS_clock_settime (CONFIG_SYS_RESERVED+6) +#define SYS_close (CONFIG_SYS_RESERVED+7) +#define SYS_closedir (CONFIG_SYS_RESERVED+8) +#define SYS_connect (CONFIG_SYS_RESERVED+9) +#define SYS_creat (CONFIG_SYS_RESERVED+10) +#define SYS_dup (CONFIG_SYS_RESERVED+11) +#define SYS_dup2 (CONFIG_SYS_RESERVED+12) +#define SYS_exit (CONFIG_SYS_RESERVED+13) +#define SYS_fcntl (CONFIG_SYS_RESERVED+14) +#define SYS_fstat (CONFIG_SYS_RESERVED+15) +#define SYS_fstatfs (CONFIG_SYS_RESERVED+16) +#define SYS_fsync (CONFIG_SYS_RESERVED+17) +#define SYS_getcwd (CONFIG_SYS_RESERVED+18) +#define SYS_getpid (CONFIG_SYS_RESERVED+19) +#define SYS_getsockopt (CONFIG_SYS_RESERVED+20) +#define SYS_gettimeofday (CONFIG_SYS_RESERVED+21) +#define SYS_ioctl (CONFIG_SYS_RESERVED+22) +#define SYS_kill (CONFIG_SYS_RESERVED+23) +#define SYS_listen (CONFIG_SYS_RESERVED+24) +#define SYS_lseek (CONFIG_SYS_RESERVED+25) +#define SYS_mkdir (CONFIG_SYS_RESERVED+26) +#define SYS_mmap (CONF6G_SYS_RESERVED+27) +#define SYS_mount (CONF7G_SYS_RESERVED+28) +#define SYS_mq_notify (CONFIG_SYS_RESERVED+29) +#define SYS_mq_open (CONFIG_SYS_RESERVED+30) +#define SYS_mq_timedreceive (CONFIG_SYS_RESERVED+31) +#define SYS_mq_timedsend (CONFIG_SYS_RESERVED+32) +#define SYS_mq_unlink (CONFIG_SYS_RESERVED+33) +#define SYS_munmap (CONFIG_SYS_RESERVED+34) +#define SYS_open (CONFIG_SYS_RESERVED+35) +#define SYS_pipe (CONFIG_SYS_RESERVED+36) +#define SYS_poll (CONFIG_SYS_RESERVED+37) +#define SYS_read (CONFIG_SYS_RESERVED+38) +#define SYS_readdir (CONFIG_SYS_RESERVED+39) +#define SYS_reboot (CONFIG_SYS_RESERVED+40) +#define SYS_recvfrom (CONFIG_SYS_RESERVED+41) +#define SYS_rename (CONFIG_SYS_RESERVED+42) +#define SYS_rmdir (CONFIG_SYS_RESERVED+43) +#define SYS_sched_getparam (CONFIG_SYS_RESERVED+44) +#define SYS_sched_get_priority_max (CONFIG_SYS_RESERVED+45) +#define SYS_sched_get_priority_min (CONFIG_SYS_RESERVED+46) +#define SYS_sched_getscheduler (CONFIG_SYS_RESERVED+47) +#define SYS_sched_rr_get_interval (CONFIG_SYS_RESERVED+48) +#define SYS_sched_setparam (CONFIG_SYS_RESERVED+49) +#define SYS_sched_setscheduler (CONFIG_SYS_RESERVED+50) +#define SYS_sched_yield (CONFIG_SYS_RESERVED+51) +#define SYS_select (CONFIG_SYS_RESERVED+52) +#define SYS_sendto (CONFIG_SYS_RESERVED+53) +#define SYS_setsockopt (CONFIG_SYS_RESERVED+54) +#define SYS_sigaction (CONFIG_SYS_RESERVED+55) +#define SYS_signal (CONFIG_SYS_RESERVED+56) +#define SYS_sigpending (CONFIG_SYS_RESERVED+57) +#define SYS_sigprocmask (CONFIG_SYS_RESERVED+58) +#define SYS_sigsuspend (CONFIG_SYS_RESERVED+59) +#define SYS_socket (CONFIG_SYS_RESERVED+60) +#define SYS_stat (CONFIG_SYS_RESERVED+61) +#define SYS_statfs (CONFIG_SYS_RESERVED+62) +#define SYS_task_create (CONFIG_SYS_RESERVED+63) +#define SYS_task_delete (CONFIG_SYS_RESERVED+64) +#define SYS_task_init (CONFIG_SYS_RESERVED+65) +#define SYS_task_restart (CONFIG_SYS_RESERVED+66) +#define SYS_timer_create (CONFIG_SYS_RESERVED+67) +#define SYS_timer_delete (CONFIG_SYS_RESERVED+68) +#define SYS_timer_getoverrun (CONFIG_SYS_RESERVED+69) +#define SYS_timer_gettime (CONFIG_SYS_RESERVED+70) +#define SYS_timer_settime (CONFIG_SYS_RESERVED+71) +#define SYS_umount (CONFIG_SYS_RESERVED+72) +#define SYS_unlink (CONFIG_SYS_RESERVED+73) +#define SYS_waitid (CONFIG_SYS_RESERVED+74) +#define SYS_waitpid (CONFIG_SYS_RESERVED+75) +#define SYS_write (CONFIG_SYS_RESERVED+76) /**************************************************************************** * Public Type Definitions diff --git a/syscall/README.txt b/syscall/README.txt index 1f75b6cc96..08d0413466 100644 --- a/syscall/README.txt +++ b/syscall/README.txt @@ -88,8 +88,9 @@ The format of the CVS file for each line is: Field 1: Function name Field 2: The header file that contains the function prototype - Field 3: The type of function return value. - Field 4 - N+4: The type of each of the N formal parameters of the function + Field 3: Condition for compilation + Field 4: The type of function return value. + Field 5 - N+5: The type of each of the N formal parameters of the function Auto-Generated Files ==================== diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 76bea04890..2e412acaa5 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -1,159 +1,159 @@ -"_exit","unistd.h","void","int" -"accept","sys/socket.h","int","int","struct sockaddr*","socklen_t*" -"atexit","stdlib.h","int","void (*)(void)" -"bind","sys/socket.h","int","int","FAR const struct sockaddr*","socklen_t" -"clearenv","stdlib.h","int" -"clock_getres","time.h","int","clockid_t","struct timespec*" -"clock_gettime","time.h","int","clockid_t","struct timespec*" -"clock_settime","time.h","int","clockid_t","const struct timespec*" -"close","unistd.h","int","int" -"closedir","dirent.h","int","FAR DIR*" -"connect","sys/socket.h","int","int","FAR const struct sockaddr*","socklen_t" -"creat","fcntl.h","int","const char*","mode_t" -"dup","unistd.h","int","int" -"dup2","unistd.h","int","int","int" -"exit","stdlib.h","void","int" -"fcntl","fcntl.h","int","int","int","..." -"fstat","sys/stat.h","int","int","FAR struct stat*" -"fstatfs","sys/statfs.h","int","int","struct statfs*" -"fsync","unistd.h","int","int" -"get_environ_ptr","stdlib.h","FAR char**" -"get_errno_ptr","errno.h","FAR int*" -"getenv","stdlib.h","FAR char*","FAR const char*" -"getpid","unistd.h","pidt_t" -"getsockopt","sys/socket.h","int","int","int","int","FAR void*","FAR socklen_t*" -"gettimeofday","sys/time.h","int","struct timeval*","FAR void*" -"ioctl","sys/ioctl.h","int","int","int","unsigned long" -"kill","signal.h","int","pid_t","int" -"listen","sys/socket.h","int","int","int" -"lseek","unistd.h","off_t","int","off_t","int" -"mkdir","sys/stat.h","int","FAR const char*","mode_t" -"mkfifo","sys/stat.h","int","FAR const char*","mode_t" -"mmap","sys/mman.h","FAR void*","FAR void*","size_t","int","int","int","off_t" -"mount","sys/mount.h","int","const char*","const char*","const char*","unsigned long","const void*" -"mq_close","mqueue.h","int","mqd_t" -"mq_getattr","mqueue.h","int","mqd_t","struct mq_attr*" -"mq_notify","mqueue.h","int","mqd_t","const struct sigevent*" -"mq_open","mqueue.h","mqd_t","const char*","int","..." -"mq_receive","mqueue.h","ssize_t","mqd_t","void*","size_t","int*" -"mq_send","mqueue.h","int","mqd_t","const void*","size_t","int" -"mq_setattr","mqueue.h","int","mqd_t","const struct mq_attr*","struct mq_attr*" -"mq_timedreceive","mqueue.h","ssize_t","mqd_t","void*","size_t","int*","const struct timespec*" -"mq_timedsend","mqueue.h","int","mqd_t","const char*","size_t","int","const struct timespec*" -"mq_unlink","mqueue.h","int","const char*" -"open","fcntl.h","int","const char*","int","..." -"opendir","dirent.h","FAR DIR*","FAR const char*" -"pipe","unistd.h","int","int [2]|int*" -"poll","poll.h","int","FAR struct pollfd*","nfds_t","int" -"pthread_barrier_destroy","pthread.h","int","FAR pthread_barrier_t*" -"pthread_barrier_init","pthread.h","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int" -"pthread_barrier_wait","pthread.h","int","FAR pthread_barrier_t*" -"pthread_cancel","pthread.h","int","pthread_t" -"pthread_cond_broadcast","pthread.h","int","FAR pthread_cond_t*" -"pthread_cond_destroy","pthread.h","int","FAR pthread_cond_t*" -"pthread_cond_init","pthread.h","int","FAR pthread_cond_t*","FAR pthread_condattr_t*" -"pthread_cond_signal","pthread.h","int","FAR pthread_cond_t*" -"pthread_cond_timedwait","pthread.h","int","FAR pthread_cond_t*","FAR pthread_mutex_t*","FAR const struct timespec*" -"pthread_cond_wait","pthread.h","int","FAR pthread_cond_t*","FAR pthread_mutex_t*" -"pthread_create","pthread.h","int","FAR pthread_t*","FAR pthread_attr_t*","pthread_startroutine_t","pthread_addr_t" -"pthread_detach","pthread.h","int","pthread_t" -"pthread_exit","pthread.h","void","pthread_addr_t" -"pthread_getschedparam","pthread.h","int","pthread_t","FAR int*","FAR struct sched_param*" -"pthread_getspecific","pthread.h","FAR void*","pthread_key_t" -"pthread_join","pthread.h","int","pthread_t","FAR pthread_addr_t*" -"pthread_key_create","pthread.h","int","FAR pthread_key_t*","CODE void (*)(FAR void*)" -"pthread_key_delete","pthread.h","int","pthread_key_t" -"pthread_kill","pthread.h","int","pthread_t","int" -"pthread_mutex_destroy","pthread.h","int","FAR pthread_mutex_t*" -"pthread_mutex_init","pthread.h","int","FAR pthread_mutex_t*","FAR pthread_mutexattr_t*" -"pthread_mutex_lock","pthread.h","int","FAR pthread_mutex_t*" -"pthread_mutex_trylock","pthread.h","int","FAR pthread_mutex_t*" -"pthread_mutex_unlock","pthread.h","int","FAR pthread_mutex_t*" -"pthread_once","pthread.h","int","FAR pthread_once_t*","CODE void (*)(void)" -"pthread_setcancelstate","pthread.h","int","int","FAR int*" -"pthread_setschedparam","pthread.h","int","pthread_t","int","FAR const struct sched_param*" -"pthread_setschedprio","pthread.h","int","pthread_t","int" -"pthread_setspecific","pthread.h","int","pthread_key_t","FAR void*" -"pthread_sigmask","pthread.h","int","int","FAR const sigset_t*","FAR sigset_t*" -"pthread_testcancel","pthread.h","void" -"pthread_yield","pthread.h","void" -"putenv","stdlib.h","int","FAR const char*" -"read","unistd.h","ssize_t","int","FAR void*","size_t" -"readdir","dirent.h","FAR struct dirent*","FAR DIR*" -"readdir_r","dirent.h","int","FAR DIR*","FAR struct dirent*","FAR struct dirent**" -"recv","sys/socket.h","ssize_t","int","FAR void*","size_t","int" -"recvfrom","sys/socket.h","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*" -"rename","stdio.h","int","FAR const char*","FAR const char*" -"rewinddir","dirent.h","void","FAR DIR*" -"rmdir","unistd.h","int","FAR const char*" -"sched_get_priority_max","sched.h","int","int" -"sched_get_priority_min","sched.h","int","int" -"sched_getparam","sched.h","int","pid_t","struct sched_param*" -"sched_getscheduler","sched.h","int","pid_t" -"sched_lock","sched.h","int" -"sched_lockcount","sched.h","int32_t" -"sched_note_start","sched.h","void","FAR _TCB* " -"sched_note_stop","sched.h","void","FAR _TCB* " -"sched_note_switch","sched.h","void","FAR _TCB*","FAR _TCB*" -"sched_rr_get_interval","sched.h","int","pid_t","struct timespec*" -"sched_setparam","sched.h","int","pid_t","const struct sched_param*" -"sched_setscheduler","sched.h","int","pid_t","int","const struct sched_param*" -"sched_unlock","sched.h","int" -"sched_yield","sched.h","int" -"seekdir","dirent.h","void","FAR DIR*","off_t" -"select","sys/select.h","int","int","FAR fd_set*","FAR fd_set*","FAR fd_set*","FAR struct timeval*" -"sem_close","semaphore.h","int","FAR sem_t*" -"sem_destroy","semaphore.h","int","FAR sem_t*" -"sem_open","semaphore.h","FAR sem_t*","FAR const char*","int","..." -"sem_post","semaphore.h","int","FAR sem_t*" -"sem_trywait","semaphore.h","int","FAR sem_t*" -"sem_unlink","semaphore.h","int","FAR const char*" -"sem_wait","semaphore.h","int","FAR sem_t*" -"send","sys/socket.h","ssize_t","int","FAR const void*","size_t","int" -"sendto","sys/socket.h","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t" -"setenv","stdlib.h","int","const char*","const char*","int" -"setsockopt","sys/socket.h","int","int","int","int","FAR const void*","socklen_t" -"sigaction","signal.h","int","int","FAR const struct sigaction*","FAR struct sigaction*" -"sigaddset","signal.h","int","FAR sigset_t*","int" -"sigdelset","signal.h","int","FAR sigset_t*","int" -"sigemptyset","signal.h","int","FAR sigset_t*" -"sigfillset","signal.h","int","FAR sigset_t*" -"sigismember","signal.h","int","FAR const sigset_t*","int" -"sigpending","signal.h","int","FAR sigset_t*" -"sigprocmask","signal.h","int","int","FAR const sigset_t*","FAR sigset_t*" -"sigqueue","signal.h","int","int","int","FAR void*" -"sigqueue","signal.h","int","int","int","union sigval|FAR void *" -"sigsuspend","signal.h","int","FAR const sigset_t*" -"sigtimedwait","signal.h","int","FAR const sigset_t*","FAR struct siginfo*","FAR const struct timespec*" -"sigwaitinfo","signal.h","int","FAR const sigset_t*","FAR struct siginfo*" -"sleep","unistd.h","unsigned int","unsigned int" -"snprintf","stdio.h","int","FAR char*","size_t","const char*","..." -"socket","sys/socket.h","int","int","int","int" -"stat","sys/stat.h","int","const char*","FAR struct stat*" -"statfs","stdio.h","int","FAR const char*","FAR struct statfs*" -"statfs","sys/statfs.h","int","const char*","struct statfs*" -"task_activate","sched.h","int","FAR _TCB*" -"task_create","sched.h","int","const char*","int","int","main_t","const char* []|const char**" -#"task_create","sched.h","int","const char*","int","main_t","const char* []|const char**" -"task_delete","sched.h","int","pid_t" -"task_init","sched.h","int","FAR _TCB*","const char*","int","FAR uint32_t*","uint32_t","main_t","const char* []|const char**" -#"task_init","sched.h","int","FAR _TCB*","const char*","int","main_t","const char* []|const char**" -"task_restart","sched.h","int","pid_t" -"telldir","dirent.h","off_t","FAR DIR*" -"timer_create","time.h","int","clockid_t","FAR struct sigevent*","FAR timer_t*" -"timer_delete","time.h","int","timer_t" -"timer_getoverrun","time.h","int","timer_t" -"timer_gettime","time.h","int","timer_t","FAR struct itimerspec*" -"timer_settime","time.h","int","timer_t","int","FAR const struct itimerspec*","FAR struct itimerspec*" -"umount","sys/mount.h","int","const char*" -"unlink","unistd.h","int","FAR const char*" -"unsetenv","stdlib.h","int","const char*" -"up_assert","assert.h","void","FAR const uint8_t*","int" -#"up_assert","assert.h","void" -"up_assert_code","assert.h","void","FAR const uint8_t*","int","int" -#"up_assert_code","assert.h","void","int" -"usleep","unistd.h","void","useconds_t" -#"wait","sys/wait.h","pidt_t","int*" -#"waitid","sys/wait.h","int","idtype_t","id_t id","siginfo_t*","int" -"waitpid","sys/wait.h","pidt_t","pid_t","int*","int" -"write","unistd.h","ssize_t","int","FAR const void*","size_t" +"_exit","unistd.h","","void","int" +"accept","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","struct sockaddr*","socklen_t*" +"atexit","stdlib.h","defined(CONFIG_SCHED_ATEXT)","int","void (*)(void)" +"bind","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t" +"clearenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int" +"clock_getres","time.h","!defined(CONFIG_DISABLE_CLOCK)","int","clockid_t","struct timespec*" +"clock_gettime","time.h","!defined(CONFIG_DISABLE_CLOCK)","int","clockid_t","struct timespec*" +"clock_settime","time.h","!defined(CONFIG_DISABLE_CLOCK)","int","clockid_t","const struct timespec*" +"close","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int" +"closedir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*" +"connect","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","FAR const struct sockaddr*","socklen_t" +"creat","fcntl.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","const char*","mode_t" +"dup","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int" +"dup2","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int" +"exit","stdlib.h","","void","int" +"fcntl","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","..." +"fstat","sys/stat.h","","int","int","FAR struct stat*" +"fstatfs","sys/statfs.h","","int","int","struct statfs*" +"fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int" +"get_environ_ptr","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char**" +"get_errno_ptr","errno.h","","FAR int*" +"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*" +"getpid","unistd.h","","pidt_t" +"getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*" +"gettimeofday","sys/time.h","","int","struct timeval*","FAR void*" +"ioctl","sys/ioctl.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int","int","unsigned long" +"kill","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","pid_t","int" +"listen","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int" +"lseek","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","int","off_t","int" +"mkdir","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","mode_t" +"mkfifo","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR const char*","mode_t" +"mmap","sys/mman.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR void*","FAR void*","size_t","int","int","int","off_t" +"mount","sys/mount.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","const char*","const char*","const char*","unsigned long","const void*" +"mq_close","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t" +"mq_getattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","struct mq_attr*" +"mq_notify","mqueue.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct sigevent*" +"mq_open","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","mqd_t","const char*","int","..." +"mq_receive","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","ssize_t","mqd_t","void*","size_t","int*" +"mq_send","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const void*","size_t","int" +"mq_setattr","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const struct mq_attr*","struct mq_attr*" +"mq_timedreceive","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","ssize_t","mqd_t","void*","size_t","int*","const struct timespec*" +"mq_timedsend","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","mqd_t","const char*","size_t","int","const struct timespec*" +"mq_unlink","mqueue.h","!defined(CONFIG_DISABLE_MQUEUE)","int","const char*" +"open","fcntl.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","int","..." +"opendir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR DIR*","FAR const char*" +"pipe","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0","int","int [2]|int*" +"poll","poll.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","FAR struct pollfd*","nfds_t","int" +"pthread_barrier_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*" +"pthread_barrier_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*","FAR const pthread_barrierattr_t*","unsigned int" +"pthread_barrier_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_barrier_t*" +"pthread_cancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t" +"pthread_cond_broadcast","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*" +"pthread_cond_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*" +"pthread_cond_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*","FAR pthread_condattr_t*" +"pthread_cond_signal","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*" +"pthread_cond_timedwait","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*","FAR pthread_mutex_t*","FAR const struct timespec*" +"pthread_cond_wait","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_cond_t*","FAR pthread_mutex_t*" +"pthread_create","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_t*","FAR pthread_attr_t*","pthread_startroutine_t","pthread_addr_t" +"pthread_detach","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t" +"pthread_exit","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void","pthread_addr_t" +"pthread_getschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR int*","FAR struct sched_param*" +"pthread_getspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","FAR void*","pthread_key_t" +"pthread_join","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","FAR pthread_addr_t*" +"pthread_key_create","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_key_t*","CODE void (*)(FAR void*)" +"pthread_key_delete","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_key_t" +"pthread_kill","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int" +"pthread_mutex_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" +"pthread_mutex_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*","FAR pthread_mutexattr_t*" +"pthread_mutex_lock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" +"pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" +"pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*" +"pthread_once","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_once_t*","CODE void (*)(void)" +"pthread_setcancelstate","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","int","FAR int*" +"pthread_setschedparam","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int","FAR const struct sched_param*" +"pthread_setschedprio","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int" +"pthread_setspecific","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","pthread_key_t","FAR void*" +"pthread_sigmask","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","int","FAR const sigset_t*","FAR sigset_t*" +"pthread_testcancel","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void" +"pthread_yield","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","void" +"putenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*" +"read","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR void*","size_t" +"readdir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","FAR struct dirent*","FAR DIR*" +"readdir_r","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","int","FAR DIR*","FAR struct dirent*","FAR struct dirent**" +"recv","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int" +"recvfrom","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR void*","size_t","int","FAR struct sockaddr*","FAR socklen_t*" +"rename","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","FAR const char*" +"rewinddir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","void","FAR DIR*" +"rmdir","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*" +"sched_get_priority_max","sched.h","","int","int" +"sched_get_priority_min","sched.h","","int","int" +"sched_getparam","sched.h","","int","pid_t","struct sched_param*" +"sched_getscheduler","sched.h","","int","pid_t" +"sched_lock","sched.h","","int" +"sched_lockcount","sched.h","","int32_t" +"sched_note_start","sched.h","","void","FAR _TCB* " +"sched_note_stop","sched.h","","void","FAR _TCB* " +"sched_note_switch","sched.h","","void","FAR _TCB*","FAR _TCB*" +"sched_rr_get_interval","sched.h","","int","pid_t","struct timespec*" +"sched_setparam","sched.h","","int","pid_t","const struct sched_param*" +"sched_setscheduler","sched.h","","int","pid_t","int","const struct sched_param*" +"sched_unlock","sched.h","","int" +"sched_yield","sched.h","","int" +"seekdir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","void","FAR DIR*","off_t" +"select","sys/select.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","int","int","FAR fd_set*","FAR fd_set*","FAR fd_set*","FAR struct timeval*" +"sem_close","semaphore.h","","int","FAR sem_t*" +"sem_destroy","semaphore.h","","int","FAR sem_t*" +"sem_open","semaphore.h","","FAR sem_t*","FAR const char*","int","..." +"sem_post","semaphore.h","","int","FAR sem_t*" +"sem_trywait","semaphore.h","","int","FAR sem_t*" +"sem_unlink","semaphore.h","","int","FAR const char*" +"sem_wait","semaphore.h","","int","FAR sem_t*" +"send","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int" +"sendto","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t" +"setenv","stdlib.h","","int","const char*","const char*","int" +"setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t" +"sigaction","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const struct sigaction*","FAR struct sigaction*" +"sigaddset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*","int" +"sigdelset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*","int" +"sigemptyset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*" +"sigfillset","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*" +"sigismember","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*","int" +"sigpending","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR sigset_t*" +"sigprocmask","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","FAR const sigset_t*","FAR sigset_t*" +"sigqueue","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","int","FAR void*" +"sigqueue","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","int","int","union sigval|FAR void *" +"sigsuspend","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*" +"sigtimedwait","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*","FAR struct siginfo*","FAR const struct timespec*" +"sigwaitinfo","signal.h","!defined(CONFIG_DISABLE_SIGNALS)","int","FAR const sigset_t*","FAR struct siginfo*" +"sleep","unistd.h","!defined(CONFIG_DISABLE_SIGNALS)","unsigned int","unsigned int" +"snprintf","stdio.h","","int","FAR char*","size_t","const char*","..." +"socket","sys/socket.h","","int","int","int","int" +"stat","sys/stat.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","FAR struct stat*" +#"statfs","stdio.h","","int","FAR const char*","FAR struct statfs*" +"statfs","sys/statfs.h","CONFIG_NFILE_DESCRIPTORS > 0","int","const char*","struct statfs*" +"task_activate","sched.h","","int","FAR _TCB*" +"task_create","sched.h","","int","const char*","int","int","main_t","const char* []|const char**" +#"task_create","sched.h","","int","const char*","int","main_t","const char* []|const char**" +"task_delete","sched.h","","int","pid_t" +"task_init","sched.h","","int","FAR _TCB*","const char*","int","FAR uint32_t*","uint32_t","main_t","const char* []|const char**" +#"task_init","sched.h","","int","FAR _TCB*","const char*","int","main_t","const char* []|const char**" +"task_restart","sched.h","","int","pid_t" +"telldir","dirent.h","CONFIG_NFILE_DESCRIPTORS > 0","off_t","FAR DIR*" +"timer_create","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","clockid_t","FAR struct sigevent*","FAR timer_t*" +"timer_delete","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t" +"timer_getoverrun","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t" +"timer_gettime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","FAR struct itimerspec*" +"timer_settime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","int","FAR const struct itimerspec*","FAR struct itimerspec*" +"umount","sys/mount.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","const char*" +"unlink","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*" +"unsetenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*" +"up_assert","assert.h","","void","FAR const uint8_t*","int" +#"up_assert","assert.h","","void" +"up_assert_code","assert.h","","void","FAR const uint8_t*","int","int" +#"up_assert_code","assert.h","","void","int" +"usleep","unistd.h","!defined(CONFIG_DISABLE_SIGNALS)","void","useconds_t" +#"wait","sys/wait.h","","pidt_t","int*" +#"waitid","sys/wait.h","","int","idtype_t","id_t id","siginfo_t*","int" +"waitpid","sys/wait.h","defined(CONFIG_SCHED_WAITPID)","pidt_t","pid_t","int*","int" +"write","unistd.h","CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0","ssize_t","int","FAR const void*","size_t" diff --git a/tools/mksyscall.c b/tools/mksyscall.c index dc1c41f4a9..aadb965a43 100644 --- a/tools/mksyscall.c +++ b/tools/mksyscall.c @@ -57,8 +57,9 @@ #define MAX_PARMSIZE 128 #define NAME_INDEX 0 #define HEADER_INDEX 1 -#define RETTYPE_INDEX 2 -#define PARM1_INDEX 3 +#define COND_INDEX 2 +#define RETTYPE_INDEX 3 +#define PARM1_INDEX 4 /**************************************************************************** * Private Data @@ -69,6 +70,7 @@ static bool g_inline; static char g_line[LINESIZE+1]; static char g_parm[MAX_FIELDS][MAX_PARMSIZE]; static FILE *g_stubstream; +static int g_lineno; /**************************************************************************** * Private Functions @@ -93,6 +95,7 @@ static char *read_line(FILE *stream) } else { + g_lineno++; if (g_debug) { printf("Line: %s\n", g_line); @@ -121,7 +124,7 @@ static char *copy_parm(char *src, char *dest) } else if (*src == '\n' || *src == '\0') { - fprintf(stderr, "Unexpected end of line: \"%s\"\n", start); + fprintf(stderr, "%d: Unexpected end of line: \"%s\"\n", g_lineno, start); exit(4); } else @@ -130,7 +133,7 @@ static char *copy_parm(char *src, char *dest) } } - fprintf(stderr, "Parameter too long: \"%s\"\n", start); + fprintf(stderr, "%d: Parameter too long: \"%s\"\n", g_lineno, start); exit(3); } @@ -140,7 +143,7 @@ static char *find_parm(char *ptr) if (*ptr != '"') { - fprintf(stderr, "I'm confused: \"%s\"\n", start); + fprintf(stderr, "%d: I'm confused: \"%s\"\n", g_lineno, start); exit(5); } ptr++; @@ -152,7 +155,7 @@ static char *find_parm(char *ptr) } else if (*ptr != ',') { - fprintf(stderr, "Expected ',': \"%s\"\n", start); + fprintf(stderr, "%d: Expected ',': \"%s\"\n", g_lineno, start); exit(6); } ptr++; @@ -160,7 +163,7 @@ static char *find_parm(char *ptr) ptr = skip_space(ptr); if (*ptr != '"') { - fprintf(stderr, "Expected \": \"%s\"\n", start); + fprintf(stderr, "%d: Expected \": \"%s\"\n", g_lineno, start); exit(7); } ptr++; @@ -180,7 +183,7 @@ static int parse_csvline(char *ptr) if (*ptr != '"') { - fprintf(stderr, "Bad line: \"%s\"\n", g_line); + fprintf(stderr, "%d: Bad line: \"%s\"\n", g_lineno, g_line); exit(2); } @@ -212,7 +215,7 @@ static bool is_vararg(const char *type, int index, int nparms) { if (index != (nparms-1)) { - fprintf(stderr, "... is not the last in the argument list\n"); + fprintf(stderr, "%d: ... is not the last in the argument list\n", g_lineno); exit(11); } return true; @@ -323,9 +326,15 @@ static void generate_proxy(int nparms) /* Generate "up-front" information, include correct header files */ fprintf(stream, "/* Auto-generated %s proxy file -- do not edit */\n\n", g_parm[NAME_INDEX]); + fprintf(stream, "#include \n"); fprintf(stream, "#include <%s>\n", g_parm[HEADER_INDEX]); fprintf(stream, "#include \n\n"); + if (g_parm[COND_INDEX][0] != '\0') + { + fprintf(stream, "#if %s\n\n", g_parm[COND_INDEX]); + } + /* Generate the function definition that matches standard function prototype */ fprintf(stream, "%s %s(", g_parm[RETTYPE_INDEX], g_parm[NAME_INDEX]); @@ -370,7 +379,12 @@ static void generate_proxy(int nparms) /* Handle the tail end of the function. */ - fprintf(stream, ");\n}\n"); + fprintf(stream, ");\n}\n\n"); + if (g_parm[COND_INDEX][0] != '\0') + { + fprintf(stream, "#endif /* %s */\n", g_parm[COND_INDEX]); + } + fclose(stream); } @@ -386,6 +400,9 @@ static FILE *open_stub(void) fprintf(stderr, "Failed to open STUB.h: %s\n", strerror(errno)); exit(9); } + fprintf(g_stubstream, "/* Autogenerated STUB header file */\n\n"); + fprintf(g_stubstream, "#ifndef __STUB_H\n"); + fprintf(g_stubstream, "#define __STUB_H\n\n"); } return g_stubstream; @@ -427,9 +444,15 @@ static void generate_stub(int nparms) /* Generate "up-front" information, include correct header files */ fprintf(stream, "/* Auto-generated %s stub file -- do not edit */\n\n", g_parm[0]); + fprintf(stream, "#include \n"); fprintf(stream, "#include \n"); fprintf(stream, "#include <%s>\n\n", g_parm[HEADER_INDEX]); + if (g_parm[COND_INDEX][0] != '\0') + { + fprintf(stream, "#if %s\n\n", g_parm[COND_INDEX]); + } + /* Generate the function definition that matches standard function prototype */ fprintf(stream, "uintptr_t STUB_%s(", g_parm[NAME_INDEX]); @@ -545,17 +568,22 @@ static void generate_stub(int nparms) } } - /* Tail end of the function. The the proxied function has no return + /* Tail end of the function. If the proxied function has no return * value, just return zero (OK). */ if (strcmp(g_parm[RETTYPE_INDEX], "void") == 0) { - fprintf(stream, ");\n return 0;\n}\n"); + fprintf(stream, ");\n return 0;\n}\n\n"); } else { - fprintf(stream, ");\n}\n"); + fprintf(stream, ");\n}\n\n"); + } + + if (g_parm[COND_INDEX][0] != '\0') + { + fprintf(stream, "#endif /* %s */\n", g_parm[COND_INDEX]); } stub_close(stream); } @@ -650,7 +678,7 @@ int main(int argc, char **argv, char **envp) /* Parse the line from the CVS file */ int nargs = parse_csvline(ptr); - if (nargs < 3) + if (nargs < PARM1_INDEX) { fprintf(stderr, "Only %d arguments found: %s\n", nargs, g_line); exit(8); @@ -658,14 +686,15 @@ int main(int argc, char **argv, char **envp) if (proxies) { - generate_proxy(nargs-3); + generate_proxy(nargs - PARM1_INDEX); } else { g_stubstream = NULL; - generate_stub(nargs-3); + generate_stub(nargs - PARM1_INDEX); if (g_stubstream != NULL) { + fprintf(g_stubstream, "\n#endif /* __STUB_H */\n"); fclose(g_stubstream); } }