Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/aig/gia/giaKf.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/aig/gia/giaTranStoch.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/base/cmd/cmdAuto.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/base/cmd/cmdStarter.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/base/wlc/wlcPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/map/if/ifDsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/map/if/ifTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
18 changes: 18 additions & 0 deletions src/misc/util/utilAigSim.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#define mkstemp(p) _mktemp_s(p, strlen(p)+1)
#else
#include <unistd.h> // mkstemp(), close(), unlink()
#include <fcntl.h>
#include <sys/stat.h>
#endif

#ifdef _WIN32
Expand Down Expand Up @@ -333,17 +335,29 @@ static int ends_with(const char *s, const char *suf) {

static int make_tmp_file(char *path, size_t cap, const char *prefix) {
// Creates an existing temp file (for input)
#if defined(__wasm)
static int seq = 0; // no risk of collision since we're in a sandbox
snprintf(path, cap, "%s%08d", prefix, seq++);
int fd = open(path, O_CREAT | O_EXCL | O_RDWR, S_IREAD | S_IWRITE);
#else
snprintf(path, cap, "/tmp/%sXXXXXX", prefix);
int fd = mkstemp(path);
#endif
if (fd < 0) return 0;
close(fd);
return 1;
}

static int make_tmp_path_noexist(char *path, size_t cap, const char *prefix) {
// Creates a unique temp path that does not exist (for output)
#if defined(__wasm)
static int seq = 0; // no risk of collision since we're in a sandbox
snprintf(path, cap, "%s%08d", prefix, seq++);
int fd = open(path, O_CREAT | O_EXCL | O_RDWR, S_IREAD | S_IWRITE);
#else
snprintf(path, cap, "/tmp/%sXXXXXX", prefix);
int fd = mkstemp(path);
#endif
if (fd < 0) return 0;
close(fd);
unlink(path);
Expand Down Expand Up @@ -612,7 +626,11 @@ static int SimulateCompareAigBin(const AigMan *p1, const char *bin,
// Run external binary: "<bin> <inFile> <outFile>"
remove(outFile);
snprintf(cmd, sizeof(cmd), "%s %s %s", bin, inFile, outFile);
#if defined(__wasm)
int rc = -1;
#else
int rc = system(cmd);
#endif
if (rc != 0) {
fprintf(stderr, "Error: system() failed (rc=%d): %s\n", rc, cmd);
goto fail;
Expand Down
4 changes: 2 additions & 2 deletions src/misc/util/utilPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <stdlib.h>
#include <assert.h>

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include <windows.h>
#include <time.h>
// nanosleep implementation for Windows
Expand All @@ -41,7 +41,7 @@ static inline int nanosleep(const struct timespec *req, struct timespec *rem) {

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 0 additions & 2 deletions src/opt/ufar/UfarMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#ifdef _WIN32
#include <windows.h>
#else
#include <sys/wait.h>
#endif

#include <base/wlc/wlc.h>
Expand Down
6 changes: 5 additions & 1 deletion src/opt/ufar/UfarPth.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

#include "misc/util/abc_namespaces.h"

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down Expand Up @@ -188,6 +188,10 @@ class PDRWLA : public Solver {
Wlc_Par_t _Pars;
};

#if defined(__wasm)
static void pthread_exit(void *retval) __attribute__((noreturn)) { }
#endif

void KillOthers() {
pthread_cond_signal( &g_cond );
++g_nRunIds;
Expand Down
1 change: 0 additions & 1 deletion src/opt/untk/NtkNtk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <windows.h>
#else
#include <unistd.h>
#include <sys/wait.h>
#endif
#include <fstream>

Expand Down
2 changes: 2 additions & 0 deletions src/opt/util/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
*/

#include <iomanip>
#if !defined(__wasm)
#include <csignal>
#endif
#ifdef _WIN32
#include <windows.h>
#else
Expand Down
2 changes: 1 addition & 1 deletion src/proof/abs/absPth.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/proof/cec/cecProve.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/proof/cec/cecSplit.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/proof/ssw/sswPart.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include <windows.h>
#include <time.h>
#include "../lib/pthread.h"
Expand Down
2 changes: 1 addition & 1 deletion src/sat/bmc/bmcBmcS.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
2 changes: 1 addition & 1 deletion src/sat/cnf/cnfUtil.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

#ifdef ABC_USE_PTHREADS

#ifdef _WIN32
#if defined(_WIN32) && !defined(__MINGW32__)
#include "../lib/pthread.h"
#else
#include <pthread.h>
Expand Down
Loading