Commit Graph

2184 Commits (master)

Author SHA1 Message Date
Daniil Baturin 0280127761
Fix Unix.utimes not working for directories on Win32. (#8796) 2020-11-03 11:03:35 +01:00
David Allsopp 46c7122888 Merge pull request #9840 from dra27/fix-9839
Partial revert of 9165: don't build the compiler with -O3 in flambda

(cherry picked from commit 6ce1c60ca97ee962ebf5d5218628bc388536325e)
2020-10-30 11:29:17 +01:00
Eugen Zalinescu d0c0c96d19 Clarify docstring in Str module 2020-10-21 21:36:21 +02:00
Jacques-Henri Jourdan b9abf833ca Memprof/systhreads : call [caml_memprof_delete_th_ctx] when threads gets killed by fork. 2020-10-19 17:11:11 +02:00
Jacques-Henri Jourdan f83d71830d Memprof: provide the guarantee that an allocation callback is always run in the same thread the allocation takes place.
This is done by using a local entry array for each thread, containing
tracked blocks whose allocation callback has not yet been called.

This allows some simplification in the code running callbacks for
young allocations. Indeed, since the entry array is local to one
thread, we know for sure that it cannot be modified during a callback,
and therefore we no longer need to remember the indices of the
corresponding new entries.
2020-10-19 17:08:17 +02:00
Jacques-Henri Jourdan ea52bec84b Memprof: thread-local context is now stored as a pointer in systhread's data structures.
Reasons:
- Better abstraction in memprof.h
- Simpler Saving/restore functions
- We introduce a current's thread context, so that we don't need to do a spacial case for the current thread
2020-10-19 17:00:04 +02:00
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