Subversion Repositories HelenOS

Rev

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

Rev 2071 Rev 2209
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>
39
 
40
 
40
int vprintf_write(const char *str, size_t count, void *unused);
41
atomic_t printf_futex = FUTEX_INITIALIZER;
41
 
42
 
42
int vprintf_write(const char *str, size_t count, void *unused)
43
static int vprintf_write(const char *str, size_t count, void *unused)
43
{
44
{
44
    return write(1, str, count);
45
    return write(1, str, count);
45
}
46
}
46
 
47
 
47
/** Print formatted text.
48
/** Print formatted text.
Line 49... Line 50...
49
 * @param ap    format parameters
50
 * @param ap    format parameters
50
 * \see For more details about format string see printf_core.
51
 * \see For more details about format string see printf_core.
51
 */
52
 */
52
int vprintf(const char *fmt, va_list ap)
53
int vprintf(const char *fmt, va_list ap)
53
{
54
{
54
    struct printf_spec ps = {(int(*)(void *, size_t, void *))vprintf_write, NULL};
55
    struct printf_spec ps = {(int(*)(void *, size_t, void *)) vprintf_write, NULL};
-
 
56
   
-
 
57
    futex_down(&printf_futex);
55
    return printf_core(fmt, &ps, ap);
58
    int ret = printf_core(fmt, &ps, ap);
-
 
59
    futex_up(&printf_futex);
56
 
60
   
-
 
61
    return ret;
57
}
62
}
58
 
63
 
59
/** @}
64
/** @}
60
 */
65
 */