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

SCM Repository

[smlnj] Annotation of /sml/branches/SMLNJ/src/runtime/c-libs/posix-io/fcntl_gfl.c
ViewVC logotype

Annotation of /sml/branches/SMLNJ/src/runtime/c-libs/posix-io/fcntl_gfl.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (view) (download) (as text)

1 : monnier 2 /* fcntl_gfl.c
2 :     *
3 :     * COPYRIGHT (c) 1995 by AT&T Bell Laboratories.
4 :     */
5 :    
6 :     #include "ml-unixdep.h"
7 :     #include <fcntl.h>
8 :     #include "ml-objects.h"
9 :     #include "ml-c.h"
10 :     #include "cfun-proto-list.h"
11 :    
12 :     /* _ml_P_IO_fcntl_gfl : int -> word * word
13 :     *
14 :     * Get file status flags and file access modes.
15 :     */
16 :     ml_val_t _ml_P_IO_fcntl_gfl (ml_state_t *msp, ml_val_t arg)
17 :     {
18 :     int fd = INT_MLtoC(arg);
19 :     int flag;
20 :     ml_val_t flags, mode, obj;
21 :    
22 :     flag = fcntl(fd, F_GETFD);
23 :    
24 :     if (flag < 0)
25 : monnier 8 return RAISE_SYSERR(msp, flag);
26 : monnier 2
27 :     WORD_ALLOC (msp, flags, (flag & (~O_ACCMODE)));
28 :     WORD_ALLOC (msp, mode, (flag & O_ACCMODE));
29 :     REC_ALLOC2(msp, obj, flags, mode);
30 :    
31 :     return obj;
32 :    
33 :     } /* end of _ml_P_IO_fcntl_gfl */

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