Add syslog system calls

This commit is contained in:
Gregory Nutt 2014-10-08 19:37:10 -06:00
parent ec57ab6391
commit 323084f32f
7 changed files with 56 additions and 17 deletions

View file

@ -8802,6 +8802,7 @@
* drivers/: Correct everything under nuttx/drivers, nuttx/arch, nuttx/net,
nuttx/binfmt, and nuttx/configs to use the corrected syslog interfaces
(2014-10-8).
* libc/syslog: Move syslog logic from libc/misc and libc/stdio to
libc/syslog (2014-10-8).
* libc/syslog and fs/syslog: Move syslog logic from libc/misc and
libc/stdio to libc/syslog and fs/syslog. Also move some syslog logic
from fs/driver to fs/syslog (2014-10-8).
* fs/syslog/fs_syslogmask.c: Implement syslogmask() (2014-10-8).

View file

@ -82,23 +82,29 @@
#define SYS_sched_yield (CONFIG_SYS_RESERVED+12)
#define SYS_set_errno (CONFIG_SYS_RESERVED+13)
/* SYSLOG */
#define SYS_vsyslog (CONFIG_SYS_RESERVED+14)
#define SYS_lowvsyslog (CONFIG_SYS_RESERVED+15)
#define SYS_setlogmask (CONFIG_SYS_RESERVED+16)
/* Semaphores */
#define SYS_sem_destroy (CONFIG_SYS_RESERVED+14)
#define SYS_sem_post (CONFIG_SYS_RESERVED+15)
#define SYS_sem_timedwait (CONFIG_SYS_RESERVED+16)
#define SYS_sem_trywait (CONFIG_SYS_RESERVED+17)
#define SYS_sem_wait (CONFIG_SYS_RESERVED+18)
#define SYS_sem_destroy (CONFIG_SYS_RESERVED+17)
#define SYS_sem_post (CONFIG_SYS_RESERVED+18)
#define SYS_sem_timedwait (CONFIG_SYS_RESERVED+19)
#define SYS_sem_trywait (CONFIG_SYS_RESERVED+20)
#define SYS_sem_wait (CONFIG_SYS_RESERVED+21)
/* Named semaphores */
#ifdef CONFIG_FS_NAMED_SEMAPHORES
# define SYS_sem_open (CONFIG_SYS_RESERVED+19)
# define SYS_sem_close (CONFIG_SYS_RESERVED+20)
# define SYS_sem_unlink (CONFIG_SYS_RESERVED+21)
# define __SYS_task_create (CONFIG_SYS_RESERVED+22)
# define SYS_sem_open (CONFIG_SYS_RESERVED+22)
# define SYS_sem_close (CONFIG_SYS_RESERVED+23)
# define SYS_sem_unlink (CONFIG_SYS_RESERVED+24)
# define __SYS_task_create (CONFIG_SYS_RESERVED+25)
#else
# define __SYS_task_create (CONFIG_SYS_RESERVED+19)
# define __SYS_task_create (CONFIG_SYS_RESERVED+22)
#endif
/* Task creation APIs based on global entry points cannot be use with

View file

@ -49,6 +49,19 @@
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
/* Some interfaces in this file are currently only available within the
* kernel. They could are available to applicaions in the flat build and
* could be made available in the protected and kernel builds IF system
* calls were added.
*/
#if !defined(CONFIG_BUILD_PROTECTED) && !defined(CONFIG_BUILD_KERNEL)
# undef __KERNEL__
# define __KERNEL__ 1
#endif
/* syslog interface *********************************************************/
/* The option argument to openlog() is an OR of any of these:
*
* LOG_CONS - Write directly to system console if there is an error
@ -136,7 +149,7 @@ void closelog(void);
int syslog(int priority, FAR const char *format, ...);
int vsyslog(int priority, FAR const char *src, va_list ap);
#ifdef CONFIG_ARCH_LOWPUTC /* Non-standard */
#ifdef CONFIG_ARCH_LOWPUTC
/* These are non-standard, low-level system logging interface. The
* difference between syslog() and lowsyslog() is that the syslog()
* interface writes to the syslog device (usually fd=1, stdout) whereas
@ -167,9 +180,9 @@ int lowvsyslog(int priority, FAR const char *format, va_list ap);
int setlogmask(int mask);
/* Enable or disable syslog output */
#if defined(CONFIG_SYSLOG_ENABLE) && defined(__KERNEL__)
/* Non-standard interface to enable or disable syslog output */
#ifdef CONFIG_SYSLOG_ENABLE /* Non-standard */
void syslog_enable(bool enable);
#endif

View file

@ -156,7 +156,6 @@
"strtoul","stdlib.h","","unsigned long","const char *","char **","int"
"strtoull","stdlib.h","defined(CONFIG_HAVE_LONG_LONG)","unsigned long long","const char *","char **","int"
"syslog","syslog.h","","int","int","FAR const char *","..."
"syslog_enable","syslog.h","defined(CONFIG_SYSLOG_ENABLE)","void","bool"
"tcflush","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int"
"tcgetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","FAR struct termios *"
"tcsetattr","termios.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_SERIAL_TERMIOS)","int","int","int","FAR const struct termios *"

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -29,6 +29,7 @@
"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"
"lowvsyslog","syslog.h","","int","int","FAR const char *","va_list"
"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"
@ -118,6 +119,7 @@
"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"
"setlogmask","syslog.h","","int","int"
"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 *"
@ -150,6 +152,7 @@
"up_assert","assert.h","","void","FAR const uint8_t*","int"
#"up_assert","assert.h","","void"
"vfork","unistd.h","defined(CONFIG_ARCH_HAVE_VFORK)","pid_t"
"vsyslog","syslog.h","","int","int","FAR const char *","va_list"
"wait","sys/wait.h","defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT)","pid_t","int*"
"waitid","sys/wait.h","defined(CONFIG_SCHED_WAITPID) && defined(CONFIG_SCHED_HAVE_PARENT)","int","idtype_t","id_t"," FAR siginfo_t *","int"
"waitpid","sys/wait.h","defined(CONFIG_SCHED_WAITPID)","pid_t","pid_t","int*","int"

Can't render this file because it has a wrong number of fields in line 2.

View file

@ -58,6 +58,12 @@ SYSCALL_LOOKUP(sched_unlock, 0, STUB_sched_unlock)
SYSCALL_LOOKUP(sched_yield, 0, STUB_sched_yield)
SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno)
/* SYSLOG */
SYSCALL_LOOKUP(vsyslog, 3, SYS_vsyslog)
SYSCALL_LOOKUP(lowvsyslog, 3, SYS_lowvsyslog)
SYSCALL_LOOKUP(setlogmask, 1, SYS_setlogmask)
/* Semaphores */
SYSCALL_LOOKUP(sem_destroy, 2, STUB_sem_destroy)

View file

@ -75,6 +75,17 @@ uintptr_t STUB_sched_setscheduler(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3);
uintptr_t STUB_sched_unlock(int nbr);
uintptr_t STUB_sched_yield(int nbr);
/* SYSLOG */
uintptr_t STUB_vsyslog(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm2);
uintptr_t STUB_lowvsyslog(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm2);
uintptr_t STUB_setlogmask(iint nbr, uintptr_t parm1);
/* Semaphores */
uintptr_t STUB_sem_close(int nbr, uintptr_t parm1);
uintptr_t STUB_sem_destroy(int nbr, uintptr_t parm1);
uintptr_t STUB_sem_open(int nbr, uintptr_t parm1, uintptr_t parm2,