Add ftruncate() and vsyslog() from gregkh via mort
diff --git a/include/syslog.h b/include/syslog.h
index b6c0acf..551527a 100644
--- a/include/syslog.h
+++ b/include/syslog.h
@@ -5,6 +5,7 @@
#ifndef _SYSLOG_H
#define _SYSLOG_H
+#include <stdio.h>
#include <klibc/extern.h>
/* Alert levels */
@@ -48,6 +49,7 @@
__extern void openlog(const char *, int, int);
__extern void syslog(int, const char *, ...);
+__extern void vsyslog(int, const char *, va_list);
__extern void closelog(void);
#endif /* _SYSLOG_H */
diff --git a/include/unistd.h b/include/unistd.h
index a9b434c..36c486f 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -82,6 +82,7 @@
__extern int flock(int, int);
__extern int fsync(int);
__extern int fdatasync(int);
+__extern int ftruncate(int, off_t);
__extern int pause(void);
__extern unsigned int alarm(unsigned int);
diff --git a/klibc/SYSCALLS b/klibc/SYSCALLS
index 1ec94ac..802f8a1 100644
--- a/klibc/SYSCALLS
+++ b/klibc/SYSCALLS
@@ -103,6 +103,7 @@
int fsync(int)
int readv(int, const struct iovec *, int)
int writev(int, const struct iovec *, int)
+int ftruncate(int, off_t)
#
# Signal operations
diff --git a/klibc/include/syslog.h b/klibc/include/syslog.h
index b6c0acf..551527a 100644
--- a/klibc/include/syslog.h
+++ b/klibc/include/syslog.h
@@ -5,6 +5,7 @@
#ifndef _SYSLOG_H
#define _SYSLOG_H
+#include <stdio.h>
#include <klibc/extern.h>
/* Alert levels */
@@ -48,6 +49,7 @@
__extern void openlog(const char *, int, int);
__extern void syslog(int, const char *, ...);
+__extern void vsyslog(int, const char *, va_list);
__extern void closelog(void);
#endif /* _SYSLOG_H */
diff --git a/klibc/include/unistd.h b/klibc/include/unistd.h
index a9b434c..36c486f 100644
--- a/klibc/include/unistd.h
+++ b/klibc/include/unistd.h
@@ -82,6 +82,7 @@
__extern int flock(int, int);
__extern int fsync(int);
__extern int fdatasync(int);
+__extern int ftruncate(int, off_t);
__extern int pause(void);
__extern unsigned int alarm(unsigned int);
diff --git a/klibc/syslog.c b/klibc/syslog.c
index b031d4f..10a2dce 100644
--- a/klibc/syslog.c
+++ b/klibc/syslog.c
@@ -40,9 +40,8 @@
id[MAXID] = '\0'; /* Make sure it's null-terminated */
}
-void syslog(int prio, const char *format, ...)
+void vsyslog(int prio, const char *format, va_list ap)
{
- va_list ap;
char buf[BUFLEN];
int rv, len;
int fd;
@@ -61,10 +60,8 @@
if ( *id )
len += sprintf(buf+3, "%s: ", id);
-
- va_start(ap, format);
+
rv = vsnprintf(buf+len, BUFLEN-len, format, ap);
- va_end(ap);
len += rv;
if ( len > BUFLEN-1 ) len = BUFLEN-1;
@@ -72,3 +69,12 @@
write(fd, buf, len+1);
}
+
+void syslog(int prio, const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vsyslog(prio, format, ap);
+ va_end(ap);
+}