Changeset eb083ad in mainline for uspace/app


Ignore:
Timestamp:
2012-05-17T21:09:06Z (14 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
8fde078
Parents:
a8b8086 (diff), 3e67ab1 (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:
4 added
3 edited
5 moved

Legend:

Unmodified
Added
Removed
  • uspace/app/inet/Makefile

    ra8b8086 reb083ad  
    2828
    2929USPACE_PREFIX = ../..
    30 BINARY = inetcfg
     30BINARY = inet
    3131
    3232SOURCES = \
    33         inetcfg.c
     33        inet.c
    3434
    3535include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/inet/inet.c

    ra8b8086 reb083ad  
    2727 */
    2828
    29 /** @addtogroup inetcfg
     29/** @addtogroup inet
    3030 * @{
    3131 */
     
    3535 */
    3636
    37 #include <async.h>
    3837#include <errno.h>
    3938#include <inet/inetcfg.h>
     
    4443#include <sys/types.h>
    4544
    46 #define NAME "inetcfg"
     45#define NAME "inet"
    4746
    4847static void print_syntax(void)
     
    188187        rc = inetcfg_addr_create_static(aobj_name, &naddr, link_id, &addr_id);
    189188        if (rc != EOK) {
    190                 printf(NAME ": Failed creating static address '%s' (%d)\n",
    191                     aobj_name, rc);
     189                printf(NAME ": Failed creating static address '%s' (%s)\n",
     190                    aobj_name, str_error(rc));
    192191                return EIO;
    193192        }
     
    346345
    347346        printf("Configured addresses:\n");
    348 
     347        if (count > 0)
     348                printf("    [Addr/Width] [Link-Name] [Addr-Name] [Def-MTU]\n");
    349349        ainfo.name = linfo.name = astr = NULL;
    350350
     
    416416
    417417        printf("Static routes:\n");
     418        if (count > 0)
     419                printf("    [Dest/Width] [Router-Addr] [Route-Name]\n");
    418420
    419421        srinfo.name = dest_str = router_str = NULL;
  • uspace/app/init/init.c

    ra8b8086 reb083ad  
    307307        spawn("/srv/loopip");
    308308        spawn("/srv/ethip");
    309         spawn("/srv/inet");
     309        spawn("/srv/inetsrv");
    310310        spawn("/srv/tcp");
    311311        spawn("/srv/udp");
  • uspace/app/loc/Makefile

    ra8b8086 reb083ad  
    2828
    2929USPACE_PREFIX = ../..
    30 EXTRA_CFLAGS = -Iinclude
    31 BINARY = locinfo
     30BINARY = loc
    3231
    3332SOURCES = \
    34         locinfo.c
     33        loc.c
    3534
    3635include $(USPACE_PREFIX)/Makefile.common
  • uspace/app/loc/loc.c

    ra8b8086 reb083ad  
    2727 */
    2828
    29 /** @addtogroup locinfo
     29/** @addtogroup loc
    3030 * @{
    3131 */
    32 /** @file locinfo.c Print information from location service.
     32/** @file loc.c Print information from location service.
    3333 */
    3434
     
    4141#include <sys/typefmt.h>
    4242
    43 #define NAME "locinfo"
     43#define NAME "loc"
    4444
    45 int main(int argc, char *argv[])
     45static int show_cat(const char *cat_name, category_id_t cat_id)
     46{
     47        service_id_t *svc_ids;
     48        size_t svc_cnt;
     49        char *svc_name;
     50        int rc;
     51        size_t j;
     52
     53        printf("%s (%" PRIun "):\n", cat_name, cat_id);
     54
     55        rc = loc_category_get_svcs(cat_id, &svc_ids, &svc_cnt);
     56        if (rc != EOK) {
     57                printf(NAME ": Failed getting list of services in "
     58                    "category %s, skipping.\n", cat_name);
     59                return rc;
     60        }
     61
     62        for (j = 0; j < svc_cnt; j++) {
     63                rc = loc_service_get_name(svc_ids[j], &svc_name);
     64                if (rc != EOK) {
     65                        printf(NAME ": Unknown service name (SID %"
     66                            PRIun ").\n", svc_ids[j]);
     67                        continue;
     68                }
     69                printf("\t%s (%" PRIun ")\n", svc_name, svc_ids[j]);
     70                free(svc_name);
     71        }
     72
     73        free(svc_ids);
     74        return EOK;
     75}
     76
     77static int list_svcs_by_cat(void)
    4678{
    4779        category_id_t *cat_ids;
    4880        size_t cat_cnt;
    49         service_id_t *svc_ids;
    50         size_t svc_cnt;
    5181
    52         size_t i, j;
     82        size_t i;
    5383        char *cat_name;
    54         char *svc_name;
    5584        int rc;
    5685
     
    5887        if (rc != EOK) {
    5988                printf(NAME ": Error getting list of categories.\n");
    60                 return 1;
     89                return rc;
    6190        }
    6291
     
    6897                if (cat_name == NULL) {
    6998                        printf(NAME ": Error allocating memory.\n");
    70                         return 1;
     99                        free(cat_ids);
     100                        return rc;
    71101                }
    72102
    73                 printf("%s (%" PRIun "):\n", cat_name, cat_ids[i]);
     103                rc = show_cat(cat_name, cat_ids[i]);
     104                (void) rc;
    74105
    75                 rc = loc_category_get_svcs(cat_ids[i], &svc_ids, &svc_cnt);
    76                 if (rc != EOK) {
    77                         printf(NAME ": Failed getting list of services in "
    78                             "category %s, skipping.\n", cat_name);
    79                         free(cat_name);
    80                         continue;
    81                 }
    82 
    83                 for (j = 0; j < svc_cnt; j++) {
    84                         rc = loc_service_get_name(svc_ids[j], &svc_name);
    85                         if (rc != EOK) {
    86                                 printf(NAME ": Unknown service name (SID %"
    87                                     PRIun ").\n", svc_ids[j]);
    88                                 continue;
    89                         }
    90                         printf("\t%s (%" PRIun ")\n", svc_name, svc_ids[j]);
    91                         free(svc_name);
    92                 }
    93 
    94                 free(svc_ids);
    95106                free(cat_name);
    96107        }
    97108
    98109        free(cat_ids);
     110        return EOK;
     111}
     112
     113static void print_syntax(void)
     114{
     115        printf("syntax:\n"
     116            "\t" NAME "                      List categories and services "
     117                "they contain\n"
     118            "\t" NAME " show-cat <category>  List services in category\n");
     119}
     120
     121int main(int argc, char *argv[])
     122{
     123        int rc;
     124        char *cmd;
     125        char *cat_name;
     126        category_id_t cat_id;
     127
     128        if (argc <= 1) {
     129                rc = list_svcs_by_cat();
     130                if (rc != EOK)
     131                        return 1;
     132                return 0;
     133        }
     134
     135        cmd = argv[1];
     136        if (str_cmp(cmd, "show-cat") == 0) {
     137                if (argc < 3) {
     138                        printf("Argument missing.\n");
     139                        print_syntax();
     140                        return 1;
     141                }
     142
     143                cat_name = argv[2];
     144                rc = loc_category_get_id(cat_name, &cat_id, 0);
     145                if (rc != EOK) {
     146                        printf("Error looking up category '%s'.\n", cat_name);
     147                        return 1;
     148                }
     149
     150                rc = show_cat(cat_name, cat_id);
     151                if (rc != EOK)
     152                        return 1;
     153        } else {
     154                printf("Invalid command '%s'\n", cmd);
     155                print_syntax();
     156                return 1;
     157        }
     158
    99159        return 0;
    100160}
  • uspace/app/nterm/conn.h

    ra8b8086 reb083ad  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libc
     29/** @addtogroup edit
    3030 * @{
    3131 */
    32 
    33 /** @file
    34  * Generic module functions.
    35  *
    36  * @todo MAKE IT POSSIBLE TO REMOVE THIS FILE VIA EITHER REPLACING PART OF ITS
    37  * FUNCTIONALITY OR VIA INTEGRATING ITS FUNCTIONALITY MORE TIGHTLY WITH THE REST
    38  * OF THE SYSTEM.
     32/**
     33 * @file
    3934 */
    4035
    41 #ifndef LIBC_MODULES_H_
    42 #define LIBC_MODULES_H_
     36#ifndef CONN_H
     37#define CONN_H
    4338
    44 #include <async.h>
    45 #include <ipc/services.h>
    46 #include <sys/time.h>
     39#include <sys/types.h>
    4740
    48 extern void answer_call(ipc_callid_t, int, ipc_call_t *, size_t);
    49 extern async_sess_t *bind_service(services_t, sysarg_t, sysarg_t, sysarg_t,
    50     async_client_conn_t);
    51 extern void refresh_answer(ipc_call_t *, size_t *);
     41extern int conn_open(const char *, const char *);
     42extern int conn_send(void *, size_t);
    5243
    5344#endif
  • uspace/app/sbi/src/stype.c

    ra8b8086 reb083ad  
    652652        assert(iface_ti->tic == tic_tobject);
    653653        iface = iface_ti->u.tobject->csi;
    654         assert(iface->cc = csi_interface);
     654        assert(iface->cc == csi_interface);
    655655
    656656#ifdef DEBUG_TYPE_TRACE
  • uspace/app/websrv/websrv.c

    ra8b8086 reb083ad  
    11/*
    2  * Copyright (c) 2011 Jiri Svoboda
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    4141#include <stdlib.h>
    4242#include <fcntl.h>
     43#include <task.h>
    4344
    4445#include <net/in.h>
     
    7172
    7273static char fbuf[BUFFER_SIZE];
     74
     75static bool verbose = false;
    7376
    7477/** Responses to send to client. */
     
    187190        size_t response_size = str_size(msg);
    188191       
    189         fprintf(stderr, "Sending response\n");
     192        if (verbose)
     193            fprintf(stderr, "Sending response\n");
     194       
    190195        ssize_t rc = send(conn_sd, (void *) msg, response_size, 0);
    191196        if (rc < 0) {
     
    251256        }
    252257       
    253         fprintf(stderr, "Request: %s", lbuf);
     258        if (verbose)
     259                fprintf(stderr, "Request: %s", lbuf);
    254260       
    255261        if (str_lcmp(lbuf, "GET ", 4) != 0) {
     
    266272       
    267273        *end_uri = '\0';
    268         fprintf(stderr, "Requested URI: %s\n", uri);
     274        if (verbose)
     275                fprintf(stderr, "Requested URI: %s\n", uri);
    269276       
    270277        if (!uri_is_valid(uri)) {
     
    287294            "\n"
    288295            "-h | --help\n"
    289             "\tShow this application help.\n");
     296            "\tShow this application help.\n"
     297            "-v | --verbose\n"
     298            "\tVerbose mode\n");
    290299}
    291300
     
    306315               
    307316                port = (uint16_t) value;
     317                break;
     318        case 'v':
     319                verbose = true;
    308320                break;
    309321        /* Long options with double dash */
     
    318330                       
    319331                        port = (uint16_t) value;
     332                } else if (str_cmp(argv[*index] +2, "verbose") == 0) {
     333                        verbose = true;
    320334                } else {
    321335                        usage();
     
    358372        }
    359373       
    360         fprintf(stderr, "Creating socket\n");
     374        printf("%s: HelenOS web server\n", NAME);
     375
     376        if (verbose)
     377                fprintf(stderr, "Creating socket\n");
    361378       
    362379        int listen_sd = socket(PF_INET, SOCK_STREAM, 0);
     
    380397        }
    381398       
    382         fprintf(stderr, "Listening for connections at port %" PRIu16 "\n",
    383             port);
     399        fprintf(stderr, "%s: Listening for connections at port %" PRIu16 "\n",
     400            NAME, port);
     401
     402        task_retval(0);
     403
    384404        while (true) {
    385405                struct sockaddr_in raddr;
     
    393413                }
    394414               
    395                 fprintf(stderr, "Connection accepted (sd=%d), "
    396                     "waiting for request\n", conn_sd);
     415                if (verbose) {
     416                        fprintf(stderr, "Connection accepted (sd=%d), "
     417                            "waiting for request\n", conn_sd);
     418                }
    397419               
    398420                rbuf_out = 0;
     
    412434                }
    413435               
    414                 fprintf(stderr, "Connection closed\n");
     436                if (verbose)
     437                        fprintf(stderr, "Connection closed\n");
    415438        }
    416439       
Note: See TracChangeset for help on using the changeset viewer.