Changeset 7c3fb9b in mainline for uspace/lib/posix/src


Ignore:
Timestamp:
2018-05-17T08:29:01Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ff23ff
Parents:
fac0ac7
git-author:
Jiri Svoboda <jiri@…> (2018-05-16 17:28:17)
git-committer:
Jiri Svoboda <jiri@…> (2018-05-17 08:29:01)
Message:

Fix block comment formatting (ccheck).

Location:
uspace/lib/posix/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/src/fcntl.c

    rfac0ac7 r7c3fb9b  
    5555        case F_DUPFD:
    5656        case F_DUPFD_CLOEXEC:
    57                 /* VFS currently does not provide the functionality to duplicate
    58                  * opened file descriptor. */
     57                /*
     58                 * VFS currently does not provide the functionality to duplicate
     59                 * opened file descriptor.
     60                 */
    5961                // FIXME: implement this once dup() is available
    6062                errno = ENOTSUP;
     
    6769                return 0;
    6870        case F_GETFL:
    69                 /* File status flags (i.e. O_APPEND) are currently private to the
    70                  * VFS server so it cannot be easily retrieved. */
     71                /*
     72                 * File status flags (i.e. O_APPEND) are currently private to the
     73                 * VFS server so it cannot be easily retrieved.
     74                 */
    7175                flags = 0;
    72                 /* File access flags are currently not supported for file descriptors.
    73                  * Provide full access. */
     76                /*
     77                 * File access flags are currently not supported for file descriptors.
     78                 * Provide full access.
     79                 */
    7480                flags |= O_RDWR;
    7581                return flags;
    7682        case F_SETFL:
    77                 /* File access flags are currently not supported for file descriptors.
    78                  * Ignore arguments and report success. */
     83                /*
     84                 * File access flags are currently not supported for file descriptors.
     85                 * Ignore arguments and report success.
     86                 */
    7987                return 0;
    8088        case F_GETOWN:
  • uspace/lib/posix/src/locale.c

    rfac0ac7 r7c3fb9b  
    4141#include "posix/string.h"
    4242
    43 /* Just a very basic dummy implementation.
     43/*
     44 * Just a very basic dummy implementation.
    4445 * This should allow code using locales to work properly, but doesn't provide
    4546 * any localization functionality.
  • uspace/lib/posix/src/signal.c

    rfac0ac7 r7c3fb9b  
    4444#include "libc/task.h"
    4545
    46 /* This file implements a fairly dumb and incomplete "simulation" of
     46/*
     47 * This file implements a fairly dumb and incomplete "simulation" of
    4748 * POSIX signals. Since HelenOS doesn't support signals and mostly doesn't
    4849 * have any equivalent functionality, most of the signals are useless. The
     
    356357        }
    357358
    358         /* Modifying signal mask is unnecessary,
     359        /*
     360         * Modifying signal mask is unnecessary,
    359361         * signal handling is serialized.
    360362         */
  • uspace/lib/posix/src/stdio.c

    rfac0ac7 r7c3fb9b  
    126126                        ++cnt;
    127127                        if (c == delimiter) {
    128                                 /* Delimiter was just stored. Provide EOF as the next
     128                                /*
     129                                 * Delimiter was just stored. Provide EOF as the next
    129130                                 * character - it will be masked as NUL and output string
    130                                  * will be properly terminated. */
     131                                 * will be properly terminated.
     132                                 */
    131133                                c = EOF;
    132134                        } else {
    133                                 /* Neither delimiter nor EOF were encountered. Just fetch
    134                                  * the next character from the stream. */
     135                                /*
     136                                 * Neither delimiter nor EOF were encountered. Just fetch
     137                                 * the next character from the stream.
     138                                 */
    135139                                c = fgetc(stream);
    136140                        }
  • uspace/lib/posix/src/stdio/scanf.c

    rfac0ac7 r7c3fb9b  
    6161        _PROV_READY,
    6262        /** Cursor is temporarily lent to the external entity. No action is
    63          * possible until the cursor is returned.  */
     63         * possible until the cursor is returned.
     64         */
    6465        _PROV_CURSOR_LENT,
    6566};
     
    7475        int fetched;
    7576        /** Elements are fetched from the source in batches (e.g. by getline())
    76          * to allow using strtol/strtod family even on streams. */
     77         * to allow using strtol/strtod family even on streams.
     78         */
    7779        char *window;
    7880        /** Size of the current window. */
     
    8486
    8587        /** Take control over data source. Finish initialization of the internal
    86          * structures (e.g. allocation of window). */
     88         * structures (e.g. allocation of window).
     89         */
    8790        void (*capture)(struct __input_provider *);
    8891        /** Get a single element from the source and update the internal structures
    8992         * accordingly (e.g. greedy update of the window). Return -1 if the
    90          * element cannot be obtained. */
     93         * element cannot be obtained.
     94         */
    9195        int (*pop)(struct __input_provider *);
    9296        /** Undo the most recent not-undone pop operation. Might be necesarry to
    9397         * flush current window and seek data source backwards. Return 0 if the
    94          * pop history is exhausted, non-zero on success. */
     98         * pop history is exhausted, non-zero on success.
     99         */
    95100        int (*undo)(struct __input_provider *);
    96101        /** Lend the cursor to the caller.  */
    97102        const char *(*borrow_cursor)(struct __input_provider *);
    98103        /** Take control over possibly incremented cursor and update the internal
    99          * structures if necessary. */
     104         * structures if necessary.
     105         */
    100106        void (*return_cursor)(struct __input_provider *, const char *);
    101107        /** Release the control over the source. That is, synchronize any
    102108         * fetched but non-consumed elements (e.g. by seeking) and destruct
    103          * internal structures (e.g. window deallocation). */
     109         * internal structures (e.g. window deallocation).
     110         */
    104111        void (*release)(struct __input_provider *);
    105112} _input_provider;
     
    199206
    200207        if (!self->cursor || self->window == self->cursor) {
    201                 /* Complex case. Either at EOF (cursor == NULL) or there is no more
     208                /*
     209                 * Complex case. Either at EOF (cursor == NULL) or there is no more
    202210                 * place to retreat to inside the window. Seek the source backwards
    203211                 * and flush the window. Regarding the scanf, this could happend only
    204212                 * when matching unbounded string (%s) or unbounded scanset (%[) not
    205213                 * containing newline, while at the same time newline is the character
    206                  * that breaks the matching process. */
     214                 * that breaks the matching process.
     215                 */
    207216                int rc = fseek(self->source.stream, -1, SEEK_CUR);
    208217                if (rc == -1) {
     
    292301        assert(self->consumed >= self->fetched);
    293302
    294         /* Try to correct the difference between the stream position and what was
    295          * actually consumed. If it is not possible, continue anyway. */
     303        /*
     304         * Try to correct the difference between the stream position and what was
     305         * actually consumed. If it is not possible, continue anyway.
     306         */
    296307        fseek(self->source.stream, self->consumed - self->fetched, SEEK_CUR);
    297308
     
    412423                return 1;
    413424        case 'p':
    414                 /* According to POSIX, %p modifier is implementation defined but
    415                  * must correspond to its printf counterpart. */
     425                /*
     426                 * According to POSIX, %p modifier is implementation defined but
     427                 * must correspond to its printf counterpart.
     428                 */
    416429        case 'x':
    417430        case 'X':
     
    506519        int int_conv_base = 0;
    507520
    508         /* Buffers allocated by scanf for optional 'm' specifier must be remembered
     521        /*
     522         * Buffers allocated by scanf for optional 'm' specifier must be remembered
    509523         * to deallocaate them in case of an error. Because each of those buffers
    510524         * corresponds to one of the argument from va_list, there is an upper bound
    511525         * on the number of those arguments. In case of C99, this uppper bound is
    512          * 127 arguments. */
     526         * 127 arguments.
     527         */
    513528        char *buffers[127];
    514529        for (int i = 0; i < 127; ++i) {
     
    519534        in->capture(in);
    520535
    521         /* Interpret format string. Control shall prematurely jump from the cycle
     536        /*
     537         * Interpret format string. Control shall prematurely jump from the cycle
    522538         * on input failure, matching failure or illegal format string. In order
    523539         * to keep error reporting simple enough and to keep input consistent,
    524540         * error condition shall be always manifested as jump from the cycle,
    525541         * not function return. Format string pointer shall be updated specifically
    526          * for each sub-case (i.e. there shall be no loop-wide increment).*/
     542         * for each sub-case (i.e. there shall be no loop-wide increment).
     543         */
    527544        while (*fmt) {
    528545
    529546                if (converting) {
    530547
    531                         /* Processing inside conversion specifier. Either collect optional
     548                        /*
     549                         * Processing inside conversion specifier. Either collect optional
    532550                         * parameters or execute the conversion. When the conversion
    533551                         * is successfully completed, increment conversion count and switch
    534                          * back to normal mode. */
     552                         * back to normal mode.
     553                         */
    535554                        if (*fmt == '*') {
    536555                                /* Assignment-supression (optional). */
     
    564583                                        fmt = fmt_new;
    565584                                } else {
    566                                         /* Since POSIX requires width to be non-zero, it is
     585                                        /*
     586                                         * Since POSIX requires width to be non-zero, it is
    567587                                         * sufficient to interpret zero width as error without
    568                                          * referring to errno. */
     588                                         * referring to errno.
     589                                         */
    569590                                        break;
    570591                                }
     
    572593                                /* Length modifier (optional). */
    573594                                if (length_mod == LMOD_NONE) {
    574                                         /* Already set. Illegal format string. The actual detection
    575                                          * is carried out in the is_length_mod(). */
     595                                        /*
     596                                         * Already set. Illegal format string. The actual detection
     597                                         * is carried out in the is_length_mod().
     598                                         */
    576599                                        break;
    577600                                }
     
    590613                                }
    591614
    592                                 /* Conversion of the integer with %p specifier needs special
     615                                /*
     616                                 * Conversion of the integer with %p specifier needs special
    593617                                 * handling, because it is not allowed to have arbitrary
    594                                  * length modifier.  */
     618                                 * length modifier.
     619                                 */
    595620                                if (*fmt == 'p') {
    596621                                        if (length_mod == LMOD_NONE) {
     
    602627                                }
    603628
    604                                 /* First consume any white spaces, so we can borrow cursor
     629                                /*
     630                                 * First consume any white spaces, so we can borrow cursor
    605631                                 * from the input provider. This way, the cursor will either
    606632                                 * point to the non-white space while the input will be
    607633                                 * prefetched up to the newline (which is suitable for strtol),
    608                                  * or the input will be at EOF. */
     634                                 * or the input will be at EOF.
     635                                 */
    609636                                do {
    610637                                        c = in->pop(in);
     
    616643                                        break;
    617644                                } else {
    618                                         /* Everything is OK, just undo the last pop, so the cursor
    619                                          * can be borrowed. */
     645                                        /*
     646                                         * Everything is OK, just undo the last pop, so the cursor
     647                                         * can be borrowed.
     648                                         */
    620649                                        in->undo(in);
    621650                                }
     
    626655                                const char *cur_updated = NULL;
    627656
    628                                 /* Borrow the cursor. Until it is returned to the provider
     657                                /*
     658                                 * Borrow the cursor. Until it is returned to the provider
    629659                                 * we cannot jump from the cycle, because it would leave
    630                                  * the input inconsistent. */
     660                                 * the input inconsistent.
     661                                 */
    631662                                cur_borrowed = in->borrow_cursor(in);
    632663
    633                                 /* If the width is limited, the cursor horizont must be
     664                                /*
     665                                 * If the width is limited, the cursor horizont must be
    634666                                 * decreased accordingly. Otherwise the strtol could read more
    635                                  * than allowed by width. */
     667                                 * than allowed by width.
     668                                 */
    636669                                if (width != -1) {
    637670                                        cur_duplicated = strndup(cur_borrowed, width);
     
    661694                                cur_updated = NULL;
    662695                                cur_duplicated = NULL;
    663                                 /* Return the cursor to the provider. Input consistency is again
     696                                /*
     697                                 * Return the cursor to the provider. Input consistency is again
    664698                                 * the job of the provider, so we can report errors from
    665                                  * now on. */
     699                                 * now on.
     700                                 */
    666701                                in->return_cursor(in, cur_borrowed);
    667702                                cur_borrowed = NULL;
     
    673708                                }
    674709
    675                                 /* If not supressed, assign the converted integer into
    676                                  * the next output argument. */
     710                                /*
     711                                 * If not supressed, assign the converted integer into
     712                                 * the next output argument.
     713                                 */
    677714                                if (!assign_supress) {
    678715                                        if (int_conv_unsigned) {
     
    795832                                }
    796833
    797                                 /* First consume any white spaces, so we can borrow cursor
     834                                /*
     835                                 * First consume any white spaces, so we can borrow cursor
    798836                                 * from the input provider. This way, the cursor will either
    799837                                 * point to the non-white space while the input will be
    800838                                 * prefetched up to the newline (which is suitable for strtof),
    801                                  * or the input will be at EOF. */
     839                                 * or the input will be at EOF.
     840                                 */
    802841                                do {
    803842                                        c = in->pop(in);
     
    809848                                        break;
    810849                                } else {
    811                                         /* Everything is OK, just undo the last pop, so the cursor
    812                                          * can be borrowed. */
     850                                        /*
     851                                         * Everything is OK, just undo the last pop, so the cursor
     852                                         * can be borrowed.
     853                                         */
    813854                                        in->undo(in);
    814855                                }
     
    819860                                const char *cur_updated = NULL;
    820861
    821                                 /* Borrow the cursor. Until it is returned to the provider
     862                                /*
     863                                 * Borrow the cursor. Until it is returned to the provider
    822864                                 * we cannot jump from the cycle, because it would leave
    823                                  * the input inconsistent. */
     865                                 * the input inconsistent.
     866                                 */
    824867                                cur_borrowed = in->borrow_cursor(in);
    825868
    826                                 /* If the width is limited, the cursor horizont must be
     869                                /*
     870                                 * If the width is limited, the cursor horizont must be
    827871                                 * decreased accordingly. Otherwise the strtof could read more
    828                                  * than allowed by width. */
     872                                 * than allowed by width.
     873                                 */
    829874                                if (width != -1) {
    830875                                        cur_duplicated = strndup(cur_borrowed, width);
     
    862907                                cur_limited = NULL;
    863908                                cur_updated = NULL;
    864                                 /* Return the cursor to the provider. Input consistency is again
     909                                /*
     910                                 * Return the cursor to the provider. Input consistency is again
    865911                                 * the job of the provider, so we can report errors from
    866                                  * now on. */
     912                                 * now on.
     913                                 */
    867914                                in->return_cursor(in, cur_borrowed);
    868915                                cur_borrowed = NULL;
     
    874921                                }
    875922
    876                                 /* If nto supressed, assign the converted floating point number
    877                                  * into the next output argument. */
     923                                /*
     924                                 * If nto supressed, assign the converted floating point number
     925                                 * into the next output argument.
     926                                 */
    878927                                if (!assign_supress) {
    879928                                        float *pf;
     
    10081057                                int my_buffer_idx = 0;
    10091058
    1010                                 /* Retrieve the buffer into which popped characters
    1011                                  * will be stored. */
     1059                                /*
     1060                                 * Retrieve the buffer into which popped characters
     1061                                 * will be stored.
     1062                                 */
    10121063                                if (!assign_supress) {
    10131064                                        if (assign_alloc) {
     
    10471098                                                                buf_size += alloc_step;
    10481099                                                        } else {
    1049                                                                 /* Break just from this tight loop. Errno will
    1050                                                                  * be checked after it. */
     1100                                                                /*
     1101                                                                 * Break just from this tight loop. Errno will
     1102                                                                 * be checked after it.
     1103                                                                 */
    10511104                                                                break;
    10521105                                                        }
     
    10711124                                /* Check for failures. */
    10721125                                if (cur == buf) {
    1073                                         /* Matching failure. Input failure was already checked
    1074                                          * earlier. */
     1126                                        /*
     1127                                         * Matching failure. Input failure was already checked
     1128                                         * earlier.
     1129                                         */
    10751130                                        matching_failure = true;
    10761131                                        if (!assign_supress && assign_alloc) {
     
    11281183                } else {
    11291184
    1130                         /* Processing outside conversion specifier. Either skip white
     1185                        /*
     1186                         * Processing outside conversion specifier. Either skip white
    11311187                         * spaces or match characters one by one. If conversion specifier
    1132                          * is detected, switch to coversion mode. */
     1188                         * is detected, switch to coversion mode.
     1189                         */
    11331190                        if (isspace(*fmt)) {
    11341191                                /* Skip white spaces in the format string. */
     
    11941251        }
    11951252        if (rc == EOF) {
    1196                 /* Caller will not know how many arguments were successfully converted,
    1197                  * so the deallocation of buffers is our responsibility. */
     1253                /*
     1254                 * Caller will not know how many arguments were successfully converted,
     1255                 * so the deallocation of buffers is our responsibility.
     1256                 */
    11981257                for (int i = 0; i < next_unused_buffer_idx; ++i) {
    11991258                        free(buffers[i]);
  • uspace/lib/posix/src/stdlib.c

    rfac0ac7 r7c3fb9b  
    153153                }
    154154                if (middle == base) {
    155                         /* There is just one member left to check and it
     155                        /*
     156                         * There is just one member left to check and it
    156157                         * didn't match the key. Avoid infinite loop.
    157158                         */
     
    234235        // TODO: symlink resolution
    235236
    236         /* Function absolutize is implemented in libc and declared in vfs.h.
     237        /*
     238         * Function absolutize is implemented in libc and declared in vfs.h.
    237239         * No more processing is required as HelenOS doesn't have symlinks
    238240         * so far (as far as I can tell), although this function will need
     
    242244
    243245        if (absolute == NULL) {
    244                 /* POSIX requires some specific errnos to be set
     246                /*
     247                 * POSIX requires some specific errnos to be set
    245248                 * for some cases, but there is no way to find out from
    246249                 * absolutize().
  • uspace/lib/posix/src/string.c

    rfac0ac7 r7c3fb9b  
    134134                dest[i] = src[i];
    135135
    136                 /* the standard requires that nul characters
     136                /*
     137                 * the standard requires that nul characters
    137138                 * are appended to the length of n, in case src is shorter
    138139                 */
  • uspace/lib/posix/src/sys/wait.c

    rfac0ac7 r7c3fb9b  
    6464{
    6565        assert(__posix_wifsignaled(status));
    66         /* There is no way to distinguish reason
     66        /*
     67         * There is no way to distinguish reason
    6768         * for unexpected termination at the moment.
    6869         */
  • uspace/lib/posix/src/time.c

    rfac0ac7 r7c3fb9b  
    5353// TODO: test everything in this file
    5454
    55 /* In some places in this file, phrase "normalized broken-down time" is used.
     55/*
     56 * In some places in this file, phrase "normalized broken-down time" is used.
    5657 * This means time broken down to components (year, month, day, hour, min, sec),
    5758 * in which every component is in its proper bounds. Non-normalized time could
  • uspace/lib/posix/src/unistd.c

    rfac0ac7 r7c3fb9b  
    110110{
    111111        // TODO
    112         /* Always returns false, because there is no easy way to find
    113          * out under HelenOS. */
     112        /*
     113         * Always returns false, because there is no easy way to find
     114         * out under HelenOS.
     115         */
    114116        return 0;
    115117}
     
    359361{
    360362        if (amode == F_OK || (amode & (X_OK | W_OK | R_OK))) {
    361                 /* HelenOS doesn't support permissions, permission checks
     363                /*
     364                 * HelenOS doesn't support permissions, permission checks
    362365                 * are equal to existence check.
    363366                 *
Note: See TracChangeset for help on using the changeset viewer.