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>
|
|
|
|
#include "unixsupport.h"
|
|
|
|
|
|
|
|
value unix_dup(value fd) /* ML */
|
|
|
|
{
|
|
|
|
HANDLE newh;
|
|
|
|
if (! DuplicateHandle(GetCurrentProcess(), Handle_val(fd),
|
|
|
|
GetCurrentProcess(), &newh,
|
1997-09-04 06:45:56 -07:00
|
|
|
0L, TRUE, DUPLICATE_SAME_ACCESS)) {
|
1997-09-03 07:38:02 -07:00
|
|
|
_dosmaperr(GetLastError());
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return win_alloc_handle(newh);
|
|
|
|
}
|
|
|
|
|