pax_global_header00006660000000000000000000000064146164733610014525gustar00rootroot0000000000000052 comment=7c166660dd6470e28a64cb4c453fd8b791c02724 jane-street-headers-0.17.0/000077500000000000000000000000001461647336100154445ustar00rootroot00000000000000jane-street-headers-0.17.0/.gitignore000066400000000000000000000000411461647336100174270ustar00rootroot00000000000000_build *.install *.merlin _opam jane-street-headers-0.17.0/.ocamlformat000066400000000000000000000000231461647336100177440ustar00rootroot00000000000000profile=janestreet jane-street-headers-0.17.0/CONTRIBUTING.md000066400000000000000000000044101461647336100176740ustar00rootroot00000000000000This repository contains open source software that is developed and maintained by [Jane Street][js]. Contributions to this project are welcome and should be submitted via GitHub pull requests. Signing contributions --------------------- We require that you sign your contributions. Your signature certifies that you wrote the patch or otherwise have the right to pass it on as an open-source patch. The rules are pretty simple: if you can certify the below (from [developercertificate.org][dco]): ``` Developer Certificate of Origin Version 1.1 Copyright (C) 2004, 2006 The Linux Foundation and its contributors. 1 Letterman Drive Suite D4700 San Francisco, CA, 94129 Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Developer's Certificate of Origin 1.1 By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. ``` Then you just add a line to every git commit message: ``` Signed-off-by: Joe Smith ``` Use your real name (sorry, no pseudonyms or anonymous contributions.) If you set your `user.name` and `user.email` git configs, you can sign your commit automatically with git commit -s. [dco]: http://developercertificate.org/ [js]: https://opensource.janestreet.com/ jane-street-headers-0.17.0/LICENSE.md000066400000000000000000000021461461647336100170530ustar00rootroot00000000000000The MIT License Copyright (c) 2016--2024 Jane Street Group, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. jane-street-headers-0.17.0/Makefile000066400000000000000000000004031461647336100171010ustar00rootroot00000000000000INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),) default: dune build install: dune install $(INSTALL_ARGS) uninstall: dune uninstall $(INSTALL_ARGS) reinstall: uninstall install clean: dune clean .PHONY: default install uninstall reinstall clean jane-street-headers-0.17.0/README.org000066400000000000000000000001711461647336100171110ustar00rootroot00000000000000* Jane Street header files The repository contains the C header files shared between the various Jane Street packages. jane-street-headers-0.17.0/dune-project000066400000000000000000000000211461647336100177570ustar00rootroot00000000000000(lang dune 3.11) jane-street-headers-0.17.0/include/000077500000000000000000000000001461647336100170675ustar00rootroot00000000000000jane-street-headers-0.17.0/include/core_params.h000066400000000000000000000002321461647336100215300ustar00rootroot00000000000000#ifndef PARAMS_H #define PARAMS_H /* I/O transaction size after which to release the OCaml-lock */ #define THREAD_IO_CUTOFF 65536 #endif /* PARAMS_H */ jane-street-headers-0.17.0/include/dune000066400000000000000000000003521461647336100177450ustar00rootroot00000000000000(library (name jane_street_headers) (public_name jane-street-headers) (install_c_headers core_params jane_common ocaml_utils ocaml_utils_macros unix_utils) (js_of_ocaml (flags --no-sourcemap)) (preprocess no_preprocessing)) jane-street-headers-0.17.0/include/jane_common.h000066400000000000000000000016611461647336100215310ustar00rootroot00000000000000#ifndef JANE_COMMON_H #define JANE_COMMON_H #if __GNUC__ >= 3 # ifndef inline # define inline inline __attribute__ ((always_inline)) # endif # ifndef __pure # define __pure __attribute__ ((pure)) # endif # ifndef __const # define __const __attribute__ ((const)) # endif # ifndef __malloc # define __malloc __attribute__ ((malloc)) # endif # ifndef __unused # define __unused __attribute__ ((unused)) # endif # ifndef __likely # define likely(x) __builtin_expect (!!(x), 1) # endif # ifndef __unlikely # define unlikely(x) __builtin_expect (!!(x), 0) # endif #else # ifndef inline # define inline # endif # ifndef __pure # define __pure # endif # ifndef __const # define __const # endif # ifndef __malloc # define __malloc # endif # ifndef __unused # define __unused # endif # ifndef __likely # define likely(x) (x) # endif # ifndef __unlikely # define unlikely(x) (x) # endif #endif #endif /* JANE_COMMON_H */ jane-street-headers-0.17.0/include/ocaml_utils.h000066400000000000000000000044141461647336100215560ustar00rootroot00000000000000#ifndef OCAML_UTILS_H #define OCAML_UTILS_H #include "jane_common.h" #include #include #include #include #include #include #include #include #include #include #include #include #include "ocaml_utils_macros.h" #define XSTR(S) STR(S) #define STR(S) #S #ifdef ARCH_SIXTYFOUR # define caml_alloc_int63(v) Val_long(v) # define Int63_val(v) Long_val(v) #else /* On 32bit architectures, an OCaml [int63] is represented as a 64 bit * integer with its bits shifted to the left and the least significant bit set to 0. * It makes int64 arithmetic operations work on [int63] with proper overflow handling. */ # define caml_alloc_int63(v) caml_copy_int64(((int64_t) (v)) << 1) # define Int63_val(v) (Int64_val(v)) >> 1 #endif typedef int64_t int63; #define DEFINE_INT63_CONSTANT(name,z) \ CAMLprim value name(value __unused v_unit) { return caml_alloc_int63(z); } /* [strcmp] is defined as a macro in our current compilation environment. We use [strcmp_not_a_macro] instead so that the text of this macro does not overflow the C89 limit on string literal length when used inside [assert]. */ /* defined in ocaml_utils_stubs.c */ extern int strcmp_not_a_macro(const char*, const char*); extern value getsockopt_int(int *tcpopt, value sock, int level, value option); extern value setsockopt_int( int *tcpopt, value sock, int level, value option, value status); extern int caml_convert_signal_number(int signo); extern int caml_rev_convert_signal_number(int signo); extern void raise_with_two_args(value tag, value arg1, value arg2) Noreturn; extern const value* named_value_exn(const char* n); extern void* malloc_exn(size_t size); extern const char* string_ocaml_to_c(value s_v); extern const char* string_of_ocaml_string_option(value v); extern int int_of_ocaml_int_option(value v, int* i); extern const char** array_map(value array, const char* (*f__must_not_allocate)(value)); #if OCAML_VERSION < 41200 static inline value caml_alloc_some(value v) { CAMLparam1(v); value some; some = caml_alloc_small(1, 0); Field(some, 0) = v; CAMLreturn(some); } #endif #endif /* OCAML_UTILS_H */ jane-street-headers-0.17.0/include/ocaml_utils_macros.h000066400000000000000000000022751461647336100231250ustar00rootroot00000000000000#ifndef ocaml_utils_macros_h #define ocaml_utils_macros_h #include #include #define UNUSED __attribute__((unused)) #define Is_string(v) (Is_block(v) && Tag_val(v) == String_tag) #define Is_int_option(v) \ (Is_none(v) \ || (Is_block(v) && Tag_val(v) == 0 && Wosize_val(v) == 1 && Is_long(Field(v, 0)))) #define Is_string_option(v) \ (Is_none(v) \ || (Is_block(v) && Tag_val(v) == 0 && Wosize_val(v) == 1 && Is_string(Field(v, 0)))) #define Is_custom(v) (Is_block(v) && Tag_val(v) == Custom_tag) #define Custom_block_name(v) (Custom_ops_val(v)->identifier) #if OCAML_VERSION < 41200 #define Val_none Val_int(0) #define Some_val(v) Field(v, 0) #define Is_none(v) ((v) == Val_none) #define Is_some(v) Is_block(v) #endif /* [strcmp] is defined as a macro in our current compilation environment. We use [strcmp_not_a_macro] instead so that the text of this macro does not overflow the C89 limit on string literal length when used inside [assert]. */ /* defined in ocaml_utils_stubs.c */ extern int strcmp_not_a_macro(const char*, const char*); #define Is_custom_named(v, name) \ (Is_custom(v) && !strcmp_not_a_macro(name, Custom_block_name(v))) #endif jane-street-headers-0.17.0/include/unix_utils.h000066400000000000000000000022531461647336100214450ustar00rootroot00000000000000#ifndef UNIX_UTILS_H #define UNIX_UTILS_H #define _GNU_SOURCE #include #include #include "ocaml_utils.h" #include "core_params.h" /* Utility definitions */ static inline char * get_bstr(value v_bstr, value v_pos) { return (char *) Caml_ba_data_val(v_bstr) + Long_val(v_pos); } static inline struct iovec * copy_iovecs(size_t *total_len, value v_iovecs, int n) { struct iovec *iovecs = caml_stat_alloc(sizeof(struct iovec) * n); for (--n; n >= 0; --n) { struct iovec *iovec = &iovecs[n]; value v_iovec = Field(v_iovecs, n); value v_iov_base = Field(v_iovec, 0); value v_iov_pos = Field(v_iovec, 1); size_t iov_len = Long_val(Field(v_iovec, 2)); iovec->iov_len = iov_len; *total_len += iov_len; iovec->iov_base = get_bstr(v_iov_base, v_iov_pos); } return iovecs; } static inline ssize_t jane_writev(int fd, struct iovec *iov, int iovcnt) { ssize_t ret = writev(fd, iov, iovcnt); if (ret == -1 && errno == EINVAL && iovcnt == 0) { /* On OSX [count = 0] is an error, but it's not on Linux. For simplicity we always ignore [EINVAL] when [iovcnt] is 0. */ ret = 0; } return ret; } #endif /* UNIX_UTILS_H */ jane-street-headers-0.17.0/jane-street-headers.opam000066400000000000000000000012671461647336100221620ustar00rootroot00000000000000opam-version: "2.0" version: "v0.17.0" maintainer: "Jane Street developers" authors: ["Jane Street Group, LLC"] homepage: "https://github.com/janestreet/jane-street-headers" bug-reports: "https://github.com/janestreet/jane-street-headers/issues" dev-repo: "git+https://github.com/janestreet/jane-street-headers.git" doc: "https://ocaml.janestreet.com/ocaml-core/latest/doc/jane-street-headers/index.html" license: "MIT" build: [ ["dune" "build" "-p" name "-j" jobs] ] depends: [ "ocaml" {>= "5.1.0"} "dune" {>= "3.11.0"} ] available: arch != "arm32" & arch != "x86_32" synopsis: "Jane Street C header files" description: " C header files shared between the various Jane Street packages "