Changeset b7fd2a0 in mainline for uspace/srv/ns


Ignore:
Timestamp:
2018-01-13T03:10:29Z (8 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a53ed3a
Parents:
36f0738
Message:

Use errno_t in all uspace and kernel code.

Change type of every variable, parameter and return value that holds an
<errno.h> constant to either errno_t (the usual case), or sys_errno_t
(some places in kernel). This is for the purpose of self-documentation,
as well as for type-checking with a bit of type definition hackery.

Although this is a massive commit, it is a simple text replacement, and thus
is very easy to verify. Simply do the following:

`
git checkout <this commit's hash>
git reset HEAD
git add .
tools/srepl '\berrno_t\b' int
git add .
tools/srepl '\bsys_errno_t\b' sysarg_t
git reset
git diff
`

While this doesn't ensure that the replacements are correct, it does ensure
that the commit doesn't do anything except those replacements. Since errno_t
is typedef'd to int in the usual case (and sys_errno_t to sysarg_t), even if
incorrect, this commit cannot change behavior.

Location:
uspace/srv/ns
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/ns/clonable.c

    r36f0738 rb7fd2a0  
    5555static list_t cs_req;
    5656
    57 int clonable_init(void)
     57errno_t clonable_init(void)
    5858{
    5959        list_initialize(&cs_req);
     
    128128       
    129129        /* Spawn a loader. */
    130         int rc = loader_spawn("loader");
     130        errno_t rc = loader_spawn("loader");
    131131       
    132132        if (rc != EOK) {
  • uspace/srv/ns/clonable.h

    r36f0738 rb7fd2a0  
    3939#include <stdbool.h>
    4040
    41 extern int clonable_init(void);
     41extern errno_t clonable_init(void);
    4242
    4343extern bool service_clonable(service_t);
  • uspace/srv/ns/ns.c

    r36f0738 rb7fd2a0  
    8080               
    8181                task_id_t id;
    82                 int retval;
     82                errno_t retval;
    8383               
    8484                service_t service;
     
    131131        printf("%s: HelenOS IPC Naming Service\n", NAME);
    132132       
    133         int rc = service_init();
     133        errno_t rc = service_init();
    134134        if (rc != EOK)
    135135                return rc;
  • uspace/srv/ns/service.c

    r36f0738 rb7fd2a0  
    9595static list_t pending_conn;
    9696
    97 int service_init(void)
     97errno_t service_init(void)
    9898{
    9999        if (!hash_table_create(&service_hash_table, 0, 0,
     
    139139 *
    140140 */
    141 int register_service(service_t service, sysarg_t phone, ipc_call_t *call)
     141errno_t register_service(service_t service, sysarg_t phone, ipc_call_t *call)
    142142{
    143143        if (hash_table_find(&service_hash_table, &service))
     
    173173        sysarg_t arg3 = IPC_GET_ARG3(*call);
    174174        sysarg_t flags = IPC_GET_ARG4(*call);
    175         int retval;
     175        errno_t retval;
    176176       
    177177        ht_link_t *link = hash_table_find(&service_hash_table, &service);
  • uspace/srv/ns/service.h

    r36f0738 rb7fd2a0  
    3838#include <abi/ipc/interfaces.h>
    3939
    40 extern int service_init(void);
     40extern errno_t service_init(void);
    4141extern void process_pending_conn(void);
    4242
    43 extern int register_service(service_t, sysarg_t, ipc_call_t *);
     43extern errno_t register_service(service_t, sysarg_t, ipc_call_t *);
    4444extern void connect_to_service(service_t, iface_t, ipc_call_t *, ipc_callid_t);
    4545
  • uspace/srv/ns/task.c

    r36f0738 rb7fd2a0  
    151151static list_t pending_wait;
    152152
    153 int task_init(void)
     153errno_t task_init(void)
    154154{
    155155        if (!hash_table_create(&task_hash_table, 0, 0, &task_hash_table_ops)) {
     
    225225}
    226226
    227 int ns_task_id_intro(ipc_call_t *call)
     227errno_t ns_task_id_intro(ipc_call_t *call)
    228228{
    229229        task_id_t id = MERGE_LOUP32(IPC_GET_ARG1(*call), IPC_GET_ARG2(*call));
     
    264264}
    265265
    266 static int get_id_by_phone(sysarg_t phone_hash, task_id_t *id)
     266static errno_t get_id_by_phone(sysarg_t phone_hash, task_id_t *id)
    267267{
    268268        ht_link_t *link = hash_table_find(&phone_to_id, &phone_hash);
     
    276276}
    277277
    278 int ns_task_retval(ipc_call_t *call)
     278errno_t ns_task_retval(ipc_call_t *call)
    279279{
    280280        task_id_t id = call->in_task_id;
     
    296296}
    297297
    298 int ns_task_disconnect(ipc_call_t *call)
     298errno_t ns_task_disconnect(ipc_call_t *call)
    299299{
    300300        task_id_t id;
    301         int rc = get_id_by_phone(call->in_phone_hash, &id);
     301        errno_t rc = get_id_by_phone(call->in_phone_hash, &id);
    302302        if (rc != EOK)
    303303                return rc;
  • uspace/srv/ns/task.h

    r36f0738 rb7fd2a0  
    3737#include <abi/proc/task.h>
    3838
    39 extern int task_init(void);
     39extern errno_t task_init(void);
    4040extern void process_pending_wait(void);
    4141
    4242extern void wait_for_task(task_id_t, ipc_call_t *, ipc_callid_t);
    4343
    44 extern int ns_task_id_intro(ipc_call_t *);
    45 extern int ns_task_disconnect(ipc_call_t *);
    46 extern int ns_task_retval(ipc_call_t *);
     44extern errno_t ns_task_id_intro(ipc_call_t *);
     45extern errno_t ns_task_disconnect(ipc_call_t *);
     46extern errno_t ns_task_retval(ipc_call_t *);
    4747
    4848
Note: See TracChangeset for help on using the changeset viewer.