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/trunk/src/runtime/c-libs/posix-io/fcntl_l.c
ViewVC logotype

Annotation of /sml/trunk/src/runtime/c-libs/posix-io/fcntl_l.c

Parent Directory Parent Directory | Revision Log Revision Log


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

1 : monnier 2 /* fcntl_l.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-base.h"
9 :     #include "ml-values.h"
10 :     #include "ml-objects.h"
11 :     #include "ml-c.h"
12 :     #include "cfun-proto-list.h"
13 :    
14 :     /* _ml_P_IO_fcntl_l : int * int * flock_rep -> flock_rep
15 :     * flock_rep = int * int * offset * offset * int
16 :     *
17 :     * Handle record locking.
18 :     */
19 :     ml_val_t _ml_P_IO_fcntl_l (ml_state_t *msp, ml_val_t arg)
20 :     {
21 :     int fd = REC_SELINT(arg, 0);
22 :     int cmd = REC_SELINT(arg, 1);
23 :     ml_val_t flock_rep = REC_SEL(arg, 2), obj;
24 :     struct flock flock;
25 :     int sts;
26 :    
27 :     flock.l_type = REC_SELINT(flock_rep, 0);
28 :     flock.l_whence = REC_SELINT(flock_rep, 1);
29 :     flock.l_start = REC_SELINT(flock_rep, 2);
30 :     flock.l_len = REC_SELINT(flock_rep, 3);
31 :    
32 :     sts = fcntl(fd, cmd, &flock);
33 :    
34 : monnier 8 if (sts < 0)
35 :     return RAISE_SYSERR(msp, sts);
36 : monnier 2
37 : monnier 8 REC_ALLOC5(msp, obj,
38 :     INT_CtoML(flock.l_type),
39 :     INT_CtoML(flock.l_whence),
40 :     INT_CtoML(flock.l_start),
41 :     INT_CtoML(flock.l_len),
42 :     INT_CtoML(flock.l_pid));
43 : monnier 2
44 :     return obj;
45 :    
46 :     } /* end of _ml_P_IO_fcntl_l */

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