Changeset 8e7c9fe in mainline for uspace/app


Ignore:
Timestamp:
2014-09-12T03:45:25Z (11 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c53b58e
Parents:
3eb0c85 (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

most usb changes were reverted. blink and usbmass were fixed
known problems:
ehci won't initialize
usbmast asserts on unmount (happens on mainline too)

Location:
uspace/app
Files:
7 added
226 deleted
30 edited
2 moved

Legend:

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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    5959#define TMPFS_FS_TYPE      "tmpfs"
    6060#define TMPFS_MOUNT_POINT  "/tmp"
    61 
    62 #define DATA_FS_TYPE      "fat"
    63 #define DATA_DEVICE       "bd/ata1disk0"
    64 #define DATA_MOUNT_POINT  "/data"
    6561
    6662#define SRV_CONSOLE  "/srv/console"
     
    176172        va_start(ap, path);
    177173        task_id_t id;
    178         int rc = task_spawn(&id, path, cnt, ap);
     174        task_wait_t wait;
     175        int rc = task_spawn(&id, &wait, path, cnt, ap);
    179176        va_end(ap);
    180177       
     
    193190        task_exit_t texit;
    194191        int retval;
    195         rc = task_wait(id, &texit, &retval);
     192        rc = task_wait(&wait, &texit, &retval);
    196193        if (rc != EOK) {
    197194                printf("%s: Error waiting for %s (%s)\n", NAME, path,
     
    257254       
    258255        task_id_t id;
    259         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);
    260258        if (rc != EOK) {
    261259                printf("%s: Error spawning %s %s (%s)\n", NAME, app,
     
    266264        task_exit_t texit;
    267265        int retval;
    268         rc = task_wait(id, &texit, &retval);
     266        rc = task_wait(&wait, &texit, &retval);
    269267        if ((rc != EOK) || (texit != TASK_EXIT_NORMAL)) {
    270268                printf("%s: Error retrieving retval from %s (%s)\n", NAME,
     
    276274}
    277275
    278 static void getterm(const char *svc, const char *app, bool wmsg)
    279 {
    280         char term[LOC_NAME_MAXLEN];
    281         snprintf(term, LOC_NAME_MAXLEN, "%s/%s", LOCFS_MOUNT_POINT, svc);
    282        
    283         printf("%s: Spawning %s %s %s\n", NAME, APP_GETTERM, term, app);
    284        
    285         /* Wait for the terminal service to be ready */
    286         service_id_t service_id;
    287         int rc = loc_service_get_id(svc, &service_id, IPC_FLAG_BLOCKING);
    288         if (rc != EOK) {
    289                 printf("%s: Error waiting on %s (%s)\n", NAME, term,
    290                     str_error(rc));
    291                 return;
    292         }
    293        
    294         if (wmsg) {
    295                 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, "-w", term,
    296                     app, NULL);
    297                 if (rc != EOK) {
    298                         printf("%s: Error spawning %s -w %s %s (%s)\n", NAME,
    299                             APP_GETTERM, term, app, str_error(rc));
    300                 }
     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);
    301287        } else {
    302                 rc = task_spawnl(NULL, APP_GETTERM, APP_GETTERM, term, app,
    303                     NULL);
    304                 if (rc != EOK) {
    305                         printf("%s: Error spawning %s %s %s (%s)\n", NAME,
    306                             APP_GETTERM, term, app, str_error(rc));
    307                 }
     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);
    308296        }
    309297}
     
    316304}
    317305
    318 static bool mount_data(void)
    319 {
    320         int rc = mount(DATA_FS_TYPE, DATA_MOUNT_POINT, DATA_DEVICE, "wtcache", 0, 0);
    321         return mount_report("Data filesystem", DATA_MOUNT_POINT, DATA_FS_TYPE,
    322             DATA_DEVICE, rc);
    323 }
    324 
    325306int main(int argc, char *argv[])
    326307{
     
    350331        srv_start("/srv/apic");
    351332        srv_start("/srv/i8259");
     333        srv_start("/srv/icp-ic");
    352334        srv_start("/srv/obio");
    353335        srv_start("/srv/cuda_adb");
     
    367349        srv_start("/srv/remcons");
    368350       
    369         /*
    370          * Start these synchronously so that mount_data() can be
    371          * non-blocking.
    372          */
    373 #ifdef CONFIG_START_BD
    374         srv_start("/srv/ata_bd");
    375 #endif
    376        
    377 #ifdef CONFIG_MOUNT_DATA
    378         /* Make sure fat is running. */
    379         if (str_cmp(STRING(RDFMT), "fat") != 0)
    380                 srv_start("/srv/fat");
    381        
    382         mount_data();
    383 #else
    384         (void) mount_data;
    385 #endif
    386        
    387351        srv_start("/srv/input", HID_INPUT);
    388352        srv_start("/srv/output", HID_OUTPUT);
     
    393357                gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER);
    394358                gui_start("/app/vterm", HID_COMPOSITOR_SERVER);
    395         } else {
    396                 rc = console(HID_INPUT, HID_OUTPUT);
    397                 if (rc == EOK) {
    398                         getterm("term/vc0", "/app/bdsh", true);
    399                         getterm("term/vc1", "/app/bdsh", false);
    400                         getterm("term/vc2", "/app/bdsh", false);
    401                         getterm("term/vc3", "/app/bdsh", false);
    402                         getterm("term/vc4", "/app/bdsh", false);
    403                         getterm("term/vc5", "/app/bdsh", false);
    404                         getterm("term/vc6", "/app/klog", false);
    405                 }
     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);
    406369        }
    407370       
  • uspace/app/kio/kio.c

    r3eb0c85 r8e7c9fe  
    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

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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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/Makefile

    r3eb0c85 r8e7c9fe  
    2929
    3030USPACE_PREFIX = ../..
     31
    3132LIBS = \
    3233        $(LIBBLOCK_PREFIX)/libblock.a \
     
    4041
    4142BINARY = tester
     43MATH = y
    4244
    4345SOURCES = \
     
    6163        fault/fault3.c \
    6264        float/float1.c \
     65        float/float2.c \
    6366        float/softfloat1.c \
    6467        vfs/vfs1.c \
  • uspace/app/tester/float/softfloat1.c

    r3eb0c85 r8e7c9fe  
    3939#include "../tester.h"
    4040
    41 #define OPERANDS  10
     41#define OPERANDS   10
    4242#define PRECISION  10000
    4343
     
    5656    cmptype_t *);
    5757
    58 #define NUMBERS \
     58#define NUMBERS \
    5959        3.5, -2.1, 100.0, 50.0, -1024.0, 0.0, 768.3156, 1080.499999, -600.0, 1.0
    6060
     
    6363};
    6464
    65 static double dop_a[OPERANDS] = {
     65static double dop_a[OPERANDS] = {
    6666        NUMBERS
    6767};
     
    8383        if (a < b)
    8484                return -1;
    85         else if (a > b)
     85       
     86        if (a > b)
    8687                return 1;
    87 
     88       
    8889        return 0;
    8990}
    9091
    91 static void
    92 uint_to_double_template(void *f, unsigned i, cmptype_t *pic, cmptype_t *pisc)
    93 {
     92static void uint_to_double_template(void *f, unsigned i, cmptype_t *pic,
     93    cmptype_t *pisc)
     94{
     95        uint_to_double_op_t op = (uint_to_double_op_t) f;
     96       
    9497        double c;
    9598        double_t sc;
    96 
    97         uint_to_double_op_t op = (uint_to_double_op_t) f;
    98        
    9999        op(uop_a[i], &c, &sc);
    100 
     100       
    101101        *pic = (cmptype_t) (c * PRECISION);
    102102        *pisc = (cmptype_t) (sc.val * PRECISION);
    103103}
    104104
    105 static void
    106 double_to_uint_template(void *f, unsigned i, cmptype_t *pic, cmptype_t *pisc)
    107 {
     105static void double_to_uint_template(void *f, unsigned i, cmptype_t *pic,
     106    cmptype_t *pisc)
     107{
     108        double_to_uint_op_t op = (double_to_uint_op_t) f;
     109       
    108110        unsigned int c;
    109111        unsigned int sc;
    110 
    111         double_to_uint_op_t op = (double_to_uint_op_t) f;
    112        
    113112        op(dop_a[i], &c, &sc);
    114 
     113       
    115114        *pic = (cmptype_t) c;
    116115        *pisc = (cmptype_t) sc;
     
    118117
    119118
    120 static void
    121 float_template_binary(void *f, unsigned i, unsigned j, cmptype_t *pic,
    122     cmptype_t *pisc)
    123 {
     119static void float_template_binary(void *f, unsigned i, unsigned j,
     120    cmptype_t *pic, cmptype_t *pisc)
     121{
     122        float_binary_op_t op = (float_binary_op_t) f;
     123       
    124124        float c;
    125125        float_t sc;
    126 
    127         float_binary_op_t op = (float_binary_op_t) f;
    128        
    129126        op(fop_a[i], fop_a[j], &c, &sc);
    130 
     127       
    131128        *pic = (cmptype_t) (c * PRECISION);
    132129        *pisc = (cmptype_t) (sc.val * PRECISION);
    133130}
    134131
    135 static void
    136 double_template_binary(void *f, unsigned i, unsigned j, cmptype_t *pic,
    137     cmptype_t *pisc)
    138 {
     132static void double_template_binary(void *f, unsigned i, unsigned j,
     133    cmptype_t *pic, cmptype_t *pisc)
     134{
     135        double_binary_op_t op = (double_binary_op_t) f;
     136       
    139137        double c;
    140138        double_t sc;
    141 
    142         double_binary_op_t op = (double_binary_op_t) f;
    143        
    144139        op(dop_a[i], dop_a[j], &c, &sc);
    145 
     140       
    146141        *pic = (cmptype_t) (c * PRECISION);
    147142        *pisc = (cmptype_t) (sc.val * PRECISION);
    148143}
    149144
    150 static void
    151 double_compare_template(void *f, unsigned i, unsigned j, cmptype_t *pis,
    152     cmptype_t *piss)
     145static void double_compare_template(void *f, unsigned i, unsigned j,
     146    cmptype_t *pis, cmptype_t *piss)
    153147{
    154148        double_cmp_op_t op = (double_cmp_op_t) f;
     
    164158                cmptype_t ic;
    165159                cmptype_t isc;
    166 
    167                 template(f, i, &ic, &isc);     
     160               
     161                template(f, i, &ic, &isc);
    168162                cmptype_t diff = cmpabs(ic - isc);
    169                        
     163               
    170164                if (diff != 0) {
    171165                        TPRINTF("i=%u diff=%" PRIdCMPTYPE "\n", i, diff);
     
    182176       
    183177        for (unsigned int i = 0; i < OPERANDS; i++) {
    184                 for (unsigned int j = 0; j < OPERANDS; j++) {                   
     178                for (unsigned int j = 0; j < OPERANDS; j++) {
    185179                        cmptype_t ic;
    186180                        cmptype_t isc;
    187 
    188                         template(f, i, j, &ic, &isc);   
     181                       
     182                        template(f, i, j, &ic, &isc);
    189183                        cmptype_t diff = cmpabs(ic - isc);
    190184                       
     
    206200}
    207201
    208 static void
    209 double_to_uint_operator(double a, unsigned int *pc, unsigned int *psc)
    210 {
    211         double_t sa;
    212 
    213         sa.val = a;
    214 
     202static void double_to_uint_operator(double a, unsigned int *pc,
     203    unsigned int *psc)
     204{
     205        double_t sa;
     206       
     207        sa.val = a;
     208       
    215209        *pc = (unsigned int) a;
    216210        *psc = double_to_uint(sa.data);
    217211}
    218212
    219 static void
    220 double_to_int_operator(double a, unsigned int *pc, unsigned int *psc)
    221 {
    222         double_t sa;
    223 
    224         sa.val = a;
    225 
     213static void double_to_int_operator(double a, unsigned int *pc,
     214    unsigned int *psc)
     215{
     216        double_t sa;
     217       
     218        sa.val = a;
     219       
    226220        *pc = (int) a;
    227221        *psc = double_to_int(sa.data);
     
    237231        sa.val = a;
    238232        sb.val = b;
    239         if (sa.data.parts.sign == sb.data.parts.sign)
     233       
     234        if (sa.data.parts.sign == sb.data.parts.sign) {
    240235                psc->data = add_float(sa.data, sb.data);
    241         else if (sa.data.parts.sign) {
     236        } else if (sa.data.parts.sign) {
    242237                sa.data.parts.sign = 0;
    243238                psc->data = sub_float(sb.data, sa.data);
     
    267262                return;
    268263        }
    269 
     264       
    270265        *pc = a / b;
    271266       
     
    287282        sa.val = a;
    288283        sb.val = b;
    289         if (sa.data.parts.sign == sb.data.parts.sign)
     284       
     285        if (sa.data.parts.sign == sb.data.parts.sign) {
    290286                psc->data = add_double(sa.data, sb.data);
    291         else if (sa.data.parts.sign) {
     287        } else if (sa.data.parts.sign) {
    292288                sa.data.parts.sign = 0;
    293289                psc->data = sub_double(sb.data, sa.data);
     
    317313                return;
    318314        }
    319 
     315       
    320316        *pc = a / b;
    321317       
     
    328324}
    329325
    330 static void
    331 double_cmp_operator(double a, double b, cmptype_t *pis, cmptype_t *piss)
     326static void double_cmp_operator(double a, double b, cmptype_t *pis,
     327    cmptype_t *piss)
    332328{
    333329        *pis = dcmp(a, b);
    334 
     330       
    335331        double_t sa;
    336332        double_t sb;
    337 
    338         sa.val = a;
    339         sb.val = b;
    340 
     333       
     334        sa.val = a;
     335        sb.val = b;
     336       
    341337        if (is_double_lt(sa.data, sb.data))
    342338                *piss = -1;
     
    352348{
    353349        const char *err = NULL;
    354 
     350       
    355351        if (!test_template_binary(float_template_binary, float_add_operator)) {
    356352                err = "Float addition failed";
    357353                TPRINTF("%s\n", err);
    358354        }
     355       
    359356        if (!test_template_binary(float_template_binary, float_mul_operator)) {
    360357                err = "Float multiplication failed";
    361358                TPRINTF("%s\n", err);
    362359        }
     360       
    363361        if (!test_template_binary(float_template_binary, float_div_operator)) {
    364362                err = "Float division failed";
    365363                TPRINTF("%s\n", err);
    366364        }
     365       
    367366        if (!test_template_binary(double_template_binary, double_add_operator)) {
    368367                err = "Double addition failed";
    369368                TPRINTF("%s\n", err);
    370369        }
     370       
    371371        if (!test_template_binary(double_template_binary, double_mul_operator)) {
    372372                err = "Double multiplication failed";
    373373                TPRINTF("%s\n", err);
    374374        }
     375       
    375376        if (!test_template_binary(double_template_binary, double_div_operator)) {
    376377                err = "Double division failed";
    377378                TPRINTF("%s\n", err);
    378379        }
     380       
    379381        if (!test_template_binary(double_compare_template, double_cmp_operator)) {
    380382                err = "Double comparison failed";
    381383                TPRINTF("%s\n", err);
    382384        }
     385       
    383386        if (!test_template_unary(uint_to_double_template,
    384387            uint_to_double_operator)) {
     
    386389                TPRINTF("%s\n", err);
    387390        }
     391       
    388392        if (!test_template_unary(double_to_uint_template,
    389393            double_to_uint_operator)) {
     
    391395                TPRINTF("%s\n", err);
    392396        }
     397       
    393398        if (!test_template_unary(double_to_uint_template,
    394399            double_to_int_operator)) {
     
    399404        return err;
    400405}
    401 
  • uspace/app/tester/hw/misc/virtchar1.c

    r3eb0c85 r8e7c9fe  
    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/tester/tester.c

    r3eb0c85 r8e7c9fe  
    6464#include "fault/fault3.def"
    6565#include "float/float1.def"
     66#include "float/float2.def"
    6667#include "float/softfloat1.def"
    6768#include "vfs/vfs1.def"
  • uspace/app/tester/tester.h

    r3eb0c85 r8e7c9fe  
    9797extern const char *test_fault3(void);
    9898extern const char *test_float1(void);
     99extern const char *test_float2(void);
    99100extern const char *test_softfloat1(void);
    100101extern const char *test_vfs1(void);
  • uspace/app/trace/syscalls.c

    r3eb0c85 r8e7c9fe  
    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

    r3eb0c85 r8e7c9fe  
    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/vdemo/Makefile

    r3eb0c85 r8e7c9fe  
    2828
    2929USPACE_PREFIX = ../..
    30 LIBS = $(LIBGUI_PREFIX)/libgui.a $(LIBDRAW_PREFIX)/libdraw.a \
    31         $(LIBSOFTREND_PREFIX)/libsoftrend.a $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    32 EXTRA_CFLAGS += -I$(LIBGUI_PREFIX) -I$(LIBDRAW_PREFIX) \
     30
     31LIBS = \
     32        $(LIBGUI_PREFIX)/libgui.a \
     33        $(LIBDRAW_PREFIX)/libdraw.a \
     34        $(LIBSOFTREND_PREFIX)/libsoftrend.a \
     35        $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
     36
     37EXTRA_CFLAGS += \
     38        -I$(LIBGUI_PREFIX) \
     39        -I$(LIBDRAW_PREFIX) \
    3340        -I$(LIBSOFTREND_PREFIX)
     41
    3442BINARY = vdemo
     43MATH = y
    3544
    3645SOURCES = \
  • uspace/app/viewer/Makefile

    r3eb0c85 r8e7c9fe  
    2828
    2929USPACE_PREFIX = ../..
    30 LIBS = $(LIBGUI_PREFIX)/libgui.a $(LIBDRAW_PREFIX)/libdraw.a \
    31         $(LIBSOFTREND_PREFIX)/libsoftrend.a $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    32 EXTRA_CFLAGS += -I$(LIBGUI_PREFIX) -I$(LIBDRAW_PREFIX) \
     30
     31LIBS = \
     32        $(LIBGUI_PREFIX)/libgui.a \
     33        $(LIBDRAW_PREFIX)/libdraw.a \
     34        $(LIBSOFTREND_PREFIX)/libsoftrend.a \
     35        $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
     36
     37EXTRA_CFLAGS += \
     38        -I$(LIBGUI_PREFIX) \
     39        -I$(LIBDRAW_PREFIX) \
    3340        -I$(LIBSOFTREND_PREFIX)
     41
    3442BINARY = viewer
     43MATH = y
    3544
    3645SOURCES = \
  • uspace/app/viewer/viewer.c

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

    r3eb0c85 r8e7c9fe  
    2828
    2929USPACE_PREFIX = ../..
    30 LIBS = $(LIBGUI_PREFIX)/libgui.a $(LIBDRAW_PREFIX)/libdraw.a \
    31         $(LIBSOFTREND_PREFIX)/libsoftrend.a $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    32 EXTRA_CFLAGS += -I$(LIBGUI_PREFIX) -I$(LIBDRAW_PREFIX) \
     30
     31LIBS = \
     32        $(LIBGUI_PREFIX)/libgui.a \
     33        $(LIBDRAW_PREFIX)/libdraw.a \
     34        $(LIBSOFTREND_PREFIX)/libsoftrend.a \
     35        $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
     36
     37EXTRA_CFLAGS += \
     38        -I$(LIBGUI_PREFIX) \
     39        -I$(LIBDRAW_PREFIX) \
    3340        -I$(LIBSOFTREND_PREFIX)
     41
    3442BINARY = vlaunch
     43MATH = y
    3544
    3645SOURCES = \
  • uspace/app/vlaunch/vlaunch.c

    r3eb0c85 r8e7c9fe  
    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();
  • uspace/app/vterm/Makefile

    r3eb0c85 r8e7c9fe  
    2828
    2929USPACE_PREFIX = ../..
    30 LIBS = $(LIBGUI_PREFIX)/libgui.a $(LIBDRAW_PREFIX)/libdraw.a \
    31         $(LIBSOFTREND_PREFIX)/libsoftrend.a $(LIBGRAPH_PREFIX)/libgraph.a \
     30
     31LIBS = \
     32        $(LIBGUI_PREFIX)/libgui.a \
     33        $(LIBDRAW_PREFIX)/libdraw.a \
     34        $(LIBSOFTREND_PREFIX)/libsoftrend.a \
     35        $(LIBGRAPH_PREFIX)/libgraph.a \
    3236        $(LIBSOFTFLOAT_PREFIX)/libsoftfloat.a
    33 EXTRA_CFLAGS += -I$(LIBGUI_PREFIX) -I$(LIBDRAW_PREFIX) \
    34         -I$(LIBSOFTREND_PREFIX) -I$(LIBGRAPH_PREFIX)
     37
     38EXTRA_CFLAGS += \
     39        -I$(LIBGUI_PREFIX) \
     40        -I$(LIBDRAW_PREFIX) \
     41        -I$(LIBSOFTREND_PREFIX) \
     42        -I$(LIBGRAPH_PREFIX)
     43
    3544BINARY = vterm
     45MATH = y
    3646
    3747SOURCES = \
  • uspace/app/wavplay/dplay.c

    r3eb0c85 r8e7c9fe  
    4141#include <fibril_synch.h>
    4242#include <pcm/format.h>
    43 #include <sys/mman.h>
     43#include <as.h>
    4444#include <sys/time.h>
    4545#include <inttypes.h>
     
    397397cleanup:
    398398        fclose(pb.source);
    399         munmap(pb.buffer.base, pb.buffer.size);
     399        as_area_destroy(pb.buffer.base);
    400400        audio_pcm_release_buffer(pb.device);
    401401close_session:
  • uspace/app/wavplay/drec.c

    r3eb0c85 r8e7c9fe  
    4040#include <pcm/format.h>
    4141#include <stdio.h>
    42 #include <sys/mman.h>
     42#include <as.h>
    4343#include <inttypes.h>
    4444
     
    229229cleanup:
    230230        fclose(rec.file);
    231         munmap(rec.buffer.base, rec.buffer.size);
     231        as_area_destroy(rec.buffer.base);
    232232        audio_pcm_release_buffer(rec.device);
    233233close_session:
Note: See TracChangeset for help on using the changeset viewer.