Skip to content
Permalink
Browse files

posix: define ssize_t correctly on x86_64 (ie, not a 32-bit integer...)

  • Loading branch information...
miselin committed May 20, 2014
1 parent 06082df commit 8058513a42566c20705440c7e094da29781aca07
Showing with 63 additions and 6 deletions.
  1. +20 −1 src/subsys/posix/include/limits.h
  2. +19 −4 src/subsys/posix/include/sys/_types.h
  3. +24 −1 src/subsys/posix/include/sys/config.h
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2008-2014, Pedigree Developers
*
* Please see the CONTRIB file in the root of the source tree for a full
* list of contributors.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef _LIBC_LIMITS_H_
# define _LIBC_LIMITS_H_ 1

@@ -77,7 +96,7 @@
/* Minimum and maximum values a `signed long int' can hold.
(Same as `int'). */
# ifndef __LONG_MAX__
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9)
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) || defined (__sparcv9) || defined(__LP64__)
# define __LONG_MAX__ 9223372036854775807L
# else
# define __LONG_MAX__ 2147483647L
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2008-2014, Pedigree Developers
*
* Please see the CONTRIB file in the root of the source tree for a full
* list of contributors.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/* ANSI C namespace clean utility typedefs */

/* This file defines various typedefs needed by the system calls that support
@@ -14,11 +33,7 @@
typedef long _off_t;
__extension__ typedef long long _off64_t;

#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
#else
typedef long _ssize_t;
#endif

#define __need_wint_t
#include <stddef.h>
@@ -1,3 +1,22 @@
/*
* Copyright (c) 2008-2014, Pedigree Developers
*
* Please see the CONTRIB file in the root of the source tree for a full
* list of contributors.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#ifndef __SYS_CONFIG_H__
#define __SYS_CONFIG_H__

@@ -153,7 +172,7 @@
# define __LONG_MAX__ LONG_MAX
# else
# if defined (__alpha__) || (defined (__sparc__) && defined(__arch64__)) \
|| defined (__sparcv9)
|| defined (__sparcv9) || defined(__LP64__)
# define __LONG_MAX__ 9223372036854775807L
# else
# define __LONG_MAX__ 2147483647L
@@ -188,6 +207,10 @@
#define _READ_WRITE_RETURN_TYPE _ssize_t
#endif

#if defined(__pedigree__)
#define _READ_WRITE_RETURN_TYPE _ssize_t
#endif

#ifndef __EXPORT
#define __EXPORT
#endif

0 comments on commit 8058513

Please sign in to comment.
You can’t perform that action at this time.