Changeset 087c8798 in mainline for uspace/lib/posix/stdlib.c
- Timestamp:
- 2011-07-20T19:30:30Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 102a729
- Parents:
- fc3680e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/posix/stdlib.c
rfc3680e r087c8798 31 31 * @{ 32 32 */ 33 /** @file 33 /** @file Standard library definitions. 34 34 */ 35 35 … … 59 59 60 60 /** 61 * Integer absolute value. 61 62 * 62 63 * @param i Input value. … … 69 70 70 71 /** 72 * Long integer absolute value. 71 73 * 72 74 * @param i Input value. … … 79 81 80 82 /** 83 * Long long integer absolute value. 81 84 * 82 85 * @param i Input value. … … 88 91 } 89 92 93 /** 94 * Compute the quotient and remainder of an integer division. 95 * 96 * @param numer Numerator. 97 * @param denom Denominator. 98 * @return Quotient and remainder packed into structure. 99 */ 90 100 posix_div_t posix_div(int numer, int denom) 91 101 { … … 93 103 } 94 104 105 /** 106 * Compute the quotient and remainder of a long integer division. 107 * 108 * @param numer Numerator. 109 * @param denom Denominator. 110 * @return Quotient and remainder packed into structure. 111 */ 95 112 posix_ldiv_t posix_ldiv(long numer, long denom) 96 113 { … … 98 115 } 99 116 117 /** 118 * Compute the quotient and remainder of a long long integer division. 119 * 120 * @param numer Numerator. 121 * @param denom Denominator. 122 * @return Quotient and remainder packed into structure. 123 */ 100 124 posix_lldiv_t posix_lldiv(long long numer, long long denom) 101 125 { … … 109 133 * @param elem2 Second element to compare. 110 134 * @param compare Comparison function without userdata parameter. 111 *112 135 * @return Relative ordering of the elements. 113 136 */ … … 121 144 * Array sorting utilizing the quicksort algorithm. 122 145 * 123 * @param array 124 * @param count 125 * @param size 126 * @param compare 146 * @param array Array of elements to sort. 147 * @param count Number of elements in the array. 148 * @param size Width of each element. 149 * @param compare Decides relative ordering of two elements. 127 150 */ 128 151 void posix_qsort(void *array, size_t count, size_t size, … … 171 194 /** 172 195 * Retrieve a value of the given environment variable. 196 * 173 197 * Since HelenOS doesn't support env variables at the moment, 174 198 * this function always returns NULL. 175 199 * 176 * @param name 177 * @return Always NULL.200 * @param name Name of the variable. 201 * @return Value of the variable or NULL if such variable does not exist. 178 202 */ 179 203 char *posix_getenv(const char *name) … … 195 219 196 220 /** 197 * 198 * @param string String to be passed to a command interpreter. 199 * @return 221 * Issue a command. 222 * 223 * @param string String to be passed to a command interpreter or NULL. 224 * @return Termination status of the command if the command is not NULL, 225 * otherwise indicate whether there is a command interpreter (non-zero) 226 * or not (zero). 200 227 */ 201 228 int posix_system(const char *string) { … … 205 232 206 233 /** 207 * 208 * @param name 209 * @param resolved 210 * @return 211 */ 212 char *posix_realpath(const char *name, char *resolved) 234 * Resolve absolute pathname. 235 * 236 * @param name Pathname to be resolved. 237 * @param resolved Either buffer for the resolved absolute pathname or NULL. 238 * @return On success, either resolved (if it was not NULL) or pointer to the 239 * newly allocated buffer containing the absolute pathname (if resolved was 240 * NULL). Otherwise NULL. 241 * 242 */ 243 char *posix_realpath(const char *restrict name, char *restrict resolved) 213 244 { 214 245 #ifndef PATH_MAX … … 254 285 * its native representation. See posix_strtold(). 255 286 * 256 * @param nptr 257 * @return 287 * @param nptr String representation of a floating-point number. 288 * @return Double-precision number resulting from the string conversion. 258 289 */ 259 290 double posix_atof(const char *nptr) … … 266 297 * its native representation. See posix_strtold(). 267 298 * 268 * @param nptr 269 * @param endptr 270 * @return 299 * @param nptr String representation of a floating-point number. 300 * @param endptr Pointer to the final part of the string which 301 * was not used for conversion. 302 * @return Single-precision number resulting from the string conversion. 271 303 */ 272 304 float posix_strtof(const char *restrict nptr, char **restrict endptr) … … 279 311 * its native representation. See posix_strtold(). 280 312 * 281 * @param nptr 282 * @param endptr 283 * @return 313 * @param nptr String representation of a floating-point number. 314 * @param endptr Pointer to the final part of the string which 315 * was not used for conversion. 316 * @return Double-precision number resulting from the string conversion. 284 317 */ 285 318 double posix_strtod(const char *restrict nptr, char **restrict endptr) … … 289 322 290 323 /** 291 * 292 * @param size 293 * @return 324 * Allocate memory chunk. 325 * 326 * @param size Size of the chunk to allocate. 327 * @return Either pointer to the allocated chunk or NULL if not possible. 294 328 */ 295 329 void *posix_malloc(size_t size) … … 299 333 300 334 /** 301 * 302 * @param nelem 303 * @param elsize 304 * @return 335 * Allocate memory for an array of elements. 336 * 337 * @param nelem Number of elements in the array. 338 * @param elsize Size of each element. 339 * @return Either pointer to the allocated array or NULL if not possible. 305 340 */ 306 341 void *posix_calloc(size_t nelem, size_t elsize) … … 310 345 311 346 /** 312 * 313 * @param ptr 314 * @param size 315 * @return 347 * Reallocate memory chunk to a new size. 348 * 349 * @param ptr Memory chunk to reallocate. Might be NULL. 350 * @param size Size of the reallocated chunk. Might be zero. 351 * @return Either NULL or the pointer to the newly reallocated chunk. 316 352 */ 317 353 void *posix_realloc(void *ptr, size_t size) … … 321 357 322 358 /** 323 * 324 * @param ptr 359 * Free allocated memory chunk. 360 * 361 * @param ptr Memory chunk to be freed. 325 362 */ 326 363 void posix_free(void *ptr) … … 343 380 344 381 /** 345 * Should read system load statistics. Not supported. Always returns -1. 346 * 347 * @param loadavg 348 * @param nelem 349 * @return 382 * Get system load average statistics. 383 * 384 * Not supported. Always returns -1. 385 * 386 * @param loadavg Array where the load averages shall be placed. 387 * @param nelem Maximum number of elements to be placed into the array. 388 * @return Number of elements placed into the array on success, -1 otherwise. 350 389 */ 351 390 int bsd_getloadavg(double loadavg[], int nelem)
Note:
See TracChangeset
for help on using the changeset viewer.