Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unistd.h not available on Windows #521

Closed
sipsorcery opened this issue Oct 21, 2017 · 1 comment
Closed

unistd.h not available on Windows #521

sipsorcery opened this issue Oct 21, 2017 · 1 comment

Comments

@sipsorcery
Copy link

sipsorcery commented Oct 21, 2017

When compiling with msvc on Windows unistd.h is not available in leveldb/c.cc.

Excluding the header and also adding a definition for ssize_t and undefining _snprintf in port_win.h allows compilation to succeed.

db/c.cc

#include <stdlib.h>
#ifndef WIN32
#include <unistd.h>
#endif
#include "leveldb/cache.h"

port/port_win.h

#ifdef _MSC_VER
//#define snprintf _snprintf
#define close _close
#define fread_unlocked _fread_nolock
#include <stdint.h>
#ifdef _WIN64
typedef int64_t ssize_t;
#else
typedef int32_t ssize_t;
#endif
#endif

#include <string>
@cmumford
Copy link
Contributor

Thanks for the issue. At present Windows is not an officially supported platform. We are currently working on adding this as it is frequently asked for.

laanwj added a commit to bitcoin-core/leveldb-subtree that referenced this issue Jan 16, 2019
d6eab93 Fixes to allow building with msvc. (Aaron Clauson)

Pull request description:

  This PR would be very handy to facilitate building bitcoin with msvc.

  The [relevant parts of the patch were submitted](google#521) upstream to the main leveldb source but there looks to be a bigger Windows port going on there at the moment.

Tree-SHA512: 0183c6fb189ee3446c2de1f02b514dcb77b2e1d6524e127be2e396575eb6106e1081143b4b5a2a91c9cc8424dfcfc0230c4b4c55db6a66dceb6f61fb89f90f5a
maochongxin pushed a commit to maochongxin/leveldb that referenced this issue Jul 21, 2022
* Support State::KeepRunningBatch().

State::KeepRunning() can take large amounts of time relative to quick
operations (on the order of 1ns, depending on hardware). For such
sensitive operations, it is recommended to run batches of repeated
operations.

This commit simplifies handling of total_iterations_. Rather than
predecrementing such that total_iterations_ == 1 signals that
KeepRunning() should exit, total_iterations_ == 0 now signals the
intention for the benchmark to exit.

* Create better fast path in State::KeepRunningBatch()

* Replace int parameter with size_t to fix signed mismatch warnings

* Ensure benchmark State has been started even on error.

* Simplify KeepRunningBatch()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants