- inline Pervasives in Stdlib and re-add Pervasives as a deprecated
module that aliases all elements of Stdlib except the stdlib modules.
- remove special case for Stdlib.Pervasives in printtyp.ml
* added otherlibs/unix/fsync.c and otherlibs/unix/unix.ml
* add Unix.fsync
* added otherlibs/win32unix/fsync.c
* Unix.fsync for windows
* big typo
* Rewrite Unix.fsync stub for Windows
* belts and braces: fail in the case of named pipe
* Add missing include
* corrected header
* better ocamldoc for fsync
* rm fsync.c from the UNIX_FILES list
* updated Changes for Unix.fsync
* Use _commit instead of FlushFileBuffers
* Include <io.h>
The st_rdev is not the minor number, it is the device ID according to
the manpage of stat, which is actually the major * 256 + minor. I've
replaced the old incorrect docstring with the description of st_rdev
from the man page of the stat command - it looks like the implemenation
of Unix.stat just puts the st_rdev returned from stat into the st_rdev
field.
Signed-off-by: Gabor Igloi <gabor.igloi@citrix.com>
The idea is to add a variant of the Unix.open_process{,_in,_out,_full} functions that work with a pair (program, args) directly, without going through the system shell, which introduces extra complexity (in particular, with respect to quoting).
I used the name Unix.open_process_args which is the one suggested in ocaml-batteries-team/batteries-included#858, but I am not completely sold on it.
One uses the usual "close" functions Unix.close_process{,_in,_out,_full} with the new functions as well.
The "old" functions Unix.open_process{,_in,_out,_full} are re-implemented in terms of the "new" functions, so I did not feel pressed to add new tests.
Addresses: MPR#7794.
* Reimplement Sys.rename under Win32 to be more POSIX
Specifically: "Sys.rename src dst" no longer fails if file "dst" exists,
but replaces it with file "src", as in POSIX.
Test added.
* Sys.rename: document the "replace if existing" behavior
Now that we have this behavior under Win32, let's guarantee it.
* byterun/win32.c: typos in names of error codes
* Tests for Unix.rename similar to those for Sys.rename
* win32unix/rename.c: simplify the implementation
All versions of Windows we support provide MoveFileEx.
* Sys.remove: for backward compatibility, copy if cannot move
This is what the old implementation (based on MoveFile() and on rename() from the CRT) did.
* Improve documentation of Sys.remove
* Improve documentation of Unix.rename
Bring it in line with that of Sys.rename.
* Restrict Unix.environment to return an empty array in privileged environments.
* Add Unix.unsafe_environment.
Unix.unsafe_environment is an analogue of Unix.environment that
returns the process environment regardless of privileges.
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
* fall back to __secure_getenv when secure_getenv is not available
* use secure_getenv for instrumented runtimes
* documentation: warn against setting the setuid or setgid bits on custom bytecode executables
This is a follow-up to GPR #997 with a different implementation that creates fewer dependencies.
We add to the runtime a `byterun/bigarray.c` file that contains the bigarray creation functions that used to be in `otherlibs/bigarray/bigarray_stubs.c`. In the latter file we keep all primitives needed to implement the Bigarray interface. The functions in the new `byterun/bigarray.c` make it possible to create bigarrays both from the bigarray library and from the unix library.
The header file `bigarray.h` moves to `byterun/caml/bigarray.h` accordingly.
The `map_file` implementations move to `otherlibs/unix/mmap.c` and `otherlibs/win32unix/mmap.c`. Some bigarray allocation code shared between the two implementations is put in `otherlibs/unix/mmap_ba.c`.
Through a couple of `#ifdef`, the `map_file` implementations can also be compiled from within `otherlibs/bigarray` with the same semantics they had in 4.04.
As a consequence, the bigarray library still contains a standalone, Unix-independent implementation of `Bigarray.*.map_file`; the only difference with 4.04 is that it is marked deprecated.
Current status: compiled and lightly tested under Unix. Win32 implementation neither compiled nor tested.
This reverts commit 5ed72007f8.
GPR#997 introduced a hard dependency of Bigarray on Unix, while there
previously only was a type-level dependency. This break some programs,
such as Camomile, that linked bigarray.cma but not unix.cma.
A solution is being worked out in GPR #1077 to remove the dependency,
but I would like to go forward with opam package testing on the 4.05
branch, and getting the details right for GPR#1077 requires some care,
so I wouldn't feel comfortable rushing to merge it.
I had to handle the following conflicts:
otherlibs/unix/unix.mli
("@since 4.05.0" was added in faab91a96c)
testsuite/tests/lib-bigarray-file/mapfile.ml
(changed by 5839c9827d9fdd55e5a9eff6bbd6173370c30bbb;
I kept and adapted the new version)
testsuite/tests/lib-bigarray-file/mapfile.reference
Add missing @since annotations for OCaml versions 4.00.0 - 4.05.0,
and fix existing annotations as needed:
Format.ikprintf: clarify ambiguity on @since 4.0 annotation
See b81519668f
Hashtbl.is_randomized and ListLabels.sort_uniq should be @since 4.03
List.sort_uniq is 4.02 but ListLabels.sort_uniq is 4.03
See:
512d128918189d29bfcf
Add missing @since annotations for OCaml versions 4.00.0 - 4.05.0,
and fix existing annotations as needed:
Format.ikprintf: clarify ambiguity on @since 4.0 annotation
See b81519668f
Hashtbl.is_randomized and ListLabels.sort_uniq should be @since 4.03
List.sort_uniq is 4.02 but ListLabels.sort_uniq is 4.03
See:
512d128918189d29bfcf
To break the circular dependency between Bigarray and Unix, a CamlinternalBigarray module was added to the stdlib. This module defines all the types used by the compiler to produce optimized code for bigarrays.
Thanks to David Allsopp for fixing Windows tests.
Unix.sleepf provides sleep with sub-second resolution.
Unix.sleep is implemented on top of Unix.sleepf.
If a handled signal causes the sleep to return early with an EINTR
error, catch it and restart the sleep for the remaining time.