aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2003-11-19 20:32:08 +0000
committerH. Peter Anvin <hpa@zytor.com>2003-11-19 20:32:08 +0000
commit6ffe26a3fda44ebecee6b18cc5fb363bbdb1a381 (patch)
tree648c09ee1aac9518e54f4902467426e6a23f8276
parent5b8b6534e42c3937d92cc80da9d959e7bc9a8b70 (diff)
downloadklibc-6ffe26a3fda44ebecee6b18cc5fb363bbdb1a381.tar.gz
Add ftruncate() and vsyslog() from gregkh via mortklibc-0.82
-rw-r--r--include/syslog.h2
-rw-r--r--include/unistd.h1
-rw-r--r--klibc/SYSCALLS1
-rw-r--r--klibc/include/syslog.h2
-rw-r--r--klibc/include/unistd.h1
-rw-r--r--klibc/syslog.c16
6 files changed, 18 insertions, 5 deletions
diff --git a/include/syslog.h b/include/syslog.h
index b6c0acfea1df7..551527a04228e 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 a9b434c16b959..36c486f49d15a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -82,6 +82,7 @@ __extern int ioctl(int, int, void *);
__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 1ec94acec6137..802f8a1711f31 100644
--- a/klibc/SYSCALLS
+++ b/klibc/SYSCALLS
@@ -103,6 +103,7 @@ int poll(struct pollfd *, nfds_t, long)
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 b6c0acfea1df7..551527a04228e 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 a9b434c16b959..36c486f49d15a 100644
--- a/klibc/include/unistd.h
+++ b/klibc/include/unistd.h
@@ -82,6 +82,7 @@ __extern int ioctl(int, int, void *);
__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 b031d4f0e7946..10a2dce40543d 100644
--- a/klibc/syslog.c
+++ b/klibc/syslog.c
@@ -40,9 +40,8 @@ void openlog(const char *ident, int option, int facility)
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 @@ void syslog(int prio, const char *format, ...)
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 @@ void syslog(int prio, const char *format, ...)
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);
+}