Skip to content

Commit

Permalink
Add st_ino size/sign probes
Browse files Browse the repository at this point in the history
Work initiated by Tony Cook
  • Loading branch information
H.Merijn Brand committed Jul 31, 2011
1 parent dd35fa1 commit 668fdbe
Show file tree
Hide file tree
Showing 18 changed files with 120 additions and 1 deletion.
74 changes: 73 additions & 1 deletion Configure
Expand Up @@ -28,7 +28,7 @@
# See Porting/pumpkin.pod for more information on metaconfig.
#

# Generated on Sun Jul 31 12:06:46 CEST 2011 [metaconfig 3.5 PL0]
# Generated on Sun Jul 31 12:11:29 CEST 2011 [metaconfig 3.5 PL0]
# (with additional metaconfig patches by perlbug@perl.org)

cat >c1$$ <<EOF
Expand Down Expand Up @@ -1194,6 +1194,8 @@ shsharp=''
spitshell=''
src=''
ssizetype=''
st_ino_sign=''
st_ino_size=''
startperl=''
startsh=''
stdchar=''
Expand Down Expand Up @@ -21117,6 +21119,74 @@ EOM
fi
$rm_try

: Check the size of st_ino
$echo " "
$echo "Checking the size of st_ino..." >&4
$cat > try.c <<EOCP
#include <sys/stat.h>
#include <stdio.h>
#$i_stdlib I_STDLIB
#ifdef I_STDLIB
#include <stdlib.h>
#endif
int main() {
struct stat st;
printf("%d\n", (int)sizeof(st.st_ino));
exit(0);
}
EOCP
set try
if eval $compile_ok; then
val=`$run ./try`
case "$val" in
'') st_ino_size=4
$echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
;;
*) st_ino_size=$val
$echo "Your st_ino is $st_ino_size bytes long."
;;
esac
else
st_ino_size=4
$echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
fi
$rm_try

: Check if st_ino is signed
$echo " "
$echo "Checking the sign of st_ino..." >&4
$cat > try.c <<EOCP
#include <sys/stat.h>
#include <stdio.h>
int main() {
struct stat foo;
foo.st_ino = -1;
if (foo.st_ino < 0)
printf("-1\n");
else
printf("1\n");
}
EOCP
set try
if eval $compile; then
val=`$run ./try`
case "$val" in
'') st_ino_sign=1
$echo "(I can't execute the test program--guessing unsigned.)" >&4
;;
*) st_ino_sign=$val
case "$st_ino_sign" in
1) $echo "Your st_ino is unsigned." ;;
-1) $echo "Your st_ino is signed." ;;
esac
;;
esac
else
st_ino_sign=1
$echo "(I can't compile the test program--guessing unsigned.)" >&4
fi
$rm_try

: see what type of char stdio uses.
echo " "
echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
Expand Down Expand Up @@ -23277,6 +23347,8 @@ srand48_r_proto='$srand48_r_proto'
srandom_r_proto='$srandom_r_proto'
src='$src'
ssizetype='$ssizetype'
st_ino_sign='$st_ino_sign'
st_ino_size='$st_ino_size'
startperl='$startperl'
startsh='$startsh'
static_ext='$static_ext'
Expand Down
2 changes: 2 additions & 0 deletions Cross/config.sh-arm-linux
Expand Up @@ -977,6 +977,8 @@ stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions NetWare/config.wc
Expand Up @@ -942,6 +942,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
7 changes: 7 additions & 0 deletions Porting/Glossary
Expand Up @@ -4750,6 +4750,13 @@ ssizetype (ssizetype.U):
of bytes or an error condition. It must be a signed type.
We will pick a type such that sizeof(SSize_t) == sizeof(Size_t).

st_ino_sign (st_ino_def.U):
This variable contains the signedness of struct stat's st_ino.
1 for unsigned, -1 for signed.

st_ino_size (st_ino_def.U):
This variable contains the size of struct stat's st_ino in bytes.

startperl (startperl.U):
This variable contains the string to put on the front of a perl
script to make sure (hopefully) that it runs with perl and not some
Expand Down
2 changes: 2 additions & 0 deletions Porting/config.sh
Expand Up @@ -999,6 +999,8 @@ stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
10 changes: 10 additions & 0 deletions config_h.SH
Expand Up @@ -4387,6 +4387,16 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#define SELECT_MIN_BITS $selectminbits /**/
/* ST_INO_SIZE:
* This variable contains the size of struct stat's st_ino in bytes.
*/
/* ST_INO_SIGN:
* This symbol holds the signedess of struct stat's st_ino.
* 1 for unsigned, -1 for signed.
*/
#define ST_INO_SIGN $st_ino_sign /* st_ino sign */
#define ST_INO_SIZE $st_ino_size /* st_ino size */
/* STARTPERL:
* This variable contains the string to put in front of a perl
* script to make sure (one hopes) that it runs with perl and not
Expand Down
2 changes: 2 additions & 0 deletions epoc/config.sh
Expand Up @@ -858,6 +858,8 @@ stdio_cnt=''
stdio_filbuf=''
stdio_ptr=''
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings=''
submit=''
Expand Down
2 changes: 2 additions & 0 deletions metaconfig.h
Expand Up @@ -35,6 +35,8 @@
* LOCALTIME_MAX
* LOCALTIME_MIN
* LOCALTIME_R_NEEDS_TZSET
* ST_INO_SIGN
* ST_INO_SIZE
* U16SIZE
* U32SIZE
* U64SIZE
Expand Down
2 changes: 2 additions & 0 deletions plan9/config_sh.sample
Expand Up @@ -948,6 +948,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/sys/include/ape/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions symbian/config.sh
Expand Up @@ -779,6 +779,8 @@ stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
targetarch='thumb-symbian'
timetype=time_t
Expand Down
2 changes: 2 additions & 0 deletions uconfig.sh
Expand Up @@ -745,6 +745,8 @@ stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
stdio_filbuf=''
stdio_ptr='((fp)->_IO_read_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
targetarch=''
timetype=time_t
Expand Down
2 changes: 2 additions & 0 deletions win32/config.bc
Expand Up @@ -973,6 +973,8 @@ stdio_cnt='((fp)->level)'
stdio_filbuf=''
stdio_ptr='((fp)->curp)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.ce
Expand Up @@ -934,6 +934,8 @@ stdio_cnt=''
stdio_filbuf=''
stdio_ptr=''
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.gc
Expand Up @@ -973,6 +973,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.gc64
Expand Up @@ -974,6 +974,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='8'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.gc64nox
Expand Up @@ -974,6 +974,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='8'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.vc
Expand Up @@ -973,6 +973,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='4'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down
2 changes: 2 additions & 0 deletions win32/config.vc64
Expand Up @@ -973,6 +973,8 @@ stdio_cnt='((fp)->_cnt)'
stdio_filbuf=''
stdio_ptr='((fp)->_ptr)'
stdio_stream_array=''
st_ino_sign='1'
st_ino_size='8'
strerror_r_proto='0'
strings='/usr/include/string.h'
submit=''
Expand Down

0 comments on commit 668fdbe

Please sign in to comment.