Commit Graph

2178 Commits (9fdc759ac0847de5380e25882d690bb22a89df24)

Author SHA1 Message Date
Thomas Refis 9fdc759ac0
Centralized tracking of frontend's global state (#9963)
import Local_store from merlin, with a simplified API following review comments
2020-10-15 14:47:19 +02:00
Xavier Leroy 426b10c6a8
Provide semaphores in the threading library (#9930)
This commit adds a new thread-related module Semaphore, implementing
counting semaphores and binary semaphores.

The two kinds of semaphores are presented as two different
abstract types in two sub-modules, Counting and Binary.
2020-10-12 19:09:52 +02:00
Xavier Leroy f809e9dec1
Make sure the process can terminate when the last thread calls Thread.exit (#9973)
To this end, the tick thread must be stopped, otherwise it prevents
the whole process from exiting.

Fixes: #9971
2020-10-12 15:24:40 +02:00
Nicolás Ojeda Bär 540996d21e Remove Spacetime 2020-10-08 20:28:12 +02:00
Nicolás Ojeda Bär 8806ddcbba
Unix.setsid: guard against errors (#9958)
The return value of `setsid()` was not checked for errors.
2020-10-05 19:20:30 +02:00
Xavier Leroy 786ee521cf
Use "error checking" mutexes in the threads library (#9846)
- Mutex.lock raises Sys_error if the mutex is already locked by the
  calling thread.
- Mutex.unlock raises Sys_error if the mutex is unlocked or locked
  by another thread.

Add the corresponding tests.

Co-authored-by: David Allsopp <david.allsopp@metastack.com>
2020-10-05 15:00:58 +02:00
David Allsopp 001c2d1283 Restore Cygwin64 support 2020-09-21 13:36:03 +01:00
Florian Angeletti d0e983e2aa
Merge pull request #9745 from johnwhitington/trunk
Unify labeled and unlabeled Standard Library module interfaces
2020-09-15 11:07:25 +02:00
Xavier Leroy ba0a9c2ce8
Export, document, and use Unix._exit (#9914)
This is a wrapper around the _exit system call.  It has been implemented
in otherlibs/unix/exit.c for a long time but never exported.

This commit exports and documents it as `Unix._exit`.

The Unix implementation of `establish_server` is changed to use `_exit`
and to have gender-neutral comments.

A test was added to check that OCaml finalization actions are not performed.
2020-09-14 19:03:42 +02:00
John Whitington cd920ab553 Remove false self-references 2020-09-11 18:11:54 +01:00
David Allsopp 0d91bef985
Eliminate CAMLprim/CAMLexport in socketaddr.h (#9900)
* Merge {win32,}unix/socketaddr.h so that unix/socketaddr.h can be used from win32unix/ as well.
* Update socket-related files in win32unix/
2020-09-11 16:35:31 +02:00
John Whitington c3f6cd7ff7 Merge remote-tracking branch 'upstream/trunk' into trunk 2020-09-11 14:14:38 +01:00
David Allsopp 28789cd045
Merge pull request #9904 from dra27/unix-io-prims
Declare primitives used by unix in io.h
2020-09-11 09:35:31 +01:00
John Whitington fc101ae849 Rename tools/unlabel --> tools/sync_stdlib_docs 2020-09-10 19:17:43 +01:00
David Allsopp 435babd6f8 Declare primitives used by unix in io.h 2020-09-10 16:34:24 +01:00
David Allsopp 83f0dda553 Don't use CAMLextern in C files 2020-09-10 13:55:38 +01:00
Yishuai Li 63c7071a34
Add Unix.SO_REUSEPORT (#9869)
Support the SO_REUSEPORT socket option.

Closes: #3512
2020-09-02 10:52:04 +02:00
David Allsopp 79ee88c270 tools/unlabel 2020-08-07 15:04:22 +01:00
David Allsopp bd2f72d647 unixLabels.cmi must be pre-processed 2020-08-07 12:00:38 +01:00
David Allsopp 2271e9c0f5 Final nits 2020-08-07 11:51:26 +01:00
John Whitington 7bb80d434e "final" fixes 2020-08-06 14:18:18 +01:00
John Whitington 53f753d772 remove double @sinces 2020-08-03 15:26:44 +01:00
John Whitington 0af3a1a805 Small fixes from @dra27's comments 2020-08-03 12:46:16 +01:00
John Whitington 7a22c2b1e4 Remove unneeded comment, typo 2020-08-01 13:54:36 +01:00
John Whitington 1c258b463f Fix label warnings 2020-07-31 15:51:11 +01:00
John Whitington 0e2a4a6ea7 Better, simpler, removal of unix type aliases 2020-07-30 19:07:03 +01:00
John Whitington 6e0557f6d7 Labeled and unlabeled @sinces automatically 2020-07-30 17:21:22 +01:00
John Whitington 0fbeee11be Fix smaller review comments from @dra27 2020-07-30 13:26:20 +01:00
John Whitington 85491c8867 Tildes back in labeled modules 2020-07-29 14:58:01 +01:00
John Whitington d0263ac0e4
Merge branch 'trunk' into trunk 2020-07-27 13:53:52 +01:00
John Whitington f32c4df6df {!Unix.xxx} changed to {!xxx} in docstrings 2020-07-23 18:55:57 +01:00
Daniel Bünzli 1578a359e0 Dynlink.*_unit functions: make sure they call the internal init ().
Otherwise they report inaccurate information before any load
occurs. Closes #9338.
2020-07-23 11:38:39 +02:00
David Allsopp 9a7a17c012 Add Sys.mkdir 2020-07-21 14:15:40 +01:00
Sébastien Hinderer f3ff1337a1 Build system: honour the CFLAGS and CPPFLAGS build variables
With this commit, it becomes possible to provide C compiler and preprocessor
flags to use in addition to those defined by the build system.

As required by the GNU coding standards, the flags can be provided
either at configure or at make invocation.

The provided CFLAGS and CPPFLAGS will also be taken into account
when C code is compiled by ocamlc/ocamlopt.

This commit removes the explicit reference to CFLAGS in the
configuration for the xlc compiler, since it is not necessary any longer.
2020-08-06 14:30:50 +02:00
Stephen Dolan 5b4b834578
Ensure signals are handled before Unix.{kill,sigprocmask} return (#9802) 2020-07-30 14:30:42 +01:00
David Allsopp a7ecba9045
Merge pull request #9804 from stedolan/otherlibs-debug
Build otherlibs with debug info in C stubs
2020-07-29 19:58:36 +01:00
Stephen Dolan a741f25803 Build otherlibs with debug info in C stubs 2020-07-28 17:30:28 +01:00
Stephen Dolan 15b9d006a4 Avoid polling in caml_leave_blocking_section
To preserve behaviour, explicit polls are added:

   - in caml_raise, to raise the right exception when as system
     call is interrupted by a signal.

   - in sigprocmask, to ensure that signals are handled as soon
     as they are unmasked.
2020-07-28 10:54:54 +01:00
Stephen Dolan 32feddc1fc Do not run OCaml code inside signal handlers 2020-07-27 17:29:39 +01:00
John Whitington db432875c9 Fixes per check-typo failure 2020-07-18 09:25:43 +01:00
John Whitington 84414661c1 Unify unixLabels.mli / unix.mli via tools/unlabel 2020-07-17 17:26:28 +01:00
Nicolás Ojeda Bär 34ff264937 Add module utils/binutils 2020-07-02 06:40:10 +02:00
Antonin Décimo d107fedd13
Don't define _INTEGRAL_MAX_BITS macro (#9686)
VS2019 throws the following warning [1] about the _INTEGRAL_MAX_BITS
[2] macro:

    stat.c(33): error C2220: the following warning is treated as an error
    stat.c(33): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored

The doc reads:

> _INTEGRAL_MAX_BITS Defined as the integer literal value 64, the
> maximum size (in bits) for a non-vector integral type. This macro is
> always defined.

Apparently, it became a predefined macro in Visual Studio 2005.

This commit simply removes the macro definition.

[1]: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4117
[2]: https://docs.microsoft.com/en-us/cpp/preprocessor/predefined-macros?view=vs-2019
2020-06-24 18:32:43 +02:00
Sébastien Hinderer 8087f7f1c5 Build system: simplify installation rules
Now that programs are built with their $(EXE) suffix, their installation
rules can be simplified a bit because most of the programs get installed
under the name they have been built with.
2020-06-18 11:16:58 +02:00
Sébastien Hinderer bdd9ca391e Add the $(EXE) suffix to all programs at build rather than install time
This commit touches neither boot/ocamlc nor boot/ocamllex

It has the side-effect of fixing the cleanup rules which did not use the
$(EXE) extension when removing a file although it was produced with the
$(EXE) extension.
2020-06-18 11:16:55 +02:00
Stephen Dolan a8e2f2b170
Unbox result of Unix.gettimeofday in unix and win32unix (#9561)
This patch makes Unix.time and Unix.gettimeofday be unboxed and @noalloc, which makes them about 20% faster (as measured by a stupid benchmark that does them many times in a loop).

This removes the fallback and error-handling paths from gettimeofday.  Neither is needed according to Single Unix Specification and POSIX.

Fixes: #7446
2020-06-02 11:05:57 +02:00
Manuel Hornung 2b6f49e874
Add new flag for non-elevated symbolic links and test for Developer Mode on Windows (#9593)
Support symbolic links in developer mode on Windows 10
2020-05-29 07:39:59 +01:00
David Allsopp 643d1af004 Map ERROR_PRIVILEGE_NOT_HELD to EPERM 2020-05-25 16:55:50 +01:00
Stephen Dolan ff6ae43184
Merge pull request #9458 from jhjourdan/memprof_fatal_error_thread_exit
Memprof: fatal error if thread is stopped from a callback.
2020-05-20 16:58:10 +01:00
Xavier Leroy 3e8272fe7c Reimplement Unix.command like Unix.create_process
Avoid calling Unix.fork and use the new "spawn" primitive, for efficiency
and for improved compatibility with threads and Multicore OCaml.
2020-05-19 19:21:18 +02:00