package core
- v0.11
- v0.10
- v0.9
- 113.43.00
- 113.33.01
- 113.33.00
- 113.24.02
- 113.24.01
- 113.24.00
- 112.35.00
- 112.24.00
- 112.17.00
- 112.06.00
- 112.01.00
- 111.28.00
- 111.25.00
- 111.21.00
- 111.17.00
- 111.11.00
- 111.08.00
- 111.06.00
- 111.03.00
- 110.01.00
- 109.60.00
- 109.58.00
- 109.55.00
- 109.53.00
- 109.52.00
- 109.47.00
- 109.45.00
- 109.44.00
- 109.42.00
- 109.41.00
- 109.37.00
- 109.35.00
- 109.34.00
- 109.32.00
- 109.30.00
- 109.28.00
- 109.27.00
- 109.24.00
- 109.23.00
- 109.21.00
- 109.20.00
- 109.19.00
- 109.18.00
- 109.17.00
- 109.15.00
- 109.14.00
- 109.13.00
- 109.12.00
- 109.11.00
- 109.10.00
- 109.09.00
- 109.08.00
- 109.07.00
- 109.06.00
- 109.05.00
- 109.04.00
- 109.02.00
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=7996e4063d51bdb7337ded720d31d4bc4c02cca467fad6b550c0f9ae8deae0bb
md5=85f006b0666f4fe05c566be8fda64cb2
doc/CHANGES.html
As Core is built on top of Base and Core_kernel you might want to have a look at Base's changelog and Core_kernel's changelog.
git version
- Added
Unix.map_file. - Added
Iobuf.{of,to}_bytes. - Added
Md5.digest_bigstringand used it to implement a more efficient version ofMd5.digest_bin_prot. - Optimized Time_stamp_counter.Calibrator.calibrate to not allocate.
- Removed
Piecewise_linearandCrc. Weak_hashtblwas moved out into its own library (which is still part of the core package)- Move
Syslogout ofCore.Unixinto its own librarycore.syslog. - Add
get_bind_to_interfacefunction to read current status of SO_BINDTODEVICE socket option. Make bothbind_to_interfaceandget_bind_to_interfaceuse new typeBound_interface_name.tfor its argument/return value.
v0.12.1
- Fix linking of Core in bytecode executables
v0.11
- Fix a segfault in
Time. (fixes #102)
v0.10
- Renamed
Float.to_stringasto_string_12, to reflect its 12-digit precision. And introduce a newFloat.to_stringwith the behavior ofFloat.to_string_round_trippable. - Added to
Command.execsupport for specifying another executable viaargv.(0)rather thanSys.executable_name. - Changed
Lock_fileto not delete lock files in forked processes. - In
Linux_ext.Epoll, reduced closure allocation - Added support to
Piecewise_linearforTime_ns - Added function
Iobuf.Expert.reinitialize_of_bigstring, which allows users to use anIobufwhile being passed a bigstring, without allocating - Changed
Commandto no longer print the entire help on parse errors. - Added
[@@deriving hash]toIdentifiable.S*andHashable.S*. Added functorsIdentifiable.Make*_and_derive_hash_fold_t, which generatehash_fold_tfromhash. - Added to
Iobufinlining annotations for Flambda. - Added to
ScheduleaZoned_betweenconstructor, which allows the span to cross the midnight boundary, and allows a different time zone for the start and end ofdays. Because of the new expressive power, renamed the existingScheduletoSchedule_v4_deprecatedand added the new functionality inSchedule_v5. - Improved
Schedule_v5.Betweento support crossing the midnight boundary. - Exposed
[@@deriving hash]inUuid. - Changed
Commandto display build time in the local zone. - Changed
Command.execto allow executing a subcommand of the child executable. - Added
Command.Param.flag_optional_with_default_doc, which takes a default value and formats that value into the doc. - Added
Command.lazy_groupandCommand.Sexpable.Lazy, so that help for lazy commands and groups of commands doesn't have to force the lazy unless necessary. - Changed
FilenameandUnixfunctions that generate temporary filenames and directories to include.tmp.in the name, so one can reliably recognize them. - Changed
Daemon.daemonize_waitto obey stdout/stderr redirection even when they are already pointing at a regular file. - Fixed
Time.Format's handling of zones. - In
Linux_ext, added support for theTCP_QUICKACKsocket option, for use on TCP connections where latency is important - Added
Sys.quotefunction for quoting bash input, likeFilename.quote, but with more readable output. - Added support to
Signalfor signals that were added in OCaml 4.03: bus, poll, sys, trap, urg, xcpu, xfsz. - Added support to
Udp.sendtofor MacOS. - Added
Linux_ext.Eventfdmodule, with bindings foreventfd(2). - Removed bounds checks from
Iobuf.unsafe_blit. - Optimized
Inet_addr.inet4_addr_to_int32_exn, removing an intermediate string allocation. - Optimized
Time_nscomparison functions to use theInt63primitives; they had been shadowed to use slower generic operations exported byIdentifiable.Make. - Added to
Unix.RlimitaLimitsubmodule, withminandmaxfunctions. - Added function
Unix.Inet_addr.inet4_addr_of_int63, for efficient conversion from anInt63.tto anInet_addr.t. - Changed
Unix.create_process_env's execvp emulation w.r.t environment handling, PATH, and allowed nonfatal errors. - Changed
Unix.sysconfto return an option, and to correctly detect when there is no value. - Made
Unix.IOVec.max_iovecslazy, to avoid calling sysconf at top-level. - Removed function
Time.Ofday.Zoned.compare, which was misleading because it does not correspond to a temporal ordering. The comparison is now available asTime.Ofday.Zoned.With_nonchronolgical_compare. - Removed
Time_nsfunctions:of_time,local_now,of_local_time. These functions do not exist inTime.Ofdayand are simple wrappers around existing functions. - Renamed
Command.basicasbasic_spec. Renamed Command.basic' as basic. We want to encourage the use ofCommand.Paramand discourage the use ofCommand.Spec. - Removed
Uuid.t_of_sexp. - Switched Core to
-safe-string. - Changed
Uuid.sexp_of_tto show the nil UUID whenam_running_inline_test. - Added module-level documentation for
Interval. - Changed
Time_ns.Ofday'sto_stringandsexp_of_tfunctions to output nine decimal places rather than six. - Deprecated
Uuid.t_of_sexp, in favor ofUnstable.t_of_sexpandStable.V1.t_of_sexp. - Fixed
Unix.Iovec.of_stringandof_bigstringso that the default len includes the suffix of the input starting atpos, as usual. - Removed
Unix.create_process's support for the oldml_create_processbackend, leaving it with only thespawn_vforkbackend.
v0.9
113.43.00
Time.Ofday.of_stringsupports "AM and "PM" suffixes.- Change the innards of
Command.Flagso it no longer uses mutable state. It now updates aUniv_map.tinstead. Renamed:
core/test --> core/test-bin
since these directories contain executables to run rather than libraries with standard unit tests. This is in preparation for moving the standard unit tests to a more "normal" test directory.
- Move unit tests from core/src to core/test .
- The output for the "version" subcommand and the "-version" flag is now the same.
Core.Std.Lock_file doesn't work properly on OSX, see this:
https://github.com/janestreet/jenga/issues/4#issuecomment-205176593
This fix the issue by requiring both flock and lockf only on Linux.
Closes janestreet/jenga#4
- Unix.fork_exec needs to handle exceptions raised by exec
- Remove
Core.Core_list, which was not inCore.Stdand had only an unusedto_sequence. - Array.random_element
Shift operations are unspecified outside of the range
0 <= x < bitsize.This fixes unit tests for core/src/core_unix.ml in 32bit.
Replace all occurences (in Core) of
Time_ns.Span.to_int_nsandTime_ns.to_int_ns_since_epochwith their 63bit counterpart.Time_ns.Span.to_int_nsandTime_ns.to_int_ns_since_epochare not implemented in 32bit.The is one step toward have unit tests to pass in 32bit.
- Wrap Unix.strptime in Date and Time
New arg types in Command.Param:
sexp = Arg_type.create Sexp.of_string
sexp_conv a_of_sexp = Arg_type.create (fun s -> a_of_sexp (Sexp.of_string s))
Time_ns.Ofday.createpresently makes 2 function calls tocaml_int_compare. Changed to use the native int comparisons and avoid the calls increate(and other comparisons).
113.33.01
- Fix build problem on BSD related to
endian.h.
113.33.00
- Updated to follow core_kernel's evolution.
- Add variance annotations to a few types in
Command. Command.Param.choicerepresents a sum type.- Added
Command.Spec.of_paramfor conversion from new-style to old style command line specifications. This is expected to be useful for gradually converting Spec-based commands into Param-based ones. flag_namesandanon_namesgives the flags and anons used by a Command.Param.t, whilemnemoniccombines them to give a string that's good for referring to that param in error messages.This feature improves the interface of
Command.Param.one_ofby saving the caller from passing the flag names separately.- Remove the closure allocation from
Date0.create_exn - Many apps take schedules as command line parameters (to determine when they'll be up, or when they should raise issues, etc.). Let's add a Schedule.Stable.V4.flag function to generate the command line param to make writing this common pattern easier.
Add Ofday.Option to
time_ns.ml.Exports
Time_ns.Span.Option.unchecked_valueand.Ofday.Option.unchecked_value!Finally fix
Time_ns.Of_day.of_local_timew.r.t. DST transitions after regression test failures at the DST transition.As a result, clarified slightly the role of
Time_ns.Ofday, likeTime.Ofday, as 24h wall-clock times, not linear time offsets, which latter would have to be up to 25h for DST.- Adds
Command.Spec.Arg_type.percent. - Add
Stable.V1toTime_ns.Ofday.Option.t, add it toCore.Stable, and standardize the interface toOptionmodules inTime_ns. - Add
Time_ns.to_ofday.
113.24.02
- Deprecated core.syntax and updated
coretopto useppx_jane
113.24.01
Updated corebuild to use ppx-jane instead of camlp4
Closes #70
113.24.00
N.B. Some interface change were made which are not listed here, as they are only cascading from core_kernel. Look at core_kernel's CHANGES.md file to get a complete history of the changes made for this release.
- Add
Core.Command.Arg_type.Export.time_zone Fix
Command.shapeto run external programs only once to get their sexp.Introduces a new variant of Command.t called Proxy. The Exec variant represents the top-level command of an external executable that has not yet been run; the Proxy variant represents an arbitrary subcommand that has been extracted by running an external executable. Command.exec constructs an Exec variant; Command.shape of an Exec variant runs the executable and generates a tree of Proxy variants representing all the information from the generated sexp, so the executable will not need to be re-run.
A version of recvmmsg that pre-allocates and reuses the iovec record. Profiling indicates this is a non-trivial amount of our I/O loop (under very heavy load).
Since nobody is using the heavyweight features of the existing recvmmsg, replace it with the lightweight one. This leads to minor but important changes to the interfaces of
Iobuf.recvmmsg_assume_fd_nonblockingandUdp.recvmmsg_loop.- Switch to ppx.
Time.set_sexp_zoneaffectst_of_sexpIf we're willing to read sexps without zones, we should be willing to let you control what timezone they're read with.
- Sped up
Llimiter. - Make
Interval.IntimplementContainerandBinary_searchable. - Add
Identifiable.StoUnix.Cidrso that it supports hash tables. UpdateUnix.Cidr.tto normalize values, e.g. "192.168.1.101/24" ==> "192.168.1.0/24". - Added "noalloc" attribute to
Linux_ext.unsafe_timerfd_settime. In Iobuf, made some functions take:
(
> write, _) Iobuf.trather than:
(read_write, _) Iobuf.t
if they only need to write to the iobuf and don't need to read it.
Time.of_string_absdidn't support ISO 8601 time zone strings without colons, or those specified as locations. This version adds support for time zones without colonsUnix.Passwd.getpwentstakes the lock, partially appliesExn.protect, then releases the lock, then completes the application and actually runs stuff.Command.file-completion
Files are now completed correctly when paths contain a directory.
Previously, completion when pointed at a directory would put a space at the end. This would cause the user to hit backspace every time a directory was in the path.
- Add
diff_weekdaysanddiff_weekend_daysfunctions to date module. Time.to_date_ofday_preciseimplements a complete inverse forof_date_ofday. This is needed to give the DWIM-est semantics to Schedule.t that we can think of.Reduce allocation in Linux_ext.Epoll- Add
Time_ns.Of_day.(add_exn, sub_exn, diff). - Adding
head_padded_fixed_stringto Iobuf. - Move
Core_extended.Std.Sys.hometoCore.Std.Sys.home_directory. - Add
Iobuf.{read,write,input,output}akin to the bigstring versions. - Add expert iobuf functions for extracting bigstrings and iovecs that share the iobuf's underlying storage.
- Add stable
Int63.tconversions for types inTime_ns. - Rename DNS-based
Inet_addrsexp conversions to expose their blocking nature. - Add
Unix.Inet_addr.Stable. - Add [Core.Std.Schedule].
Fixed
Iobuf_packet.iter, which behaved incorrectly if the packet didn't start at the lo_min of the iobuf. It usedIobuf.rewindwhen it should have usedIobuf.Lo_bound.restore.Added
@@deriving comparetoIobuf.Bound.- Add ability to
Time.formatfor a specific time zone Make more information available via Command.Shape.t
Expose machine-readable info on anonymous arguments.
- Remove unnecessary rebinding of
(^/)incore_filename.ml. It had one call site and wasn't exposed. The(^/)everyone uses comes from std.ml Add
getifaddrstoCore.Std.Unix.Handles Packet (for interfaces that do not have an address on Linux systems only), IPv4 and IPv6 address families.
- Implement
Time_ns.Span.to_string_humby analogy toTime.Span.to_string_hum. The code and tests are essentially copied from "lib/core/src/span.ml". Remove our stubs for
Unix.stat.They were upstreamed in 4.02.2.
112.35.00
Tweaked
Unix.stat's C code to reduce float rounding error, by using double-precision rather than single-precision floats.Following Xavier's comment: http://caml.inria.fr/mantis/view.php?id=6285
- Added
Date.Omodule. - In
Interval, exposedcomparein stable types by having the appropriate modules match theStablesignature. - Added
Iobuf.Fill.decimalandPoke.decimal, for efficiently writing integers in decimal format. - Removed
Filename.O(and/^), since it's not used that much, and is inconsistent with the older operator for this that's exposed inCore.Std:^/. Improved
Commandautocompletion to work even if some arguments can't be parsed.This is useful because the completion mode does not get fed precisely the same arguments that it would get if you hit RETURN.
As a simple example, if completion is set up for
my-exewhich takes a sexp as its first argument, then:my-exe '(a b)' <TAB>will run
my-exein completion mode with:'(a b)'as its first argument, rather than:
(a b)as would be passed if RETURN had been pressed instead. Since
Sexp.of_string "'(a b)'"fails, in this example tab completion won't work.Changed the internals a bit to make this possible. Most notably, the
Parsermodule is now applicative rather than monadic, which required only a few simple changes to support.Made
Time_ns.to_timeandTime_ns.Span.to_spanround to the nearest microsecond in all cases.Previously,
Time_ns.Span.to_spansometimes rounded incorrectly for negative spans.Added
Time.Zone.prev_clock_shift, the analog ofnext_clock_shift.val prev_clock_shift : t -> before:Time_internal.T.t -> (Time_internal.T.t * Span.t) optionImplemented
next_clock_shiftandprev_clock_shiftusingArray.binary_search_segmented.- Added
Lock_file.get_pid : string -> Pid.t option. - Added
val random: unit -> inttoTime_nsandTime_ns.Span. Renamed
Iobuf.subasIobuf.sub_shared.This more closely matches
Bigstring, and clarifies the semantics ofIobuf.subvssubinBlit_intf.S.- Added
Iobufblit modules:Blit,Blit_consume,Blit_fill,Blit_consume_and_fill. Added
Piecewise_linear.first_knotandlast_knot.val first_knot : t -> (key * value) option val last_knot : t -> (key * value) option- Made
Unix.CidrmatchComparable.S_binable, and addedCidr.createandCidr.netmask_of_bits. - Moved
Unix.tmandUnix.strftimefromCore_kerneltoCore. Made
Crc.crc32returnInt63.trather thanint64, and addedCrc.bigstring_crc32andIobuf.crc32.Cleaned up old cruft in the C stubs for CRC checking.
- Added
Iobuf.narrow_loandnarrow_hi, which compriseIobuf.narrow. Changed
Linux_ext.Timerfd,Epoll.wait, andUnix.selectto use (int)Time_nsrather than (float)Time.This avoids spurious float conversions and rounding problems.
Made all timeouts consistently treat negative timeouts as "timeout immediately".
This fixes an incorrect behavior of
Linux_ext.Timerfd.set_afterandset, which had been rounding to the nearest microsecond, which was particularly bad for time spans smaller than 500ns, which would be rounded to zero, and then would cause the timerfd to never fire. Now, the small span is directly fed totimerfd_settime. We also changed a span of zero to be treated as1ns, to avoid the behavior oftimerfd_settime 0, which causes the timerfd to be cleared and never fire.- Made
Or_errormatchApplicative.S. Added
Command.Param, with the intention of one day replacingCommand.Specand providing an applicative interface for command-line parsing.This change required lots of rearrangement of
command.mliso thatCommand.ParamandCommand.Speccould share large portions of their interface. As a side effect, the interface is more sweeksy than before.- Added
Command.shape, for exposing the shape of a command, including what subcommands its has. Changed
Syscall_result.to_resultto return a preallocated object, and changed many uses to take advantage of this property.Pattern matching on results is much clearer than if-analysis and avoids double-checking errors in many cases.
Syscall_result.to_resultcan only return preallocated results for a fewOkvalues fromSyscall_result.Int, of course, and likewise for other largeok_valuetypes. We have initially, and arbitrarily, limited preallocation to 64errno's and 2048ok_value's.- Added
Sys.big_endian : bool, fromCaml.Sys. Disabled unit tests in
Time_nsthat started failing around 10:40pm NYC 2015-05-15.The tests indicate an off-by-one-microsecond error in round tripping between
Time.Span.tandTime_ns.Span.t.
112.24.00
- Renamed
DequeueasDeque. - Added
Fdeque, a functional deque (a double-endedFqueue, or a functionalDeque). Changed
Fqueue's bin-io format, and added a stable type.Deprecated deque-like functions in favor of
Fdeque.- Added
Fheap, a functional heap implementation based on pairing heaps. - Reverted the change to
Or_error's bin-io format made in 112.17, going back to the format in 112.16 and before. - Added to
Unix.envtype a ``Replace_rawvariant, as used inexecandfork_exec`. - Added
Array.Permissionedmodule, which has a permissioned array type and permissioned versions of all the regular array functions. - Added
Date.week_number : t -> int. Added values to
Day_of_week:of_int_exn,iso_8601_weekday_number,weekdays.val of_int_exn : int -> t val iso_8601_weekday_number : t -> int val weekdays : t list (- [ Mon; Tue; Wed; Thu; Fri ] *)- Switched
FloatIEEE functions to useInt63.tfor the mantissa rather thanint, so they work on 32-bit platforms. - Added a
lengthfield to theMap.trecord, makingMap.lengthO(1)rather thanO(n). - Moved a fragment of
Time_nsfromCoretoCore_kernel, enough so thatAsync_kernelcan useCore_kernel.Time_nsand ultimately only depend onCore_kernel. - Fixed compilation of
Time_ns32-bit Linux. - Added
Bounded_int_table.clear. Fixed the
module_namepassed toIdentifiable.Makefor a number of modules.The module name must be an absolute module path.
Reported here: https://github.com/janestreet/core/issues/52
- Added
Tuple.Binablefunctor, for making binable tuples. Sped up a
Time_stamp_counterunit test.Time_stamp_counterunit test has an 18s unit test, which seems excessive. Take a couple of orders of magnitude off the number of iterations.Added
Time_ns.pause, whose implementation is the same asTime.pause.This involved moving the
nanosleepC code fromCoretoCore_kernel.This was necessary so that
Async_kernelcan pause without introducing a dependence of Async on Core.Made
Core_kernel.Time_ns.Alternate_sexpuse a similar format toCore.Time_ns.This was needed so that
Async_kernelcan use a nice sexp format for time spans.Changed
Timing_wheelimplementation to useTime_ns, and moved toCore_kernel.Timing_wheel_ns; madeCore.Timing_wheela wrapper aroundTiming_wheel_ns.Generalized the timing-wheel interface to be parametric in
Time, so that one interface applies to bothTiming_wheelandTiming_wheel_ns.Generalized the timing-wheel unit tests to a functor,
Timing_wheel_unit_tests.Make, that is used to test bothTiming_wheel_nsandTiming_wheel_float. Moved a few tests that depend onTimeandDatefrom the functor intotiming_wheel_float_unit_tests.ml.Split out
Timing_wheel.Debuginto a separate functor,Timing_wheel_debug.Make.This was done in so that
Async_kernelcan depend only onCore_kerneland notCore.Added optional arguments to
Command.group:?bodyand?preserve_subcommand_order.preserve_subcommand_order : unitcauses subcommands to be in the order they are specified, rather than sorted.body : (path:string list -> unit)is called when no additional arguments are passed.- Added accessor function
Command.summary : t -> string. - Fixed a bug in
Time.Spanrobust comparison. Changed
Command's tab-completion bash code so that it is possible for programs to return completions containing spaces.Actually knowing when and how to do so is difficult, because of course there's escaping to worry about. Adding helper functions to make that sort of thing manageable is left for future work.
- In
Command, made the-versionand-build-infoflags work at the top level when there are subcommands. - Added
Sequence.interleaved_cartesian_product, which implements cartesian product of potentially infinite sequences.
112.17.00
Deprecated the single-line files that simply
includethe corresponding Core_kernel module. Those are unnecessary, because people should useCore.Std.We will keep these aliases around for a version before deleted them entirely.
- Changed finalizers and signal handlers to, upon an unhandled exception, exit nonzero rather than asynchronously raise.
Removed
Time.Zone.find_office.Replaced uses with the still-blocking
Time.Zone.find_exnMade many changes to
Timeto make the time zone explicit instead of implicitly using the local timezone.Added
zone:Time.Zone.tparameters to many functions. In almost all cases, used~zone:Time.Zone.localwhere previously it was implicit.Removed
of_local_ofdayandto_local_ofdayin favor of the explicit versions (withTime.Zone.local).Removed
Time.Zone.machine_zone ()in favor oflocal.- Exported
Core.Std.With_return. - Exposed
Core.Std.with_return_option. - Fixed
Time_ns.Ofday.of_span_since_start_of_dayto check its input. - Changed
Time_ns.to_spanandof_spanto round to microseconds, for round trippability. - Added
Unix.Errormodule, for theUnix.errortype. Added
Unix.Syscall_result, a new abstract type representing the result of a Unix system call as anint, to avoid allocation.A lot of Unix system calls return an integer on success, so for ones that are called a lot, we can encode errors as
-errno. This module abstracts this concept.- Changed
Iobuf.recvmmsgfunctions to return the newUnix.Syscall_result. - Changed
Unix.exec's?envargument to support extending the environment in addition to replacing it. - Added
with comparetoUnix.Exit.tandUnix.Exit_or_signal.t. Moved
BacktracetoCore_kernel.Deleted
backtrace_stubs.c, now that we havePrintexc.get_callstack.- Changed
Bigstring.read_assume_fd_is_nonblockingandsend_nonblocking_no_sigpipeto returnUnix.Syscall_result.t, to reduce allocation. - Changed
Iobuf.send_nonblocking_no_sigpipeto handleEINTRlikeEAGAIN, instead of raising. - Added
Command.Spec.char. - Changed
Process_env.parse_ssh_clientto accept anSSH_CLIENTthat is just IP address without ports.
112.06.00
Renamed
Linux_ext.gettidasUnix.gettid, and added OpenBSD support.SYS_gettidis not available on OpenBSD, but is used inCore_extended. See the mailing list discussion about this here:https://groups.google.com/forum/#!topic/ocaml-core/51knlnuJ8MM
Seems like the OpenBSD alternative is:
pid_t getthrid(void);although it's not defined in any header file, which is a bit unfortunate.
- Added
Piecewise_linear.precache, which computes a lookup table that speeds up subsequent calls toPiecewise_linear.get. - Added
Time_nsmodule, representing times as 63-bit integers of nanoseconds since the epoch. - Fixed build of
unix_stubs.con OpenBSD. - In
Daemon, fixed an error message regardingWSTOPPED(fixes #47). Added
Time.Span.Stable.V2, with sexps that use new suffixes for microseconds (us) and nanoseconds (ns).Time.Span.of_stringsupports the new format, butTime.Span.to_stringdoesn't yet produce it -- we plan to change that later, after the newof_stringhas made it out more widely.- Added
Time.Span.to_string_hum, which gives more options for rendering time spans. Merged the
recvmmsgstubs inBigstringandIobuf.Factored out a shared underlying
recvmmsgcall that both stubs use.Restored
-pedanticby avoiding a C99 feature (variable-length stack arrays).- Made
Date.tabstract, and changed its representation from a 4-word record to an immediate int (packing year, month, day). - In
Daemon, changed the permissions of thestd{err,out}files generated during daemonization from0o777to0o644. Moved
Thread_safe_queuefromcoretocore_kernel.This was done so that
Async_kernelcan use it, eliminating one ofAsync_kernel's dependencies onCore.Thread_safe_queue_unit_testsremainsCore, at least for now, because it has some dependencies on other stuff inCore.
112.01.00
- Removed vestigial code supporting OCaml 4.00.
Added
Commandsupport for flags that are passed one or more times.Added
Command.Spec.one_or_moreandCommand.Spec.non_empty_sequenceto deal with the cases where you expect a flag or anonymous argument (respectively) to be passed one or (optionally) more times. This is common enough and distinct from the case where you want the argument passed zero or more times that it seems like we should canonize it in the library.In
Lock_file, made stale lock detection more robust.Made
Lock_file.create foosucceed iffoois absent andfoo.nfs_lockfile is present and stale. Previously, it would fail.- Removed
Syslog.syslog'sadd_stderrargument; use thePERRORoption instead. Fixed
unix_stubs.ccompilation on NetBSDCloses #45
- Added
Filenameoperators/^and/@, andof_parts, like the same functions for Catalog paths. Changed
Iobuffunctions that advance the iobuf to not also return a redundant number of bytes processed.This avoids a small allocation (in the case of the
int optionfunctions) and normalizes the result (so the same information isn't returned two ways). Actually, it doesn't yet avoid the allocation in the implementation, as the correspondingBigstringfunctions must still return the number of bytes processed, and currently do so as an option. We hope to eventually change that.In the future I expect we will change
unitto someerrorvariant to also avoid the exception construction forEWOULDBLOCK/EAGAIN. We can even make Unix syscallsnoallocif we're careful.- In
Unixmodule, added unit tests forCidr.does_match.
111.28.00
Added
Piecewise_linear.create_from_linear_combination.val create_from_linear_combination : (t * float) list -> t Or_error.t- Added
Time.is_{earlier,later} : Time.t -> than:Time.t -> bool, which are easier to read thanTime.(<)and friends. Added
Command.exec, which allows one to include theCommandhierarchy from one executable in another.Command.exectakes the file path to an executable that uses theCommandmodule and returns aCommand.tthat integrates the executable (by exec'ing it), including providing recursive help and autocompletion as if it were a standardCommand.t.- Replaced most uses of
Hashtbl.replacewithHashtbl.set. - Renamed
Float.epsilontorobust_comparison_tolerance, to avoid confusion withepsilon_float.
111.25.00
- Added
Gc.disable_compactionfunction. - Added
Time.to_string_abs_trimmed, which prints a trimmed time and takes azoneargument. - Fixed
unix_stubs.cto suppress a warning when building with some versions of gcc. Changed
Time.Zoneto allow the zoneinfo location to be specified by an environment variable.Closes #40
- Fix compatibility with 4.02
111.21.00
- Fixed an issue where
Time.Zone.initwould not properly traverse the directory containing timezone information. - Added
Time.With_utc_sexp, which has stable serialization ofTime.tthat is byte-for-byte equal across timezones. - Made
Uuidstable. - Made
Piecewise_linearstable.
111.17.00
Fixed a bug in
Bigstring.really_recvifrecvdoesn't receive all the data it wants.This bug has been around forever; it may not have caused trouble because
Bigstring.really_recv(1) is barely used (the only use is inBigstring.unmarshal_from_sock) and (2) passesrecvtheMSG_WAITALLflag, so it will read the full amount unless it gets interrupted by a signal.Fixed
Bigstring.read's handling ofEINTRso that it retries rather than returning zero.This fixes a bug introduced in 111.09 in the interaction between
Bigstring.readandAsync.Reader. Prior to 111.09,Bigstring.readwould raise onEINTR, andAsync.Readerwould propagate the exception. From 111.09 to 111.16,Bigstring.readwould return zero, which would confuseAsync.Readerinto thinking it reached EOF when it hadn't. From 111.17,Bigstring.readwill retry and not return zero when not at EOF.We believe the bug was rare, because otherwise we would have frequently seen
EINTRexceptions prior to 111.09.Added
Command.Spec.applyandpair, which allow one to program more withSpec.paramrather thanSpec.t.val apply : ('a -> 'b) param -> 'a param -> 'b param val pair : 'a param -> 'b param -> ('a * 'b) paramAdded
Command.Spec.file, which builds anArg_typevalue with the same autocompletion asSpec.file.(** [file] defines an [Arg_type.t] that completes in the same way as [Command.Spec.file], but perhaps with a different type than [string] or with an autocompletion key. *) val file : ?key:'a Univ_map.Multi.Key.t -> (string -> 'a) -> 'a t
111.11.00
Change some
Bigstringfunctions to retry onEINTRrather than raise.The following functions (and their unsafe versions) were affected:
readreally_readreally_recvreally_writereally_send_no_sigpipe
Some other
Bigstringfunctions, likeinputandoutput, already retried onEINTR, so this change has precedent.All of the affected stubs raise
Bigstring.IOErroron failure, rather thanUnix_error, which means the normal method for retrying onEINTRdoesn't work. In particularAsync.Readerdidn't retry them, even though it was supposed to.Additionally, the documentation for the following functions was corrected to say that they raise =Unix_error= rather than =IOError=:
pread_assume_fd_is_nonblockingpwrite_assume_fd_is_nonblocking
Eliminated global binary-to-decimal tables computed at startup for converting
DateandOf_dayto string.Used an efficient implementation of division by 10, rather than the
sprintftables intime_internal.ml. This result in much less allocation at startup and it is a bit faster:- before:
Name
Time/Run
mWd/Run
Percentage
Date.to_string
69.39ns
3.00w
100.00%
- after:
Name
Time/Run
mWd/Run
Percentage
Date.to_string
53.38ns
3.00w
100.00%
- Fixed
Time.Zonetests so that they are deterministic. - Added
Iobuf.to_string_hum, which produces a readable, multi-line representation of an iobuf, intended for debugging. - Fixed brittle unit tests of
Command.
111.08.00
Improved
Commandto print a good error message if command-line parsing raises.Command'sExn.handle_uncaughtnow protects the phase of parsing command-line arguments in addition to protecting the phase of running themainfunction as it did already.
111.06.00
Added inline benchmarks for =Iobuf= and =Time=.
Hera are some of the results from the new benchmarks, with some indexed tests dropped.
Name
Time/Run
mWd/Run
Percentage
[time.ml:Time] Time.to_string
848.74ns
249.98w
100.00%
[time.ml:Time] Time.to_ofday
59.66ns
38.00w
7.03%
[time.ml:Time] Time.now
39.78ns
2.00w
4.69%
[time.ml:Time] Time.Zone.find_office
83.64ns
4.00w
9.85%
[time.ml:Time] Time.Span.of_hr
3.71ns
2.00w
0.44%
[time.ml:Time] Time.Span.of_min
3.69ns
2.00w
0.44%
[time.ml:Time] Time.Span.of_sec
2.72ns
0.32%
[time.ml:Time] Time.Span.of_ms
6.02ns
2.00w
0.71%
[time.ml:Time] Time.Span.of_ns
5.98ns
2.00w
0.71%
Name
Time/Run
Percentage
[iobuf.ml:Blit tests] functor blit:5
15.53ns
7.66%
[iobuf.ml:Poke tests] char:0
4.11ns
2.03%
[iobuf.ml:Poke tests] uint8:0
5.35ns
2.64%
[iobuf.ml:Poke tests] int8:0
4.59ns
2.26%
[iobuf.ml:Poke tests] int16_be:0
5.19ns
2.56%
[iobuf.ml:Poke tests] int16_le:0
5.14ns
2.53%
[iobuf.ml:Poke tests] uint16_be:0
5.11ns
2.52%
[iobuf.ml:Poke tests] uint16_le:0
5.12ns
2.53%
[iobuf.ml:Poke tests] int32_be:0
5.17ns
2.55%
[iobuf.ml:Poke tests] int32_le:0
4.91ns
2.42%
[iobuf.ml:Poke tests] uint32_be:0
5.73ns
2.83%
[iobuf.ml:Poke tests] uint32_le:0
5.74ns
2.83%
[iobuf.ml:Poke tests] int64_be:0
5.33ns
2.63%
[iobuf.ml:Poke tests] int64_le:0
4.93ns
2.43%
[iobuf.ml:Peek tests] char:0
5.50ns
2.71%
[iobuf.ml:Peek tests] uint8:0
4.68ns
2.31%
[iobuf.ml:Peek tests] int8:0
4.91ns
2.42%
[iobuf.ml:Peek tests] int16_be:0
5.19ns
2.56%
[iobuf.ml:Peek tests] int16_le:0
4.90ns
2.42%
[iobuf.ml:Peek tests] uint16_be:0
5.17ns
2.55%
[iobuf.ml:Peek tests] uint16_le:0
5.10ns
2.51%
[iobuf.ml:Peek tests] int32_be:0
5.17ns
2.55%
[iobuf.ml:Peek tests] int32_le:0
4.92ns
2.42%
[iobuf.ml:Peek tests] uint32_be:0
5.45ns
2.69%
[iobuf.ml:Peek tests] uint32_le:0
5.46ns
2.69%
[iobuf.ml:Peek tests] int64_be:0
6.61ns
3.26%
[iobuf.ml:Peek tests] int64_le:0
6.31ns
3.11%
Re-implemented
Thread_safe_queueto improve performance and reduce allocation.The new implementation requires 3 words per element, down from the 7 words required by the old implementation.
The new implementation pools elements so that they can be reused, so there is no allocation in steady-state use.
The new implementation has
dequeue_exnrather thandequeue, so that one can dequeue without allocating 2 words.Eliminated
create'. One should just usecreateand explicit calls toenqueueanddequeue_exn.Eliminated
dequeue_until_empty. One should use an explicit while loop guarded bylengthand usingdequeue_exn.Moved
Thread_safe_queuefromCore_kerneltoCore, since it's thread related.All in, there is now no allocation in a steady-state usage of enqueueing and dequeueing elements, as opposed to 9 words per
enqueue+dequeuein the old implementation. This reduces the cost fromenqueue+dequeuetaking 166-216ns toenqueue+dequeue_exntaking 48-82ns (plus eliminating gc impacts). Here are someBENCHresults, the first table being the old implementation, and the second table the new.Name
Time/Run
mWd/Run
mjWd/Run
[thread_safe_queue.ml] enqueue + dequeue of immediate
183.89ns
9.00w
7.02w
[thread_safe_queue.ml] enqueue + dequeue of young object
216.69ns
11.00w
9.01w
[thread_safe_queue.ml] enqueue + dequeue_exn of old object
166.75ns
9.00w
7.02w
Name
Time/Run
mWd/Run
[thread_safe_queue.ml] enqueue + dequeue_exn of immediate
48.20ns
[thread_safe_queue.ml] enqueue + dequeue_exn of young object
81.96ns
2.00w
[thread_safe_queue.ml] enqueue + dequeue_exn of old object
48.30ns
Changed
{Bigstring,Iobuf}.recvmmsg_assume_fd_is_nonblocking, when no message is available, to return a negative number rather than raise.This was done for performance reasons, because raising an exception is expensive, due to the stashing of the backtrace and the string creation.
- Added
Iobuf.unsafe_resize. Changed
Bigstring.blitso that it doesn't release the OCaml lock onmap_filebigstrings.The old behavior of releasing the lock for blits of (small) bigstrings involving mmapped files was problematic and inconsistent. Its cost is high, and fundamentally any access to a mapped bigstring could cause some level of blocking.
- Added time-related
Arg_type.tvalues toCommand.Spec. Added module
Type_immediacy, which has witnesses that express whether a type's values are always, sometimes, or never immediate.This code used to be in the
Typerep_immediatelibrary in typerep.
111.03.00
- Added
Unix.Syslogmodule. - Changed
Command.runto no longer ignore the first element of its~argvparameter. - Made
Time.Span.to_short_stringshow microsecond precision.
110.01.00
- Fixed
Timeunit tests that failed in London because of timezone dependence. - Added
Iobuf.protect_window_and_bounds, which calls a user function and restores the iobuf's bounds afterwards. - Fixed compilation on OpenBSD, which doesn't support
Unix.mcast_join's?source : Inet_addr.targument.
109.60.00
Added
Iobuf.unsafe_advance.This can be used to benchmark inner loops that have redundant bounds checking, to see if the checks matter. For example, see the following two
advancecalls:let rec process_buffer buf ~f = let len = Iobuf.length buf in if header_len <= len then let msg_len = header_len + Iobuf.Unsafe.Peek.uint16_be buf ~pos:0 in if msg_len <= len then begin let len = msg_len - header_len in Iobuf.advance buf header_len; f (Protocol.packed_of_iobuf buf); Iobuf.advance buf len; process_buffer buf ~f end- Added
Weak_hashtbl.add_exnandsexp_of_t. Fixed
Lock_file.createto behave correctly if the target mountpoint is out of space.Previously in this situation,
Lock_file.createwould create an empty lock and exit with exception trying to write pid/message there. Subsequent runs would not able to read pid out of empty pid file andblocking_createwould block instead of removing defective lock.
109.58.00
- Added
Debug.should_print_backtrace : bool ref, to control whetherDebug.am*functions print backtraces. - Added to
Floatinline benchmarks. Moved all of the
Gcmodule intoCore_kernel.Part of the
Gcmodule used to be inCorebecause it used threads. But it doesn't use threads anymore, so can be all inCore_kernel.Improved
Iobufsupport for copying to/from strings and bigstrings.The new modules are
Iobuf.{Consume,Peek}.To_{bigstring,string}. They match aBlit-like interface. We don't yet implement theBlitinterface in all applicable contexts, but do useBlit.Makeand expose some of the operations we want in the forms we expect them to take under aBlitinterface.- Added
Linux_ext.Timerfd.to_file_descr. - Added to
Time.next_multiplean optional argument to control whether the inequality withafteris strict. Added
Time.Zone.local, a lazily cachedTime.Zone.machine_zone ().This is the first stage in a plan to make explicit timezones more pervasive. First, they are made more convenient, by replacing the relatively wordy
Time.Zone.machine_zone ()withTime.Zone.local. This involves making the underlying timezone type lazy.The next stage will be to remove
machine_zoneand useTime.Zone.localeverywhere instead. Then (it is hoped) instead ofof_local_whatever, we just say e.g.of_date_ofday Time.Zone.localand currently-implicitly-local functions will be able to switch over to explicit timezones without becoming too verbose.- Added
Timing_wheel.Alarm.null. Made
Unix.File_descr.thavewith sexp.Closes janestreet/async_unix#3
- Fixed OpenBSD compilation failures in C stubs.
- Fixed
Lock_file.is_lockedto require read permission, not write permission, on the lock file. Added to
Unix.mcast_joinan optional?source:Inet_addr.targument.From pull-request on bitbucket: https://bitbucket.org/janestreet/core/pull-request/1/receive-source-specific-multicast/diff
109.55.00
- Fixed building on FreeBSD and OpenBSD.
- Added
with typerepto manyCoretypes. - Made
open Core.Stdsupportwith typerep. Added
Iobuf.recvmmsg_assume_fd_is_nonblocking_no_options, a specialization ofrecvmmsg_assume_fd_is_nonblockingfor improved performance.This improvement was driven by profiling at high message rates.
- Changed
Unix.Rlimit.virtual_memorybe anOr_error.t, for platforms where it is undefined.
109.53.00
- Added
Linux_ext.Epoll.close. Added
Weak_hashtblmodule, moved fromAsync.It had only been in
Asyncto useAsync's finalizers. The move toCoreexposes a bit more with respect to finalization so that one can still implementAsync.Weak_hashtbl, as well as do other things (e.g. useWeak_hashtblinIncremental, which does not useAsync).Simplified the implementation of
Weak_hashtblto eliminate "entry ids". They were only used to avoid removing a table entry that was in use. But there is a more direct way to test for that -- just check if the weak isNoneorSome.- Added an autoload file for utop
- Disabled warning 40 in corebuild
109.52.00
- Added
Unix.File_descr.equal. - Added
Lock_file.Nfs.unlock, theOr_errorversion ofunlock_exn. - Improved the detail of the error messages exposed by
Lock_file.Nfs.create{,_exn}. Added
Unix.set_mcast_ifname, to control the interface used for UDP multicast traffic.Added bindings for setsockopt
IP_MULTICAST_IF.See 6.3 in: http://www.tldp.org/HOWTO/Multicast-HOWTO-6.html
Changed
Commandargument processing to treat a single dash (-) as an anonymous argument rather than a flag.This change follows the unix convention of passing
-as an anonymous argument meaningstdin.Added more bin-prot support to
Iobuf:Consume.bin_prot,Fill.bin_prot,Peek.bin_prot,Poke.bin_prot.Framing doesn't do much for
Iobuf, so these are to be more standard, unframed accessors, as opposed tofill_bin_prot.Added
Core.Debug.am,amf, andams, for outputting debugging messages showing the current source-code position.Unfortunately, these aren't available in
Core.Std.Debug, but only inCore.Debug. That will be fixed in 109.49.- Made
Time_stamp_countercompile on non x86-64 platforms. Made
Core.Std.DebugbeCore.Debugrather thanCore_kernel.Debug.This exposes the
Debug.am*functions added in 109.48.
109.47.00
Added
Time_stamp_countermodule, which has fast (< 10 nanos) access to the hardware time-stamp counter.This module provides the fast function
Time_stamp_counter.now ()which is our best effort high-performance cycle counter for a given platform. For x86 systems this retrieves the CPU's internal time stamp counter using theRDTSCinstruction. For systems that do not have a RDTSC instruction, we fallback to usingclock_gettime(CLOCK_MONOTONIC).Here is a benchmark of execution time in nanos and allocations in words:
Name Time/Run Minor ------------------------------- ---------- ------- Time.now 39.02 2.00 TSC.now 7.54 TSC.to_time 4.88 2.00 TSC.to_time (TSC.now ()) 8.54 2.00 TSC.to_time_nanos 4.49 TSC.to_time_nanos(TSC.now ()) 8.95 Calibrator.calibrate 279 34.00Historically, the rate of increment of the TSC (sometimes referred to as the TSC frequency) varied based of CPU overclocking, temperature, load etc. On modern Intel CPU's the TSC is expected to be stable. On Linux systems, the "constant_tsc" in
/proc/cpuinfoindicates that the machine has a stable TSC rate. While this module assumes that the TSC is relatively stable, it can adapt to small variations in the TSC frequency.Changed
Daemon.daemonizeanddaemonize_waitto leave theumaskalone by default.Previously, these had alwasy set the umask to
0, which means that all app-harness programs and all binaries run from grass were creating world-writeable (0666) files by default.
109.45.00
Added
Core.Std.phys_same, which is likephys_equal, except has a more general type.val phys_equal : 'a -> 'a -> bool val phys_same : _ -> _ -> boolphys_sameis useful when dealing with existential types, and one has a packed value and an unpacked value that one wants to check are physically equal. One can't usephys_equalin such a situation because the types are different.Added
Iobuf.set_bounds_and_bufferandset_bounds_and_buffer_sub, which make it easier to use with zero allocation.(** [set_bounds_and_buffer ~src ~dst] copies bounds (ie limits + window) and shallowly copies the buffer from [src] to [dst]. [read_write] access is required on [src] because the caller might have [read_write] access to [dst], and would after the call then effectively have [read_write] access to [src]. *) val set_bounds_and_buffer : src:(read_write, _) t -> dst:(_, seek) t -> unit (** [set_bounds_and_buffer_sub ?pos ?len ~src ~dst ()] is a more efficient version of: [set_bounds_and_buffer ~src:(Iobuf.sub ?pos ?len src) ~dst]. [set_bounds_and_buffer ~src ~dst] is not the same as [set_bounds_and_buffer_sub ~dst ~src ()], because the limits are narrowed in the latter case. *) val set_bounds_and_buffer_sub : ?pos:int -> ?len:int -> src:(read_write, _) t -> dst:(_, seek) t -> unit -> unit- Added
?timeout:Time.Span.targument toLock_file.blocking_create,Lock_file.Nfs.blocking_createandcritical_section.
109.44.00
- Added
val Day_of_week.num_days : from:t -> to_:t -> int. Added
Time.of_date_ofday_preciseandTime.Zone.next_clock_shift, to deal with clocks going forward and backward.Due to clocks going forward/backward, some local times occur twice, and some never occur at all.
Time.of_date_ofday_preciseidentifies these cases and returns all of the relevant information.Added accessors for
Unix.Cidr:base_addressandbits.(** Accessors. - [base_address 192.168.0.0/24 ` 192.168.0.0] - [bits 192.168.0.0/24 ` 24]. *) val base_address : t -> Inet_addr.t val bits : t -> int
109.42.00
- Removed
ZonefromCore.Std; useTime.Zoneinstead. - Removed
Time.Date; useDateinstead. Improved the performance of
Piecewise_linearby using arrays with binary search on indices.The previous implementation
Piecewise_linearused(float * float) list(a list of (x,y) pairs) to represent piecewise linear functions, with a linear search through the knots to evaluate the function at a point. This type is now:{ x : float array ; y : float array }and the implementation uses binary search to identify the correct array index.
Here are the costs of the
getfunction under the old (list) and new (array) implementations for various numbers of knots:knots | old | new ------+------+----- 1 | 11ns| 12ns 2 | 18ns| 14ns 5 | 27ns| 19ns 100 | 182ns| 38ns 1000 |1974ns| 52ns- Added module
Time.Ofday.Zoned, which is a pair of anTime.Ofday.tand aTime.Zone.t. - Added
with comparetoTime.Zone.Stable.t. Added
Timing_wheelfunctionality.- Added
Configmodule, which combinesalarm_precisionandtiming_wheel_level_bits. - Removed the need to supply a dummy value to
create. - Added
memandclearfunctions. - Added functions for dealing with the interval number:
interval_num,now_interval_num,interval_num_start,add_at_interval_num.
This makes it easier to use a timing wheel with
intinterval numbers, which are more efficient than thanfloattimes.- Added
109.41.00
Added
Command.Spec.map_anonandmap_flag.(** [map_flag flag ~f] transforms the parsed result of [flag] by applying [f] *) val map_flag : 'a flag -> f:('a -> 'b) -> 'b flag (** [map_anons anons ~f] transforms the parsed result of [anons] by applying [f] *) val map_anons : 'a anons -> f:('a -> 'b) -> 'b anonsFixed
Unix.open_flagto compile with OCaml 4.01.It needed the additional constructor
O_CLOEXEC.
109.37.00
- Command.run now calls Exn.handle_uncaught so you don't have to.
- Fixes for building on FreeBSD.
Fixed Blang to build with OCaml 4.01.
In blang.mli:
Blang.t is a private variant type, Blang.Stable.V1.t is a private variant type, and client code knows Blang.t = Blang.Stable.V1.t. Previously, this was done in a strange way, using with type 'a t = private 'a t on the signature of Blang.Stable.V1. In addition to being strange, this line no longer builds in OCaml 4.01, which caused problems for building Real World Ocaml.
This patch changed the code to something much more straightforward, although not quite so straightforward as we expect to be able to achieve once a nonrec bug is fixed.
109.35.00
Added
or_errorfunctions inUnix.Exit_*types tounit Or_error.t.This makes it easier to deal with combining with infix operators
>>=?and>>|?
109.34.00
Added
val Backtrace.get_opt : unit -> t option.This is more convenient to use than
Backtrace.get, which is anOr_error.t.Moved functions for dealing with finalizers into the
Gc.Expertmodule.This was done to make people be very explicit and sure that they want finalizers, which are very hard to use because they essentially introduce multithreading semantics.
One should typically use async finalizers.
- Eliminated the thread that had been used to sequentialize all finalizers.
109.32.00
Normalized
Command's help messages.Made anonymous argument names uppercase and subcommand names lowercase.
In
Iobuf, added duals toflipandsnapshotto work on the high end of the window.fliphas been renamed toflip_lo. The dual offlip_lois the newly addedflip_hi, and shifts the window forward to continue reading, rather than back to switch from writing to reading, asflip_lodoes.flip_hi, in practice, needs snapshots of the upper bound of the window, we splitSnapshotintoLo_boundandHi_boundand introduced bounded versions offlip_lo,compact, andflip_hito support buffers which are only partially filled, but have substructure, like packet buffers.Here's the new API.
module type Bound = sig type ('d, 'w) iobuf (** Expose =t = private int= only if a =t= is stored in a mutable data structure somewhere and leads to a measurable =caml_modify= performance problem. *) type t with sexp_of val window : (_, _) iobuf -> t val limit : (_, _) iobuf -> t val restore : t -> (_, seek) iobuf -> unit end module Lo_bound : Bound module Hi_bound : Bound val flip_lo : (_, seek) t -> unit val bounded_flip_lo : (_, seek) t -> Lo_bound.t -> unit val flip_hi : (_, seek) t -> unit val bounded_flip_hi : (_, seek) t -> Hi_bound.t -> unit
109.30.00
Created submodule
Core.Signal.Expertmodule.This is for functions previously in
Core.Signalthat introduce multithreading semantics, and are hence hard to reason about and should only be used by experts.
109.28.00
- Moved
Timing_wheelfromZero.
109.27.00
- Disabled use of
recvmmssg, which isn't available on our CentOS 5 machines. - Defined
Option.compareusingwith compareso that their comparisons are consistent. Cleaned up the
Dequeuemodule's interface and implementation.The interface now matches the conventions used elsewhere in
Core. The new implementation is also cleaner and more efficient.Reimplemented the
Stackmodule to improve performance, and renamed the old implementation asLinked_stack.The new
Stackis implemented with this type:type 'a t ` { dummy : 'a; mutable length : int; mutable elts : 'a array; }Linked_stackis implemented with this type:type 'a t ` { mutable length : int; mutable elts : 'a list; }Using an array rather than a linked list is a more efficient and traditional implementation. Pushing to the stack now does not require allocation, except in the rare case when the stack grows.
One downside is that
Stack.clearis now O(n) rather than O(1).This change also eliminates the
Stack.Emptyexception, so any code matching on that exception should fail to compile, and should be changed to depend on option-returningtopandpopoperations.Improved
Lock_file.Nfs.- Allowed an arbitrary message to be stored and retreived.
- Fixed a case where
createmight throw an exception. - Delete both files used for locking when we unlock.
- Split
CoreintoCore_kernelandCore. Core_kernelis composed of all modules ofCorethat do not depend on unix or threads, andCorecontains the rest and depends onCore_kernel.The goal is to have a very portable standard library that can especially run on exotic environment such as Javascript.
So that code that directly refers to
Core(rather thanCore.Std) for modules that have moved toCore_kernel, we included "proxy" modules inCorethat simply include the corresponding module fromCore_kernel.Fixed
Core.Flagsto build on 32-bit machines.It had contained a unit test with an integer literal too large to be accepted by the compiler when building on a 32-bit machine.
109.24.00
Added module
Core.Iobuf, a module aimed at zero-copy I/O.An iobuf is a bigstring combined with a position and length, that defines a contiguous region of bytes in the bigstring. Operations on an iobuf operate relative to start of the region and cannot look outside the region.
- Added module
Core.Validatedfor creating an abstract type that ensures a validation function has been run. - Added function
Bigstring.recvmmsg_assume_fd_is_nonblocking, which allows one to read a number of UDP packets with a single system call. - Fixed
Unix.create_processon OSX.
109.23.00
- Exposed
Core.Std.Flagsmodule. - Made the
Heapmodule implementContainer.S1. - Added module
Ref.Permissioned, which is a ref withread_only/read_writeaccess control. Exposed the unique id in
Type_equal.Id.This allows, e.g. hash tables indexed by unique ids.
Removed the use of
Obj.magicfrom the implementation ofType_equal.Id.same.It is not needed because the
Id.tcontains aUid.tand we can just useUid.equal.
109.21.00
Massively improved the signatures of
MapandSet, both for readability and ocamldoc, as well as improved type error messages.For instance the type of
Int.Set.singletonwas:('a, 'comparator, 'a Core.Std.Int.Set.elt_ -> ('a, 'comparator) Core.Std.Int.Set.t_) Core.Core_set_intf.without_comparatorNow it is simply:
int -> Int.Set.tAdded an optional argument to
Command.runthat can be used to specify default flags from a user config file.The optional argument can extend the command line based on the path to the command.
Rename module
WeekdayasDay_of_week.The name
Weekdayconflicted with ordinary usage of "weekday" to mean Monday through Friday.Changed
sexp_of_tfor{Month,Ofday,Time,Time.Span}.{Set,Map}to use the nice sexp format of the underlying atomic type.Previously, the converter had used thes raw type (
float,int, etc.).t_of_sexpstill accepts both formats; we will remove the ability to accept the raw format in the distant future.This output-format change was planned when we originally in 108.06b improved those
t_of_sexpfunctions to accept both formats.- Added
Unix.remove. - Removed some
IFDEF's connected to OCaml <4 support.
109.20.00
- Wrapped
Unix.wordexpin anOr_error.tsince it is not available on all systems. - Added function
Process_env.parse_ssh_client. This gets the address from which you're currently ssh'd in. - Added to
Unixmodule the ability to get and setIP_MULTICAST_LOOPandIP_MULTICAST_TTL. - Exposed module
Core.Std.Ref, which was previously only available viaCore.Ref. Remove
Mutex.am_holding_mutexand changed the type ofMutex.try_lock.With NPTL it is impossible to determine which thread is holding the lock. So,
Mutex.am_holding_mutexis unimplementable. Also,Mutex.try_lockwas incorrect because it claimed to raise if one was attempting to recursively lock. Since it's not possible to distinguish between recursive locking and the lock being held by another thread, we changed the type to make this clear:val try_lock : t -> [ `Already_held_by_me_or_other | `Acquired ]Removed our custom version of the OCaml runtime's
core_sys_openfunction.There used to be a bug in the OCaml runtime, PR#5069, in which
open_{in,out}_gencould block while holding the OCaml lock, because they made a call tofcntloutside the blocking section. We had our own C code with the bug fix and re-exposed the fixed versions of the functions inCore.The bug in OCaml has been fixed, so we have removed our patched function from
Core.In
unix_stubs.c, switched from usingFNM_FILE_NAMEtoFNM_PATHNAME.The GNU project introduced FNM_FILE_NAME as a non-portable synonym for FNM_PATHNAME.
We were using pre-processor macros to define FNM_FILE_NAME as FNM_PATHNAME if unavailable, but it is simpler to just use the more portable FNM_PATHNAME everywhere.
109.19.00
Changed
Time.to_stringandTime.sexp_of_tto include the timezone.This is an incompatible change with very old programs in which
Time.of_stringandTime.t_of_sexpdid not support the timezone.If you have programs that are:
- very old and do Time string/sexp handling
- rely on reading in time values without using
Time.of_stringandTime.t_of_sexp. - rely on chains of writing/reading/writing times across machines and timezones where the time is always intended to be taken as the local time on the currently reading machine
you should recompile/review your code to make sure you won't have issues.
Added function
List.remove_consecutive_duplicates : 'a t -> equal:('a -> 'a -> bool) -> 'a t.This returns the input list with consecutive duplicates removed, and doesn't change the order of the remaining elements.
Added module
User_and_group, which is a pair of a unix username and primary unix group.The string/sexp converters follow the usual unix convention of
<user>:<group>.Added function
Date.first_strictly_after : t -> on:Weekday.t -> t.first_strictly_after t ~on:day_of_weekreturns the first occurrence ofday_of_weekstrictly aftert.Added functor
Type_equal.Lift.It is always safe to conclude that if type
aequalsb, then typea X.tequalsb X.t, for any typeX.t. The OCaml type checker uses this fact when it can. However, sometimes, e.g. when usingType_equal.conv, one needs to explicitly use this fact to construct an appropriateType_equal.t. TheType_equal.Lift*functors do this.module Type_equal : sig type ('a, 'b) t ... module Lift (X : T1) : sig val lift : ('a, 'b) t -> ('a X.t, 'b X.t) t end end
109.18.00
changed implementation of
Array.sortto use introsort.See http://en.wikipedia.org/wiki/Introsort.
- tweaked a unit test in
Core.Flagsto not print a message to stderr.
109.17.00
Fixed
Random.self_init, which was broken since 109.00.00 with the upgrade to OCaml 4.0The fix changed the type signature expressed in
core_random.mlof the standard OCamlcaml_sys_random_seedC function fromunit -> intfromunit -> int array. That C function changed between OCaml 3.12 and 4.0.- Moved module
Core_extended.Unix.CidrintoCore.Unix. - Wrapped
Unix.wordexpinto anOr_error.tto handle systems that does not implement it in the libc. - Fixed two other printer names
Added
Array.int_blitandArray.float_blit, which are specialized fast blits forint arrayandfloat array.For motivation underlying this change and other design alternatives please see Section 3 "Fast, Slow and Incorrect Array blits" of http://janestreet.github.com/ocaml-perf-notes.html
- Added
Unpack_buffer.Unpack_one.sexpfor parsing sexps using theUnpack_bufferinterface.
109.15.00
- Changed the tolerance of
Time.Robustly_comparefunctions from1E-7to1E-6. Fixed the names of some toplevel pretty-printers, which referred to nonexistent modules.
Fix some of the
pp's for Core which are used to install printers in the top-level. Some of the toplevel printers refer to non-existent modules likeCore.Nativeint.pp; this feature changed to the correct name, likeCore.Std.Nativeint.pp.Added to module
Unixfunctionality for getting and setting flags in the open-file-descriptor table.module Open_flags : sig type t include Flags.S with type t :` t ... end val fcntl_getfl : File_descr.t -> Open_flags.t val fcntl_setfl : File_descr.t -> Open_flags.t -> unitAdded module
Linux_ext.Timerfd.This allows one to create a file descriptor that can be monitored by
epollorselectand notify them at a certain time. It makes it possible to useepollwith sub-millisecond timeouts.- Added
Version_util.application_specific_fields, which allows custom build-time information to be included in an executable.
109.14.00
Fixed major performance problem with hashing in
Int.Table.Our
Int.Table.replacewas 3 times slower than polymorphic hash table andfindwas 8 times slower.This was caused by using:
external seeded_hash_param : int -> int -> int -> 'a -> int = "caml_hash" "noalloc"in
Int.Tablebut:external old_hash_param : int -> int -> 'a -> int = "caml_hash_univ_param" "noalloc"everywhere else.
The
seeded_hash_paramwas introduced in Caml 4.We fixed this problem by changing
Int.hashfrom:let hash (x : t) = Hashtbl.hash xto:
let hash (x : t) = if x >= 0 then x else ~-x- Added
Bigstring.{pread,pwrite}, which allow reading and writing at a specific file offset. Added module
Nothing, which is a type with no values.This is useful when an interface requires you to specify a type that you know will never be used in your implementation.
Changed
Identifiable.Makeso that it registers a pretty printer.Identifiable.Makenow usesPretty_printer.Register. This requires all calls toIdentifiable.Maketo supply aval module_name : string.- Made
Core.Zonematch theIdentifiablesignature. Made polymorphic equality always fail on
Core.Map.tandCore.Set.t.Before this change, polymorphic equality on a
Core.Mapor aCore.Setcould either raise or returnfalse. It returndfalseif the data structures were unequal, and raised if the data structures were equal.This is because their type definitions looked like:
type ('k, 'v, 'comparator) t = { tree : ('k, 'v) Tree0.t; comparator : ('k, 'comparator) Comparator.t; }and polymorphic equality visits a block's fields in order. So, it will detect unequal trees and return false, but if the trees are equal, it will compare the comparators and raise because of the functional value.
This change reversed the order of the fields so polymorphic equality always fails.
109.13.00
Added
Command.Spec.flags_of_args_exn, for compatibility with OCaml's standard library.This function converts a
Core.Std.Arg.tinto aCommand.Spec.t.Made various modules
Identifiable:Char,String, and the variousIntmodules.In particular,
Intbeing identifiable is useful, because one can now write:module My_numeric_identifier : Identifiable ` IntYou might think that we could now delete
String_id, and just write:module My_string_identifier : Identifiable ` StringBut this is not quite equivalent to using
String_id, becauseString_id.of_stringenforces that its argument is nonempty.Removed module
Space_safe_tuple, which became unnecessary in OCaml 4.00.0.OCaml 4.00.0 included Fabrice's patch to fix the space leak that
Space_safe_tuplewas circumventing (PR#5288, commit SVN 11085).- Added
Exn.to_string_mach, for single-line output. Added
Linux_ext.bind_to_interface, to improve security of UDP applications.val bind_to_interface : (File_descr.t -> string -> unit) Or_error.tThis uses the linux-specifc socket option
BINDTODEVICEto prevent packets being received from any interface other than one named.- Fixed
Unix.mkdir_pon Mac OS X.
109.12.00
Add some functions to
Byte_units.- Added functions:
to_string_hum,scale,Infix.//. - Eliminated the notion of "preferred measure", so a
Byte_units.tis just afloat.
- Added functions:
Improved the performance of
Array.of_list_rev.The new implementation puts the list elements directly in the right place in the resulting array, rather that putting them in order and then reversing the array in place.
Benchmarking shows that the new implementation runs in 2/3 the time of the old one.
Fixed
Fqueue.t_of_sexp, which didn't work withsexp_of_t.There was a custom
sexp_of_tto abstract away the internal record structure and make the sexp look like a list, but there wasn't a customt_of_sexpdefined, so it didn't work.- Added
Stable.V1types forHost_and_port. Removed
Identifiable.Of_sexpableandIdentifiable.Of_stringable, in favor ofIdentifiable.MakeIdentifiable.Of_sexpableencouraged a terrible implementation ofIdentifiable.S. In particular,hash,compare, and bin_io were all built by converting the type to a sexp, and then to a string.Identifiable.Of_stringablewasn't as obviously bad asOf_sexpable. But it still used the string as an intermediate, which is often the wrong choice -- especially forcompareandbin_io, which can be generated by preprocessors.Added
Identifiable.Makeas the replacement. It avoids using sexp conversion for any of the other operations.Added
List.intersperseandList.split_while.These came from
Core_extended.List.val intersperse : 'a list -> sep:'a -> 'a list val split_while : 'a list -> f:('a -> bool) -> 'a list ** 'a listAdded a functor,
Pretty_printer.Register, for registering pretty printers. The codifies the idiom that was duplicated in lots of places:let pp formatter t = Format.pp_print_string formatter (to_string t) let () = Pretty_printer.register "Some_module.pp")
109.11.00
- Added module
Interned_stringThis has a functor for creating modules of interned strings. It uses the very simple mechanism of mapping distinct strings to consecutive ints. - Added value
Hashtbl.find_and_remove.
109.10.00
- Added
|>, which means the same as|!, but is likely to replace it someday. This is mostly because|>is an accepted notation elsewhere, particularly in F#. In the future, we will consider eliminating|!in favor of|>, so as to avoid the duplication. - Made
module Lazyinto a monad. - Renamed
List.stable_dedup_involving_an_application_of_the_set_functorasList.stable_dedup_staged. Made it useStaged.tto make explicit the expectation of partial application. - Added pretty printers for the toplevel to
ErrorandInfo.
109.09.00
- In
Core.Std, exposedOr_error.ok_exnandOr_error.error Removed some values exported by
Core.Std.Removed some values from
Core.Stdthat weren't widely used, or we didn't think should be exposed, includingascending,descending, andequal, which use polymorphic comparison, and we want to discourage.Here's a guide to some of what was removed, and what one should now use instead.
removed
replace with
-----------------------------------+---------------------------------------
Int_replace_polymorphic_compareInt.Replace_polymorphic_compareascendingPolymorphic_compare.ascendingdescendingPolymorphic_compare.descendingequalPolymorphic_compare.equalifprintfPrintf.ifprintfsscanfScanf.sscanfScan_failureScanf.Scan_failurestring_of__of__sexp_ofSexplib.Conv.string_of__of__sexp_ofof_string__of__of_sexpSexplib.Conv.of_string__of__of_sexptype vectype float64_vec- Disallowed
<:sexp_of<with two underscores; using a single underscore instead. - Added
Command.Spec.Arg_type.of_alist_exnas an alternative forof_map. This captures the common pattern to create the map from an alist. - Improved the performance of
Hashtbl. Constrained hashtbl size to a power of two and used a bitmask rather than mod operation for finding hash buckets. Improved the performance of
Univ, using theType_equalGADT. The new implementation improves the run-time and space usage over the old one. In the old implementation, aUniv.twas represented as record with three fields: an exception, a string, and a closure. Creating a univ required allocating three heap blocks, the exception (3 words), the closure (3 words), and the three-field record (4 words). In the new implementation, aUniv.tis represented as a 2-field heap block containing theConstr.tand the value. Creating a univ allocates that single 3-word block, improving on the 10 words needed previously.Matching on univs is also faster. In the old implementation, matching on a univ required making a function call, testing exception equality, and allocating a
Someblock. Now, it does just the test and allocation. Furthermore, it is possible to usedoes_matchandmatch_exnto avoid the allocation.- Added
Version_util.build_info_as_sexp. - Added
_squelch_unused_module_warning_toComparable.S.Replace_polymorphic_compare.
109.08.00
- Cleaned up and updated the
README. - Changed executables to enable backtraces if
OCAMLRUNPARAMis not set. Changed
Commandso that executables show build info and version info This happens when an executatble is called as:foo.exe version
Before this change, rather than display build info, executables would display the not-so-helpful:
(no option given - printing version)
- Added back
Floatrounding functions with a hardcoded direction. - Exposed
with bin_ioandwith comparefor the =sexp_bool= type. - Added value
Core.Never_returns.sexp_of_t. - Added values
Or_error.tag{,_arg}These are analogous toErrorfunctions of the same name. - Added functor
Sexpable.Of_sexpableThis is for serializing values of one type as though it were some other isomorphic type. - Added module
Backtrace.ExnThis exposes OCaml stdlib'sPrintexcfunctions for backtraces. - Added module
FlagsThis implements Unix-style sets of flags that are represented as anintwith various bits set, one bit for each flag, e.g.,Linux_ext.Epoll.Flag. - Added module
UuidThis module implements universally unique identifiers based on version 3 of the UUID specification. It used to be inCore_extended= - Added module
Type_equal, which defines the "equality" GADT.
109.07.00
- Added a number of functions to =Bounded_int_table=: =equal=, =exists{,i}=, =for_all{,i}=, =filter_map{,i}=, =map{,i}=. Also added a functor, =Bounded_int_table.With_key=, that makes a bounded-int table binable and sexpable, and adds =of_alist= and =of_alist_exn=.
- Added =Doubly_linked.iter_elt= and =Bag.iter_elt=.
- Added =module Invariant=, which defines signatures that are to be included in other signatures to ensure a consistent interface to invariant-style functions.
- Added =module Ordering=, which defines: =type t = Less | Equal | Greater=
109.06.00
- Added [Map.symmetric_diff], for returning a list of differences between two maps. It has a fast-path implementation for maps that share a large amount of their internal structure.
109.05.00
- Updated [Core.Unix.stat] so that access, modify, and change times have nanosecond precision.
- Fixed a bug in [Nano_mutex.invariant].
- Simplified the implementation of [with_return] using a local explicit polymorphic type variable.
109.04.00
- Fix [Backtrace.get], which was broken in 109.00, with the switch to OCaml 4.0.
- Added [Heap.iter_el].
109.02.00
- Add Char.of_string
- v0.11
- v0.10
- v0.9
- 113.43.00
- 113.33.01
- 113.33.00
- 113.24.02
- 113.24.01
- 113.24.00
- 112.35.00
- 112.24.00
- 112.17.00
- 112.06.00
- 112.01.00
- 111.28.00
- 111.25.00
- 111.21.00
- 111.17.00
- 111.11.00
- 111.08.00
- 111.06.00
- 111.03.00
- 110.01.00
- 109.60.00
- 109.58.00
- 109.55.00
- 109.53.00
- 109.52.00
- 109.47.00
- 109.45.00
- 109.44.00
- 109.42.00
- 109.41.00
- 109.37.00
- 109.35.00
- 109.34.00
- 109.32.00
- 109.30.00
- 109.28.00
- 109.27.00
- 109.24.00
- 109.23.00
- 109.21.00
- 109.20.00
- 109.19.00
- 109.18.00
- 109.17.00
- 109.15.00
- 109.14.00
- 109.13.00
- 109.12.00
- 109.11.00
- 109.10.00
- 109.09.00
- 109.08.00
- 109.07.00
- 109.06.00
- 109.05.00
- 109.04.00
- 109.02.00