Changeset 15d0046 in mainline for uspace/app


Ignore:
Timestamp:
2014-09-12T13:22:33Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
9b20126
Parents:
8db09e4 (diff), 105d8d6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes

Location:
uspace/app
Files:
5 added
227 deleted
20 edited
2 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/bdsh/compl.c

    r8db09e4 r15d0046  
    209209                *cstart += rpath_sep + 1 - prefix;
    210210                free(prefix);
     211                prefix = NULL;
    211212
    212213                cs->path_list = malloc(sizeof(char *) * 2);
     
    252253        }
    253254
    254         if (cs != NULL && cs->prefix != NULL)
     255        if ((cs != NULL) && (cs->prefix != NULL))
    255256                free(cs->prefix);
     257       
    256258        if (dirname != NULL)
    257259                free(dirname);
     260       
    258261        if (prefix != NULL)
    259262                free(prefix);
     263       
    260264        if (stext != NULL)
    261265                free(stext);
     266       
    262267        if (cs != NULL)
    263268                free(cs);
     269       
    264270        if (tokens != NULL)
    265271                free(tokens);
  • uspace/app/bdsh/exec.c

    r8db09e4 r15d0046  
    9797{
    9898        task_id_t tid;
     99        task_wait_t twait;
    99100        task_exit_t texit;
    100101        char *tmp;
     
    121122        file_handles_p[i] = NULL;
    122123
    123         rc = task_spawnvf(&tid, tmp, (const char **) argv, file_handles_p);
     124        rc = task_spawnvf(&tid, &twait, tmp, (const char **) argv, file_handles_p);
    124125        free(tmp);
    125126
     
    130131        }
    131132       
    132         rc = task_wait(tid, &texit, &retval);
     133        rc = task_wait(&twait, &texit, &retval);
    133134        if (rc != EOK) {
    134135                printf("%s: Failed waiting for command (%s)\n", progname,
  • uspace/app/blkdump/Makefile

    r8db09e4 r15d0046  
    3030USPACE_PREFIX = ../..
    3131LIBS = $(LIBBLOCK_PREFIX)/libblock.a
    32 EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX)
     32EXTRA_CFLAGS = -I$(LIBBLOCK_PREFIX) -I$(LIBSCSI_PREFIX)/include
    3333BINARY = blkdump
    3434
  • uspace/app/blkdump/blkdump.c

    r8db09e4 r15d0046  
    4444#include <loc.h>
    4545#include <byteorder.h>
     46#include <scsi/mmc.h>
    4647#include <sys/types.h>
    4748#include <sys/typefmt.h>
     
    214215static int print_toc(void)
    215216{
    216         toc_block_t *toc;
    217 
    218         toc = block_get_toc(service_id, 0);
    219         if (toc == NULL)
     217        scsi_toc_multisess_data_t toc;
     218        int rc;
     219
     220        rc = block_read_toc(service_id, 0, &toc, sizeof(toc));
     221        if (rc != EOK)
    220222                return 1;
    221223
    222         printf("TOC size: %" PRIu16 " bytes\n", toc->size);
    223         printf("First session: %" PRIu8 "\n", toc->first_session);
    224         printf("Last_session: %" PRIu8 "\n", toc->last_session);
     224        printf("Multisession Information:\n");
     225        printf("\tFirst complete session: %" PRIu8 "\n", toc.first_sess);
     226        printf("\tLast complete session: %" PRIu8 "\n", toc.last_sess);
     227        printf("\tFirst track of last complete session:\n");
     228        printf("\t\tADR / Control: 0x%" PRIx8 "\n", toc.ftrack_lsess.adr_control);
     229        printf("\t\tTrack number: %" PRIu8 "\n", toc.ftrack_lsess.track_no);
     230        printf("\t\tStart block address: %" PRIu32 "\n", toc.ftrack_lsess.start_addr);
    225231
    226232        return 0;
     
    271277static void syntax_print(void)
    272278{
    273         printf("syntax: blkdump [--relative] [--offset <num_blocks>] [--count <num_blocks>] <device_name>\n");
     279        printf("syntax: blkdump [--toc] [--relative] [--offset <num_blocks>] "
     280            "[--count <num_blocks>] <device_name>\n");
    274281}
    275282
  • uspace/app/getterm/getterm.c

    r8db09e4 r15d0046  
    4242#include <str_error.h>
    4343#include <errno.h>
     44#include <loc.h>
    4445#include "version.h"
    4546#include "welcome.h"
     
    4950static void usage(void)
    5051{
    51         printf("Usage: %s <terminal> [-w] <command> [<arguments...>]\n", APP_NAME);
     52        printf("Usage: %s <terminal> <locfs> [--msg] [--wait] -- "
     53            "<command> [<arguments...>]\n", APP_NAME);
     54        printf(" <terminal>    Terminal device\n");
     55        printf(" <locfs>       Mount point of locfs\n");
     56        printf(" --msg         Print welcome message\n");
     57        printf(" --wait        Wait for the terminal to be ready\n");
    5258}
    5359
    54 static void reopen(FILE **stream, int fd, const char *path, int flags, const char *mode)
     60static void reopen(FILE **stream, int fd, const char *path, int flags,
     61    const char *mode)
    5562{
    5663        if (fclose(*stream))
     
    7683int main(int argc, char *argv[])
    7784{
    78         int rc;
    79         task_exit_t texit;
    80         int retval;
    81         task_id_t id;
    82         char *fname, *term;
    83         char **cmd_args;
    84         bool print_wmsg;
    85 
    8685        argv++;
    8786        argc--;
     87        if (argc < 4) {
     88                usage();
     89                return 1;
     90        }
     91       
     92        char *term = *argv;
     93        argv++;
     94        argc--;
     95       
     96        char *locfs = *argv;
     97        argv++;
     98        argc--;
     99       
     100        bool print_msg = false;
     101        bool wait = false;
     102       
     103        while ((argc > 0) && (str_cmp(*argv, "--") != 0)) {
     104                if (str_cmp(*argv, "--msg") == 0) {
     105                        print_msg = true;
     106                } else if (str_cmp(*argv, "--wait") == 0) {
     107                        wait = true;
     108                } else {
     109                        usage();
     110                        return 2;
     111                }
     112               
     113                argv++;
     114                argc--;
     115        }
     116       
    88117        if (argc < 1) {
    89118                usage();
    90                 return -1;
     119                return 3;
    91120        }
    92 
    93         if (str_cmp(*argv, "-w") == 0) {
    94                 print_wmsg = true;
    95                 argv++;
    96                 argc--;
    97         } else {
    98                 print_wmsg = false;
     121       
     122        /* Skip "--" */
     123        argv++;
     124        argc--;
     125       
     126        char *cmd = *argv;
     127        char **args = argv;
     128       
     129        if (wait) {
     130                /* Wait for the terminal service to be ready */
     131                service_id_t service_id;
     132                int rc = loc_service_get_id(term, &service_id, IPC_FLAG_BLOCKING);
     133                if (rc != EOK) {
     134                        printf("%s: Error waiting on %s (%s)\n", APP_NAME, term,
     135                            str_error(rc));
     136                        return rc;
     137                }
    99138        }
    100 
    101         if (argc < 2) {
    102                 usage();
    103                 return -1;
    104         }
    105 
    106         term = *argv++;
    107         fname = *argv;
    108         cmd_args = argv;
    109139       
    110         reopen(&stdin, 0, term, O_RDONLY, "r");
    111         reopen(&stdout, 1, term, O_WRONLY, "w");
    112         reopen(&stderr, 2, term, O_WRONLY, "w");
     140        char term_node[LOC_NAME_MAXLEN];
     141        snprintf(term_node, LOC_NAME_MAXLEN, "%s/%s", locfs, term);
     142       
     143        reopen(&stdin, 0, term_node, O_RDONLY, "r");
     144        reopen(&stdout, 1, term_node, O_WRONLY, "w");
     145        reopen(&stderr, 2, term_node, O_WRONLY, "w");
    113146       
    114147        if (stdin == NULL)
    115                 return -2;
     148                return 4;
    116149       
    117150        if (stdout == NULL)
    118                 return -3;
     151                return 5;
    119152       
    120153        if (stderr == NULL)
    121                 return -4;
     154                return 6;
    122155       
    123156        /*
     
    128161       
    129162        version_print(term);
    130         if (print_wmsg)
     163        if (print_msg)
    131164                welcome_msg_print();
    132 
    133         rc = task_spawnv(&id, fname, (const char * const *) cmd_args);
     165       
     166        task_id_t id;
     167        task_wait_t twait;
     168       
     169        int rc = task_spawnv(&id, &twait, cmd, (const char * const *) args);
    134170        if (rc != EOK) {
    135                 printf("%s: Error spawning %s (%s)\n", APP_NAME, fname,
     171                printf("%s: Error spawning %s (%s)\n", APP_NAME, cmd,
    136172                    str_error(rc));
    137                 return -5;
     173                return rc;
    138174        }
    139 
    140         rc = task_wait(id, &texit, &retval);
     175       
     176        task_exit_t texit;
     177        int retval;
     178        rc = task_wait(&twait, &texit, &retval);
    141179        if (rc != EOK) {
    142                 printf("%s: Error waiting for %s (%s)\n", APP_NAME, fname,
     180                printf("%s: Error waiting for %s (%s)\n", APP_NAME, cmd,
    143181                    str_error(rc));
    144                 return -6;
     182                return rc;
    145183        }
    146 
     184       
    147185        return 0;
    148186}
  • uspace/app/init/init.c

    r8db09e4 r15d0046  
    172172        va_start(ap, path);
    173173        task_id_t id;
    174         int rc = task_spawn(&id, path, cnt, ap);
     174        task_wait_t wait;
     175        int rc = task_spawn(&id, &wait, path, cnt, ap);
    175176        va_end(ap);
    176177       
     
    189190        task_exit_t texit;
    190191        int retval;
    191         rc = task_wait(id, &texit, &retval);
     192        rc = task_wait(&wait, &texit, &retval);
    192193        if (rc != EOK) {
    193194                printf("%s: Error waiting for %s (%s)\n", NAME, path,
     
    253254       
    254255        task_id_t id;
    255         int rc = task_spawnl(&id, app, app, winreg, NULL);
     256        task_wait_t wait;
     257        int rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
    256258        if (rc != EOK) {
    257259                printf("%s: Error spawning %s %s (%s)\n", NAME, app,
     
    262264        task_exit_t texit;
    263265        int retval;
    264         rc = task_wait(id, &texit, &retval);
     266        rc = task_wait(&wait, &texit, &retval);
    265267        if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) {
    266268                printf("%s: Error retrieving retval from %s (%s)\n", NAME,
     
    272274}
    273275
    274 static void getterm(const char *svc, const char *app, bool wmsg)
    275 {
    276         char term[LOC_NAME_MAXLEN];
    277         snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc);
    278        
    279         printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app);
    280        
    281         /* Wait for the terminal service to be ready */
    282         service_id_t service_id;
    283         int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING);
    284         if (rc != EOK) {
    285                 printf("%s: Error waiting on %s (%s)\n", NAME, term,
    286                     str_error(rc));
    287                 return;
    288         }
    289        
    290         if (wmsg) {
    291                 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term,
    292                     app, NULL);
    293                 if (rc != EOK) {
    294                         printf("%s: Error spawning %s -w %s %s (%s)\n", NAME,
    295                             APP_GETTERM, term, app, str_error(rc));
    296                 }
     276static void getterm(const char *svc, const char *app, bool msg)
     277{
     278        if (msg) {
     279                printf("%s: Spawning %s %s %s --msg --wait -- %s\n", NAME,
     280                    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
     281               
     282                int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
     283                    LOCFS_MOUNT_POINT, "--msg", "--wait", "--", app, NULL);
     284                if (rc != EOK)
     285                        printf("%s: Error spawning %s %s %s --msg --wait -- %s\n",
     286                            NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
    297287        } else {
    298                 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app,
    299                     NULL);
    300                 if (rc != EOK) {
    301                         printf("%s: Error spawning %s %s %s (%s)\n", NAME,
    302                             APP_GETTERM, term, app, str_error(rc));
    303                 }
     288                printf("%s: Spawning %s %s %s --wait -- %s\n", NAME,
     289                    APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
     290               
     291                int rc = task_spawnl(NULL, NULL, APP_GETTERM, APP_GETTERM, svc,
     292                    LOCFS_MOUNT_POINT, "--wait", "--", app, NULL);
     293                if (rc != EOK)
     294                        printf("%s: Error spawning %s %s %s --wait -- %s\n",
     295                            NAME, APP_GETTERM, svc, LOCFS_MOUNT_POINT, app);
    304296        }
    305297}
     
    339331        srv_start("/srv/apic");
    340332        srv_start("/srv/i8259");
     333        srv_start("/srv/icp-ic");
    341334        srv_start("/srv/obio");
    342335        srv_start("/srv/cuda_adb");
     
    364357                gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER);
    365358                gui_start("/app/vterm", HID_COMPOSITOR_SERVER);
    366         } else {
    367                 rc = console(HID_INPUT, HID_OUTPUT);
    368                 if (rc == EOK) {
    369                         getterm("term/vc0", "/app/bdsh", true);
    370                         getterm("term/vc1", "/app/bdsh", false);
    371                         getterm("term/vc2", "/app/bdsh", false);
    372                         getterm("term/vc3", "/app/bdsh", false);
    373                         getterm("term/vc4", "/app/bdsh", false);
    374                         getterm("term/vc5", "/app/bdsh", false);
    375                         getterm("term/vc6", "/app/klog", false);
    376                 }
     359        }
     360       
     361        rc = console(HID_INPUT, HID_OUTPUT);
     362        if (rc == EOK) {
     363                getterm("term/vc0", "/app/bdsh", true);
     364                getterm("term/vc1", "/app/bdsh", false);
     365                getterm("term/vc2", "/app/bdsh", false);
     366                getterm("term/vc3", "/app/bdsh", false);
     367                getterm("term/vc4", "/app/bdsh", false);
     368                getterm("term/vc5", "/app/bdsh", false);
    377369        }
    378370       
  • uspace/app/kio/kio.c

    r8db09e4 r15d0046  
    3939#include <as.h>
    4040#include <ddi.h>
    41 #include <event.h>
    4241#include <errno.h>
    4342#include <str_error.h>
     
    6362
    6463/* Pointer to kio area */
    65 static wchar_t *kio;
     64static wchar_t *kio = (wchar_t *) AS_AREA_ANY;
    6665static size_t kio_length;
    6766
     
    149148 *
    150149 */
    151 static void notification_received(ipc_callid_t callid, ipc_call_t *call)
     150static void kio_notification_handler(ipc_callid_t callid, ipc_call_t *call,
     151    void *arg)
    152152{
    153153        /*
     
    181181                producer(kio_stored, kio + offset);
    182182       
    183         event_unmask(EVENT_KIO);
     183        async_event_unmask(EVENT_KIO);
    184184        fibril_mutex_unlock(&mtx);
    185185}
     
    214214       
    215215        prodcons_initialize(&pc);
    216         async_set_interrupt_received(notification_received);
    217         rc = event_subscribe(EVENT_KIO, 0);
     216        rc = async_event_subscribe(EVENT_KIO, kio_notification_handler, NULL);
    218217        if (rc != EOK) {
    219218                fprintf(stderr, "%s: Unable to register kio notifications\n",
     
    233232                fprintf(stderr, "%s: Could not create input\n", NAME);
    234233                return ENOMEM;
    235         }       
     234        }
    236235
    237236        fibril_add_ready(fid);
    238         event_unmask(EVENT_KIO);
     237        async_event_unmask(EVENT_KIO);
    239238        kio_update();
    240239       
     
    251250                free(str);
    252251        }
    253  
     252
    254253        if (rc == ENOENT)
    255                 rc = EOK;       
     254                rc = EOK;
    256255
    257256        return EOK;
  • uspace/app/logset/main.c

    r8db09e4 r15d0046  
    3333 */
    3434#include <stdio.h>
     35#include <stdlib.h>
    3536#include <async.h>
    3637#include <errno.h>
  • uspace/app/mixerctl/mixerctl.c

    r8db09e4 r15d0046  
    3535#include <assert.h>
    3636#include <errno.h>
     37#include <loc.h>
    3738#include <str_error.h>
    3839#include <str.h>
    39 #include <devman.h>
    4040#include <audio_mixer_iface.h>
    4141#include <stdio.h>
    4242
    43 #define DEFAULT_DEVICE "/hw/pci0/00:01.0/sb16/control"
     43#define DEFAULT_SERVICE "devices/\\hw\\pci0\\00:01.0\\sb16\\control"
    4444
    4545/**
     
    128128int main(int argc, char *argv[])
    129129{
    130         const char *device = DEFAULT_DEVICE;
     130        const char *service = DEFAULT_SERVICE;
    131131        void (*command)(async_exch_t *, int, char*[]) = NULL;
    132132
     
    134134                command = set_level;
    135135                if (argc == 5)
    136                         device = argv[1];
     136                        service = argv[1];
    137137        }
    138138
     
    140140                command = get_level;
    141141                if (argc == 4)
    142                         device = argv[1];
     142                        service = argv[1];
    143143        }
    144144
    145145        if ((argc == 2 && command == NULL))
    146                 device = argv[1];
     146                service = argv[1];
    147147
    148148
    149         devman_handle_t mixer_handle;
    150         int ret = devman_fun_get_handle(device, &mixer_handle, 0);
    151         if (ret != EOK) {
    152                 printf("Failed to get device(%s) handle: %s.\n",
    153                     device, str_error(ret));
     149        service_id_t mixer_sid;
     150        int rc = loc_service_get_id(service, &mixer_sid, 0);
     151        if (rc != EOK) {
     152                printf("Failed to resolve service '%s': %s.\n",
     153                    service, str_error(rc));
    154154                return 1;
    155155        }
    156156
    157         async_sess_t *session = devman_device_connect(
    158             EXCHANGE_ATOMIC, mixer_handle, IPC_FLAG_BLOCKING);
     157        async_sess_t *session = loc_service_connect(
     158            EXCHANGE_ATOMIC, mixer_sid, 0);
    159159        if (!session) {
    160                 printf("Failed to connect to device.\n");
     160                printf("Failed connecting mixer service '%s'.\n", service);
    161161                return 1;
    162162        }
  • uspace/app/redir/redir.c

    r8db09e4 r15d0046  
    7575}
    7676
    77 static task_id_t spawn(int argc, char *argv[])
     77static task_id_t spawn(task_wait_t *wait, int argc, char *argv[])
    7878{
    7979        const char **args;
     
    9393        args[argc] = NULL;
    9494       
    95         rc = task_spawnv(&id, argv[0], args);
     95        rc = task_spawnv(&id, wait, argv[0], args);
    9696       
    9797        free(args);
     
    152152         */
    153153        setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
    154        
    155         task_id_t id = spawn(argc - i, argv + i);
     154
     155        task_wait_t wait;       
     156        task_id_t id = spawn(&wait, argc - i, argv + i);
    156157       
    157158        if (id != 0) {
    158159                task_exit_t texit;
    159160                int retval;
    160                 task_wait(id, &texit, &retval);
     161                task_wait(&wait, &texit, &retval);
    161162               
    162163                return retval;
  • uspace/app/sbi/src/os/helenos.c

    r8db09e4 r15d0046  
    250250{
    251251        task_id_t tid;
     252        task_wait_t twait;
    252253        task_exit_t texit;
    253254        int rc, retval;
    254255
    255         rc = task_spawnv(&tid, cmd[0], (char const * const *) cmd);
     256        rc = task_spawnv(&tid, &twait, cmd[0], (char const * const *) cmd);
    256257        if (rc != EOK) {
    257258                printf("Error: Failed spawning '%s' (%s).\n", cmd[0],
     
    261262
    262263        /* XXX Handle exit status and return value. */
    263         rc = task_wait(tid, &texit, &retval);
     264        rc = task_wait(&twait, &texit, &retval);
    264265        (void) rc;
    265266
  • uspace/app/taskdump/Makefile

    r8db09e4 r15d0046  
    3333SOURCES = \
    3434        elf_core.c \
     35        fibrildump.c \
    3536        taskdump.c \
    3637        symtab.c
  • uspace/app/taskdump/include/fibrildump.h

    r8db09e4 r15d0046  
    11/*
    2  * Copyright (c) 2005 Ondrej Palkovsky
     2 * Copyright (c) 2014 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libcmips64
     29/** @addtogroup edit
    3030 * @{
    3131 */
    32 /** @file
     32/**
     33 * @file
    3334 */
    3435
    35 #ifndef LIBC_mips64_FADDR_H_
    36 #define LIBC_mips64_FADDR_H_
     36#ifndef FIBRILDUMP_H
     37#define FIBRILDUMP_H
    3738
    38 #include <libarch/types.h>
     39#include <async.h>
     40#include <symtab.h>
    3941
    40 #define FADDR(fptr)  ((uintptr_t) (fptr))
     42extern int fibrils_dump(symtab_t *, async_sess_t *sess);
    4143
    4244#endif
  • uspace/app/taskdump/include/symtab.h

    r8db09e4 r15d0046  
    5050extern int symtab_load(const char *file_name, symtab_t **symtab);
    5151extern void symtab_delete(symtab_t *st);
    52 extern int symtab_name_to_addr(symtab_t *st, char *name, uintptr_t *addr);
     52extern int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr);
    5353extern int symtab_addr_to_name(symtab_t *symtab, uintptr_t addr, char **name,
    5454    size_t *offs);
  • uspace/app/taskdump/include/taskdump.h

    r8db09e4 r15d0046  
    11/*
    2  * Copyright (c) 2005 Martin Decky
     2 * Copyright (c) 2014 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup edit
    3030 * @{
    3131 */
     
    3434 */
    3535
    36 #ifndef LIBC_mips64_SYSCALL_H_
    37 #define LIBC_mips64_SYSCALL_H_
     36#ifndef TASKDUMP_H
     37#define TASKDUMP_H
    3838
    39 #define LIBARCH_SYSCALL_GENERIC
     39#include <stdint.h>
    4040
    41 #include <syscall.h>
     41extern int td_stacktrace(uintptr_t, uintptr_t);
    4242
    4343#endif
  • uspace/app/taskdump/symtab.c

    r8db09e4 r15d0046  
    202202 * @return      EOK on success, ENOENT if no such symbol was found.
    203203 */
    204 int symtab_name_to_addr(symtab_t *st, char *name, uintptr_t *addr)
     204int symtab_name_to_addr(symtab_t *st, const char *name, uintptr_t *addr)
    205205{
    206206        size_t i;
  • uspace/app/taskdump/taskdump.c

    r8db09e4 r15d0046  
    3535#include <async.h>
    3636#include <elf/elf_linux.h>
     37#include <fibrildump.h>
    3738#include <stdio.h>
    3839#include <stdlib.h>
     
    5253#include <elf_core.h>
    5354#include <stacktrace.h>
     55#include <taskdump.h>
    5456
    5557#define LINE_BYTES 16
     
    7678static istate_t reg_state;
    7779
     80static stacktrace_ops_t td_stacktrace_ops = {
     81        .read_uintptr = td_read_uintptr
     82};
     83
    7884int main(int argc, char *argv[])
    7985{
     
    106112        if (rc < 0)
    107113                printf("Failed dumping address space areas.\n");
     114
     115        rc = fibrils_dump(app_symtab, sess);
     116        if (rc < 0)
     117                printf("Failed dumping fibrils.\n");
    108118
    109119        udebug_end(sess);
     
    311321}
    312322
     323int td_stacktrace(uintptr_t fp, uintptr_t pc)
     324{
     325        uintptr_t nfp;
     326        stacktrace_t st;
     327        char *sym_pc;
     328        int rc;
     329
     330        st.op_arg = NULL;
     331        st.ops = &td_stacktrace_ops;
     332
     333        while (stacktrace_fp_valid(&st, fp)) {
     334                sym_pc = fmt_sym_address(pc);
     335                printf("  %p: %s\n", (void *) fp, sym_pc);
     336                free(sym_pc);
     337
     338                rc = stacktrace_ra_get(&st, fp, &pc);
     339                if (rc != EOK)
     340                        return rc;
     341
     342                rc = stacktrace_fp_prev(&st, fp, &nfp);
     343                if (rc != EOK)
     344                        return rc;
     345
     346                fp = nfp;
     347        }
     348
     349        return EOK;
     350}
     351
    313352static int thread_dump(uintptr_t thash)
    314353{
    315354        istate_t istate;
    316         uintptr_t pc, fp, nfp;
    317         stacktrace_t st;
     355        uintptr_t pc, fp;
    318356        char *sym_pc;
    319357        int rc;
     
    336374        free(sym_pc);
    337375
    338         st.op_arg = NULL;
    339         st.read_uintptr = td_read_uintptr;
    340 
    341         while (stacktrace_fp_valid(&st, fp)) {
    342                 sym_pc = fmt_sym_address(pc);
    343                 printf("  %p: %s\n", (void *) fp, sym_pc);
    344                 free(sym_pc);
    345 
    346                 rc = stacktrace_ra_get(&st, fp, &pc);
    347                 if (rc != EOK)
    348                         return rc;
    349 
    350                 rc = stacktrace_fp_prev(&st, fp, &nfp);
    351                 if (rc != EOK)
    352                         return rc;
    353 
    354                 fp = nfp;
    355         }
     376        (void) td_stacktrace(fp, pc);
    356377
    357378        return EOK;
  • uspace/app/tester/hw/misc/virtchar1.c

    r8db09e4 r15d0046  
    4040#include <sys/types.h>
    4141#include <async.h>
     42#include <unistd.h>
    4243#include <char_dev_iface.h>
    4344#include <str.h>
  • uspace/app/trace/syscalls.c

    r8db09e4 r15d0046  
    6565    [SYS_IPC_HANGUP] = { "ipc_hangup",                  1,      V_ERRNO },
    6666
    67     [SYS_EVENT_SUBSCRIBE] = { "event_subscribe",        2,      V_ERRNO },
     67    [SYS_IPC_EVENT_SUBSCRIBE] = { "ipc_event_subscribe",        2,      V_ERRNO },
     68    [SYS_IPC_EVENT_UNSUBSCRIBE] = { "ipc_event_unsubscribe",    1,      V_ERRNO },
     69    [SYS_IPC_EVENT_UNMASK] = { "ipc_event_unmask",      1,      V_ERRNO },
    6870
    6971    [SYS_CAP_GRANT] = { "cap_grant",                    2,      V_ERRNO },
     
    7173    [SYS_PHYSMEM_MAP] = { "physmem_map",                4,      V_ERRNO },
    7274    [SYS_IOSPACE_ENABLE] = { "iospace_enable",          1,      V_ERRNO },
    73     [SYS_IRQ_REGISTER] = { "irq_register",      4,      V_ERRNO },
    74     [SYS_IRQ_UNREGISTER] = { "irq_unregister",  2,      V_ERRNO },
     75
     76    [SYS_IPC_IRQ_SUBSCRIBE] = { "ipc_irq_subscribe",    4,      V_ERRNO },
     77    [SYS_IPC_IRQ_UNSUBSCRIBE] = { "ipc_irq_unsubscribe",        2,      V_ERRNO },
    7578
    7679    [SYS_SYSINFO_GET_VAL_TYPE] = { "sysinfo_get_val_type",              2,      V_INTEGER },
     
    7982    [SYS_SYSINFO_GET_DATA] = { "sysinfo_get_data",              5,      V_ERRNO },
    8083
    81     [SYS_DEBUG_ACTIVATE_CONSOLE] = { "debug_activate_console", 0,       V_ERRNO },
     84    [SYS_DEBUG_CONSOLE] = { "debug_console", 0, V_ERRNO },
    8285    [SYS_IPC_CONNECT_KBOX] = { "ipc_connect_kbox",      1,      V_ERRNO }
    8386};
  • uspace/app/trace/trace.c

    r8db09e4 r15d0046  
    876876                printf("Waiting for task to exit.\n");
    877877
    878                 rc = task_wait(task_id, &texit, &retval);
     878                rc = task_wait_task_id(task_id, &texit, &retval);
    879879                if (rc != EOK) {
    880880                        printf("Failed waiting for task.\n");
  • uspace/app/viewer/viewer.c

    r8db09e4 r15d0046  
    4444#include <surface.h>
    4545#include <codec/tga.h>
     46#include <task.h>
    4647
    4748#define NAME  "viewer"
  • uspace/app/vlaunch/vlaunch.c

    r8db09e4 r15d0046  
    4141#include <str.h>
    4242#include <str_error.h>
     43#include <loc.h>
     44#include <fibril_synch.h>
     45#include <io/pixel.h>
     46#include <device/led_dev.h>
    4347
    4448#include <window.h>
     
    6064#define LOGO_HEIGHT  66
    6165
     66#define PERIOD  1000000
     67#define COLORS  7
     68
    6269static char *winreg = NULL;
     70static fibril_timer_t *timer = NULL;
     71static list_t led_devs;
     72
     73static pixel_t colors[COLORS] = {
     74        PIXEL(0xff, 0xff, 0x00, 0x00),
     75        PIXEL(0xff, 0x00, 0xff, 0x00),
     76        PIXEL(0xff, 0x00, 0x00, 0xff),
     77        PIXEL(0xff, 0xff, 0xff, 0x00),
     78        PIXEL(0xff, 0xff, 0x00, 0xff),
     79        PIXEL(0xff, 0x00, 0xff, 0xff),
     80        PIXEL(0xff, 0xff, 0xff, 0xff)
     81};
     82
     83static unsigned int color = 0;
     84
     85typedef struct {
     86        link_t link;
     87        service_id_t svc_id;
     88        async_sess_t *sess;
     89} led_dev_t;
    6390
    6491static int app_launch(const char *app)
    6592{
    66         int rc;
    6793        printf("%s: Spawning %s %s \n", NAME, app, winreg);
    68 
     94       
    6995        task_id_t id;
    70         task_exit_t texit;
    71         int retval;
    72         rc = task_spawnl(&id, app, app, winreg, NULL);
     96        task_wait_t wait;
     97        int rc = task_spawnl(&id, &wait, app, app, winreg, NULL);
    7398        if (rc != EOK) {
    7499                printf("%s: Error spawning %s %s (%s)\n", NAME, app,
     
    76101                return -1;
    77102        }
    78         rc = task_wait(id, &texit, &retval);
    79         if (rc != EOK || texit != TASK_EXIT_NORMAL) {
     103       
     104        task_exit_t texit;
     105        int retval;
     106        rc = task_wait(&wait, &texit, &retval);
     107        if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) {
    80108                printf("%s: Error retrieving retval from %s (%s)\n", NAME,
    81109                    app, str_error(rc));
    82110                return -1;
    83111        }
    84 
     112       
    85113        return retval;
    86114}
     
    99127{
    100128        app_launch("/app/vlaunch");
     129}
     130
     131static void timer_callback(void *data)
     132{
     133        pixel_t next_color = colors[color];
     134       
     135        color++;
     136        if (color >= COLORS)
     137                color = 0;
     138       
     139        list_foreach(led_devs, link, led_dev_t, dev) {
     140                if (dev->sess)
     141                        led_dev_color_set(dev->sess, next_color);
     142        }
     143       
     144        fibril_timer_set(timer, PERIOD, timer_callback, NULL);
     145}
     146
     147static void loc_callback(void)
     148{
     149        category_id_t led_cat;
     150        int rc = loc_category_get_id("led", &led_cat, IPC_FLAG_BLOCKING);
     151        if (rc != EOK)
     152                return;
     153       
     154        service_id_t *svcs;
     155        size_t count;
     156        rc = loc_category_get_svcs(led_cat, &svcs, &count);
     157        if (rc != EOK)
     158                return;
     159       
     160        for (size_t i = 0; i < count; i++) {
     161                bool known = false;
     162               
     163                /* Determine whether we already know this device. */
     164                list_foreach(led_devs, link, led_dev_t, dev) {
     165                        if (dev->svc_id == svcs[i]) {
     166                                known = true;
     167                                break;
     168                        }
     169                }
     170               
     171                if (!known) {
     172                        led_dev_t *dev = (led_dev_t *) calloc(1, sizeof(led_dev_t));
     173                        if (!dev)
     174                                continue;
     175                       
     176                        link_initialize(&dev->link);
     177                        dev->svc_id = svcs[i];
     178                        dev->sess = loc_service_connect(EXCHANGE_SERIALIZE, svcs[i], 0);
     179                       
     180                        list_append(&dev->link, &led_devs);
     181                }
     182        }
     183       
     184        // FIXME: Handle LED device removal
     185       
     186        free(svcs);
    101187}
    102188
     
    105191        if (argc < 2) {
    106192                printf("Compositor server not specified.\n");
     193                return 1;
     194        }
     195       
     196        list_initialize(&led_devs);
     197        int rc = loc_register_cat_change_cb(loc_callback);
     198        if (rc != EOK) {
     199                printf("Unable to register callback for device discovery.\n");
     200                return 1;
     201        }
     202       
     203        timer = fibril_timer_create(NULL);
     204        if (!timer) {
     205                printf("Unable to create timer.\n");
    107206                return 1;
    108207        }
     
    163262        window_exec(main_window);
    164263       
     264        fibril_timer_set(timer, PERIOD, timer_callback, NULL);
     265       
    165266        task_retval(0);
    166267        async_manager();
Note: See TracChangeset for help on using the changeset viewer.