Subversion Repositories HelenOS

Rev

Rev 2209 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2209 Rev 2229
Line 34... Line 34...
34
 
34
 
35
#include <stdarg.h>
35
#include <stdarg.h>
36
#include <stdio.h>
36
#include <stdio.h>
37
#include <unistd.h>
37
#include <unistd.h>
38
#include <io/printf_core.h>
38
#include <io/printf_core.h>
39
#include <futex.h>
-
 
40
 
-
 
41
atomic_t printf_futex = FUTEX_INITIALIZER;
-
 
42
 
39
 
43
static int vprintf_write(const char *str, size_t count, void *unused)
40
static int vprintf_write(const char *str, size_t count, void *unused)
44
{
41
{
45
    return write(1, str, count);
42
    return write(1, str, count);
46
}
43
}
Line 52... Line 49...
52
 */
49
 */
53
int vprintf(const char *fmt, va_list ap)
50
int vprintf(const char *fmt, va_list ap)
54
{
51
{
55
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
52
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
56
   
53
   
57
    futex_down(&printf_futex);
-
 
58
    int ret = printf_core(fmt, &ps, ap);
54
    int ret = printf_core(fmt, &ps, ap);
59
    futex_up(&printf_futex);
-
 
60
   
55
   
61
    return ret;
56
    return ret;
62
}
57
}
63
 
58
 
64
/** @}
59
/** @}