Raymond Toy pushed to branch issue-125-unix-stat-wrong at cmucl / cmucl

Commits:

1 changed file:

Changes:

  • src/lisp/os-common.c
    ... ... @@ -5,10 +5,12 @@
    5 5
     
    
    6 6
     */
    
    7 7
     
    
    8
    +#ifdef __linux__
    
    9
    +/* Needed to get 64-bit objects for stat and friends on Linux. */
    
    8 10
     #define _LARGEFILE_SOURCE
    
    9 11
     #define _FILE_OFFSET_BITS 64
    
    12
    +#endif
    
    10 13
     
    
    11
    -#include <stdio.h>
    
    12 14
     #include <errno.h>
    
    13 15
     #include <math.h>
    
    14 16
     #include <netdb.h>
    
    ... ... @@ -595,16 +597,23 @@ os_sleep(double seconds)
    595 597
         }
    
    596 598
     }
    
    597 599
     
    
    598
    -int unix_stat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    599
    -              uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    600
    -              time_t *atime, time_t *mtime, time_t *ctime,
    
    601
    -              long *blksize, off_t *blocks)
    
    600
    +int
    
    601
    +unix_stat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    602
    +          uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    603
    +          time_t *atime, time_t *mtime, time_t *ctime,
    
    604
    +          long *blksize, off_t *blocks)
    
    602 605
     {
    
    603 606
         int rc;
    
    604 607
         struct stat buf;
    
    605 608
     
    
    606 609
         rc = stat(path, &buf);
    
    607 610
     
    
    611
    +#if 0
    
    612
    +    /*
    
    613
    +     * Useful prints to see the actual size of the various
    
    614
    +     * fields. Helpful for porting this to other OSes that we haven't
    
    615
    +     * tested on.
    
    616
    +     */
    
    608 617
         fprintf(stderr, "size dev %d\n", sizeof(buf.st_dev));
    
    609 618
         fprintf(stderr, "size ino %d\n", sizeof(buf.st_ino));
    
    610 619
         fprintf(stderr, "size mode %d\n", sizeof(buf.st_mode));
    
    ... ... @@ -618,6 +627,7 @@ int unix_stat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *n
    618 627
         fprintf(stderr, "size ctime %d\n", sizeof(buf.st_ctime));
    
    619 628
         fprintf(stderr, "size blksize %d\n", sizeof(buf.st_blksize));
    
    620 629
         fprintf(stderr, "size blocks %d\n", sizeof(buf.st_blocks));
    
    630
    +#endif    
    
    621 631
         
    
    622 632
         *dev = buf.st_dev;
    
    623 633
         *ino = buf.st_ino;
    
    ... ... @@ -636,10 +646,11 @@ int unix_stat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *n
    636 646
         return rc;
    
    637 647
     }
    
    638 648
     
    
    639
    -int unix_fstat(int fd, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    640
    -               uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    641
    -               time_t *atime, time_t *mtime, time_t *ctime,
    
    642
    -               long *blksize, off_t *blocks)
    
    649
    +int
    
    650
    +unix_fstat(int fd, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    651
    +           uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    652
    +           time_t *atime, time_t *mtime, time_t *ctime,
    
    653
    +           long *blksize, off_t *blocks)
    
    643 654
     {
    
    644 655
         int rc;
    
    645 656
         struct stat buf;
    
    ... ... @@ -663,10 +674,11 @@ int unix_fstat(int fd, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    663 674
         return rc;
    
    664 675
     }
    
    665 676
     
    
    666
    -int unix_lstat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    667
    -               uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    668
    -               time_t *atime, time_t *mtime, time_t *ctime,
    
    669
    -               long *blksize, off_t *blocks)
    
    677
    +int
    
    678
    +unix_lstat(const char* path, dev_t *dev, ino_t *ino, mode_t *mode, nlink_t *nlink,
    
    679
    +           uid_t *uid, gid_t *gid, dev_t *rdev, off_t *size,
    
    680
    +           time_t *atime, time_t *mtime, time_t *ctime,
    
    681
    +           long *blksize, off_t *blocks)
    
    670 682
     {
    
    671 683
         int rc;
    
    672 684
         struct stat buf;