Commit Graph

160 Commits (9124ab82d14b0fe4c8092af0f666b19d42139af0)

Author SHA1 Message Date
Jérémie Dimino 9124ab82d1
Deprecate Pervasives (#1605)
- 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
2018-08-27 12:42:14 +01:00
Francois Berenger 5b884d6244 Unix fsync (#1839)
* 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>
2018-07-31 07:57:21 +02:00
David Allsopp d5952a5093 GPR#1061 check-typo compliance 2018-07-01 10:55:30 +01:00
madroach cba4ca510c Add ~follow option to Unix.link (#1061)
This allows hardlinking symlinks.
2018-06-25 13:39:21 +02:00
David Allsopp b5d1929e87 Whitespace and overlong line fixes. 2018-06-14 15:15:34 +01:00
Gabor Igloi 04cc9e8a7c Fix docstring of stats.st_rdev in Unix modules
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>
2018-06-07 17:09:03 +01:00
Nicolás Ojeda Bär 76f30d00f3 Unix: add open_process_args{,_in,_out,_full} (#1792)
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.
2018-05-24 11:10:36 +02:00
Jérémie Dimino 32da45a80a Move bigarray to the stdlib (#1685) 2018-04-09 13:14:05 +01:00
octachron e30e82a219 PR#7363: start documentation headers at {1 2017-10-04 13:05:05 +02:00
Xavier Leroy 3e0aadf7b0 Reimplement Sys.rename under Win32 to be more POSIX (#1306)
* 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.
2017-08-30 18:16:27 +02:00
Damien Doligez f78128a7d7 merge 4.05 into trunk 2017-07-18 13:03:54 +02:00
yallop de6ec33c6e Restrict Unix.environment in privileged contexts; add Unix.unsafe_environment (#1217)
* 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.
2017-06-30 11:31:10 +02:00
Damien Doligez fee01100fb Some tweaks for MPR#7557 (#1213)
* 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
2017-06-28 14:08:07 +02:00
Damien Doligez cf100bae04 Some tweaks for MPR#7557 (#1213)
* 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
2017-06-28 14:02:15 +02:00
Damien Doligez b38b008d88 Add Unix.unsafe_getenv. (See MPR#7557) 2017-06-23 18:04:40 +02:00
Damien Doligez 15966dbeaa cherry-pick the fix for MPR#7557 from 4.04 2017-06-23 17:55:46 +02:00
Damien Doligez d4972ea1d3 cherry-pick the fix for MPR#7557 from 4.04 2017-06-23 17:50:53 +02:00
Max Mouratov 485c2e68d3 Fixed grammar in user-facing comments and README 2017-04-06 13:26:18 +01:00
Max Mouratov c329255521 Fixed grammar in user-facing comments and README 2017-04-06 14:16:18 +02:00
Xavier Leroy a9e4c54b75 Deprecation of Bigarray.*.map_file and introduction of Unix.map_file, continued
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.
2017-03-13 19:15:10 +01:00
Gabriel Scherer bf5a61b38c Revert "Deprecate Bigarray.*.map_file and add Unix.map_file (#997)"
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
2017-03-12 12:41:55 -04:00
Christophe Troestler 2923dfbc19 Document how to perform the inverse of (gm|local)time
The goal is to make the documentation slightly more self contained on
the links between the time functions.
2017-02-22 20:26:49 -05:00
Gabriel Scherer 12bc55e6eb Merge pull request #1051 from Chris00/timegm
Document how to perform the inverse of (gm|local)time
2017-02-22 20:24:15 -05:00
Török Edwin faab91a96c Documentation: improve @since annotations
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:
512d128918
189d29bfcf
2017-02-21 13:31:12 -05:00
Török Edwin 20f61d7fb4 Documentation: improve @since annotations
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:
512d128918
189d29bfcf
2017-02-21 17:11:51 +02:00
Christophe Troestler af092cccff Document how to perform the inverse of (gm|local)time
The goal is to make the documentation slightly more self contained on
the links between the time functions.
2017-02-17 22:17:16 +01:00
Xavier Leroy f28f5d27f0 PR#7264: document the different behaviors of Unix.lockf under POSIX and under Win32. 2017-02-16 09:36:49 +01:00
Xavier Leroy 47b44135e4 PR#7264: document the different behaviors of Unix.lockf under POSIX and under Win32. 2017-02-16 09:34:34 +01:00
Xavier Leroy ab4e3beab1 Unix library: better API for "close-on-exec" over file descriptors (#650) 2017-02-13 18:05:19 +01:00
Florian Angeletti cdb0208300 Merge pull request #1017 from Octachron/potential_cross_reference_warning
Ocamldoc: option to show missed cross-reference opportunities
2017-02-05 21:03:43 +01:00
octachron c4d49c89c1 Add cross-reference detected by ocamldoc 2017-02-01 20:20:02 +01:00
Jérémie Dimino 5ed72007f8 Deprecate Bigarray.*.map_file and add Unix.map_file (#997)
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.
2017-01-10 10:03:24 +00:00
Sébastien Briais 032888921b Apply suggested change. 2016-11-10 14:04:19 +01:00
Sébastien Briais d78607e13c Document behaviour of unlink on directories. 2016-11-10 09:57:32 +01:00
Damien Doligez 33afceb5a5 Merge remote-tracking branch 'origin/4.03' into trunk 2016-07-07 16:58:59 +02:00
Xavier Leroy 4515477da8 PR#7153: document that Unix.SOCK_SEQPACKET is not really usable
Also update documentation of PF_INET6, which has been supported on Windows for a while.
2016-06-29 10:06:16 +02:00
Gabriel Scherer 783be07789 stdlib .mli: forgotten @since 4.03.0 2016-05-11 22:34:45 -04:00
Damien Doligez 525799bfb5 update documentation for `readlink` ( https://github.com/ocaml/ocaml/pull/462#issuecomment-217867859 ) 2016-05-10 11:18:41 +02:00
Leo White 9081dbea03 Turn on warning 50 for otherlibs 2016-03-28 20:16:47 +01:00
Alain Frisch 59ff6062fb Also enable more warnings in otherlibs/ and fix them. 2016-03-15 22:47:28 +01:00
Damien Doligez 5401ce8473 Update headers for the new license.
Remains to be done: remove all headers in testsuite/tests.
2016-02-18 16:59:16 +01:00
David Allsopp f23d1424ee Add Unix.has_symlink 2016-02-10 23:25:39 +00:00
David Allsopp 616ef2cae7 Support Unix.symlink on Windows 2016-02-10 23:25:39 +00:00
Christophe Troestler 985daea528 unix.mli: Use @raise wherever fit 2015-12-13 18:56:39 +01:00
Christophe Troestler da17e59caa unix.mli: Use "on Windows" everywhere 2015-12-13 18:56:39 +01:00
Christophe Troestler 46d6e28333 Specify in unix.mli which functions are implemented on Windows
Fixes http://caml.inria.fr/mantis/view.php?id=5253
2015-12-13 18:56:32 +01:00
Xavier Leroy 77cf36cf82 Merge pull request #331 from ocaml/win32-sockets
Windows sockets in asynchronous mode
2015-12-09 11:51:36 +01:00
Xavier Leroy 0939a59850 PR#6289: Unix.utimes uses the current time only if both arguments are exactly 0.0
Also: use utimes() in preference to utime() so as to get sub-second resolution.
2015-12-06 17:35:34 +01:00
Xavier Leroy 5551db5778 Branch win32-sockets: add documentation, update Changes. 2015-12-04 14:32:30 +01:00
Xavier Leroy 50648ed2b7 PR#4023 and GPR#68: add Unix.sleepf and improve Unix.sleep
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.
2015-11-15 15:34:45 +01:00