replaced enter_fixnum by enter_integer in really_stat so files may be bigger than 5 GB and it works with the inode numbers in my afs.

This commit is contained in:
marting 2000-05-16 08:43:01 +00:00
parent f021f13b26
commit cc385802be
1 changed files with 22 additions and 29 deletions

View File

@ -31,8 +31,9 @@
#include <unistd.h>
#include <string.h>
#include <utime.h>
//#include <crypt.h> TODO: adapt configure to figure out if needed
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#endif
#include "cstuff.h"
#include "machine/stdio_dep.h"
@ -309,18 +310,6 @@ ssize_t write_fdes_substring(s48_value buf, size_t start, size_t end, int fd)
}
/*
** Stat hackery
*******************************************************************************
** DANGER, WILL ROBINSON: It's not necessarily true that all these
** stat fields will fit into a fixnum.
** In fact, S48's 30 bit fixnums are almost certainly good enough
** for everything but times. 30 signed bits ran out in 1987.
** So the time fields are split, low 24, high everything else.
** I haven't bothered w/anything else, since the only other real limit
** is size -- files can't be bigger than .5Gb.
*/
// JMG: removed time_hacks
/* S_ISSOCK(mode) and S_ISLNK(mode) are not POSIX. You lose on a NeXT. Ugh. */
#ifndef S_ISSOCK
@ -343,7 +332,7 @@ static int really_stat(int retval, struct stat *s, s48_value vec)
{
int modes, typecode = -1;
S48_DECLARE_GC_PROTECT(1);
if( 11 != S48_VECTOR_LENGTH(vec) ) return -1;
if( 11 != S48_VECTOR_LENGTH(vec) ) return -1;
if( retval < 0 ) return errno;
S48_GC_PROTECT_1(vec);
@ -356,15 +345,15 @@ static int really_stat(int retval, struct stat *s, s48_value vec)
else if( S_ISREG(modes) ) typecode = 4;
else if( S_ISSOCK(modes) ) typecode = 5;
else if( S_ISLNK(modes) ) typecode = 6;
S48_VECTOR_SET(vec,0,s48_enter_fixnum(typecode));
S48_VECTOR_SET(vec,1, s48_enter_fixnum(s->st_dev));
S48_VECTOR_SET(vec,2, s48_enter_fixnum(s->st_ino));
S48_VECTOR_SET(vec,3, s48_enter_fixnum(s->st_mode));
S48_VECTOR_SET(vec,4, s48_enter_fixnum(s->st_nlink));
S48_VECTOR_SET(vec,5, s48_enter_fixnum(s->st_uid));
S48_VECTOR_SET(vec,6, s48_enter_fixnum(s->st_gid));
S48_VECTOR_SET(vec,7, s48_enter_fixnum(s->st_size));
S48_VECTOR_SET(vec,1, s48_enter_integer(s->st_dev));
S48_VECTOR_SET(vec,2, s48_enter_integer(s->st_ino));
S48_VECTOR_SET(vec,3, s48_enter_integer(s->st_mode));
S48_VECTOR_SET(vec,4, s48_enter_integer(s->st_nlink));
S48_VECTOR_SET(vec,5, s48_enter_integer(s->st_uid));
S48_VECTOR_SET(vec,6, s48_enter_integer(s->st_gid));
S48_VECTOR_SET(vec,7, s48_enter_integer(s->st_size));
S48_VECTOR_SET(vec,8, s48_enter_integer(s->st_atime));
S48_VECTOR_SET(vec,9, s48_enter_integer(s->st_mtime));
S48_VECTOR_SET(vec,10, s48_enter_integer(s->st_ctime));
@ -509,15 +498,19 @@ int envvec_setenv(s48_value scheme_name, s48_value entry){
}
}
char** scm_envvec(int *len) /* Returns environ c-vector & its length. */
{
char **ptr=environ;
while( *ptr ) ptr++;
*len = ptr-environ;
//char** scm_envvec(int *len) /* Returns environ c-vector & its length. */
//{
// char **ptr=environ;
// while( *ptr ) ptr++;
// *len = ptr-environ;
// return(environ);
//}
return(environ);
s48_value scm_envvec(){
return char_pp_2_string_list(environ);
}
/* Load the (Scheme) strings in the (Scheme) vector VEC into environ.
** Somewhat wasteful of memory: we do not free any of the memory
** in the old environ -- don't know if it is being shared elsewhere.