Changeset 4cf8ca6 in mainline


Ignore:
Timestamp:
2011-07-20T21:52:22Z (13 years ago)
Author:
Petr Koupy <petr.koupy@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
aa5acd47
Parents:
102a729
Message:

Various minor commenting (no change in functionality).

Location:
uspace/lib/posix
Files:
38 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/posix/Makefile

    r102a729 r4cf8ca6  
    6363$(INCLUDE_LIBC): ../c/include
    6464        ln -s -f -n $^ $@
    65 
  • uspace/lib/posix/assert.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Program assertion.
    3333 */
    3434
     
    5252/** @}
    5353 */
    54 
  • uspace/lib/posix/errno.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file System error numbers.
    3333 */
    3434
     
    5151/** @}
    5252 */
    53 
  • uspace/lib/posix/errno.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file System error numbers.
    3333 */
    3434
     
    325325/** @}
    326326 */
    327 
  • uspace/lib/posix/fcntl.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file File control.
    3333 */
    3434
  • uspace/lib/posix/fcntl.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file File control.
    3333 */
    3434
  • uspace/lib/posix/float.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Floating type support.
    3333 */
    3434
  • uspace/lib/posix/fnmatch.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Filename-matching.
    3333 */
    3434
     
    4545#include "internal/common.h"
    4646#include "fnmatch.h"
     47
     48// TODO: documentation
    4749
    4850#define INVALID_PATTERN -1
     
    169171};
    170172
     173/**
     174 *
     175 * @param key
     176 * @param elem
     177 * @return
     178 */
    171179static int _class_compare(const void *key, const void *elem)
    172180{
     
    175183}
    176184
     185/**
     186 *
     187 * @param cname
     188 * @param c
     189 * @return
     190 */
    177191static bool _is_in_class (const char *cname, int c)
    178192{
     
    191205}
    192206
     207/**
     208 *
     209 * @param pattern
     210 * @param str
     211 * @param flags
     212 * @return
     213 */
    193214static int _match_char_class(const char **pattern, const char *str, int flags)
    194215{
     
    204225/************** END CHARACTER CLASSES ****************/
    205226
     227/**
     228 *
     229 * @param pattern
     230 * @param flags
     231 * @return
     232 */
    206233static _coll_elm_t _next_coll_elm(const char **pattern, int flags)
    207234{
     
    240267
    241268/**
    242  *
     269 *
     270 * @param pattern
     271 * @param str
     272 * @param flags
     273 * @return
    243274 */
    244275static int _match_bracket_expr(const char **pattern, const char *str, int flags)
     
    327358
    328359/**
    329  *
     360 *
     361 * @param pattern
     362 * @param string
     363 * @param flags
     364 * @return
    330365 */
    331366static bool _partial_match(const char **pattern, const char **string, int flags)
     
    421456}
    422457
     458/**
     459 *
     460 * @param pattern
     461 * @param string
     462 * @param flags
     463 * @return
     464 */
    423465static bool _full_match(const char *pattern, const char *string, int flags)
    424466{
     
    476518}
    477519
     520/**
     521 *
     522 * @param s
     523 * @return
     524 */
    478525static char *_casefold(const char *s)
    479526{
     
    604651/** @}
    605652 */
    606 
  • uspace/lib/posix/fnmatch.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Filename-matching.
    3333 */
    3434
     
    3636#define POSIX_FNMATCH_H_
    3737
    38 /* Error Values. */
     38/* Error Values */
    3939#undef FNM_NOMATCH
    4040#define FNM_NOMATCH 1
     
    6666/** @}
    6767 */
    68 
  • uspace/lib/posix/internal/common.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Helper definitions common for all libposix files.
    3333 */
    3434
  • uspace/lib/posix/inttypes.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Fixed size integer types.
    3333 */
    3434
  • uspace/lib/posix/iso646.h

    r102a729 r4cf8ca6  
     1/*
     2 * Copyright (c) 2011 Jiri Zarevucky
     3 * All rights reserved.
     4 *
     5 * Redistribution and use in source and binary forms, with or without
     6 * modification, are permitted provided that the following conditions
     7 * are met:
     8 *
     9 * - Redistributions of source code must retain the above copyright
     10 *   notice, this list of conditions and the following disclaimer.
     11 * - Redistributions in binary form must reproduce the above copyright
     12 *   notice, this list of conditions and the following disclaimer in the
     13 *   documentation and/or other materials provided with the distribution.
     14 * - The name of the author may not be used to endorse or promote products
     15 *   derived from this software without specific prior written permission.
     16 *
     17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     27 */
    128
    229/** @addtogroup libposix
    330 * @{
    431 */
    5 /** @file
     32/** @file Alternative spellings.
    633 */
    734
     
    2552/** @}
    2653 */
    27 
  • uspace/lib/posix/limits.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Implementation-defined limit constants.
    3333 */
    3434
  • uspace/lib/posix/locale.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Locale-specific definitions.
    3333 */
    3434
     
    4141#include "limits.h"
    4242#include "string.h"
     43
     44// TODO: documentation
    4345
    4446struct __posix_locale {
     
    7375};
    7476
     77/**
     78 *
     79 * @param category
     80 * @param locale
     81 * @return
     82 */
    7583char *posix_setlocale(int category, const char *locale)
    7684{
     
    8391}
    8492
     93/**
     94 *
     95 * @return
     96 */
    8597struct posix_lconv *posix_localeconv(void)
    8698{
     
    89101}
    90102
     103/**
     104 *
     105 * @param locobj
     106 * @return
     107 */
    91108posix_locale_t posix_duplocale(posix_locale_t locobj)
    92109{
     
    104121}
    105122
     123/**
     124 *
     125 * @param locobj
     126 */
    106127void posix_freelocale(posix_locale_t locobj)
    107128{
     
    109130}
    110131
     132/**
     133 *
     134 * @param category_mask
     135 * @param locale
     136 * @param base
     137 * @return
     138 */
    111139posix_locale_t posix_newlocale(int category_mask, const char *locale,
    112140    posix_locale_t base)
     
    129157}
    130158
    131 posix_locale_t posix_uselocale (posix_locale_t newloc)
     159/**
     160 *
     161 * @param newloc
     162 * @return
     163 */
     164posix_locale_t posix_uselocale(posix_locale_t newloc)
    132165{
    133166        // TODO
  • uspace/lib/posix/locale.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Locale-specific definitions.
    3333 */
    3434
    3535#ifndef POSIX_LOCALE_H_
    3636#define POSIX_LOCALE_H_
     37
     38// TODO: documentation
    3739
    3840#ifndef NULL
     
    8385
    8486struct posix_lconv {
    85         char    *currency_symbol;
    86         char    *decimal_point;
    87         char     frac_digits;
    88         char    *grouping;
    89         char    *int_curr_symbol;
    90         char     int_frac_digits;
    91         char     int_n_cs_precedes;
    92         char     int_n_sep_by_space;
    93         char     int_n_sign_posn;
    94         char     int_p_cs_precedes;
    95         char     int_p_sep_by_space;
    96         char     int_p_sign_posn;
    97         char    *mon_decimal_point;
    98         char    *mon_grouping;
    99         char    *mon_thousands_sep;
    100         char    *negative_sign;
    101         char     n_cs_precedes;
    102         char     n_sep_by_space;
    103         char     n_sign_posn;
    104         char    *positive_sign;
    105         char     p_cs_precedes;
    106         char     p_sep_by_space;
    107         char     p_sign_posn;
    108         char    *thousands_sep;
     87        char *currency_symbol;
     88        char *decimal_point;
     89        char  frac_digits;
     90        char *grouping;
     91        char *int_curr_symbol;
     92        char  int_frac_digits;
     93        char  int_n_cs_precedes;
     94        char  int_n_sep_by_space;
     95        char  int_n_sign_posn;
     96        char  int_p_cs_precedes;
     97        char  int_p_sep_by_space;
     98        char  int_p_sign_posn;
     99        char *mon_decimal_point;
     100        char *mon_grouping;
     101        char *mon_thousands_sep;
     102        char *negative_sign;
     103        char  n_cs_precedes;
     104        char  n_sep_by_space;
     105        char  n_sign_posn;
     106        char *positive_sign;
     107        char  p_cs_precedes;
     108        char  p_sep_by_space;
     109        char  p_sign_posn;
     110        char *thousands_sep;
    109111};
    110112
     
    117119extern posix_locale_t posix_newlocale(int category_mask, const char *locale,
    118120    posix_locale_t base);
    119 extern posix_locale_t posix_uselocale (posix_locale_t newloc);
     121extern posix_locale_t posix_uselocale(posix_locale_t newloc);
    120122
    121123#ifndef LIBPOSIX_INTERNAL
     
    131133#endif
    132134
    133 
    134135#endif /* POSIX_LOCALE_H_ */
    135136
  • uspace/lib/posix/math.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Mathematical operations.
    3333 */
    3434
  • uspace/lib/posix/math.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Mathematical operations.
    3333 */
    3434
  • uspace/lib/posix/pwd.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Password handling.
    3333 */
    3434
    3535#define LIBPOSIX_INTERNAL
     36
    3637#include "pwd.h"
    3738#include "string.h"
    3839#include "errno.h"
    3940
     41// TODO: documentation
    4042
    4143static bool entry_read = false;
     
    5355 * Since HelenOS doesn't have user accounts, this always returns
    5456 * the same made-up entry.
     57 *
     58 * @return
    5559 */
    5660struct posix_passwd *posix_getpwent(void)
     
    178182/** @}
    179183 */
    180 
  • uspace/lib/posix/pwd.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Password handling.
    3333 */
    3434
    3535#ifndef POSIX_PWD_H_
    3636#define POSIX_PWD_H_
     37
     38// TODO: documentation
    3739
    3840#include "sys/types.h"
     
    7678/** @}
    7779 */
    78 
  • uspace/lib/posix/signal.c

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Signal handling.
    3333 */
    3434
     
    4545#include "libc/task.h"
    4646
     47// TODO: documentation
     48
    4749/* Used to serialize signal handling. */
    4850static FIBRIL_MUTEX_INITIALIZE(_signal_mutex);
     
    6365};
    6466
     67/**
     68 *
     69 * @param signo
     70 */
    6571void __posix_default_signal_handler(int signo)
    6672{
     
    118124}
    119125
     126/**
     127 *
     128 * @param signo
     129 */
    120130void __posix_hold_signal_handler(int signo)
    121131{
     
    123133}
    124134
     135/**
     136 *
     137 * @param signo
     138 */
    125139void __posix_ignore_signal_handler(int signo)
    126140{
     
    128142}
    129143
    130 
     144/**
     145 *
     146 * @param set
     147 * @return
     148 */
    131149int posix_sigemptyset(posix_sigset_t *set)
    132150{
     
    137155}
    138156
     157/**
     158 *
     159 * @param set
     160 * @return
     161 */
    139162int posix_sigfillset(posix_sigset_t *set)
    140163{
     
    145168}
    146169
     170/**
     171 *
     172 * @param set
     173 * @param signo
     174 * @return
     175 */
    147176int posix_sigaddset(posix_sigset_t *set, int signo)
    148177{
     
    153182}
    154183
     184/**
     185 *
     186 * @param set
     187 * @param signo
     188 * @return
     189 */
    155190int posix_sigdelset(posix_sigset_t *set, int signo)
    156191{
     
    161196}
    162197
     198/**
     199 *
     200 * @param set
     201 * @param signo
     202 * @return
     203 */
    163204int posix_sigismember(const posix_sigset_t *set, int signo)
    164205{
     
    168209}
    169210
     211/**
     212 *
     213 * @param sig
     214 * @param act
     215 * @param oact
     216 */
    170217static void _sigaction_unsafe(int sig, const struct posix_sigaction *restrict act,
    171218    struct posix_sigaction *restrict oact)
     
    182229}
    183230
     231/**
     232 *
     233 * @param sig
     234 * @param act
     235 * @param oact
     236 * @return
     237 */
    184238int posix_sigaction(int sig, const struct posix_sigaction *restrict act,
    185239    struct posix_sigaction *restrict oact)
     
    206260}
    207261
     262/**
     263 *
     264 * @param sig
     265 * @param func
     266 * @return
     267 */
    208268void (*posix_signal(int sig, void (*func)(int)))(int)
    209269{
     
    222282}
    223283
     284/**
     285 *
     286 * @param signo
     287 * @param siginfo
     288 * @return
     289 */
    224290static int _raise_sigaction(int signo, posix_siginfo_t *siginfo)
    225291{
     
    259325}
    260326
     327/**
     328 *
     329 * @param sig
     330 * @return
     331 */
    261332int posix_raise(int sig)
    262333{
     
    273344}
    274345
     346/**
     347 *
     348 * @param pid
     349 * @param signo
     350 * @return
     351 */
    275352int posix_kill(posix_pid_t pid, int signo)
    276353{
     
    303380}
    304381
     382/**
     383 *
     384 * @param pid
     385 * @param sig
     386 * @return
     387 */
    305388int posix_killpg(posix_pid_t pid, int sig)
    306389{
     
    309392}
    310393
     394/**
     395 *
     396 * @param pinfo
     397 * @param message
     398 */
    311399void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message)
    312400{
     
    316404}
    317405
     406/**
     407 *
     408 * @param signum
     409 * @param message
     410 */
    318411void posix_psignal(int signum, const char *message)
    319412{
     
    326419}
    327420
     421/**
     422 *
     423 * @param how
     424 * @param set
     425 * @param oset
     426 * @return
     427 */
    328428int posix_thread_sigmask(int how, const posix_sigset_t *restrict set,
    329429    posix_sigset_t *restrict oset)
     
    358458}
    359459
     460/**
     461 *
     462 * @param how
     463 * @param set
     464 * @param oset
     465 * @return
     466 */
    360467int posix_sigprocmask(int how, const posix_sigset_t *restrict set,
    361468    posix_sigset_t *restrict oset)
     
    371478/** @}
    372479 */
    373 
  • uspace/lib/posix/signal.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Signal handling.
    3333 */
    3434
    3535#ifndef POSIX_SIGNAL_H_
    3636#define POSIX_SIGNAL_H_
     37
     38// TODO: documentation
    3739
    3840#include "libc/errno.h"
     
    107109        posix_mcontext_t uc_mcontext;
    108110} posix_ucontext_t;
    109 
    110111
    111112/* Values of posix_sigevent::sigev_notify */
     
    154155#define SIGSTKSZ 0
    155156
    156 /* full POSIX set */
     157/* Full POSIX set */
    157158enum {
    158159        /* Termination Signals */
     
    214215
    215216/* Values for sigaction field si_code. */
    216 
    217217enum {
    218218        SI_USER,
     
    287287                #define sigevent posix_sigevent
    288288        #endif
    289         #define sigaction posix_sigaction
    290289        #define mcontext_t posix_mcontext_t
    291290        #define ucontext_t posix_ucontext_t
    292291        #define stack_t posix_stack_t
    293292        #define siginfo_t posix_siginfo_t
     293
     294        #define sigaction posix_sigaction
    294295
    295296        #define signal posix_signal
  • uspace/lib/posix/stdbool.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Boolean type and values.
    3333 */
    3434
     
    5050
    5151#endif /* POSIX_STDBOOL_H_ */
    52 
  • uspace/lib/posix/stddef.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Standard type definitions.
    3333 */
    3434
  • uspace/lib/posix/stdint.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Integer types.
    3333 */
    3434
  • uspace/lib/posix/stdio.c

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Standard buffered input/output.
    3434 */
    3535
  • uspace/lib/posix/stdio.h

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Standard buffered input/output.
    3434 */
    3535
  • uspace/lib/posix/stdlib/strtold.c

    r102a729 r4cf8ca6  
    513513 * @param nptr Input string.
    514514 * @param endptr If non-NULL, *endptr is set to the position of the first
    515  *    unrecognized character.
     515 *     unrecognized character.
    516516 * @return An approximate representation of the input floating-point number.
    517517 */
  • uspace/lib/posix/string.h

    r102a729 r4cf8ca6  
    106106extern char *posix_strsignal(int signum);
    107107
    108 /* Legacy declarations */
     108/* Legacy Declarations */
    109109#ifndef POSIX_STRINGS_H_
    110110extern int posix_ffs(int i);
  • uspace/lib/posix/sys/mman.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Memory management declarations.
    3333 */
    3434
  • uspace/lib/posix/sys/stat.c

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file File status handling.
    3434 */
    3535
     
    8080        int rc = fstat(fd, &hst);
    8181        if (rc < 0) {
    82                 /* fstat() returns negative error code instead of using errno.
    83                  */
     82                /* fstat() returns negative error code instead of using errno. */
    8483                errno = -rc;
    8584                return -1;
     
    9695 * @return Zero on success, -1 otherwise.
    9796 */
    98 int posix_lstat(const char *path, struct posix_stat *st)
     97int posix_lstat(const char *restrict path, struct posix_stat *restrict st)
    9998{
    10099        /* There are currently no symbolic links in HelenOS. */
     
    109108 * @return Zero on success, -1 otherwise.
    110109 */
    111 int posix_stat(const char *path, struct posix_stat *st)
     110int posix_stat(const char *restrict path, struct posix_stat *restrict st)
    112111{
    113112        struct stat hst;
    114113        int rc = stat(path, &hst);
    115114        if (rc < 0) {
    116                 /* stat() returns negative error code instead of using errno.
    117                  */
     115                /* stat() returns negative error code instead of using errno. */
    118116                errno = -rc;
    119117                return -1;
  • uspace/lib/posix/sys/stat.h

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file File status handling.
    3434 */
    3535
  • uspace/lib/posix/sys/types.h

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Data types definitions.
    3434 */
    3535
     
    4949typedef sysarg_t posix_dev_t;
    5050
    51 /* PThread types */
     51/* PThread Types */
    5252typedef struct posix_thread_attr posix_thread_attr_t;
    5353
    54 /* Clock types */
     54/* Clock Types */
    5555typedef long posix_clock_t;
    5656typedef int posix_clockid_t;
  • uspace/lib/posix/sys/wait.c

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Support for waiting.
    3434 */
    3535
     
    6565/** @}
    6666 */
    67 
  • uspace/lib/posix/sys/wait.h

    r102a729 r4cf8ca6  
    3030 * @{
    3131 */
    32 /** @file
     32/** @file Support for waiting.
    3333 */
    3434
  • uspace/lib/posix/time.c

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Time measurement support.
    3434 */
    3535
     
    6363#define SECS_PER_DAY (SECS_PER_HOUR * HOURS_PER_DAY)
    6464
     65/**
     66 *
     67 * @param year
     68 * @return
     69 */
    6570static bool _is_leap_year(time_t year)
    6671{
     
    7681}
    7782
     83/**
     84 *
     85 * @param year
     86 * @param mon
     87 * @return
     88 */
    7889static int _days_in_month(time_t year, time_t mon)
    7990{
     
    92103}
    93104
     105/**
     106 *
     107 * @param year
     108 * @param mon
     109 * @param mday
     110 * @return
     111 */
    94112static int _day_of_year(time_t year, time_t mon, time_t mday)
    95113{
     
    102120}
    103121
    104 /* Integer division that rounds to negative infinity.
     122/**
     123 * Integer division that rounds to negative infinity.
     124 *
     125 * @param op1
     126 * @param op2
     127 * @return
    105128 */
    106129static time_t _floor_div(time_t op1, time_t op2)
     
    113136}
    114137
    115 /* Modulo that rounds to negative infinity.
     138/**
     139 * Modulo that rounds to negative infinity.
     140 *
     141 * @param op1
     142 * @param op2
     143 * @return
    116144 */
    117145static time_t _floor_mod(time_t op1, time_t op2)
     
    132160}
    133161
     162/**
     163 *
     164 * @param year
     165 * @param mon
     166 * @param mday
     167 * @return
     168 */
    134169static time_t _days_since_epoch(time_t year, time_t mon, time_t mday)
    135170{
     
    139174}
    140175
    141 /* Assumes normalized broken-down time. */
     176/**
     177 * Assumes normalized broken-down time.
     178 *
     179 * @param tm
     180 * @return
     181 */
    142182static time_t _secs_since_epoch(const struct posix_tm *tm)
    143183{
     
    147187}
    148188
     189/**
     190 *
     191 * @param year
     192 * @param mon
     193 * @param mday
     194 * @return
     195 */
    149196static int _day_of_week(time_t year, time_t mon, time_t mday)
    150197{
     
    165212};
    166213
     214/**
     215 *
     216 * @param ltm
     217 * @param ptm
     218 */
    167219static void _posix_to_long_tm(struct _long_tm *ltm, struct posix_tm *ptm)
    168220{
     
    179231}
    180232
     233/**
     234 *
     235 * @param ptm
     236 * @param ltm
     237 */
    181238static void _long_to_posix_tm(struct posix_tm *ptm, struct _long_tm *ltm)
    182239{
     
    196253}
    197254
     255/**
     256 *
     257 * @param tm
     258 */
    198259static void _normalize_time(struct _long_tm *tm)
    199260{
     
    241302}
    242303
    243 /* Which day the week-based year starts on relative to the first calendar day.
     304/**
     305 * Which day the week-based year starts on relative to the first calendar day.
    244306 * E.g. if the year starts on December 31st, the return value is -1.
     307 *
     308 * @param year
     309 * @return
    245310 */
    246311static int _wbyear_offset(int year)
     
    250315}
    251316
    252 /* Returns week-based year of the specified time.
     317/**
     318 * Returns week-based year of the specified time.
    253319 * Assumes normalized broken-down time.
     320 *
     321 * @param tm
     322 * @return
    254323 */
    255324static int _wbyear(const struct posix_tm *tm)
     
    268337}
    269338
    270 /** Week number of the year, assuming weeks start on sunday.
    271  *  The first Sunday of January is the first day of week 1;
    272  *  days in the new year before this are in week 0.
     339/**
     340 * Week number of the year, assuming weeks start on sunday.
     341 * The first Sunday of January is the first day of week 1;
     342 * days in the new year before this are in week 0.
    273343 *
    274344 * @param tm Normalized broken-down time.
     
    281351}
    282352
    283 /** Week number of the year, assuming weeks start on monday.
    284  *  If the week containing January 1st has four or more days in the new year,
    285  *  then it is considered week 1. Otherwise, it is the last week of the previous
    286  *  year, and the next week is week 1. Both January 4th and the first Thursday
    287  *  of January are always in week 1.
     353/**
     354 * Week number of the year, assuming weeks start on monday.
     355 * If the week containing January 1st has four or more days in the new year,
     356 * then it is considered week 1. Otherwise, it is the last week of the previous
     357 * year, and the next week is week 1. Both January 4th and the first Thursday
     358 * of January are always in week 1.
    288359 *
    289360 * @param tm Normalized broken-down time.
     
    305376}
    306377
    307 /** Week number of the year, assuming weeks start on monday.
    308  *  The first Monday of January is the first day of week 1;
    309  *  days in the new year before this are in week 0.
     378/**
     379 * Week number of the year, assuming weeks start on monday.
     380 * The first Monday of January is the first day of week 1;
     381 * days in the new year before this are in week 0.
    310382 *
    311383 * @param tm Normalized broken-down time.
     
    324396char *posix_tzname[2];
    325397
     398/**
     399 *
     400 */
    326401void posix_tzset(void)
    327402{
     
    333408}
    334409
     410/**
     411 *
     412 * @param time1
     413 * @param time0
     414 * @return
     415 */
    335416double posix_difftime(time_t time1, time_t time0)
    336417{
     
    338419}
    339420
    340 /** This function first normalizes the provided broken-down time
    341  *  (moves all values to their proper bounds) and then tries to
    342  *  calculate the appropriate time_t representation.
    343  *
    344  * @param timeptr Broken-down time.
     421/**
     422 * This function first normalizes the provided broken-down time
     423 * (moves all values to their proper bounds) and then tries to
     424 * calculate the appropriate time_t representation.
     425 *
     426 * @param tm Broken-down time.
    345427 * @return time_t representation of the time, undefined value on overflow
    346428 */
     
    358440}
    359441
     442/**
     443 *
     444 * @param timer
     445 * @return
     446 */
    360447struct posix_tm *posix_gmtime(const time_t *timer)
    361448{
     
    364451}
    365452
     453/**
     454 *
     455 * @param timer
     456 * @param result
     457 * @return
     458 */
    366459struct posix_tm *posix_gmtime_r(const time_t *restrict timer,
    367460    struct posix_tm *restrict result)
     
    394487/**
    395488 *
    396  * @param timep
     489 * @param timer
    397490 * @return
    398491 */
     
    403496}
    404497
     498/**
     499 *
     500 * @param timer
     501 * @param result
     502 * @return
     503 */
    405504struct posix_tm *posix_localtime_r(const time_t *restrict timer,
    406505    struct posix_tm *restrict result)
     
    413512/**
    414513 *
    415  * @param tm
     514 * @param timeptr
    416515 * @return
    417516 */
     
    422521}
    423522
     523/**
     524 *
     525 * @param timeptr
     526 * @param buf
     527 * @return
     528 */
    424529char *posix_asctime_r(const struct posix_tm *restrict timeptr,
    425530    char *restrict buf)
     
    448553/**
    449554 *
    450  * @param timep
     555 * @param timer
    451556 * @return
    452557 */
     
    460565}
    461566
     567/**
     568 *
     569 * @param timer
     570 * @param buf
     571 * @return
     572 */
    462573char *posix_ctime_r(const time_t *timer, char *buf)
    463574{
     
    477588 * @return
    478589 */
    479 size_t posix_strftime(char *s, size_t maxsize,
    480     const char *format, const struct posix_tm *tm)
     590size_t posix_strftime(char *restrict s, size_t maxsize,
     591    const char *restrict format, const struct posix_tm *restrict tm)
    481592{
    482593        // TODO: use locale
     
    655766}
    656767
     768/**
     769 *
     770 * @param s
     771 * @param maxsize
     772 * @param format
     773 * @param tm
     774 * @param loc
     775 * @return
     776 */
     777extern size_t posix_strftime_l(char *restrict s, size_t maxsize,
     778    const char *restrict format, const struct posix_tm *restrict tm,
     779    posix_locale_t loc)
     780{
     781        // TODO
     782        not_implemented();
     783}
     784
     785/**
     786 *
     787 * @param clock_id
     788 * @param res
     789 * @return
     790 */
    657791int posix_clock_getres(posix_clockid_t clock_id, struct posix_timespec *res)
    658792{
     
    670804}
    671805
     806/**
     807 *
     808 * @param clock_id
     809 * @param tp
     810 * @return
     811 */
    672812int posix_clock_gettime(posix_clockid_t clock_id, struct posix_timespec *tp)
    673813{
     
    688828}
    689829
     830/**
     831 *
     832 * @param clock_id
     833 * @param tp
     834 * @return
     835 */
    690836int posix_clock_settime(posix_clockid_t clock_id,
    691837    const struct posix_timespec *tp)
     
    706852}
    707853
     854/**
     855 *
     856 * @param clock_id
     857 * @param flags
     858 * @param rqtp
     859 * @param rmtp
     860 * @return
     861 */
    708862int posix_clock_nanosleep(posix_clockid_t clock_id, int flags,
    709863    const struct posix_timespec *rqtp, struct posix_timespec *rmtp)
     
    735889};
    736890
     891/**
     892 *
     893 * @param clockid
     894 * @param evp
     895 * @param timerid
     896 * @return
     897 */
    737898int posix_timer_create(posix_clockid_t clockid,
    738899    struct posix_sigevent *restrict evp,
     
    743904}
    744905
     906/**
     907 *
     908 * @param timerid
     909 * @return
     910 */
    745911int posix_timer_delete(posix_timer_t timerid)
    746912{
     
    749915}
    750916
     917/**
     918 *
     919 * @param timerid
     920 * @return
     921 */
    751922int posix_timer_getoverrun(posix_timer_t timerid)
    752923{
     
    755926}
    756927
     928/**
     929 *
     930 * @param timerid
     931 * @param value
     932 * @return
     933 */
    757934int posix_timer_gettime(posix_timer_t timerid,
    758935    struct posix_itimerspec *value)
     
    762939}
    763940
     941/**
     942 *
     943 * @param timerid
     944 * @param flags
     945 * @param value
     946 * @param ovalue
     947 * @return
     948 */
    764949int posix_timer_settime(posix_timer_t timerid, int flags,
    765950    const struct posix_itimerspec *restrict value,
  • uspace/lib/posix/time.h

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Time measurement support.
    3434 */
    3535
     
    9494
    9595/* Timezones */
    96 
    9796extern int posix_daylight;
    9897extern long posix_timezone;
    9998extern char *posix_tzname[2];
    100 
    10199extern void posix_tzset(void);
    102100
    103 /* time_t */
    104 
     101/* Elapsed Time */
    105102extern double posix_difftime(time_t time1, time_t time0);
    106103
    107104/* Broken-down Time */
    108 extern time_t posix_mktime(struct posix_tm *timeptr);
     105extern time_t posix_mktime(struct posix_tm *tm);
    109106extern struct posix_tm *posix_gmtime(const time_t *timer);
    110107extern struct posix_tm *posix_gmtime_r(const time_t *restrict timer,
     
    120117extern char *posix_ctime(const time_t *timer);
    121118extern char *posix_ctime_r(const time_t *timer, char *buf);
    122 
    123119extern size_t posix_strftime(char *restrict s, size_t maxsize,
    124120    const char *restrict format, const struct posix_tm *restrict tm);
    125 
    126121extern size_t posix_strftime_l(char *restrict s, size_t maxsize,
    127122    const char *restrict format, const struct posix_tm *restrict tm,
    128123    posix_locale_t loc);
    129124
    130 /* Clocks. */
    131 
     125/* Clocks */
    132126extern int posix_clock_getres(posix_clockid_t clock_id,
    133127    struct posix_timespec *res);
     
    139133    const struct posix_timespec *rqtp, struct posix_timespec *rmtp);
    140134
    141 /* Timers. */
    142 
    143135#if 0
    144136
     137/* Timers */
    145138extern int posix_timer_create(posix_clockid_t clockid,
    146139    struct posix_sigevent *restrict evp,
     
    159152extern posix_clock_t posix_clock(void);
    160153
    161 
    162154#ifndef LIBPOSIX_INTERNAL
    163155        #define tm posix_tm
    164 
    165156        #define timespec posix_timespec
    166157        #define itimerspec posix_itimerspec
    167158        #define timer_t posix_timer_t
    168159
     160        #define daylight posix_daylight
     161        #define timezone posix_timezone
     162        #define tzname posix_tzname
     163        #define tzset posix_tzset
     164
    169165        #define difftime posix_difftime
     166
    170167        #define mktime posix_mktime
    171168        #define gmtime posix_gmtime
     
    174171        #define localtime_r posix_localtime_r
    175172
    176         #define daylight posix_daylight
    177         #define timezone posix_timezone
    178         #define tzname posix_tzname
    179         #define tzset posix_tzset
    180 
    181173        #define asctime posix_asctime
    182174        #define asctime_r posix_asctime_r
     
    184176        #define ctime_r posix_ctime_r
    185177        #define strftime posix_strftime
     178        #define strftime_l posix_strftime_l
    186179
    187180        #define clock_getres posix_clock_getres
  • uspace/lib/posix/unistd.c

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Miscellaneous standard definitions.
    3434 */
    3535
  • uspace/lib/posix/unistd.h

    r102a729 r4cf8ca6  
    3131 * @{
    3232 */
    33 /** @file
     33/** @file Miscellaneous standard definitions.
    3434 */
    3535
Note: See TracChangeset for help on using the changeset viewer.