source: mainline/uspace/lib/posix/stdlib.c@ e64b55a

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since e64b55a was 823a929, checked in by Petr Koupy <petr.koupy@…>, 14 years ago

Added function stubs (binutils compile-time dependencies).

  • Property mode set to 100644
File size: 3.8 KB
RevLine 
[2fc5072]1/*
2 * Copyright (c) 2011 Petr Koupy
[ceebf0a]3 * Copyright (c) 2011 Jiri Zarevucky
[2fc5072]4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * - Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * - The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29
30/** @addtogroup libposix
31 * @{
32 */
33/** @file
34 */
35
[4d10fc8]36#define LIBPOSIX_INTERNAL
[2fc5072]37
[4d10fc8]38#include "stdlib.h"
[9b1503e]39#include "internal/common.h"
[2fc5072]40
[823a929]41/**
42 *
43 * @param array
44 * @param count
45 * @param size
46 * @param compare
47 */
48int posix_atexit(void (*func)(void))
49{
50 // TODO: low priority, just a compile-time dependency of binutils
51 not_implemented();
52}
53
54/**
55 *
56 * @param array
57 * @param count
58 * @param size
59 * @param compare
60 */
61int posix_abs(int i)
62{
63 // TODO
64 not_implemented();
65}
66
[2fc5072]67/**
68 *
69 * @param array
70 * @param count
71 * @param size
72 * @param compare
73 */
[4f4b4e7]74void posix_qsort(void *array, size_t count, size_t size,
75 int (*compare)(const void *, const void *))
[2fc5072]76{
77 // TODO
[ceebf0a]78 not_implemented();
[2fc5072]79}
80
81/**
82 *
83 * @param name
84 * @return
85 */
86char *posix_getenv(const char *name)
87{
88 // TODO
[ceebf0a]89 not_implemented();
[2fc5072]90}
91
[823a929]92/**
93 *
94 * @param name
95 * @param resolved
96 * @return
97 */
98int posix_putenv(char *string)
99{
100 // TODO: low priority, just a compile-time dependency of binutils
101 not_implemented();
102}
103
[2fc5072]104/**
105 *
106 * @param name
107 * @param resolved
108 * @return
109 */
110char *posix_realpath(const char *name, char *resolved)
111{
112 // TODO
[ceebf0a]113 not_implemented();
114}
115
116/**
[63fc519]117 * Converts a string representation of a floating-point number to
118 * its native representation. See posix_strtold().
119 *
[ceebf0a]120 * @param nptr
121 * @param endptr
122 * @return
123 */
124float posix_strtof(const char *restrict nptr, char **restrict endptr)
125{
[63fc519]126 return (float) posix_strtold(nptr, endptr);
[ceebf0a]127}
128
129/**
[63fc519]130 * Converts a string representation of a floating-point number to
131 * its native representation. See posix_strtold().
132 *
[ceebf0a]133 * @param nptr
134 * @param endptr
135 * @return
136 */
137double posix_strtod(const char *restrict nptr, char **restrict endptr)
138{
[63fc519]139 return (double) posix_strtold(nptr, endptr);
[2fc5072]140}
141
[09b0b1fb]142/**
143 *
144 * @param str
145 * @return
146 */
147int posix_atoi(const char *str)
148{
149 // TODO
150 not_implemented();
151}
152
[823a929]153/**
154 *
155 * @param size
156 * @return
157 */
158void *posix_malloc(size_t size)
159{
160 return malloc(size);
161}
162
163/**
164 *
165 * @param nelem
166 * @param elsize
167 * @return
168 */
169void *posix_calloc(size_t nelem, size_t elsize)
170{
171 return calloc(nelem, elsize);
172}
173
174/**
175 *
176 * @param ptr
177 * @param size
178 * @return
179 */
180void *posix_realloc(void *ptr, size_t size)
181{
182 return realloc(ptr, size);
183}
184
185/**
186 *
187 * @param ptr
188 */
189void posix_free(void *ptr)
190{
191 free(ptr);
192}
193
194/**
195 *
196 * @param tmpl
197 * @return
198 */
199char *posix_mktemp(char *tmpl)
200{
201 // TODO: low priority, just a compile-time dependency of binutils
202 not_implemented();
203}
204
[2fc5072]205/** @}
206 */
Note: See TracBrowser for help on using the repository browser.