flusher.c File Reference

TCP-based Server flushing to various output media. More...

Go to the source code of this file.

Functions

static int wait_for_flush_request (void)
 Wait for an IPC from the main thread.
static int answer_flush_request (void)
 Answer a flush-request from the main thread.
static void thread_loop (void)
 Thread-loop: Wait for a client and handle it's requests.
static int general_flush_buffer (int head, int(*flush)(const char *, int))
static int console_flush (const char *addr, int size)
 Flush the buffer to the local console.
int do_flush_buffer (void)
 Flush the buffered data.
int flush_buffer (void)
 Request flushing the buffer.
static void flush_signaller (void)
 flush-signaller - request flushing
int flusher_init (void)
 Initialize the tcp-handling stuff.

Variables

const unsigned client_socket = 0
int flusher_prio
l4_threadid_t main_thread
l4_threadid_t flusher_thread
static l4_threadid_t flush_requester


Detailed Description

TCP-based Server flushing to various output media.

Date:
03/02/2001
Author:
Jork Loeser <jork.loeser@inf.tu-dresden.de>
This file includes the code to flush the buffered log-data. Network-specific things are handled in tcpip.c.

The communication with the main thread is done by waiting for IPCs from the main thread. Our own OSKIT-Code is activated by either our actions, or by actions due to interrupts/exceptions. We notice an interrupt/exception because our wait-IPC is aborted. In reaction to this, we check if something happened on the net.

In detail, this file hanles:

Function-Interface: flusher_init(), flush_buffer, do_flush_buffer().

Definition in file flusher.c.


Function Documentation

static int console_flush ( const char *  addr,
int  size 
) [static]

Flush the buffer to the local console.

Return values:
0 on success, error otherwise.

Definition at line 196 of file flusher.c.

Referenced by do_flush_buffer().

int do_flush_buffer ( void   ) 

Flush the buffered data.

Context: Flusher thread.

net_flush_buffer() is exported from tcpip.c, console_flush() is a local function.

Definition at line 224 of file flusher.c.

References CONFIG_LOG_RINGBUFFER, and console_flush().

Referenced by thread_loop().

int flush_buffer ( void   ) 

Request flushing the buffer.

This function blocks until the buffer is flushed. If we are in muxed mode (flush_muxed==1), this function also flushes the binary buffers.

Context: Main thread, flush-signaller thread

Return values:
0 on success, error otherwise.

Definition at line 259 of file flusher.c.

Referenced by flush_signaller().

static void flush_signaller ( void   )  [static]

flush-signaller - request flushing

This function runs at a very low priority, and requests flushing the buffer, if it is non-empty.

Precondition:
main_thread and flusher_thread must be set.

Definition at line 294 of file flusher.c.

References flush_buffer().

Referenced by flusher_init().

int flusher_init ( void   ) 

Initialize the tcp-handling stuff.

This function creates the TCP/IP handling thread. Then it waits for its startup-IPC.

Context: Main thread.

Returns:
0 on success

Definition at line 332 of file flusher.c.

References flush_signaller(), and thread_loop().

static void thread_loop ( void   )  [static]

Thread-loop: Wait for a client and handle it's requests.

This function opens the bound socket, and triggers the accept on it. Then it sends the up-and-running IPC to it's parrent and waits for clients to connect. If we have a client, wait for IPC's from the main thread requesting a buffer-flush.

Alternatively, this IPC may be aborted by local interrupt handling. If we realize this, we check the network stack.

As reaction to creation, we send an IPC to main_thread, dw0 contains an error code, 0 means success.

Definition at line 97 of file flusher.c.

References answer_flush_request(), CONFIG_LOG_IPC, CONFIG_LOG_TCPIP, do_flush_buffer(), and wait_for_flush_request().

Referenced by flusher_init().

static int wait_for_flush_request ( void   )  [static]

Wait for an IPC from the main thread.

The main thread will do an IPC-call to indicate a full buffer and wait for successful flushing..

Definition at line 62 of file flusher.c.

References CONFIG_LOG_IPC.

Referenced by thread_loop().


Generated on Wed Apr 11 06:40:52 2012 for Logging and output facility for DROPS by  doxygen 1.5.6