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>
This commit is contained in:
Johan Hedberg 2016-02-19 10:52:53 +02:00 committed by Gerrit Code Review
parent ccab7d0d6f
commit da1552a923
2 changed files with 57 additions and 0 deletions

View file

@ -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

View file

@ -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__ */