1997-09-03 07:38:02 -07:00
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Objective Caml */
|
|
|
|
/* */
|
|
|
|
/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1996 Institut National de Recherche en Informatique et */
|
1999-11-17 10:59:06 -08:00
|
|
|
/* en Automatique. All rights reserved. This file is distributed */
|
|
|
|
/* under the terms of the GNU Library General Public License. */
|
1997-09-03 07:38:02 -07:00
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
|
|
|
#include <mlvalues.h>
|
1997-11-17 09:15:28 -08:00
|
|
|
#include <alloc.h>
|
1997-09-03 07:38:02 -07:00
|
|
|
#include "unixsupport.h"
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLprim value win_fd_handle(value handle)
|
1997-09-03 07:38:02 -07:00
|
|
|
{
|
1998-07-02 02:52:57 -07:00
|
|
|
int fd = _open_osfhandle((long) Handle_val(handle), O_BINARY);
|
1997-09-04 06:45:56 -07:00
|
|
|
if (fd == -1) uerror("channel_of_descr", Nothing);
|
|
|
|
return Val_int(fd);
|
1997-09-03 07:38:02 -07:00
|
|
|
}
|
|
|
|
|
2001-08-28 07:47:48 -07:00
|
|
|
CAMLprim value win_handle_fd(value fd)
|
1997-09-03 07:38:02 -07:00
|
|
|
{
|
|
|
|
return win_alloc_handle((HANDLE) _get_osfhandle(Int_val(fd)));
|
|
|
|
}
|