Changeset b7fd2a0 in mainline for uspace/lib/c/generic/io/io.c


Ignore:
Timestamp:
2018-01-13T03:10:29Z (7 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.

File:
1 edited

Legend:

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

    r36f0738 rb7fd2a0  
    297297                flags |= WALK_MAY_CREATE;
    298298        int file;
    299         int rc = vfs_lookup(path, flags, &file);
     299        errno_t rc = vfs_lookup(path, flags, &file);
    300300        if (rc != EOK) {
    301301                errno = rc;
     
    364364static int _fclose_nofree(FILE *stream)
    365365{
    366         int rc = 0;
     366        errno_t rc = 0;
    367367       
    368368        fflush(stream);
     
    433433static size_t _fread(void *buf, size_t size, size_t nmemb, FILE *stream)
    434434{
    435         int rc;
     435        errno_t rc;
    436436        size_t nread;
    437437
     
    462462static size_t _fwrite(const void *buf, size_t size, size_t nmemb, FILE *stream)
    463463{
    464         int rc;
     464        errno_t rc;
    465465        size_t nwritten;
    466466
     
    495495static void _ffillbuf(FILE *stream)
    496496{
    497         int rc;
     497        errno_t rc;
    498498        size_t nread;
    499499
     
    801801int fseek(FILE *stream, long offset, int whence)
    802802{
    803         int rc;
     803        errno_t rc;
    804804
    805805        if (stream->error)
     
    877877       
    878878        if ((stream->fd >= 0) && (stream->need_sync)) {
    879                 int rc;
     879                errno_t rc;
    880880
    881881                /**
     
    934934}
    935935
    936 int vfs_fhandle(FILE *stream, int *handle)
     936errno_t vfs_fhandle(FILE *stream, int *handle)
    937937{
    938938        if (stream->fd >= 0) {
Note: See TracChangeset for help on using the changeset viewer.