Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/sysinfo/stats.c

    rc0699467 r059a8e4  
    8383 *
    8484 * @param item Sysinfo item (unused).
     85 * @param data Unused.
    8586 *
    8687 * @return System uptime (in secords).
    8788 *
    8889 */
    89 static sysarg_t get_stats_uptime(struct sysinfo_item *item)
     90static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data)
    9091{
    9192        /* This doesn't have to be very accurate */
     
    9899 * @param size    Size of the returned data.
    99100 * @param dry_run Do not get the data, just calculate the size.
     101 * @param data    Unused.
    100102 *
    101103 * @return Data containing several stats_cpu_t structures.
     
    104106 */
    105107static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
    106     bool dry_run)
     108    bool dry_run, void *data)
    107109{
    108110        *size = sizeof(stats_cpu_t) * config.cpu_count;
     
    249251        ASSERT(interrupts_disabled());
    250252        ASSERT(irq_spinlock_locked(&task->lock));
    251 
     253       
    252254        stats_task->task_id = task->taskid;
    253255        str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name);
     
    293295 * @param size    Size of the returned data.
    294296 * @param dry_run Do not get the data, just calculate the size.
     297 * @param data    Unused.
    295298 *
    296299 * @return Data containing several stats_task_t structures.
     
    299302 */
    300303static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
    301     bool dry_run)
     304    bool dry_run, void *data)
    302305{
    303306        /* Messing with task structures, avoid deadlock */
     
    350353        ASSERT(interrupts_disabled());
    351354        ASSERT(irq_spinlock_locked(&thread->lock));
    352 
     355       
    353356        stats_thread->thread_id = thread->tid;
    354357        stats_thread->task_id = thread->task->taskid;
     
    398401 * @param size    Size of the returned data.
    399402 * @param dry_run Do not get the data, just calculate the size.
     403 * @param data    Unused.
    400404 *
    401405 * @return Data containing several stats_task_t structures.
     
    404408 */
    405409static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
    406     bool dry_run)
     410    bool dry_run, void *data)
    407411{
    408412        /* Messing with threads structures, avoid deadlock */
     
    451455 * @param name    Task ID (string-encoded number).
    452456 * @param dry_run Do not get the data, just calculate the size.
     457 * @param data    Unused.
    453458 *
    454459 * @return Sysinfo return holder. The type of the returned
     
    460465 *
    461466 */
    462 static sysinfo_return_t get_stats_task(const char *name, bool dry_run)
     467static sysinfo_return_t get_stats_task(const char *name, bool dry_run,
     468    void *data)
    463469{
    464470        /* Initially no return value */
     
    468474        /* Parse the task ID */
    469475        task_id_t task_id;
    470         if (str_uint64(name, NULL, 0, true, &task_id) != EOK)
     476        if (str_uint64_t(name, NULL, 0, true, &task_id) != EOK)
    471477                return ret;
    472478       
     
    520526 * @param name    Thread ID (string-encoded number).
    521527 * @param dry_run Do not get the data, just calculate the size.
     528 * @param data    Unused.
    522529 *
    523530 * @return Sysinfo return holder. The type of the returned
     
    529536 *
    530537 */
    531 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run)
     538static sysinfo_return_t get_stats_thread(const char *name, bool dry_run,
     539    void *data)
    532540{
    533541        /* Initially no return value */
     
    537545        /* Parse the thread ID */
    538546        thread_id_t thread_id;
    539         if (str_uint64(name, NULL, 0, true, &thread_id) != EOK)
     547        if (str_uint64_t(name, NULL, 0, true, &thread_id) != EOK)
    540548                return ret;
    541549       
     
    586594 * @param size    Size of the returned data.
    587595 * @param dry_run Do not get the data, just calculate the size.
     596 * @param data    Unused.
    588597 *
    589598 * @return Data containing several stats_exc_t structures.
     
    592601 */
    593602static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
    594     bool dry_run)
     603    bool dry_run, void *data)
    595604{
    596605        *size = sizeof(stats_exc_t) * IVT_ITEMS;
     
    634643 * @param name    Exception number (string-encoded number).
    635644 * @param dry_run Do not get the data, just calculate the size.
     645 * @param data    Unused.
    636646 *
    637647 * @return Sysinfo return holder. The type of the returned
     
    643653 *
    644654 */
    645 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run)
     655static sysinfo_return_t get_stats_exception(const char *name, bool dry_run,
     656    void *data)
    646657{
    647658        /* Initially no return value */
     
    651662        /* Parse the exception number */
    652663        uint64_t excn;
    653         if (str_uint64(name, NULL, 0, true, &excn) != EOK)
     664        if (str_uint64_t(name, NULL, 0, true, &excn) != EOK)
    654665                return ret;
    655666       
     
    705716 * @param size    Size of the returned data.
    706717 * @param dry_run Do not get the data, just calculate the size.
     718 * @param data    Unused.
    707719 *
    708720 * @return Data containing stats_physmem_t.
     
    711723 */
    712724static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
    713     bool dry_run)
     725    bool dry_run, void *data)
    714726{
    715727        *size = sizeof(stats_physmem_t);
     
    735747 * @param size    Size of the returned data.
    736748 * @param dry_run Do not get the data, just calculate the size.
     749 * @param data    Unused.
    737750 *
    738751 * @return Data several load_t values.
     
    741754 */
    742755static void *get_stats_load(struct sysinfo_item *item, size_t *size,
    743     bool dry_run)
     756    bool dry_run, void *data)
    744757{
    745758        *size = sizeof(load_t) * LOAD_STEPS;
     
    810823        mutex_initialize(&load_lock, MUTEX_PASSIVE);
    811824       
    812         sysinfo_set_item_fn_val("system.uptime", NULL, get_stats_uptime);
    813         sysinfo_set_item_fn_data("system.cpus", NULL, get_stats_cpus);
    814         sysinfo_set_item_fn_data("system.physmem", NULL, get_stats_physmem);
    815         sysinfo_set_item_fn_data("system.load", NULL, get_stats_load);
    816         sysinfo_set_item_fn_data("system.tasks", NULL, get_stats_tasks);
    817         sysinfo_set_item_fn_data("system.threads", NULL, get_stats_threads);
    818         sysinfo_set_item_fn_data("system.exceptions", NULL, get_stats_exceptions);
    819         sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task);
    820         sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread);
    821         sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception);
     825        sysinfo_set_item_gen_val("system.uptime", NULL, get_stats_uptime, NULL);
     826        sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL);
     827        sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL);
     828        sysinfo_set_item_gen_data("system.load", NULL, get_stats_load, NULL);
     829        sysinfo_set_item_gen_data("system.tasks", NULL, get_stats_tasks, NULL);
     830        sysinfo_set_item_gen_data("system.threads", NULL, get_stats_threads, NULL);
     831        sysinfo_set_item_gen_data("system.exceptions", NULL, get_stats_exceptions, NULL);
     832        sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL);
     833        sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL);
     834        sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL);
    822835}
    823836
Note: See TracChangeset for help on using the changeset viewer.