Changeset 97c7682 in mainline for uspace/lib/c


Ignore:
Timestamp:
2012-07-14T11:18:40Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
804d9b6
Parents:
0747468 (diff), f0348c8 (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.

Text conflict in boot/arch/arm32/Makefile.inc:

Trivial conflict around ifeq condition.

Text conflict in kernel/arch/arm32/include/mm/page.h:

Added defines and set_pt_levelx_present function.
COnflict looked horrible because of the armv4/v7 split.

Location:
uspace/lib/c
Files:
6 added
15 deleted
41 edited
6 moved

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/Makefile

    r0747468 r97c7682  
    8787        generic/task.c \
    8888        generic/futex.c \
     89        generic/inet.c \
     90        generic/inetcfg.c \
     91        generic/inetping.c \
    8992        generic/io/asprintf.c \
    9093        generic/io/io.c \
     
    97100        generic/io/printf_core.c \
    98101        generic/io/console.c \
     102        generic/iplink.c \
     103        generic/iplink_srv.c \
    99104        generic/malloc.c \
    100105        generic/sysinfo.c \
     
    108113        generic/adt/hash_set.c \
    109114        generic/adt/dynamic_fifo.c \
    110         generic/adt/measured_strings.c \
    111115        generic/adt/char_map.c \
    112116        generic/adt/prodcons.c \
     
    118122        generic/vfs/canonify.c \
    119123        generic/net/inet.c \
    120         generic/net/icmp_common.c \
    121         generic/net/icmp_api.c \
    122         generic/net/modules.c \
    123         generic/net/packet.c \
    124124        generic/net/socket_client.c \
    125125        generic/net/socket_parse.c \
  • uspace/lib/c/arch/ia64/include/fibril.h

    r0747468 r97c7682  
    4949#define PFM_MASK  (~0x3fffffffff)
    5050
    51 #define PSTHREAD_INITIAL_STACK_PAGES_NO  2
    52 
    5351/* Stack is divided into two equal parts (for memory stack and register stack). */
    54 #define PSTHREAD_INITIAL_STACK_DIVISION  2
     52#define FIBRIL_INITIAL_STACK_DIVISION  2
    5553
    5654#define context_set(c, _pc, stack, size, tls) \
     
    5856                (c)->pc = (uint64_t) _pc; \
    5957                (c)->bsp = ((uint64_t) stack) + \
    60                     size / PSTHREAD_INITIAL_STACK_DIVISION; \
     58                    size / FIBRIL_INITIAL_STACK_DIVISION; \
    6159                (c)->ar_pfs &= PFM_MASK; \
    6260                (c)->sp = ((uint64_t) stack) + \
    63                     ALIGN_UP((size / PSTHREAD_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \
     61                    ALIGN_UP((size / FIBRIL_INITIAL_STACK_DIVISION), STACK_ALIGNMENT) - \
    6462                    SP_DELTA; \
    6563                (c)->tp = (uint64_t) tls; \
  • uspace/lib/c/arch/ia64/include/thread.h

    r0747468 r97c7682  
    2727 */
    2828
    29 /** @addtogroup libcia64       
     29/** @addtogroup libcia64
    3030 * @{
    3131 */
     
    3636#define LIBC_ia64_THREAD_H_
    3737
    38 #define THREAD_INITIAL_STACK_PAGES_NO 2
    39 
    4038#endif
    4139
  • uspace/lib/c/generic/as.c

    r0747468 r97c7682  
    4646 *
    4747 * @param base  Starting virtual address of the area.
    48  *              If set to (void *) -1, the kernel finds
    49  *              a mappable area.
     48 *              If set to AS_AREA_ANY ((void *) -1),
     49 *              the kernel finds a mappable area.
    5050 * @param size  Size of the area.
    5151 * @param flags Flags describing type of the area.
    5252 *
    5353 * @return Starting virtual address of the created area on success.
    54  * @return (void *) -1 otherwise.
     54 * @return AS_MAP_FAILED ((void *) -1) otherwise.
    5555 *
    5656 */
  • uspace/lib/c/generic/async.c

    r0747468 r97c7682  
    189189        /** If reply was received. */
    190190        bool done;
     191
     192        /** If the message / reply should be discarded on arrival. */
     193        bool forget;
     194
     195        /** If already destroyed. */
     196        bool destroyed;
    191197       
    192198        /** Pointer to where the answer data is stored. */
     
    240246/** Identifier of the incoming connection handled by the current fibril. */
    241247static fibril_local connection_t *fibril_connection;
     248
     249static void to_event_initialize(to_event_t *to)
     250{
     251        struct timeval tv = { 0, 0 };
     252
     253        to->inlist = false;
     254        to->occurred = false;
     255        link_initialize(&to->link);
     256        to->expires = tv;
     257}
     258
     259static void wu_event_initialize(wu_event_t *wu)
     260{
     261        wu->inlist = false;
     262        link_initialize(&wu->link);
     263}
     264
     265void awaiter_initialize(awaiter_t *aw)
     266{
     267        aw->fid = 0;
     268        aw->active = false;
     269        to_event_initialize(&aw->to_event);
     270        wu_event_initialize(&aw->wu_event);
     271}
     272
     273static amsg_t *amsg_create(void)
     274{
     275        amsg_t *msg;
     276
     277        msg = malloc(sizeof(amsg_t));
     278        if (msg) {
     279                msg->done = false;
     280                msg->forget = false;
     281                msg->destroyed = false;
     282                msg->dataptr = NULL;
     283                msg->retval = (sysarg_t) EINVAL;
     284                awaiter_initialize(&msg->wdata);
     285        }
     286
     287        return msg;
     288}
     289
     290static void amsg_destroy(amsg_t *msg)
     291{
     292        assert(!msg->destroyed);
     293        msg->destroyed = true;
     294        free(msg);
     295}
    242296
    243297static void *default_client_data_constructor(void)
     
    892946       
    893947        switch (IPC_GET_IMETHOD(*call)) {
    894         case IPC_M_CONNECT_ME:
     948        case IPC_M_CLONE_ESTABLISH:
    895949        case IPC_M_CONNECT_ME_TO:
    896950                /* Open new connection with fibril, etc. */
     
    9631017               
    9641018                suseconds_t timeout;
     1019                unsigned int flags = SYNCH_FLAGS_NONE;
    9651020                if (!list_empty(&timeout_list)) {
    9661021                        awaiter_t *waiter = list_get_instance(
     
    9731028                                futex_up(&async_futex);
    9741029                                handle_expired_timeouts();
    975                                 continue;
    976                         } else
     1030                                /*
     1031                                 * Notice that even if the event(s) already
     1032                                 * expired (and thus the other fibril was
     1033                                 * supposed to be running already),
     1034                                 * we check for incoming IPC.
     1035                                 *
     1036                                 * Otherwise, a fibril that continuously
     1037                                 * creates (almost) expired events could
     1038                                 * prevent IPC retrieval from the kernel.
     1039                                 */
     1040                                timeout = 0;
     1041                                flags = SYNCH_FLAGS_NON_BLOCKING;
     1042
     1043                        } else {
    9771044                                timeout = tv_sub(&waiter->to_event.expires, &tv);
    978                 } else
     1045                                futex_up(&async_futex);
     1046                        }
     1047                } else {
     1048                        futex_up(&async_futex);
    9791049                        timeout = SYNCH_NO_TIMEOUT;
    980                
    981                 futex_up(&async_futex);
     1050                }
    9821051               
    9831052                atomic_inc(&threads_in_ipc_wait);
    9841053               
    9851054                ipc_call_t call;
    986                 ipc_callid_t callid = ipc_wait_cycle(&call, timeout,
    987                     SYNCH_FLAGS_NONE);
     1055                ipc_callid_t callid = ipc_wait_cycle(&call, timeout, flags);
    9881056               
    9891057                atomic_dec(&threads_in_ipc_wait);
     
    11001168       
    11011169        msg->done = true;
    1102         if (!msg->wdata.active) {
     1170
     1171        if (msg->forget) {
     1172                assert(msg->wdata.active);
     1173                amsg_destroy(msg);
     1174        } else if (!msg->wdata.active) {
    11031175                msg->wdata.active = true;
    11041176                fibril_add_ready(msg->wdata.fid);
    11051177        }
    1106        
     1178
    11071179        futex_up(&async_futex);
    11081180}
     
    11311203                return 0;
    11321204       
    1133         amsg_t *msg = malloc(sizeof(amsg_t));
     1205        amsg_t *msg = amsg_create();
    11341206        if (msg == NULL)
    11351207                return 0;
    11361208       
    1137         msg->done = false;
    11381209        msg->dataptr = dataptr;
    1139        
    1140         msg->wdata.to_event.inlist = false;
    1141        
    1142         /*
    1143          * We may sleep in the next method,
    1144          * but it will use its own means
    1145          */
    11461210        msg->wdata.active = true;
    11471211       
     
    11771241                return 0;
    11781242       
    1179         amsg_t *msg = malloc(sizeof(amsg_t));
    1180        
     1243        amsg_t *msg = amsg_create();
    11811244        if (msg == NULL)
    11821245                return 0;
    11831246       
    1184         msg->done = false;
    11851247        msg->dataptr = dataptr;
    1186        
    1187         msg->wdata.to_event.inlist = false;
    1188        
    1189         /*
    1190          * We may sleep in the next method,
    1191          * but it will use its own means
    1192          */
    11931248        msg->wdata.active = true;
    11941249       
     
    12131268       
    12141269        futex_down(&async_futex);
     1270
     1271        assert(!msg->forget);
     1272        assert(!msg->destroyed);
     1273
    12151274        if (msg->done) {
    12161275                futex_up(&async_futex);
     
    12311290                *retval = msg->retval;
    12321291       
    1233         free(msg);
     1292        amsg_destroy(msg);
    12341293}
    12351294
    12361295/** Wait for a message sent by the async framework, timeout variant.
     1296 *
     1297 * If the wait times out, the caller may choose to either wait again by calling
     1298 * async_wait_for() or async_wait_timeout(), or forget the message via
     1299 * async_forget().
    12371300 *
    12381301 * @param amsgid  Hash of the message to wait for.
     
    12491312       
    12501313        amsg_t *msg = (amsg_t *) amsgid;
    1251        
    1252         /* TODO: Let it go through the event read at least once */
    1253         if (timeout < 0)
    1254                 return ETIMEOUT;
    1255        
     1314
    12561315        futex_down(&async_futex);
     1316
     1317        assert(!msg->forget);
     1318        assert(!msg->destroyed);
     1319
    12571320        if (msg->done) {
    12581321                futex_up(&async_futex);
     
    12601323        }
    12611324       
     1325        /*
     1326         * Negative timeout is converted to zero timeout to avoid
     1327         * using tv_add with negative augmenter.
     1328         */
     1329        if (timeout < 0)
     1330                timeout = 0;
     1331
    12621332        gettimeofday(&msg->wdata.to_event.expires, NULL);
    12631333        tv_add(&msg->wdata.to_event.expires, timeout);
    12641334       
     1335        /*
     1336         * Current fibril is inserted as waiting regardless of the
     1337         * "size" of the timeout.
     1338         *
     1339         * Checking for msg->done and immediately bailing out when
     1340         * timeout == 0 would mean that the manager fibril would never
     1341         * run (consider single threaded program).
     1342         * Thus the IPC answer would be never retrieved from the kernel.
     1343         *
     1344         * Notice that the actual delay would be very small because we
     1345         * - switch to manager fibril
     1346         * - the manager sees expired timeout
     1347         * - and thus adds us back to ready queue
     1348         * - manager switches back to some ready fibril
     1349         *   (prior it, it checks for incoming IPC).
     1350         *
     1351         */
    12651352        msg->wdata.fid = fibril_get_id();
    12661353        msg->wdata.active = false;
     
    12791366                *retval = msg->retval;
    12801367       
    1281         free(msg);
     1368        amsg_destroy(msg);
    12821369       
    12831370        return 0;
    12841371}
     1372 
     1373/** Discard the message / reply on arrival.
     1374 *
     1375 * The message will be marked to be discarded once the reply arrives in
     1376 * reply_received(). It is not allowed to call async_wait_for() or
     1377 * async_wait_timeout() on this message after a call to this function.
     1378 *
     1379 * @param amsgid  Hash of the message to forget.
     1380 */
     1381void async_forget(aid_t amsgid)
     1382{
     1383        amsg_t *msg = (amsg_t *) amsgid;
     1384
     1385        assert(msg);
     1386        assert(!msg->forget);
     1387        assert(!msg->destroyed);
     1388
     1389        futex_down(&async_futex);
     1390        if (msg->done) {
     1391                amsg_destroy(msg);
     1392        } else {
     1393                msg->dataptr = NULL;
     1394                msg->forget = true;
     1395        }
     1396        futex_up(&async_futex);
     1397}
    12851398
    12861399/** Wait for specified time.
     
    12931406void async_usleep(suseconds_t timeout)
    12941407{
    1295         amsg_t *msg = malloc(sizeof(amsg_t));
    1296        
     1408        amsg_t *msg = amsg_create();
    12971409        if (!msg)
    12981410                return;
    12991411       
    13001412        msg->wdata.fid = fibril_get_id();
    1301         msg->wdata.active = false;
    13021413       
    13031414        gettimeofday(&msg->wdata.to_event.expires, NULL);
     
    13131424        /* Futex is up automatically after fibril_switch() */
    13141425       
    1315         free(msg);
     1426        amsg_destroy(msg);
    13161427}
    13171428
     
    15591670}
    15601671
    1561 /** Wrapper for making IPC_M_CONNECT_ME calls using the async framework.
    1562  *
    1563  * Ask through for a cloned connection to some service.
     1672/** Wrapper for making IPC_M_CLONE_ESTABLISH calls using the async framework.
     1673 *
     1674 * Ask for a cloned connection to some service.
    15641675 *
    15651676 * @param mgmt Exchange management style.
     
    15691680 *
    15701681 */
    1571 async_sess_t *async_connect_me(exch_mgmt_t mgmt, async_exch_t *exch)
     1682async_sess_t *async_clone_establish(exch_mgmt_t mgmt, async_exch_t *exch)
    15721683{
    15731684        if (exch == NULL) {
     
    15841695        ipc_call_t result;
    15851696       
    1586         amsg_t *msg = malloc(sizeof(amsg_t));
    1587         if (msg == NULL) {
     1697        amsg_t *msg = amsg_create();
     1698        if (!msg) {
    15881699                free(sess);
    15891700                errno = ENOMEM;
     
    15911702        }
    15921703       
    1593         msg->done = false;
    15941704        msg->dataptr = &result;
    1595        
    1596         msg->wdata.to_event.inlist = false;
    1597        
    1598         /*
    1599          * We may sleep in the next method,
    1600          * but it will use its own means
    1601          */
    16021705        msg->wdata.active = true;
    16031706       
    1604         ipc_call_async_0(exch->phone, IPC_M_CONNECT_ME, msg,
     1707        ipc_call_async_0(exch->phone, IPC_M_CLONE_ESTABLISH, msg,
    16051708            reply_received, true);
    16061709       
     
    16431746        ipc_call_t result;
    16441747       
    1645         amsg_t *msg = malloc(sizeof(amsg_t));
    1646         if (msg == NULL)
     1748        amsg_t *msg = amsg_create();
     1749        if (!msg)
    16471750                return ENOENT;
    16481751       
    1649         msg->done = false;
    16501752        msg->dataptr = &result;
    1651        
    1652         msg->wdata.to_event.inlist = false;
    1653        
    1654         /*
    1655          * We may sleep in the next method,
    1656          * but it will use its own means
    1657          */
    16581753        msg->wdata.active = true;
    16591754       
     
    22512346            IPC_FF_ROUTE_FROM_ME);
    22522347        if (retval != EOK) {
    2253                 async_wait_for(msg, NULL);
     2348                async_forget(msg);
    22542349                ipc_answer_0(callid, retval);
    22552350                return retval;
     
    24452540            IPC_FF_ROUTE_FROM_ME);
    24462541        if (retval != EOK) {
    2447                 async_wait_for(msg, NULL);
     2542                async_forget(msg);
    24482543                ipc_answer_0(callid, retval);
    24492544                return retval;
  • uspace/lib/c/generic/device/nic.c

    r0747468 r97c7682  
    6565       
    6666        if (retval != EOK) {
    67                 async_wait_for(req, NULL);
     67                async_forget(req);
    6868                return retval;
    6969        }
     
    9494        rc = async_connect_to_me(exch, 0, 0, 0, cfun, carg);
    9595        if (rc != EOK) {
    96                 async_wait_for(req, NULL);
     96                async_forget(req);
    9797                return rc;
    9898        }
  • uspace/lib/c/generic/devman.c

    r0747468 r97c7682  
    188188       
    189189        if (retval != EOK) {
    190                 async_wait_for(req, NULL);
     190                async_forget(req);
    191191                return retval;
    192192        }
     
    226226        if (retval != EOK) {
    227227                devman_exchange_end(exch);
    228                 async_wait_for(req, NULL);
     228                async_forget(req);
    229229                return retval;
    230230        }
     
    242242                if (retval != EOK) {
    243243                        devman_exchange_end(exch);
    244                         async_wait_for(req2, NULL);
    245                         async_wait_for(req, NULL);
     244                        async_forget(req2);
     245                        async_forget(req);
    246246                        return retval;
    247247                }
     
    250250                if (retval != EOK) {
    251251                        devman_exchange_end(exch);
    252                         async_wait_for(req, NULL);
     252                        async_forget(req);
    253253                        return retval;
    254254                }
     
    283283       
    284284        if (retval != EOK) {
    285                 async_wait_for(req, NULL);
     285                async_forget(req);
    286286                return retval;
    287287        }
     
    386386       
    387387        if (retval != EOK) {
    388                 async_wait_for(req, NULL);
     388                async_forget(req);
    389389                return retval;
    390390        }
     
    423423       
    424424        if (dretval != EOK) {
    425                 async_wait_for(req, NULL);
     425                async_forget(req);
    426426                return dretval;
    427427        }
     
    430430        async_wait_for(req, &retval);
    431431       
    432         if (retval != EOK)
    433                 return retval;
     432        if (retval != EOK) {
     433                return retval;
     434        }
    434435       
    435436        act_size = IPC_GET_ARG2(dreply);
     
    452453}
    453454
     455int devman_fun_get_driver_name(devman_handle_t handle, char *buf, size_t buf_size)
     456{
     457        return devman_get_str_internal(DEVMAN_FUN_GET_DRIVER_NAME, handle, buf,
     458            buf_size);
     459}
     460
    454461int devman_fun_online(devman_handle_t funh)
    455462{
     
    488495       
    489496        if (rc != EOK) {
    490                 async_wait_for(req, NULL);
     497                async_forget(req);
    491498                return rc;
    492499        }
  • uspace/lib/c/generic/elf/elf_load.c

    r0747468 r97c7682  
    366366        a = as_area_create((uint8_t *) base + bias, mem_sz,
    367367            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
    368         if (a == (void *) -1) {
     368        if (a == AS_MAP_FAILED) {
    369369                DPRINTF("memory mapping failed (0x%x, %d)\n",
    370370                    base + bias, mem_sz);
  • uspace/lib/c/generic/fibril.c

    r0747468 r97c7682  
    286286}
    287287
     288/** Delete a fibril that has never run.
     289 *
     290 * Free resources of a fibril that has been created with fibril_create()
     291 * but never readied using fibril_add_ready().
     292 *
     293 * @param fid Pointer to the fibril structure of the fibril to be
     294 *            added.
     295 */
     296void fibril_destroy(fid_t fid)
     297{
     298        fibril_t *fibril = (fibril_t *) fid;
     299       
     300        free(fibril->stack);
     301        fibril_teardown(fibril);
     302}
     303
    288304/** Add a fibril to the ready list.
    289305 *
  • uspace/lib/c/generic/fibril_synch.c

    r0747468 r97c7682  
    112112                awaiter_t wdata;
    113113
     114                awaiter_initialize(&wdata);
    114115                wdata.fid = fibril_get_id();
    115                 wdata.active = false;
    116116                wdata.wu_event.inlist = true;
    117                 link_initialize(&wdata.wu_event.link);
    118117                list_append(&wdata.wu_event.link, &fm->waiters);
    119118                check_for_deadlock(&fm->oi);
     
    205204                awaiter_t wdata;
    206205
     206                awaiter_initialize(&wdata);
    207207                wdata.fid = (fid_t) f;
    208                 wdata.active = false;
    209208                wdata.wu_event.inlist = true;
    210                 link_initialize(&wdata.wu_event.link);
    211209                f->flags &= ~FIBRIL_WRITER;
    212210                list_append(&wdata.wu_event.link, &frw->waiters);
     
    233231                awaiter_t wdata;
    234232
     233                awaiter_initialize(&wdata);
    235234                wdata.fid = (fid_t) f;
    236                 wdata.active = false;
    237235                wdata.wu_event.inlist = true;
    238                 link_initialize(&wdata.wu_event.link);
    239236                f->flags |= FIBRIL_WRITER;
    240237                list_append(&wdata.wu_event.link, &frw->waiters);
     
    375372                return ETIMEOUT;
    376373
     374        awaiter_initialize(&wdata);
    377375        wdata.fid = fibril_get_id();
    378         wdata.active = false;
    379        
    380376        wdata.to_event.inlist = timeout > 0;
    381         wdata.to_event.occurred = false;
    382         link_initialize(&wdata.to_event.link);
    383 
    384377        wdata.wu_event.inlist = true;
    385         link_initialize(&wdata.wu_event.link);
    386378
    387379        futex_down(&async_futex);
  • uspace/lib/c/generic/io/printf_core.c

    r0747468 r97c7682  
    283283        /* Print leading spaces. */
    284284        size_t strw = str_length(str);
    285         if (precision == 0)
     285        if ((precision == 0) || (precision > strw))
    286286                precision = strw;
    287287       
     
    331331        /* Print leading spaces. */
    332332        size_t strw = wstr_length(str);
    333         if (precision == 0)
     333        if ((precision == 0) || (precision > strw))
    334334                precision = strw;
    335335       
  • uspace/lib/c/generic/ipc.c

    r0747468 r97c7682  
    647647 *
    648648 */
    649 int ipc_connect_me(int phoneid)
     649int ipc_clone_establish(int phoneid)
    650650{
    651651        sysarg_t newphid;
    652         int res = ipc_call_sync_0_5(phoneid, IPC_M_CONNECT_ME, NULL, NULL,
    653             NULL, NULL, &newphid);
     652        int res = ipc_call_sync_0_5(phoneid, IPC_M_CLONE_ESTABLISH, NULL,
     653            NULL, NULL, NULL, &newphid);
    654654        if (res)
    655655                return res;
  • uspace/lib/c/generic/loader.c

    r0747468 r97c7682  
    101101       
    102102        if (rc != EOK) {
    103                 async_wait_for(req, NULL);
     103                async_forget(req);
    104104                return (int) rc;
    105105        }
     
    139139       
    140140        if (rc != EOK) {
    141                 async_wait_for(req, NULL);
     141                async_forget(req);
    142142                return (int) rc;
    143143        }
     
    177177       
    178178        if (rc != EOK) {
    179                 async_wait_for(req, NULL);
     179                async_forget(req);
    180180                return (int) rc;
    181181        }
     
    236236       
    237237        if (rc != EOK) {
    238                 async_wait_for(req, NULL);
     238                async_forget(req);
    239239                return (int) rc;
    240240        }
     
    281281
    282282        if (rc != EOK) {
    283                 async_wait_for(req, NULL);
     283                async_forget(req);
    284284                return (int) rc;
    285285        }
  • uspace/lib/c/generic/loc.c

    r0747468 r97c7682  
    246246       
    247247        if (retval != EOK) {
    248                 async_wait_for(req, NULL);
     248                async_forget(req);
    249249                return retval;
    250250        }
     
    285285       
    286286        if (retval != EOK) {
    287                 async_wait_for(req, NULL);
     287                async_forget(req);
    288288                return retval;
    289289        }
     
    352352       
    353353        if (retval != EOK) {
    354                 async_wait_for(req, NULL);
     354                async_forget(req);
    355355                return retval;
    356356        }
     
    401401       
    402402        if (dretval != EOK) {
    403                 async_wait_for(req, NULL);
     403                async_forget(req);
    404404                return dretval;
    405405        }
     
    448448{
    449449        return loc_get_name_internal(LOC_SERVICE_GET_NAME, svc_id, name);
     450}
     451
     452/** Get service server name.
     453 *
     454 * Provided ID of a service, return the name of its server.
     455 *
     456 * @param svc_id        Service ID
     457 * @param name          Place to store pointer to new string. Caller should
     458 *                      free it using free().
     459 * @return              EOK on success or negative error code
     460 */
     461int loc_service_get_server_name(service_id_t svc_id, char **name)
     462{
     463        return loc_get_name_internal(LOC_SERVICE_GET_SERVER_NAME, svc_id, name);
    450464}
    451465
     
    471485       
    472486        if (retval != EOK) {
    473                 async_wait_for(req, NULL);
     487                async_forget(req);
    474488                return retval;
    475489        }
     
    520534       
    521535        if (retval != EOK) {
    522                 async_wait_for(req, NULL);
     536                async_forget(req);
    523537                return retval;
    524538        }
     
    683697               
    684698                if (rc != EOK) {
    685                         async_wait_for(req, NULL);
     699                        async_forget(req);
    686700                        free(devs);
    687701                        return 0;
     
    732746               
    733747                if (rc != EOK) {
    734                         async_wait_for(req, NULL);
     748                        async_forget(req);
    735749                        free(devs);
    736750                        return 0;
     
    760774       
    761775        if (rc != EOK) {
    762                 async_wait_for(req, NULL);
     776                async_forget(req);
    763777                return rc;
    764778        }
  • uspace/lib/c/generic/malloc.c

    r0747468 r97c7682  
    285285        /* Align the heap area size on page boundary */
    286286        size_t asize = ALIGN_UP(size, PAGE_SIZE);
    287         void *astart = as_area_create((void *) -1, asize,
     287        void *astart = as_area_create(AS_AREA_ANY, asize,
    288288            AS_AREA_WRITE | AS_AREA_READ);
    289         if (astart == (void *) -1)
     289        if (astart == AS_MAP_FAILED)
    290290                return false;
    291291       
  • uspace/lib/c/generic/mman.c

    r0747468 r97c7682  
    4242{
    4343        if (!start)
    44                 start = (void *) -1;
     44                start = AS_AREA_ANY;
    4545       
    4646//      if (!((flags & MAP_SHARED) ^ (flags & MAP_PRIVATE)))
  • uspace/lib/c/generic/net/socket_client.c

    r0747468 r97c7682  
    4444#include <errno.h>
    4545#include <task.h>
     46#include <ns.h>
    4647#include <ipc/services.h>
    4748#include <ipc/socket.h>
    48 #include <net/modules.h>
    4949#include <net/in.h>
    5050#include <net/socket.h>
     
    283283static async_sess_t *socket_get_tcp_sess(void)
    284284{
    285         if (socket_globals.tcp_sess == NULL) {
    286                 socket_globals.tcp_sess = bind_service(SERVICE_TCP,
     285        if (socket_globals.tcp_sess == NULL)
     286                socket_globals.tcp_sess = service_bind(SERVICE_TCP,
    287287                    0, 0, SERVICE_TCP, socket_connection);
    288         }
    289 
     288       
    290289        return socket_globals.tcp_sess;
    291290}
     
    300299static async_sess_t *socket_get_udp_sess(void)
    301300{
    302         if (socket_globals.udp_sess == NULL) {
    303                 socket_globals.udp_sess = bind_service(SERVICE_UDP,
     301        if (socket_globals.udp_sess == NULL)
     302                socket_globals.udp_sess = service_bind(SERVICE_UDP,
    304303                    0, 0, SERVICE_UDP, socket_connection);
    305         }
    306 
     304       
    307305        return socket_globals.udp_sess;
    308306}
     
    378376 * @return              Other error codes as defined for the NET_SOCKET message.
    379377 * @return              Other error codes as defined for the
    380  *                      bind_service() function.
     378 *                      service_bind() function.
    381379 */
    382380int socket(int domain, int type, int protocol)
  • uspace/lib/c/generic/ns.c

    r0747468 r97c7682  
    3737#include <async.h>
    3838#include <macros.h>
     39#include <errno.h>
    3940#include "private/ns.h"
    4041
     
    4849}
    4950
    50 async_sess_t *service_connect(exch_mgmt_t mgmt, sysarg_t service, sysarg_t arg2,
     51async_sess_t *service_connect(exch_mgmt_t mgmt, services_t service, sysarg_t arg2,
    5152    sysarg_t arg3)
    5253{
     
    7273}
    7374
    74 async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, sysarg_t service,
     75async_sess_t *service_connect_blocking(exch_mgmt_t mgmt, services_t service,
    7576    sysarg_t arg2, sysarg_t arg3)
    7677{
     
    8182            async_connect_me_to_blocking(mgmt, exch, service, arg2, arg3);
    8283        async_exchange_end(exch);
    83 
     84       
    8485        if (!sess)
    8586                return NULL;
     
    9192         */
    9293        async_sess_args_set(sess, arg2, arg3, 0);
     94       
     95        return sess;
     96}
     97
     98/** Create bidirectional connection with a service
     99 *
     100 * @param[in] service         Service.
     101 * @param[in] arg1            First parameter.
     102 * @param[in] arg2            Second parameter.
     103 * @param[in] arg3            Third parameter.
     104 * @param[in] client_receiver Message receiver.
     105 *
     106 * @return Session to the service.
     107 * @return Other error codes as defined by async_connect_to_me().
     108 *
     109 */
     110async_sess_t *service_bind(services_t service, sysarg_t arg1, sysarg_t arg2,
     111    sysarg_t arg3, async_client_conn_t client_receiver)
     112{
     113        /* Connect to the needed service */
     114        async_sess_t *sess =
     115            service_connect_blocking(EXCHANGE_SERIALIZE, service, 0, 0);
     116        if (sess != NULL) {
     117                /* Request callback connection */
     118                async_exch_t *exch = async_exchange_begin(sess);
     119                int rc = async_connect_to_me(exch, arg1, arg2, arg3,
     120                    client_receiver, NULL);
     121                async_exchange_end(exch);
     122               
     123                if (rc != EOK) {
     124                        async_hangup(sess);
     125                        errno = rc;
     126                        return NULL;
     127                }
     128        }
    93129       
    94130        return sess;
  • uspace/lib/c/generic/private/async.h

    r0747468 r97c7682  
    8181} awaiter_t;
    8282
     83extern void awaiter_initialize(awaiter_t *);
     84
    8385extern void __async_init(void);
    8486extern void async_insert_timeout(awaiter_t *);
  • uspace/lib/c/generic/stacktrace.c

    r0747468 r97c7682  
    3838#include <sys/types.h>
    3939#include <errno.h>
     40#include <unistd.h>
    4041
    4142static int stacktrace_read_uintptr(void *arg, uintptr_t addr, uintptr_t *data);
  • uspace/lib/c/generic/stats.c

    r0747468 r97c7682  
    4040#include <inttypes.h>
    4141#include <malloc.h>
     42#include <unistd.h>
    4243
    4344#define SYSINFO_STATS_MAX_PATH  64
  • uspace/lib/c/generic/sysinfo.c

    r0747468 r97c7682  
    3939#include <malloc.h>
    4040#include <bool.h>
     41#include <unistd.h>
    4142
    4243/** Get sysinfo keys size
  • uspace/lib/c/generic/thread.c

    r0747468 r97c7682  
    4141#include <str.h>
    4242#include <async.h>
     43#include <errno.h>
     44#include <as.h>
    4345#include "private/thread.h"
    4446
    45 #ifndef THREAD_INITIAL_STACK_PAGES_NO
    46 #define THREAD_INITIAL_STACK_PAGES_NO   2
     47#ifndef THREAD_INITIAL_STACK_PAGES
     48        #define THREAD_INITIAL_STACK_PAGES  2
    4749#endif
    4850
     
    6567       
    6668        uarg->uspace_thread_function(uarg->uspace_thread_arg);
    67         /* XXX: we cannot free the userspace stack while running on it
    68                 free(uarg->uspace_stack);
    69                 free(uarg);
    70         */
     69        /*
     70         * XXX: we cannot free the userspace stack while running on it
     71         *
     72         * free(uarg->uspace_stack);
     73         * free(uarg);
     74         */
    7175       
    7276        /* If there is a manager, destroy it */
     
    9296    thread_id_t *tid)
    9397{
    94         char *stack;
    95         uspace_arg_t *uarg;
    96         int rc;
    97 
    98         stack = (char *) malloc(getpagesize() * THREAD_INITIAL_STACK_PAGES_NO);
    99         if (!stack)
    100                 return -1;
    101                
    102         uarg = (uspace_arg_t *) malloc(sizeof(uspace_arg_t));
    103         if (!uarg) {
    104                 free(stack);
    105                 return -1;
     98        uspace_arg_t *uarg =
     99            (uspace_arg_t *) malloc(sizeof(uspace_arg_t));
     100        if (!uarg)
     101                return ENOMEM;
     102       
     103        size_t stack_size = getpagesize() * THREAD_INITIAL_STACK_PAGES;
     104        void *stack = as_area_create(AS_AREA_ANY, stack_size,
     105            AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE);
     106        if (stack == AS_MAP_FAILED) {
     107                free(uarg);
     108                return ENOMEM;
    106109        }
    107110       
    108111        uarg->uspace_entry = (void *) FADDR(__thread_entry);
    109         uarg->uspace_stack = (void *) stack;
     112        uarg->uspace_stack = stack;
     113        uarg->uspace_stack_size = stack_size;
    110114        uarg->uspace_thread_function = function;
    111115        uarg->uspace_thread_arg = arg;
    112116        uarg->uspace_uarg = uarg;
    113117       
    114         rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg, (sysarg_t) name,
    115             (sysarg_t) str_size(name), (sysarg_t) tid);
     118        int rc = __SYSCALL4(SYS_THREAD_CREATE, (sysarg_t) uarg,
     119            (sysarg_t) name, (sysarg_t) str_size(name), (sysarg_t) tid);
    116120       
    117         if (rc) {
     121        if (rc != EOK) {
    118122                /*
    119123                 * Failed to create a new thread.
    120                  * Free up the allocated structures.
     124                 * Free up the allocated data.
    121125                 */
     126                as_area_destroy(stack);
    122127                free(uarg);
    123                 free(stack);
    124128        }
    125 
     129       
    126130        return rc;
    127131}
  • uspace/lib/c/generic/time.c

    r0747468 r97c7682  
    4343#include <ddi.h>
    4444#include <libc.h>
     45#include <unistd.h>
    4546
    4647/** Pointer to kernel shared variables with time */
  • uspace/lib/c/include/as.h

    r0747468 r97c7682  
    4141#include <libarch/config.h>
    4242
     43#define AS_AREA_ANY    ((void *) -1)
     44#define AS_MAP_FAILED  ((void *) -1)
     45
    4346static inline size_t SIZE2PAGES(size_t size)
    4447{
  • uspace/lib/c/include/async.h

    r0747468 r97c7682  
    139139extern void async_wait_for(aid_t, sysarg_t *);
    140140extern int async_wait_timeout(aid_t, sysarg_t *, suseconds_t);
     141extern void async_forget(aid_t);
    141142
    142143extern fid_t async_new_connection(task_id_t, sysarg_t, ipc_callid_t,
     
    320321    sysarg_t *, sysarg_t *);
    321322
    322 extern async_sess_t *async_connect_me(exch_mgmt_t, async_exch_t *);
     323extern async_sess_t *async_clone_establish(exch_mgmt_t, async_exch_t *);
    323324extern async_sess_t *async_connect_me_to(exch_mgmt_t, async_exch_t *, sysarg_t,
    324325    sysarg_t, sysarg_t);
  • uspace/lib/c/include/devman.h

    r0747468 r97c7682  
    6464    size_t *);
    6565extern int devman_fun_get_name(devman_handle_t, char *, size_t);
     66extern int devman_fun_get_driver_name(devman_handle_t, char *, size_t);
    6667extern int devman_fun_get_path(devman_handle_t, char *, size_t);
    6768extern int devman_fun_online(devman_handle_t);
  • uspace/lib/c/include/errno.h

    r0747468 r97c7682  
    3737
    3838#include <abi/errno.h>
    39 #include <fibril.h>
    4039
    4140#define errno  (*(__errno()))
  • uspace/lib/c/include/fibril.h

    r0747468 r97c7682  
    8787
    8888extern fid_t fibril_create(int (*func)(void *), void *arg);
     89extern void fibril_destroy(fid_t fid);
    8990extern fibril_t *fibril_setup(void);
    9091extern void fibril_teardown(fibril_t *f);
  • uspace/lib/c/include/inet/inet.h

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup libc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Hardware types according to the on-line IANA - Address Resolution Protocol
    35  * (ARP) Parameters
    36  * http://www.iana.org/assignments/arp-parameters/arp-parameters.xml,
    37  * cited January 14 2009.
    3833 */
    3934
    40 #ifndef LIBNET_NET_HARDWARE_H_
    41 #define LIBNET_NET_HARDWARE_H_
     35#ifndef LIBC_INET_INET_H_
     36#define LIBC_INET_INET_H_
    4237
    4338#include <sys/types.h>
    4439
    45 /** Network interface layer type type definition. */
    46 typedef uint8_t hw_type_t;
     40#define INET_TTL_MAX 255
    4741
    48 /** @name Network interface layer types definitions */
    49 /*@{*/
     42typedef struct {
     43        uint32_t ipv4;
     44} inet_addr_t;
    5045
    51 /** Ethernet (10Mb) hardware type. */
    52 #define HW_ETHER                1
     46typedef struct {
     47        inet_addr_t src;
     48        inet_addr_t dest;
     49        uint8_t tos;
     50        void *data;
     51        size_t size;
     52} inet_dgram_t;
    5353
    54 /*@}*/
     54typedef struct {
     55        int (*recv)(inet_dgram_t *);
     56} inet_ev_ops_t;
     57
     58typedef enum {
     59        INET_DF = 1
     60} inet_df_t;
     61
     62extern int inet_init(uint8_t, inet_ev_ops_t *);
     63extern int inet_send(inet_dgram_t *, uint8_t, inet_df_t);
     64extern int inet_get_srcaddr(inet_addr_t *, uint8_t, inet_addr_t *);
    5565
    5666#endif
     
    5868/** @}
    5969 */
    60 
  • uspace/lib/c/include/inet/inetping.h

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  * ICMP common interface implementation.
    35  * @see icmp_common.h
    36  */
     35#ifndef LIBC_INET_INETPING_H_
     36#define LIBC_INET_INETPING_H_
    3737
    38 #include <net/modules.h>
    39 #include <net/icmp_common.h>
    40 #include <ipc/services.h>
    41 #include <ipc/icmp.h>
    42 #include <sys/time.h>
    43 #include <async.h>
     38#include <inet/inet.h>
     39#include <sys/types.h>
    4440
    45 /** Connect to the ICMP module.
    46  *
    47  * @return ICMP module session.
    48  *
    49  */
    50 async_sess_t *icmp_connect_module(void)
    51 {
    52         return connect_to_service(SERVICE_ICMP);
    53 }
     41typedef struct {
     42        inet_addr_t src;
     43        inet_addr_t dest;
     44        uint16_t seq_no;
     45        void *data;
     46        size_t size;
     47} inetping_sdu_t;
     48
     49typedef struct inetping_ev_ops {
     50        int (*recv)(inetping_sdu_t *);
     51} inetping_ev_ops_t;
     52
     53extern int inetping_init(inetping_ev_ops_t *);
     54extern int inetping_send(inetping_sdu_t *);
     55extern int inetping_get_srcaddr(inet_addr_t *, inet_addr_t *);
     56
     57
     58#endif
    5459
    5560/** @}
  • uspace/lib/c/include/inet/iplink.h

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 /** @addtogroup libnet
     29/** @addtogroup libc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Internetwork layer module interface for the underlying network interface
    35  * layer. This interface is always called by the remote modules.
    3633 */
    3734
    38 #ifndef LIBNET_IL_REMOTE_H_
    39 #define LIBNET_IL_REMOTE_H_
     35#ifndef LIBC_INET_IPLINK_H_
     36#define LIBC_INET_IPLINK_H_
    4037
    41 #include <ipc/services.h>
     38#include <async.h>
    4239#include <sys/types.h>
    43 #include <net/device.h>
    44 #include <net/packet.h>
    45 #include <async.h>
    4640
    47 /** @name Internetwork layer module interface
    48  * This interface is used by other modules.
    49  */
    50 /*@{*/
     41struct iplink_ev_ops;
    5142
    52 extern int il_device_state_msg(async_sess_t *, nic_device_id_t,
    53     nic_device_state_t, services_t);
    54 extern int il_received_msg(async_sess_t *, nic_device_id_t, packet_t *,
    55     services_t);
    56 extern int il_mtu_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    57     services_t);
    58 extern int il_addr_changed_msg(async_sess_t *, nic_device_id_t, size_t,
    59     const uint8_t *);
     43typedef struct {
     44        async_sess_t *sess;
     45        struct iplink_ev_ops *ev_ops;
     46} iplink_t;
    6047
    61 /*@}*/
     48typedef struct {
     49        uint32_t ipv4;
     50} iplink_addr_t;
     51
     52/** IP link Service Data Unit */
     53typedef struct {
     54        /** Local source address */
     55        iplink_addr_t lsrc;
     56        /** Local destination address */
     57        iplink_addr_t ldest;
     58        /** Serialized IP packet */
     59        void *data;
     60        /** Size of @c data in bytes */
     61        size_t size;
     62} iplink_sdu_t;
     63
     64typedef struct iplink_ev_ops {
     65        int (*recv)(iplink_t *, iplink_sdu_t *);
     66} iplink_ev_ops_t;
     67
     68extern int iplink_open(async_sess_t *, iplink_ev_ops_t *, iplink_t **);
     69extern void iplink_close(iplink_t *);
     70extern int iplink_send(iplink_t *, iplink_sdu_t *);
     71extern int iplink_addr_add(iplink_t *, iplink_addr_t *);
     72extern int iplink_addr_remove(iplink_t *, iplink_addr_t *);
     73extern int iplink_get_mtu(iplink_t *, size_t *);
    6274
    6375#endif
  • uspace/lib/c/include/inet/iplink_srv.h

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
     2 * Copyright (c) 2012 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    2828
    2929/** @addtogroup libc
    30  *  @{
     30 * @{
     31 */
     32/** @file
    3133 */
    3234
    33 /** @file
    34  * Character string with measured length.
    35  * The structure has been designed for serialization of character strings
    36  * between modules.
    37  */
     35#ifndef LIBC_INET_IPLINK_SRV_H_
     36#define LIBC_INET_IPLINK_SRV_H_
    3837
    39 #ifndef LIBC_MEASURED_STRINGS_H_
    40 #define LIBC_MEASURED_STRINGS_H_
     38#include <async.h>
     39#include <fibril_synch.h>
     40#include <bool.h>
     41#include <sys/types.h>
    4142
    42 #include <sys/types.h>
    43 #include <async.h>
     43struct iplink_ops;
    4444
    45 /** Type definition of the character string with measured length.
    46  * @see measured_string
    47  */
    48 typedef struct measured_string measured_string_t;
     45typedef struct {
     46        fibril_mutex_t lock;
     47        bool connected;
     48        struct iplink_ops *ops;
     49        void *arg;
     50        async_sess_t *client_sess;
     51} iplink_srv_t;
    4952
    50 /** Character string with measured length.
    51  *
    52  * This structure has been designed for serialization of character strings
    53  * between modules.
    54  */
    55 struct measured_string {
    56         /** Character string data. */
    57         uint8_t *value;
    58         /** Character string length. */
    59         size_t length;
    60 };
     53typedef struct {
     54        uint32_t ipv4;
     55} iplink_srv_addr_t;
    6156
    62 extern measured_string_t *measured_string_create_bulk(const uint8_t *, size_t);
    63 extern measured_string_t *measured_string_copy(measured_string_t *);
     57/** IP link Service Data Unit */
     58typedef struct {
     59        /** Local source address */
     60        iplink_srv_addr_t lsrc;
     61        /** Local destination address */
     62        iplink_srv_addr_t ldest;
     63        /** Serialized IP packet */
     64        void *data;
     65        /** Size of @c data in bytes */
     66        size_t size;
     67} iplink_srv_sdu_t;
    6468
    65 extern int measured_strings_receive(measured_string_t **, uint8_t **, size_t);
    66 extern int measured_strings_reply(const measured_string_t *, size_t);
     69typedef struct iplink_ops {
     70        int (*open)(iplink_srv_t *);
     71        int (*close)(iplink_srv_t *);
     72        int (*send)(iplink_srv_t *, iplink_srv_sdu_t *);
     73        int (*get_mtu)(iplink_srv_t *, size_t *);
     74        int (*addr_add)(iplink_srv_t *, iplink_srv_addr_t *);
     75        int (*addr_remove)(iplink_srv_t *, iplink_srv_addr_t *);
     76} iplink_ops_t;
    6777
    68 extern int measured_strings_return(async_exch_t *, measured_string_t **,
    69     uint8_t **, size_t);
    70 extern int measured_strings_send(async_exch_t *, const measured_string_t *,
    71     size_t);
     78extern void iplink_srv_init(iplink_srv_t *);
     79
     80extern int iplink_conn(ipc_callid_t, ipc_call_t *, void *);
     81extern int iplink_ev_recv(iplink_srv_t *, iplink_srv_sdu_t *);
    7282
    7383#endif
  • uspace/lib/c/include/ipc/devman.h

    r0747468 r97c7682  
    157157        DEVMAN_FUN_GET_CHILD,
    158158        DEVMAN_FUN_GET_NAME,
     159        DEVMAN_FUN_GET_DRIVER_NAME,
    159160        DEVMAN_FUN_ONLINE,
    160161        DEVMAN_FUN_OFFLINE,
  • uspace/lib/c/include/ipc/inet.h

    r0747468 r97c7682  
    11/*
    2  * Copyright (c) 2009 Lukas Mejdrech
    3  * Copyright (c) 2011 Radim Vansa
     2 * Copyright (c) 2012 Jiri Svoboda
    43 * All rights reserved.
    54 *
     
    2827 */
    2928
    30 /** @addtogroup libpacket
     29/** @addtogroup libcipc
    3130 * @{
    3231 */
    33 
    3432/** @file
    35  * Packet server.
    36  * The hosting module has to be compiled with both the packet.c and the
    37  * packet_server.c source files. To function correctly, initialization of the
    38  * packet map by the pm_init() function has to happen at the first place. Then
    39  * the packet messages have to be processed by the packet_server_message()
    40  * function. The packet map should be released by the pm_destroy() function
    41  * during the module termination.
    42  * @see IS_NET_PACKET_MESSAGE()
    4333 */
    4434
    45 #ifndef NET_PACKET_SERVER_H_
    46 #define NET_PACKET_SERVER_H_
     35#ifndef LIBC_IPC_INET_H_
     36#define LIBC_IPC_INET_H_
    4737
    4838#include <ipc/common.h>
    4939
    50 extern int packet_server_init(void);
    51 extern int packet_server_message(ipc_callid_t, ipc_call_t *, ipc_call_t *,
    52     size_t *);
     40/** Inet ports */
     41typedef enum {
     42        /** Default port */
     43        INET_PORT_DEFAULT = 1,
     44        /** Configuration port */
     45        INET_PORT_CFG,
     46        /** Ping service port */
     47        INET_PORT_PING
     48} inet_port_t;
     49
     50/** Requests on Inet default port */
     51typedef enum {
     52        INET_CALLBACK_CREATE = IPC_FIRST_USER_METHOD,
     53        INET_GET_SRCADDR,
     54        INET_SEND,
     55        INET_SET_PROTO
     56} inet_request_t;
     57
     58/** Events on Inet default port */
     59typedef enum {
     60        INET_EV_RECV = IPC_FIRST_USER_METHOD
     61} inet_event_t;
     62
     63/** Requests on Inet configuration port */
     64typedef enum {
     65        INETCFG_ADDR_CREATE_STATIC = IPC_FIRST_USER_METHOD,
     66        INETCFG_ADDR_DELETE,
     67        INETCFG_ADDR_GET,
     68        INETCFG_ADDR_GET_ID,
     69        INETCFG_GET_ADDR_LIST,
     70        INETCFG_GET_LINK_LIST,
     71        INETCFG_GET_SROUTE_LIST,
     72        INETCFG_LINK_GET,
     73        INETCFG_SROUTE_CREATE,
     74        INETCFG_SROUTE_DELETE,
     75        INETCFG_SROUTE_GET,
     76        INETCFG_SROUTE_GET_ID
     77} inetcfg_request_t;
     78
     79/** Events on Inet ping port */
     80typedef enum {
     81        INETPING_EV_RECV = IPC_FIRST_USER_METHOD
     82} inetping_event_t;
     83
     84/** Requests on Inet ping port */
     85typedef enum {
     86        INETPING_SEND = IPC_FIRST_USER_METHOD,
     87        INETPING_GET_SRCADDR
     88} inetping_request_t;
    5389
    5490#endif
    5591
    56 /** @}
     92/**
     93 * @}
    5794 */
  • uspace/lib/c/include/ipc/ipc.h

    r0747468 r97c7682  
    254254    sysarg_t, sysarg_t, void *, ipc_async_callback_t, bool);
    255255
     256extern int ipc_clone_establish(int);
    256257extern int ipc_connect_to_me(int, sysarg_t, sysarg_t, sysarg_t, task_id_t *,
    257258    sysarg_t *);
    258 extern int ipc_connect_me(int);
    259259extern int ipc_connect_me_to(int, sysarg_t, sysarg_t, sysarg_t);
    260260extern int ipc_connect_me_to_blocking(int, sysarg_t, sysarg_t, sysarg_t);
  • uspace/lib/c/include/ipc/iplink.h

    r0747468 r97c7682  
    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 libcipc
    3030 * @{
    3131 */
    32 
    3332/** @file
    34  * Transport layer modules messages.
    35  * @see tl_interface.h
    3633 */
    3734
    38 #ifndef LIBC_TL_MESSAGES_H_
    39 #define LIBC_TL_MESSAGES_H_
     35#ifndef LIBC_IPC_IPLINK_H_
     36#define LIBC_IPC_IPLINK_H_
    4037
    41 #include <ipc/net.h>
     38#include <ipc/common.h>
    4239
    43 /** Transport layer modules messages. */
    4440typedef enum {
    45         /** Packet received message.
    46          * @see tl_received_msg()
    47          */
    48         NET_TL_RECEIVED = NET_TL_FIRST
    49 } tl_messages;
     41        IPLINK_GET_MTU = IPC_FIRST_USER_METHOD,
     42        IPLINK_SEND,
     43        IPLINK_ADDR_ADD,
     44        IPLINK_ADDR_REMOVE
     45} iplink_request_t;
     46
     47typedef enum {
     48        IPLINK_EV_RECV = IPC_FIRST_USER_METHOD
     49} iplink_event_t;
    5050
    5151#endif
    5252
    53 /** @}
     53/**
     54 * @}
    5455 */
  • uspace/lib/c/include/ipc/loc.h

    r0747468 r97c7682  
    5656        LOC_SERVICE_GET_ID,
    5757        LOC_SERVICE_GET_NAME,
     58        LOC_SERVICE_GET_SERVER_NAME,
    5859        LOC_NAMESPACE_GET_ID,
    5960        LOC_CALLBACK_CREATE,
  • uspace/lib/c/include/ipc/services.h

    r0747468 r97c7682  
    4848        SERVICE_IRC        = FOURCC('i', 'r', 'c', ' '),
    4949        SERVICE_CLIPBOARD  = FOURCC('c', 'l', 'i', 'p'),
    50         SERVICE_NETWORKING = FOURCC('n', 'e', 't', ' '),
    51         SERVICE_ETHERNET   = FOURCC('e', 't', 'h', ' '),
    52         SERVICE_NILDUMMY   = FOURCC('n', 'i', 'l', 'd'),
    53         SERVICE_IP         = FOURCC('i', 'p', 'v', '4'),
    54         SERVICE_ARP        = FOURCC('a', 'r', 'p', ' '),
    55         SERVICE_ICMP       = FOURCC('i', 'c', 'm', 'p'),
    5650        SERVICE_UDP        = FOURCC('u', 'd', 'p', ' '),
    5751        SERVICE_TCP        = FOURCC('t', 'c', 'p', ' ')
    5852} services_t;
     53
     54#define SERVICE_NAME_INET     "net/inet"
     55#define SERVICE_NAME_INETCFG  "net/inetcfg"
     56#define SERVICE_NAME_INETPING "net/inetping"
    5957
    6058#endif
  • uspace/lib/c/include/ipc/socket.h

    r0747468 r97c7682  
    3838#define LIBC_SOCKET_MESSAGES_H_
    3939
    40 #include <ipc/net.h>
    41 
    4240/** Socket client messages. */
    4341typedef enum {
    4442        /** Creates a new socket. @see socket() */
    45         NET_SOCKET = NET_SOCKET_FIRST,
     43        NET_SOCKET = IPC_FIRST_USER_METHOD,
    4644        /** Binds the socket. @see bind() */
    4745        NET_SOCKET_BIND,
  • uspace/lib/c/include/loc.h

    r0747468 r97c7682  
    5656    unsigned int);
    5757extern int loc_service_get_name(service_id_t, char **);
     58extern int loc_service_get_server_name(service_id_t, char **);
    5859extern int loc_namespace_get_id(const char *, service_id_t *,
    5960    unsigned int);
  • uspace/lib/c/include/net/in.h

    r0747468 r97c7682  
    4545#define INET_ADDRSTRLEN  (4 * 3 + 3 + 1)
    4646
     47#define INADDR_ANY 0
     48
    4749/** Type definition of the INET address.
    4850 * @see in_addr
  • uspace/lib/c/include/ns.h

    r0747468 r97c7682  
    3737
    3838#include <sys/types.h>
     39#include <ipc/services.h>
    3940#include <task.h>
    4041#include <async.h>
    4142
    4243extern int service_register(sysarg_t);
    43 extern async_sess_t *service_connect(exch_mgmt_t, sysarg_t, sysarg_t, sysarg_t);
    44 extern async_sess_t *service_connect_blocking(exch_mgmt_t, sysarg_t, sysarg_t,
     44extern async_sess_t *service_connect(exch_mgmt_t, services_t, sysarg_t, sysarg_t);
     45extern async_sess_t *service_connect_blocking(exch_mgmt_t, services_t, sysarg_t,
    4546    sysarg_t);
     47extern async_sess_t *service_bind(services_t, sysarg_t, sysarg_t, sysarg_t,
     48    async_client_conn_t);
    4649
    4750extern int ns_ping(void);
  • uspace/lib/c/include/stdarg.h

    r0747468 r97c7682  
    4343#define va_arg(ap, type)    __builtin_va_arg(ap, type)
    4444#define va_end(ap)          __builtin_va_end(ap)
     45#define va_copy(dst, src)   __builtin_va_copy(dst, src)
    4546
    4647#endif
  • uspace/lib/c/include/stdio.h

    r0747468 r97c7682  
    3939#include <stdarg.h>
    4040#include <str.h>
    41 #include <adt/list.h>
    4241
    4342#ifndef NVERIFY_PRINTF
  • uspace/lib/c/include/sys/mman.h

    r0747468 r97c7682  
    3939#include <sys/types.h>
    4040
    41 #define MAP_FAILED  ((void *) -1)
     41#define MAP_FAILED  AS_MAP_FAILED
    4242
    4343#define MAP_SHARED     (1 << 0)
  • uspace/lib/c/include/unistd.h

    r0747468 r97c7682  
    5858#define getpagesize()  (PAGE_SIZE)
    5959
    60 extern int dup2(int oldfd, int newfd);
     60extern int dup2(int, int);
    6161
    6262extern ssize_t write(int, const void *, size_t);
     
    7373extern int unlink(const char *);
    7474
    75 extern char *getcwd(char *buf, size_t);
     75extern char *getcwd(char *, size_t);
    7676extern int rmdir(const char *);
    7777extern int chdir(const char *);
Note: See TracChangeset for help on using the changeset viewer.