diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 10c7a17ecd7..56cd097c697 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -406,24 +406,34 @@ # define __SYS_network __SYS_environ #endif +/* The following are defined if networking is supported */ + +#ifdef CONFIG_NET +# define SYS_gethostname (__SYS_network+0) +# define SYS_sethostname (__SYS_network+1) + /* The following are defined only if networking AND sockets are supported */ -#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) -# define SYS_accept (__SYS_network+0) -# define SYS_bind (__SYS_network+1) -# define SYS_connect (__SYS_network+2) -# define SYS_getsockopt (__SYS_network+3) -# define SYS_listen (__SYS_network+4) -# define SYS_recv (__SYS_network+5) -# define SYS_recvfrom (__SYS_network+6) -# define SYS_send (__SYS_network+7) -# define SYS_sendto (__SYS_network+8) -# define SYS_setsockopt (__SYS_network+9) -# define SYS_socket (__SYS_network+10) -# define SYS_nnetsocket (__SYS_network+11) +#if CONFIG_NSOCKET_DESCRIPTORS > 0 +# define SYS_accept (__SYS_network+2) +# define SYS_bind (__SYS_network+3) +# define SYS_connect (__SYS_network+4) +# define SYS_getsockopt (__SYS_network+5) +# define SYS_listen (__SYS_network+6) +# define SYS_recv (__SYS_network+7) +# define SYS_recvfrom (__SYS_network+8) +# define SYS_send (__SYS_network+9) +# define SYS_sendto (__SYS_network+10) +# define SYS_setsockopt (__SYS_network+11) +# define SYS_socket (__SYS_network+12) +# define SYS_nnetsocket (__SYS_network+13) +#else +# define SYS_nnetsocket (__SYS_network+2) +#endif + #else # define SYS_nnetsocket __SYS_network -#endif +#endif /* CONFIG_NET */ /* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */ diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 82389b36f15..20440db93c5 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -25,6 +25,7 @@ "fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int" "get_errno","errno.h","","int" "getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*" +"gethostname","unistd.h","defined(CONFIG_NET)","int","FAR char*","size_t" "getpid","unistd.h","","pid_t" "getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*" "ioctl","sys/ioctl.h","!defined(CONFIG_LIBC_IOCTL_VARIADIC) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","int","int","unsigned long" @@ -120,7 +121,8 @@ "sendfile","sys/sendfile.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t*","size_t" "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" "set_errno","errno.h","","void","int" -"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*","const char*","int" +"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*","FAR const char*","int" +"sethostname","unistd.h","defined(CONFIG_NET)","int","FAR const char*","size_t" "setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t" "shmat", "sys/shm.h", "defined(CONFIG_MM_SHM)", "FAR void *", "int", "FAR const void *", "int" "shmctl", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "int", "int", "FAR struct shmid_ds *" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index b3838689ef6..83abcb7f1e4 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -298,9 +298,15 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(unsetenv, 1, STUB_unsetenv) #endif +/* The following are defined only if networking is supported */ + +#ifdef CONFIG_NET + SYSCALL_LOOKUP(gethostname, 2, STUB_gethostname) + SYSCALL_LOOKUP(sethostname, 2, STUB_sethostname) + /* The following are defined only if networking AND sockets are supported */ -#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) +#if CONFIG_NSOCKET_DESCRIPTORS > 0 SYSCALL_LOOKUP(accept, 3, STUB_accept) SYSCALL_LOOKUP(bind, 3, STUB_bind) SYSCALL_LOOKUP(connect, 3, STUB_connect) @@ -313,6 +319,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) SYSCALL_LOOKUP(setsockopt, 5, STUB_setsockopt) SYSCALL_LOOKUP(socket, 3, STUB_socket) #endif +#endif /* CONFIG_NET */ /* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */ diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index aa9d17a508e..28fe2f2dc03 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -315,6 +315,11 @@ uintptr_t STUB_setenv(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); uintptr_t STUB_unsetenv(int nbr, uintptr_t parm1); +/* The following are defined only if networking is upported */ + +uintptr_t STUB_gethostname(int nbr, uintptr_t parm1, uintptr_t parm2); +uintptr_t STUB_sethostname(int nbr, uintptr_t parm1, uintptr_t parm2); + /* The following are defined only if networking AND sockets are supported */ uintptr_t STUB_accept(int nbr, uintptr_t parm1, uintptr_t parm2, diff --git a/tools/README.txt b/tools/README.txt index 10b6ce8dae3..604a4c7055d 100644 --- a/tools/README.txt +++ b/tools/README.txt @@ -611,6 +611,11 @@ testbuild.sh configuration names depends on the underlying architecture of the configured board. + NOTE: The environment variable APPSDIR should be set to the relative + path to the application directory when running this script like: + + $ export APPSDIR=../apps + zipme.sh --------