Changeset 4cf8ca6 in mainline
- Timestamp:
- 2011-07-20T21:52:22Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- aa5acd47
- Parents:
- 102a729
- Location:
- uspace/lib/posix
- Files:
-
- 38 edited
-
Makefile (modified) (1 diff)
-
assert.h (modified) (2 diffs)
-
errno.c (modified) (2 diffs)
-
errno.h (modified) (2 diffs)
-
fcntl.c (modified) (1 diff)
-
fcntl.h (modified) (1 diff)
-
float.h (modified) (1 diff)
-
fnmatch.c (modified) (11 diffs)
-
fnmatch.h (modified) (3 diffs)
-
internal/common.h (modified) (1 diff)
-
inttypes.h (modified) (1 diff)
-
iso646.h (modified) (2 diffs)
-
limits.h (modified) (1 diff)
-
locale.c (modified) (8 diffs)
-
locale.h (modified) (4 diffs)
-
math.c (modified) (1 diff)
-
math.h (modified) (1 diff)
-
pwd.c (modified) (3 diffs)
-
pwd.h (modified) (2 diffs)
-
signal.c (modified) (22 diffs)
-
signal.h (modified) (5 diffs)
-
stdbool.h (modified) (2 diffs)
-
stddef.h (modified) (1 diff)
-
stdint.h (modified) (1 diff)
-
stdio.c (modified) (1 diff)
-
stdio.h (modified) (1 diff)
-
stdlib/strtold.c (modified) (1 diff)
-
string.h (modified) (1 diff)
-
sys/mman.h (modified) (1 diff)
-
sys/stat.c (modified) (4 diffs)
-
sys/stat.h (modified) (1 diff)
-
sys/types.h (modified) (2 diffs)
-
sys/wait.c (modified) (2 diffs)
-
sys/wait.h (modified) (1 diff)
-
time.c (modified) (38 diffs)
-
time.h (modified) (7 diffs)
-
unistd.c (modified) (1 diff)
-
unistd.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/Makefile
r102a729 r4cf8ca6 63 63 $(INCLUDE_LIBC): ../c/include 64 64 ln -s -f -n $^ $@ 65 -
uspace/lib/posix/assert.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Program assertion. 33 33 */ 34 34 … … 52 52 /** @} 53 53 */ 54 -
uspace/lib/posix/errno.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file System error numbers. 33 33 */ 34 34 … … 51 51 /** @} 52 52 */ 53 -
uspace/lib/posix/errno.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file System error numbers. 33 33 */ 34 34 … … 325 325 /** @} 326 326 */ 327 -
uspace/lib/posix/fcntl.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file File control. 33 33 */ 34 34 -
uspace/lib/posix/fcntl.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file File control. 33 33 */ 34 34 -
uspace/lib/posix/float.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Floating type support. 33 33 */ 34 34 -
uspace/lib/posix/fnmatch.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Filename-matching. 33 33 */ 34 34 … … 45 45 #include "internal/common.h" 46 46 #include "fnmatch.h" 47 48 // TODO: documentation 47 49 48 50 #define INVALID_PATTERN -1 … … 169 171 }; 170 172 173 /** 174 * 175 * @param key 176 * @param elem 177 * @return 178 */ 171 179 static int _class_compare(const void *key, const void *elem) 172 180 { … … 175 183 } 176 184 185 /** 186 * 187 * @param cname 188 * @param c 189 * @return 190 */ 177 191 static bool _is_in_class (const char *cname, int c) 178 192 { … … 191 205 } 192 206 207 /** 208 * 209 * @param pattern 210 * @param str 211 * @param flags 212 * @return 213 */ 193 214 static int _match_char_class(const char **pattern, const char *str, int flags) 194 215 { … … 204 225 /************** END CHARACTER CLASSES ****************/ 205 226 227 /** 228 * 229 * @param pattern 230 * @param flags 231 * @return 232 */ 206 233 static _coll_elm_t _next_coll_elm(const char **pattern, int flags) 207 234 { … … 240 267 241 268 /** 242 * 269 * 270 * @param pattern 271 * @param str 272 * @param flags 273 * @return 243 274 */ 244 275 static int _match_bracket_expr(const char **pattern, const char *str, int flags) … … 327 358 328 359 /** 329 * 360 * 361 * @param pattern 362 * @param string 363 * @param flags 364 * @return 330 365 */ 331 366 static bool _partial_match(const char **pattern, const char **string, int flags) … … 421 456 } 422 457 458 /** 459 * 460 * @param pattern 461 * @param string 462 * @param flags 463 * @return 464 */ 423 465 static bool _full_match(const char *pattern, const char *string, int flags) 424 466 { … … 476 518 } 477 519 520 /** 521 * 522 * @param s 523 * @return 524 */ 478 525 static char *_casefold(const char *s) 479 526 { … … 604 651 /** @} 605 652 */ 606 -
uspace/lib/posix/fnmatch.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Filename-matching. 33 33 */ 34 34 … … 36 36 #define POSIX_FNMATCH_H_ 37 37 38 /* Error Values .*/38 /* Error Values */ 39 39 #undef FNM_NOMATCH 40 40 #define FNM_NOMATCH 1 … … 66 66 /** @} 67 67 */ 68 -
uspace/lib/posix/internal/common.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Helper definitions common for all libposix files. 33 33 */ 34 34 -
uspace/lib/posix/inttypes.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Fixed size integer types. 33 33 */ 34 34 -
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 */ 1 28 2 29 /** @addtogroup libposix 3 30 * @{ 4 31 */ 5 /** @file 32 /** @file Alternative spellings. 6 33 */ 7 34 … … 25 52 /** @} 26 53 */ 27 -
uspace/lib/posix/limits.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Implementation-defined limit constants. 33 33 */ 34 34 -
uspace/lib/posix/locale.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Locale-specific definitions. 33 33 */ 34 34 … … 41 41 #include "limits.h" 42 42 #include "string.h" 43 44 // TODO: documentation 43 45 44 46 struct __posix_locale { … … 73 75 }; 74 76 77 /** 78 * 79 * @param category 80 * @param locale 81 * @return 82 */ 75 83 char *posix_setlocale(int category, const char *locale) 76 84 { … … 83 91 } 84 92 93 /** 94 * 95 * @return 96 */ 85 97 struct posix_lconv *posix_localeconv(void) 86 98 { … … 89 101 } 90 102 103 /** 104 * 105 * @param locobj 106 * @return 107 */ 91 108 posix_locale_t posix_duplocale(posix_locale_t locobj) 92 109 { … … 104 121 } 105 122 123 /** 124 * 125 * @param locobj 126 */ 106 127 void posix_freelocale(posix_locale_t locobj) 107 128 { … … 109 130 } 110 131 132 /** 133 * 134 * @param category_mask 135 * @param locale 136 * @param base 137 * @return 138 */ 111 139 posix_locale_t posix_newlocale(int category_mask, const char *locale, 112 140 posix_locale_t base) … … 129 157 } 130 158 131 posix_locale_t posix_uselocale (posix_locale_t newloc) 159 /** 160 * 161 * @param newloc 162 * @return 163 */ 164 posix_locale_t posix_uselocale(posix_locale_t newloc) 132 165 { 133 166 // TODO -
uspace/lib/posix/locale.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Locale-specific definitions. 33 33 */ 34 34 35 35 #ifndef POSIX_LOCALE_H_ 36 36 #define POSIX_LOCALE_H_ 37 38 // TODO: documentation 37 39 38 40 #ifndef NULL … … 83 85 84 86 struct 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; 109 111 }; 110 112 … … 117 119 extern posix_locale_t posix_newlocale(int category_mask, const char *locale, 118 120 posix_locale_t base); 119 extern posix_locale_t posix_uselocale (posix_locale_t newloc);121 extern posix_locale_t posix_uselocale(posix_locale_t newloc); 120 122 121 123 #ifndef LIBPOSIX_INTERNAL … … 131 133 #endif 132 134 133 134 135 #endif /* POSIX_LOCALE_H_ */ 135 136 -
uspace/lib/posix/math.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Mathematical operations. 33 33 */ 34 34 -
uspace/lib/posix/math.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Mathematical operations. 33 33 */ 34 34 -
uspace/lib/posix/pwd.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Password handling. 33 33 */ 34 34 35 35 #define LIBPOSIX_INTERNAL 36 36 37 #include "pwd.h" 37 38 #include "string.h" 38 39 #include "errno.h" 39 40 41 // TODO: documentation 40 42 41 43 static bool entry_read = false; … … 53 55 * Since HelenOS doesn't have user accounts, this always returns 54 56 * the same made-up entry. 57 * 58 * @return 55 59 */ 56 60 struct posix_passwd *posix_getpwent(void) … … 178 182 /** @} 179 183 */ 180 -
uspace/lib/posix/pwd.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Password handling. 33 33 */ 34 34 35 35 #ifndef POSIX_PWD_H_ 36 36 #define POSIX_PWD_H_ 37 38 // TODO: documentation 37 39 38 40 #include "sys/types.h" … … 76 78 /** @} 77 79 */ 78 -
uspace/lib/posix/signal.c
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Signal handling. 33 33 */ 34 34 … … 45 45 #include "libc/task.h" 46 46 47 // TODO: documentation 48 47 49 /* Used to serialize signal handling. */ 48 50 static FIBRIL_MUTEX_INITIALIZE(_signal_mutex); … … 63 65 }; 64 66 67 /** 68 * 69 * @param signo 70 */ 65 71 void __posix_default_signal_handler(int signo) 66 72 { … … 118 124 } 119 125 126 /** 127 * 128 * @param signo 129 */ 120 130 void __posix_hold_signal_handler(int signo) 121 131 { … … 123 133 } 124 134 135 /** 136 * 137 * @param signo 138 */ 125 139 void __posix_ignore_signal_handler(int signo) 126 140 { … … 128 142 } 129 143 130 144 /** 145 * 146 * @param set 147 * @return 148 */ 131 149 int posix_sigemptyset(posix_sigset_t *set) 132 150 { … … 137 155 } 138 156 157 /** 158 * 159 * @param set 160 * @return 161 */ 139 162 int posix_sigfillset(posix_sigset_t *set) 140 163 { … … 145 168 } 146 169 170 /** 171 * 172 * @param set 173 * @param signo 174 * @return 175 */ 147 176 int posix_sigaddset(posix_sigset_t *set, int signo) 148 177 { … … 153 182 } 154 183 184 /** 185 * 186 * @param set 187 * @param signo 188 * @return 189 */ 155 190 int posix_sigdelset(posix_sigset_t *set, int signo) 156 191 { … … 161 196 } 162 197 198 /** 199 * 200 * @param set 201 * @param signo 202 * @return 203 */ 163 204 int posix_sigismember(const posix_sigset_t *set, int signo) 164 205 { … … 168 209 } 169 210 211 /** 212 * 213 * @param sig 214 * @param act 215 * @param oact 216 */ 170 217 static void _sigaction_unsafe(int sig, const struct posix_sigaction *restrict act, 171 218 struct posix_sigaction *restrict oact) … … 182 229 } 183 230 231 /** 232 * 233 * @param sig 234 * @param act 235 * @param oact 236 * @return 237 */ 184 238 int posix_sigaction(int sig, const struct posix_sigaction *restrict act, 185 239 struct posix_sigaction *restrict oact) … … 206 260 } 207 261 262 /** 263 * 264 * @param sig 265 * @param func 266 * @return 267 */ 208 268 void (*posix_signal(int sig, void (*func)(int)))(int) 209 269 { … … 222 282 } 223 283 284 /** 285 * 286 * @param signo 287 * @param siginfo 288 * @return 289 */ 224 290 static int _raise_sigaction(int signo, posix_siginfo_t *siginfo) 225 291 { … … 259 325 } 260 326 327 /** 328 * 329 * @param sig 330 * @return 331 */ 261 332 int posix_raise(int sig) 262 333 { … … 273 344 } 274 345 346 /** 347 * 348 * @param pid 349 * @param signo 350 * @return 351 */ 275 352 int posix_kill(posix_pid_t pid, int signo) 276 353 { … … 303 380 } 304 381 382 /** 383 * 384 * @param pid 385 * @param sig 386 * @return 387 */ 305 388 int posix_killpg(posix_pid_t pid, int sig) 306 389 { … … 309 392 } 310 393 394 /** 395 * 396 * @param pinfo 397 * @param message 398 */ 311 399 void posix_psiginfo(const posix_siginfo_t *pinfo, const char *message) 312 400 { … … 316 404 } 317 405 406 /** 407 * 408 * @param signum 409 * @param message 410 */ 318 411 void posix_psignal(int signum, const char *message) 319 412 { … … 326 419 } 327 420 421 /** 422 * 423 * @param how 424 * @param set 425 * @param oset 426 * @return 427 */ 328 428 int posix_thread_sigmask(int how, const posix_sigset_t *restrict set, 329 429 posix_sigset_t *restrict oset) … … 358 458 } 359 459 460 /** 461 * 462 * @param how 463 * @param set 464 * @param oset 465 * @return 466 */ 360 467 int posix_sigprocmask(int how, const posix_sigset_t *restrict set, 361 468 posix_sigset_t *restrict oset) … … 371 478 /** @} 372 479 */ 373 -
uspace/lib/posix/signal.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Signal handling. 33 33 */ 34 34 35 35 #ifndef POSIX_SIGNAL_H_ 36 36 #define POSIX_SIGNAL_H_ 37 38 // TODO: documentation 37 39 38 40 #include "libc/errno.h" … … 107 109 posix_mcontext_t uc_mcontext; 108 110 } posix_ucontext_t; 109 110 111 111 112 /* Values of posix_sigevent::sigev_notify */ … … 154 155 #define SIGSTKSZ 0 155 156 156 /* full POSIX set */157 /* Full POSIX set */ 157 158 enum { 158 159 /* Termination Signals */ … … 214 215 215 216 /* Values for sigaction field si_code. */ 216 217 217 enum { 218 218 SI_USER, … … 287 287 #define sigevent posix_sigevent 288 288 #endif 289 #define sigaction posix_sigaction290 289 #define mcontext_t posix_mcontext_t 291 290 #define ucontext_t posix_ucontext_t 292 291 #define stack_t posix_stack_t 293 292 #define siginfo_t posix_siginfo_t 293 294 #define sigaction posix_sigaction 294 295 295 296 #define signal posix_signal -
uspace/lib/posix/stdbool.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Boolean type and values. 33 33 */ 34 34 … … 50 50 51 51 #endif /* POSIX_STDBOOL_H_ */ 52 -
uspace/lib/posix/stddef.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Standard type definitions. 33 33 */ 34 34 -
uspace/lib/posix/stdint.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Integer types. 33 33 */ 34 34 -
uspace/lib/posix/stdio.c
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Standard buffered input/output. 34 34 */ 35 35 -
uspace/lib/posix/stdio.h
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Standard buffered input/output. 34 34 */ 35 35 -
uspace/lib/posix/stdlib/strtold.c
r102a729 r4cf8ca6 513 513 * @param nptr Input string. 514 514 * @param endptr If non-NULL, *endptr is set to the position of the first 515 * unrecognized character.515 * unrecognized character. 516 516 * @return An approximate representation of the input floating-point number. 517 517 */ -
uspace/lib/posix/string.h
r102a729 r4cf8ca6 106 106 extern char *posix_strsignal(int signum); 107 107 108 /* Legacy declarations */108 /* Legacy Declarations */ 109 109 #ifndef POSIX_STRINGS_H_ 110 110 extern int posix_ffs(int i); -
uspace/lib/posix/sys/mman.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Memory management declarations. 33 33 */ 34 34 -
uspace/lib/posix/sys/stat.c
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file File status handling. 34 34 */ 35 35 … … 80 80 int rc = fstat(fd, &hst); 81 81 if (rc < 0) { 82 /* fstat() returns negative error code instead of using errno. 83 */ 82 /* fstat() returns negative error code instead of using errno. */ 84 83 errno = -rc; 85 84 return -1; … … 96 95 * @return Zero on success, -1 otherwise. 97 96 */ 98 int posix_lstat(const char * path, struct posix_stat *st)97 int posix_lstat(const char *restrict path, struct posix_stat *restrict st) 99 98 { 100 99 /* There are currently no symbolic links in HelenOS. */ … … 109 108 * @return Zero on success, -1 otherwise. 110 109 */ 111 int posix_stat(const char * path, struct posix_stat *st)110 int posix_stat(const char *restrict path, struct posix_stat *restrict st) 112 111 { 113 112 struct stat hst; 114 113 int rc = stat(path, &hst); 115 114 if (rc < 0) { 116 /* stat() returns negative error code instead of using errno. 117 */ 115 /* stat() returns negative error code instead of using errno. */ 118 116 errno = -rc; 119 117 return -1; -
uspace/lib/posix/sys/stat.h
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file File status handling. 34 34 */ 35 35 -
uspace/lib/posix/sys/types.h
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Data types definitions. 34 34 */ 35 35 … … 49 49 typedef sysarg_t posix_dev_t; 50 50 51 /* PThread types */51 /* PThread Types */ 52 52 typedef struct posix_thread_attr posix_thread_attr_t; 53 53 54 /* Clock types */54 /* Clock Types */ 55 55 typedef long posix_clock_t; 56 56 typedef int posix_clockid_t; -
uspace/lib/posix/sys/wait.c
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Support for waiting. 34 34 */ 35 35 … … 65 65 /** @} 66 66 */ 67 -
uspace/lib/posix/sys/wait.h
r102a729 r4cf8ca6 30 30 * @{ 31 31 */ 32 /** @file 32 /** @file Support for waiting. 33 33 */ 34 34 -
uspace/lib/posix/time.c
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Time measurement support. 34 34 */ 35 35 … … 63 63 #define SECS_PER_DAY (SECS_PER_HOUR * HOURS_PER_DAY) 64 64 65 /** 66 * 67 * @param year 68 * @return 69 */ 65 70 static bool _is_leap_year(time_t year) 66 71 { … … 76 81 } 77 82 83 /** 84 * 85 * @param year 86 * @param mon 87 * @return 88 */ 78 89 static int _days_in_month(time_t year, time_t mon) 79 90 { … … 92 103 } 93 104 105 /** 106 * 107 * @param year 108 * @param mon 109 * @param mday 110 * @return 111 */ 94 112 static int _day_of_year(time_t year, time_t mon, time_t mday) 95 113 { … … 102 120 } 103 121 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 105 128 */ 106 129 static time_t _floor_div(time_t op1, time_t op2) … … 113 136 } 114 137 115 /* Modulo that rounds to negative infinity. 138 /** 139 * Modulo that rounds to negative infinity. 140 * 141 * @param op1 142 * @param op2 143 * @return 116 144 */ 117 145 static time_t _floor_mod(time_t op1, time_t op2) … … 132 160 } 133 161 162 /** 163 * 164 * @param year 165 * @param mon 166 * @param mday 167 * @return 168 */ 134 169 static time_t _days_since_epoch(time_t year, time_t mon, time_t mday) 135 170 { … … 139 174 } 140 175 141 /* Assumes normalized broken-down time. */ 176 /** 177 * Assumes normalized broken-down time. 178 * 179 * @param tm 180 * @return 181 */ 142 182 static time_t _secs_since_epoch(const struct posix_tm *tm) 143 183 { … … 147 187 } 148 188 189 /** 190 * 191 * @param year 192 * @param mon 193 * @param mday 194 * @return 195 */ 149 196 static int _day_of_week(time_t year, time_t mon, time_t mday) 150 197 { … … 165 212 }; 166 213 214 /** 215 * 216 * @param ltm 217 * @param ptm 218 */ 167 219 static void _posix_to_long_tm(struct _long_tm *ltm, struct posix_tm *ptm) 168 220 { … … 179 231 } 180 232 233 /** 234 * 235 * @param ptm 236 * @param ltm 237 */ 181 238 static void _long_to_posix_tm(struct posix_tm *ptm, struct _long_tm *ltm) 182 239 { … … 196 253 } 197 254 255 /** 256 * 257 * @param tm 258 */ 198 259 static void _normalize_time(struct _long_tm *tm) 199 260 { … … 241 302 } 242 303 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. 244 306 * E.g. if the year starts on December 31st, the return value is -1. 307 * 308 * @param year 309 * @return 245 310 */ 246 311 static int _wbyear_offset(int year) … … 250 315 } 251 316 252 /* Returns week-based year of the specified time. 317 /** 318 * Returns week-based year of the specified time. 253 319 * Assumes normalized broken-down time. 320 * 321 * @param tm 322 * @return 254 323 */ 255 324 static int _wbyear(const struct posix_tm *tm) … … 268 337 } 269 338 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. 273 343 * 274 344 * @param tm Normalized broken-down time. … … 281 351 } 282 352 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. 288 359 * 289 360 * @param tm Normalized broken-down time. … … 305 376 } 306 377 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. 310 382 * 311 383 * @param tm Normalized broken-down time. … … 324 396 char *posix_tzname[2]; 325 397 398 /** 399 * 400 */ 326 401 void posix_tzset(void) 327 402 { … … 333 408 } 334 409 410 /** 411 * 412 * @param time1 413 * @param time0 414 * @return 415 */ 335 416 double posix_difftime(time_t time1, time_t time0) 336 417 { … … 338 419 } 339 420 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. 345 427 * @return time_t representation of the time, undefined value on overflow 346 428 */ … … 358 440 } 359 441 442 /** 443 * 444 * @param timer 445 * @return 446 */ 360 447 struct posix_tm *posix_gmtime(const time_t *timer) 361 448 { … … 364 451 } 365 452 453 /** 454 * 455 * @param timer 456 * @param result 457 * @return 458 */ 366 459 struct posix_tm *posix_gmtime_r(const time_t *restrict timer, 367 460 struct posix_tm *restrict result) … … 394 487 /** 395 488 * 396 * @param time p489 * @param timer 397 490 * @return 398 491 */ … … 403 496 } 404 497 498 /** 499 * 500 * @param timer 501 * @param result 502 * @return 503 */ 405 504 struct posix_tm *posix_localtime_r(const time_t *restrict timer, 406 505 struct posix_tm *restrict result) … … 413 512 /** 414 513 * 415 * @param t m514 * @param timeptr 416 515 * @return 417 516 */ … … 422 521 } 423 522 523 /** 524 * 525 * @param timeptr 526 * @param buf 527 * @return 528 */ 424 529 char *posix_asctime_r(const struct posix_tm *restrict timeptr, 425 530 char *restrict buf) … … 448 553 /** 449 554 * 450 * @param time p555 * @param timer 451 556 * @return 452 557 */ … … 460 565 } 461 566 567 /** 568 * 569 * @param timer 570 * @param buf 571 * @return 572 */ 462 573 char *posix_ctime_r(const time_t *timer, char *buf) 463 574 { … … 477 588 * @return 478 589 */ 479 size_t posix_strftime(char * s, size_t maxsize,480 const char * format, const struct posix_tm *tm)590 size_t posix_strftime(char *restrict s, size_t maxsize, 591 const char *restrict format, const struct posix_tm *restrict tm) 481 592 { 482 593 // TODO: use locale … … 655 766 } 656 767 768 /** 769 * 770 * @param s 771 * @param maxsize 772 * @param format 773 * @param tm 774 * @param loc 775 * @return 776 */ 777 extern 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 */ 657 791 int posix_clock_getres(posix_clockid_t clock_id, struct posix_timespec *res) 658 792 { … … 670 804 } 671 805 806 /** 807 * 808 * @param clock_id 809 * @param tp 810 * @return 811 */ 672 812 int posix_clock_gettime(posix_clockid_t clock_id, struct posix_timespec *tp) 673 813 { … … 688 828 } 689 829 830 /** 831 * 832 * @param clock_id 833 * @param tp 834 * @return 835 */ 690 836 int posix_clock_settime(posix_clockid_t clock_id, 691 837 const struct posix_timespec *tp) … … 706 852 } 707 853 854 /** 855 * 856 * @param clock_id 857 * @param flags 858 * @param rqtp 859 * @param rmtp 860 * @return 861 */ 708 862 int posix_clock_nanosleep(posix_clockid_t clock_id, int flags, 709 863 const struct posix_timespec *rqtp, struct posix_timespec *rmtp) … … 735 889 }; 736 890 891 /** 892 * 893 * @param clockid 894 * @param evp 895 * @param timerid 896 * @return 897 */ 737 898 int posix_timer_create(posix_clockid_t clockid, 738 899 struct posix_sigevent *restrict evp, … … 743 904 } 744 905 906 /** 907 * 908 * @param timerid 909 * @return 910 */ 745 911 int posix_timer_delete(posix_timer_t timerid) 746 912 { … … 749 915 } 750 916 917 /** 918 * 919 * @param timerid 920 * @return 921 */ 751 922 int posix_timer_getoverrun(posix_timer_t timerid) 752 923 { … … 755 926 } 756 927 928 /** 929 * 930 * @param timerid 931 * @param value 932 * @return 933 */ 757 934 int posix_timer_gettime(posix_timer_t timerid, 758 935 struct posix_itimerspec *value) … … 762 939 } 763 940 941 /** 942 * 943 * @param timerid 944 * @param flags 945 * @param value 946 * @param ovalue 947 * @return 948 */ 764 949 int posix_timer_settime(posix_timer_t timerid, int flags, 765 950 const struct posix_itimerspec *restrict value, -
uspace/lib/posix/time.h
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Time measurement support. 34 34 */ 35 35 … … 94 94 95 95 /* Timezones */ 96 97 96 extern int posix_daylight; 98 97 extern long posix_timezone; 99 98 extern char *posix_tzname[2]; 100 101 99 extern void posix_tzset(void); 102 100 103 /* time_t */ 104 101 /* Elapsed Time */ 105 102 extern double posix_difftime(time_t time1, time_t time0); 106 103 107 104 /* Broken-down Time */ 108 extern time_t posix_mktime(struct posix_tm *t imeptr);105 extern time_t posix_mktime(struct posix_tm *tm); 109 106 extern struct posix_tm *posix_gmtime(const time_t *timer); 110 107 extern struct posix_tm *posix_gmtime_r(const time_t *restrict timer, … … 120 117 extern char *posix_ctime(const time_t *timer); 121 118 extern char *posix_ctime_r(const time_t *timer, char *buf); 122 123 119 extern size_t posix_strftime(char *restrict s, size_t maxsize, 124 120 const char *restrict format, const struct posix_tm *restrict tm); 125 126 121 extern size_t posix_strftime_l(char *restrict s, size_t maxsize, 127 122 const char *restrict format, const struct posix_tm *restrict tm, 128 123 posix_locale_t loc); 129 124 130 /* Clocks. */ 131 125 /* Clocks */ 132 126 extern int posix_clock_getres(posix_clockid_t clock_id, 133 127 struct posix_timespec *res); … … 139 133 const struct posix_timespec *rqtp, struct posix_timespec *rmtp); 140 134 141 /* Timers. */142 143 135 #if 0 144 136 137 /* Timers */ 145 138 extern int posix_timer_create(posix_clockid_t clockid, 146 139 struct posix_sigevent *restrict evp, … … 159 152 extern posix_clock_t posix_clock(void); 160 153 161 162 154 #ifndef LIBPOSIX_INTERNAL 163 155 #define tm posix_tm 164 165 156 #define timespec posix_timespec 166 157 #define itimerspec posix_itimerspec 167 158 #define timer_t posix_timer_t 168 159 160 #define daylight posix_daylight 161 #define timezone posix_timezone 162 #define tzname posix_tzname 163 #define tzset posix_tzset 164 169 165 #define difftime posix_difftime 166 170 167 #define mktime posix_mktime 171 168 #define gmtime posix_gmtime … … 174 171 #define localtime_r posix_localtime_r 175 172 176 #define daylight posix_daylight177 #define timezone posix_timezone178 #define tzname posix_tzname179 #define tzset posix_tzset180 181 173 #define asctime posix_asctime 182 174 #define asctime_r posix_asctime_r … … 184 176 #define ctime_r posix_ctime_r 185 177 #define strftime posix_strftime 178 #define strftime_l posix_strftime_l 186 179 187 180 #define clock_getres posix_clock_getres -
uspace/lib/posix/unistd.c
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Miscellaneous standard definitions. 34 34 */ 35 35 -
uspace/lib/posix/unistd.h
r102a729 r4cf8ca6 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Miscellaneous standard definitions. 34 34 */ 35 35
Note:
See TracChangeset
for help on using the changeset viewer.
