logchannel.c

Go to the documentation of this file.
00001 /*!
00002  * \file   log/lib/src/logchannel.c
00003  * \brief  Communicate with the logserver, printf output-function
00004  *
00005  * \date   1999/09/15
00006  * \author Jork Loeser <jork.loeser@inf.tu-dresden.de>
00007  *
00008  */
00009 /* (c) 2003 Technische Universitaet Dresden
00010  * This file is part of DROPS, which is distributed under the terms of the
00011  * GNU General Public License 2. Please see the COPYING file for details.
00012  */
00013 
00014 #include <l4/sys/types.h>
00015 #include "log_comm.h"
00016 #include "internal.h"
00017 #include <l4/log/l4log.h>
00018 #include <l4/log/server.h>
00019 #include <l4/env/errno.h>
00020 #include "log-client.h"
00021 
00022 /*!\brief Open a binary logging connection
00023  *
00024  * \param channel       the channel to open
00025  * \param page          an fpage containing buffer memory used with
00026  *                      LOG_channel_write() later
00027  *
00028  * \return \see channel_open()
00029  *
00030  * Marshalling:
00031  * - d0/d1 fpage
00032  * - d2/d3 0
00033  * - d4    channel
00034  */
00035 int LOG_channel_open(int channel, l4_fpage_t page)
00036 {
00037   int ret;
00038   l4_snd_fpage_t f;
00039   CORBA_Environment env = dice_default_environment;
00040 
00041   if (page.fp.size > LOG_LOG2_CHANNEL_BUFFER_SIZE)
00042     return -L4_ENOMEM;
00043   if (check_server())
00044     return -L4_ENOTFOUND;
00045 
00046   f.snd_base = 0;
00047   f.fpage = page;
00048   ret = log_channel_open_call (&log_server, f, channel, &env);
00049   if (DICE_HAS_EXCEPTION(&env))
00050     return -DICE_IPC_ERROR(&env);
00051   
00052   return ret;
00053 }
00054 
00055 /*!\brief Write data to a binary logging connection
00056  *
00057  * \param id            connection identifier
00058  * \param off           offset of data in the connection buffer
00059  * \param size          size of data to write
00060  *
00061  * \return \see channel_write()
00062  *
00063  * Marshalling:
00064  * - d1 channel id
00065  * - d2 off
00066  * - d3 length
00067  */
00068 int LOG_channel_write(int id, unsigned off, unsigned size)
00069 {
00070   int ret;
00071   CORBA_Environment env = dice_default_environment;
00072 
00073   if (!initialized)
00074     return -L4_EIPC;
00075 
00076   ret = log_channel_write_call (&log_server, id, off, size, &env);
00077   if (DICE_HAS_EXCEPTION(&env))
00078     return -DICE_IPC_ERROR(&env);
00079 
00080   return ret;
00081 }
00082 
00083 /*!\brief Flush a binary logging connection
00084  *
00085  * \param id            connection identifier
00086  *
00087  * \return \see channel_flush()
00088  *
00089  * Marshalling:
00090  * - d1 channel id
00091  */
00092 int LOG_channel_flush(int id)
00093 {
00094   int ret;
00095   CORBA_Environment env = dice_default_environment;
00096 
00097   if (!initialized)
00098     return -L4_EIPC;
00099 
00100   ret = log_channel_flush_call (&log_server, id, &env);
00101   if (DICE_HAS_EXCEPTION(&env))
00102     return -DICE_IPC_ERROR(&env);
00103   
00104   return ret;
00105 }
00106 
00107 /*!\brief Close a binary logging connection
00108  *
00109  * \param id            connection identifier
00110  *
00111  * \return \see channel_close()
00112  *
00113  * Marshalling:
00114  * - d1 channel id
00115  */
00116 int LOG_channel_close(int id)
00117 {
00118   int ret;
00119   CORBA_Environment env = dice_default_environment;
00120 
00121   if (!initialized)
00122     return -L4_EIPC;
00123 
00124   ret = log_channel_close_call (&log_server, id, &env);
00125   if (DICE_HAS_EXCEPTION(&env))
00126     return -DICE_IPC_ERROR(&env);
00127   
00128   return ret;
00129 }

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