You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2025/05/06 16:06:11 UTC
(couchdb) branch cfile-fallback-on-32bit-systems updated (fccb35489 -> 4ab575d04)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch cfile-fallback-on-32bit-systems
in repository https://gitbox.apache.org/repos/asf/couchdb.git
discard fccb35489 No cfile support for 32bit systems
new 4ab575d04 No cfile support for 32bit systems
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (fccb35489)
\
N -- N -- N refs/heads/cfile-fallback-on-32bit-systems (4ab575d04)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/couch/priv/couch_cfile/couch_cfile.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
(couchdb) 01/01: No cfile support for 32bit systems
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch cfile-fallback-on-32bit-systems
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 4ab575d043ee905165e6d2d87ae6c519d88747b2
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Tue May 6 11:55:01 2025 -0400
No cfile support for 32bit systems
In principle we could support with a few more extra macro to figure out if we'd
do get enif_get_int64 vs enif_get_int for size_t values, but since we don't
have a way to test it (no CI machine) we'll just opt to fallback. We'll still
support 32bit systems just with a default file module, like we do on Windows.
---
src/couch/priv/couch_cfile/couch_cfile.c | 30 +++++++++++++++++++-----------
1 file changed, 19 insertions(+), 11 deletions(-)
diff --git a/src/couch/priv/couch_cfile/couch_cfile.c b/src/couch/priv/couch_cfile/couch_cfile.c
index 06328b069..c7e6f16f0 100644
--- a/src/couch/priv/couch_cfile/couch_cfile.c
+++ b/src/couch/priv/couch_cfile/couch_cfile.c
@@ -11,7 +11,15 @@
// the License.
-#ifndef _WIN32
+// Not supported on Windows or 32 bit architectures. When not supported the NIF
+// will still build, but the API functions will return {error, einval}, and
+// we'd fallback to the regular file API then
+//
+#if !defined(_WIN32) && defined(__LP64__)
+#define COUCH_CFILE_SUPPORTED 1
+#endif
+
+#ifdef COUCH_CFILE_SUPPORTED
#include <errno.h>
#include <limits.h>
@@ -225,7 +233,7 @@ int efile_datasync(int fd, posix_errno_t* res_errno) {
//
static ERL_NIF_TERM dup_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
int fd, newfd;
handle_t* hdl;
ErlNifRWLock *lock;
@@ -293,7 +301,7 @@ static ERL_NIF_TERM dup_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
static ERL_NIF_TERM close_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
if (argc != 1 || !get_handle(env, argv[0], &hdl)) {
@@ -326,7 +334,7 @@ static ERL_NIF_TERM close_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[
//
static ERL_NIF_TERM close_fd_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
int fd;
if (argc != 1 || !enif_is_number(env, argv[0])) {
@@ -351,7 +359,7 @@ static ERL_NIF_TERM close_fd_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM ar
//
static ERL_NIF_TERM pread_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
long offset, block_size, bytes_read;
SysIOVec io_vec[1];
@@ -413,7 +421,7 @@ static ERL_NIF_TERM pread_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
// Follows implementation from prim_file_nif.c
//
static ERL_NIF_TERM write_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) {
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
ErlNifIOVec vec, *input = &vec;
posix_errno_t res_errno = 0;
@@ -452,7 +460,7 @@ static ERL_NIF_TERM write_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[
}
static ERL_NIF_TERM seek_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
long result, offset;
int whence;
@@ -502,7 +510,7 @@ static ERL_NIF_TERM seek_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]
}
static ERL_NIF_TERM datasync_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
posix_errno_t res_errno = 0;
@@ -530,7 +538,7 @@ static ERL_NIF_TERM datasync_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM ar
}
static ERL_NIF_TERM truncate_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
off_t offset;
@@ -568,7 +576,7 @@ static ERL_NIF_TERM truncate_nif(ErlNifEnv *env, int argc, const ERL_NIF_TERM ar
//
static ERL_NIF_TERM info_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
int fd, old_fd;
@@ -601,7 +609,7 @@ static ERL_NIF_TERM info_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]
//
static ERL_NIF_TERM eof_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
-#ifndef _WIN32
+#ifdef COUCH_CFILE_SUPPORTED
handle_t* hdl;
struct stat data;