Fork us on GitHub Follow us on Facebook Follow us on Twitter

Ignore:
Timestamp:
2017-11-20T20:29:03Z (5 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial
Children:
b2f542a
Parents:
19ea61d
Message:

Chardev server-side error reporting should match client side.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/io/chardev_srv.c

    r19ea61d r677cad5  
    4848        void *buf;
    4949        size_t size;
     50        size_t nread;
    5051        int rc;
    5152        ipc_callid_t rcallid;
     
    7071        }
    7172
    72         rc = srv->srvs->ops->read(srv, buf, size);
    73         if (rc < 0) {
     73        rc = srv->srvs->ops->read(srv, buf, size, &nread);
     74        if (rc != EOK && nread == 0) {
    7475                async_answer_0(rcallid, rc);
    7576                async_answer_0(callid, rc);
     
    7879        }
    7980
    80         async_data_read_finalize(rcallid, buf, size);
     81        async_data_read_finalize(rcallid, buf, nread);
    8182
    8283        free(buf);
    83         async_answer_2(callid, EOK, EOK, rc /* nread */);
     84        async_answer_2(callid, EOK, rc, nread);
    8485}
    8586
     
    8990        void *data;
    9091        size_t size;
     92        size_t nwr;
    9193        int rc;
    9294
     
    102104        }
    103105
    104         rc = srv->srvs->ops->write(srv, data, size);
     106        rc = srv->srvs->ops->write(srv, data, size, &nwr);
    105107        free(data);
    106         if (rc < 0)
     108        if (rc != EOK && nwr == 0) {
    107109                async_answer_0(callid, rc);
     110                return;
     111        }
    108112
    109         async_answer_2(callid, EOK, EOK, rc /* nwritten */);
     113        async_answer_2(callid, EOK, rc, nwr);
    110114}
    111115
Note: See TracChangeset for help on using the changeset viewer.