Merge branch 'master' of gitlab.ops-class.org:staff/os161

This commit is contained in:
Guru Prasad Srinivasa committed 2016-03-01 02:50:11 -05:00
commit b65a333d34
4 files changed
+7 -25

No files matched your search

+4 -21
View File
@@ -16,9 +16,9 @@ tprintf(const char *fmt, ...)
int chars; int chars;
va_list ap; va_list ap;
if (strcmp(SECRET, "") != 0) { #ifdef SECRET_TESTING
return 0; return 0;
} #endif
va_start(ap, fmt); va_start(ap, fmt);
chars = vprintf(fmt, ap); chars = vprintf(fmt, ap);
@@ -34,9 +34,9 @@ nprintf(const char *fmt, ...)
int chars; int chars;
va_list ap; va_list ap;
if (strcmp(SECRET, "") == 0) { #ifndef SECRET_TESTING
return 0; return 0;
} #endif
va_start(ap, fmt); va_start(ap, fmt);
chars = vprintf(fmt, ap); chars = vprintf(fmt, ap);
@@ -44,20 +44,3 @@ nprintf(const char *fmt, ...)
return chars; return chars;
} }
/* printf variant that prepends the kernel secret */
int
printsf(const char *fmt, ...)
{
int chars;
va_list ap;
if (strcmp(SECRET, "") != 0) {
printf("%s: ", SECRET);
}
va_start(ap, fmt);
chars = vprintf(fmt, ap);
va_end(ap);
return chars;
}
+3 -1
View File
@@ -19,13 +19,15 @@
// Hack for allocating userspace memory without malloc. // Hack for allocating userspace memory without malloc.
#define BUFFER_SIZE 4096 #define BUFFER_SIZE 4096
#ifndef _KERNEL
static char temp_buffer[BUFFER_SIZE]; static char temp_buffer[BUFFER_SIZE];
static char write_buffer[BUFFER_SIZE]; static char write_buffer[BUFFER_SIZE];
#endif
static inline void * _alloc(size_t size) static inline void * _alloc(size_t size)
{ {
#ifdef _KERNEL #ifdef _KERNEL
(void)temp_buffer;
return kmalloc(size); return kmalloc(size);
#else #else
(void)size; (void)size;
-1
View File
@@ -60,7 +60,6 @@ int vsnprintf(char *buf, size_t len, const char *fmt, __va_list ap);
int tprintf(const char *fmt, ...); int tprintf(const char *fmt, ...);
int nprintf(const char *fmt, ...); int nprintf(const char *fmt, ...);
int printsf(const char *fmt, ...);
/* Print the argument string and then a newline. Returns 0 or -1 on error. */ /* Print the argument string and then a newline. Returns 0 or -1 on error. */
int puts(const char *); int puts(const char *);
-2
View File
@@ -39,8 +39,6 @@ time_t __time(time_t *secs, unsigned long *nsecs);
int tprintf(const char *fmt, ...); int tprintf(const char *fmt, ...);
int nprintf(const char *fmt, ...); int nprintf(const char *fmt, ...);
int printsf(const char *fmt, ...);
#ifdef DECLARE_NTOHLL #ifdef DECLARE_NTOHLL
uint64_t ntohll(uint64_t); uint64_t ntohll(uint64_t);