Changeset 984a9ba in mainline for uspace/srv/logger


Ignore:
Timestamp:
2018-07-05T09:34:09Z (7 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
63d46341
Parents:
76f566d
Message:

do not expose the call capability handler from the async framework

Keep the call capability handler encapsulated within the async framework
and do not expose it explicitly via its API. Use the pointer to
ipc_call_t as the sole object identifying an IPC call in the code that
uses the async framework.

This plugs a major leak in the abstraction and also simplifies both the
async framework (slightly) and all IPC servers.

Location:
uspace/srv/logger
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/logger/ctl.c

    r76f566d r984a9ba  
    6363}
    6464
    65 void logger_connection_handler_control(cap_call_handle_t chandle)
     65void logger_connection_handler_control(ipc_call_t *icall)
    6666{
    6767        errno_t rc;
    6868        int fd;
    6969
    70         async_answer_0(chandle, EOK);
     70        async_answer_0(icall, EOK);
    7171        logger_log("control: new client.\n");
    7272
    7373        while (true) {
    7474                ipc_call_t call;
    75                 cap_call_handle_t chandle = async_get_call(&call);
     75                async_get_call(&call);
    7676
    7777                if (!IPC_GET_IMETHOD(call))
     
    8181                case LOGGER_CONTROL_SET_DEFAULT_LEVEL:
    8282                        rc = set_default_logging_level(IPC_GET_ARG1(call));
    83                         async_answer_0(chandle, rc);
     83                        async_answer_0(&call, rc);
    8484                        break;
    8585                case LOGGER_CONTROL_SET_LOG_LEVEL:
    8686                        rc = handle_log_level_change(IPC_GET_ARG1(call));
    87                         async_answer_0(chandle, rc);
     87                        async_answer_0(&call, rc);
    8888                        break;
    8989                case LOGGER_CONTROL_SET_ROOT:
     
    9393                                vfs_put(fd);
    9494                        }
    95                         async_answer_0(chandle, rc);
     95                        async_answer_0(&call, rc);
    9696                        break;
    9797                default:
    98                         async_answer_0(chandle, EINVAL);
     98                        async_answer_0(&call, EINVAL);
    9999                        break;
    100100                }
  • uspace/srv/logger/logger.h

    r76f566d r984a9ba  
    9898
    9999
    100 void logger_connection_handler_control(cap_call_handle_t);
    101 void logger_connection_handler_writer(cap_call_handle_t);
     100void logger_connection_handler_control(ipc_call_t *);
     101void logger_connection_handler_writer(ipc_call_t *);
    102102
    103103void parse_initial_settings(void);
  • uspace/srv/logger/main.c

    r76f566d r984a9ba  
    4848#include "logger.h"
    4949
    50 static void connection_handler_control(cap_call_handle_t icall_handle, ipc_call_t *icall,
    51     void *arg)
     50static void connection_handler_control(ipc_call_t *icall, void *arg)
    5251{
    53         logger_connection_handler_control(icall_handle);
     52        logger_connection_handler_control(icall);
    5453}
    5554
    56 static void connection_handler_writer(cap_call_handle_t icall_handle, ipc_call_t *icall,
    57     void *arg)
     55static void connection_handler_writer(ipc_call_t *icall, void *arg)
    5856{
    59         logger_connection_handler_writer(icall_handle);
     57        logger_connection_handler_writer(icall);
    6058}
    6159
  • uspace/srv/logger/writer.c

    r76f566d r984a9ba  
    9494}
    9595
    96 void logger_connection_handler_writer(cap_call_handle_t chandle)
     96void logger_connection_handler_writer(ipc_call_t *icall)
    9797{
    9898        logger_log_t *log;
     
    100100
    101101        /* Acknowledge the connection. */
    102         async_answer_0(chandle, EOK);
     102        async_answer_0(icall, EOK);
    103103
    104104        logger_log("writer: new client.\n");
     
    109109        while (true) {
    110110                ipc_call_t call;
    111                 cap_call_handle_t chandle = async_get_call(&call);
     111                async_get_call(&call);
    112112
    113113                if (!IPC_GET_IMETHOD(call))
     
    118118                        log = handle_create_log(IPC_GET_ARG1(call));
    119119                        if (log == NULL) {
    120                                 async_answer_0(chandle, ENOMEM);
     120                                async_answer_0(&call, ENOMEM);
    121121                                break;
    122122                        }
    123123                        if (!register_log(&registered_logs, log)) {
    124124                                log_unlock(log);
    125                                 async_answer_0(chandle, ELIMIT);
     125                                async_answer_0(&call, ELIMIT);
    126126                                break;
    127127                        }
    128128                        log_unlock(log);
    129                         async_answer_1(chandle, EOK, (sysarg_t) log);
     129                        async_answer_1(&call, EOK, (sysarg_t) log);
    130130                        break;
    131131                case LOGGER_WRITER_MESSAGE:
    132132                        rc = handle_receive_message(IPC_GET_ARG1(call),
    133133                            IPC_GET_ARG2(call));
    134                         async_answer_0(chandle, rc);
     134                        async_answer_0(&call, rc);
    135135                        break;
    136136                default:
    137                         async_answer_0(chandle, EINVAL);
     137                        async_answer_0(&call, EINVAL);
    138138                        break;
    139139                }
     
    144144}
    145145
    146 
    147146/**
    148147 * @}
Note: See TracChangeset for help on using the changeset viewer.