Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/branches/num64/runtime/c-libs/posix-filesys/ftruncate_64.c
ViewVC logotype

Diff of /sml/branches/num64/runtime/c-libs/posix-filesys/ftruncate_64.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 5218, Thu May 30 03:41:38 2019 UTC revision 5219, Thu May 30 13:17:43 2019 UTC
# Line 2  Line 2 
2   *   *
3   *   Version of ftruncate with 64-positions passed as pair of 32-bit values.   *   Version of ftruncate with 64-positions passed as pair of 32-bit values.
4   *   *
5   * Copyright (c) 2004 by The Fellowship of SML/NJ   * COPYRIGHT (c) 2019 The Fellowship of SML/NJ (http://www.smlnj.org)
6     * All rights reserved.
7   */   */
8    
9  #include "ml-unixdep.h"  #include "ml-unixdep.h"
10  #include "ml-objects.h"  #include "ml-objects.h"
11  #include "ml-c.h"  #include "ml-c.h"
# Line 11  Line 13 
13  #include <sys/types.h>  #include <sys/types.h>
14  #include <sys/stat.h>  #include <sys/stat.h>
15    
16  /* _ml_P_FileSys_ftruncate_64 : (int * word32 * word32) -> unit  /* _ml_P_FileSys_ftruncate_64 : (int * Position.int) -> unit
  *                               fd   lengthhi  lengthlo  
17   *   *
18   * Make a directory   * Truncate or extend a file to a specified length
19   */   */
20  ml_val_t _ml_P_FileSys_ftruncate_64 (ml_state_t *msp, ml_val_t arg)  ml_val_t _ml_P_FileSys_ftruncate_64 (ml_state_t *msp, ml_val_t arg)
21  {  {
22      int             fd = REC_SELINT(arg, 0);      int             fd = REC_SELINT(arg, 0);
23      off_t           len =      ml_val_t    boxed_len = REC_SELINT(arg, 1);
24        (sizeof(off_t) > 4)      off_t       len = (off_t)INT64_MLtoC(boxed_len);
       ? (((off_t)WORD_MLtoC(REC_SEL(arg, 1))) << 32) |  
         ((off_t)(WORD_MLtoC(REC_SEL(arg, 2))))  
       : ((off_t)(WORD_MLtoC(REC_SEL(arg, 2))));  
25      int             sts;      int             sts;
26    
27      sts = ftruncate (fd, len);      sts = ftruncate (fd, len);

Legend:
Removed from v.5218  
changed lines
  Added in v.5219

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0