diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2016-02-19 10:52:53 +0200 |
---|---|---|
committer | Gerrit Code Review <gerrit@zephyrproject.org> | 2016-02-20 14:15:26 +0000 |
commit | da1552a923e88d6fd288f0bc9aeae2cdbd40572c (patch) | |
tree | 62f0dac207f455ae5474820a630ac13c7f8af0b0 /lib | |
parent | ccab7d0d6f29be71e64d0773107989d24bd97d6a (diff) |
libc: Add definition for ssize_t
Add definition for ssize_t that may be useful to represent sizes with
variables that also need to be able to have negative values (e.g. to
represent errors).
Change-Id: I52ec69591ccfd760021dad38f5ba1b1ebe707ea5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/minimal/include/bits/ssize_t.h | 35 | ||||
-rw-r--r-- | lib/libc/minimal/include/sys/types.h | 22 |
2 files changed, 57 insertions, 0 deletions
diff --git a/lib/libc/minimal/include/bits/ssize_t.h b/lib/libc/minimal/include/bits/ssize_t.h new file mode 100644 index 000000000..218253ad1 --- /dev/null +++ b/lib/libc/minimal/include/bits/ssize_t.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2016 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @file + * @brief ssize_t definition + */ + +#if !defined(__ssize_t_defined) +#define __ssize_t_defined + +#ifdef __i386 +typedef long int ssize_t; +#elif defined(__ARM_ARCH) +typedef int ssize_t; +#elif defined(__arc__) +typedef int ssize_t; +#else +#error "The minimal libc library does not recognize the architecture!\n" +#endif + +#endif diff --git a/lib/libc/minimal/include/sys/types.h b/lib/libc/minimal/include/sys/types.h new file mode 100644 index 000000000..f706d35c5 --- /dev/null +++ b/lib/libc/minimal/include/sys/types.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2016 Intel Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __INC_sys_types_h__ +#define __INC_sys_types_h__ + +#include <bits/ssize_t.h> + +#endif /* __INC_sys_types_h__ */ |