summaryrefslogtreecommitdiff
path: root/rts/posix
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2016-11-29 16:51:30 -0500
committerBen Gamari <ben@smart-cactus.org>2016-11-29 16:51:30 -0500
commit428e152be6bb0fd3867e41cee82a6d5968a11a26 (patch)
treee43d217c10c052704f872cd7e1df4d335c12d376 /rts/posix
parent56d74515396c8b6360ba7898cbc4b68f0f1fb2ea (diff)
downloadhaskell-428e152be6bb0fd3867e41cee82a6d5968a11a26.tar.gz
Use C99's bool
Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
Diffstat (limited to 'rts/posix')
-rw-r--r--rts/posix/OSMem.c12
-rw-r--r--rts/posix/OSThreads.c10
-rw-r--r--rts/posix/Select.c14
-rw-r--r--rts/posix/Signals.c10
-rw-r--r--rts/posix/Signals.h2
-rw-r--r--rts/posix/itimer/Pthread.c2
-rw-r--r--rts/posix/itimer/Setitimer.c2
-rw-r--r--rts/posix/itimer/TimerCreate.c2
8 files changed, 27 insertions, 27 deletions
diff --git a/rts/posix/OSMem.c b/rts/posix/OSMem.c
index febeffbd98..5291745d53 100644
--- a/rts/posix/OSMem.c
+++ b/rts/posix/OSMem.c
@@ -130,10 +130,10 @@ my_mmap (void *addr, W_ size, int operation)
{
if(addr) // try to allocate at address
err = vm_allocate(mach_task_self(),(vm_address_t*) &ret,
- size, FALSE);
+ size, false);
if(!addr || err) // try to allocate anywhere
err = vm_allocate(mach_task_self(),(vm_address_t*) &ret,
- size, TRUE);
+ size, true);
}
if(err) {
@@ -145,7 +145,7 @@ my_mmap (void *addr, W_ size, int operation)
}
if(operation & MEM_COMMIT) {
- vm_protect(mach_task_self(), (vm_address_t)ret, size, FALSE,
+ vm_protect(mach_task_self(), (vm_address_t)ret, size, false,
VM_PROT_READ|VM_PROT_WRITE);
}
@@ -399,7 +399,7 @@ StgWord64 getPhysicalMemorySize (void)
return physMemSize;
}
-void setExecutable (void *p, W_ len, rtsBool exec)
+void setExecutable (void *p, W_ len, bool exec)
{
StgWord pageSize = getPageSize();
@@ -562,12 +562,12 @@ void osReleaseHeapMemory(void)
#endif
-rtsBool osNumaAvailable(void)
+bool osNumaAvailable(void)
{
#if HAVE_LIBNUMA
return (numa_available() != -1);
#else
- return rtsFalse;
+ return false;
#endif
}
diff --git a/rts/posix/OSThreads.c b/rts/posix/OSThreads.c
index a52fbe5d37..45f394208f 100644
--- a/rts/posix/OSThreads.c
+++ b/rts/posix/OSThreads.c
@@ -99,19 +99,19 @@ closeCondition( Condition* pCond )
return;
}
-rtsBool
+bool
broadcastCondition ( Condition* pCond )
{
return (pthread_cond_broadcast(pCond) == 0);
}
-rtsBool
+bool
signalCondition ( Condition* pCond )
{
return (pthread_cond_signal(pCond) == 0);
}
-rtsBool
+bool
waitCondition ( Condition* pCond, Mutex* pMut )
{
return (pthread_cond_wait(pCond,pMut) == 0);
@@ -150,12 +150,12 @@ osThreadId(void)
return pthread_self();
}
-rtsBool
+bool
osThreadIsAlive(OSThreadId id STG_UNUSED)
{
// no good way to implement this on POSIX, AFAICT. Returning true
// is safe.
- return rtsTrue;
+ return true;
}
void
diff --git a/rts/posix/Select.c b/rts/posix/Select.c
index bd9ddfa3ed..3d3b70b565 100644
--- a/rts/posix/Select.c
+++ b/rts/posix/Select.c
@@ -93,10 +93,10 @@ LowResTime getDelayTarget (HsInt us)
* if this is true, then our time has expired.
* (idea due to Andy Gill).
*/
-static rtsBool wakeUpSleepingThreads (LowResTime now)
+static bool wakeUpSleepingThreads (LowResTime now)
{
StgTSO *tso;
- rtsBool flag = rtsFalse;
+ bool flag = false;
while (sleeping_queue != END_TSO_QUEUE) {
tso = sleeping_queue;
@@ -110,7 +110,7 @@ static rtsBool wakeUpSleepingThreads (LowResTime now)
(unsigned long)tso->id));
// MainCapability: this code is !THREADED_RTS
pushOnRunQueue(&MainCapability,tso);
- flag = rtsTrue;
+ flag = true;
}
return flag;
}
@@ -217,13 +217,13 @@ static enum FdState fdPollWriteState (int fd)
*
*/
void
-awaitEvent(rtsBool wait)
+awaitEvent(bool wait)
{
StgTSO *tso, *prev, *next;
fd_set rfd,wfd;
int numFound;
int maxfd = -1;
- rtsBool seen_bad_fd = rtsFalse;
+ bool seen_bad_fd = false;
struct timeval tv, *ptv;
LowResTime now;
@@ -330,7 +330,7 @@ awaitEvent(rtsBool wait)
while ((numFound = select(maxfd+1, &rfd, &wfd, NULL, ptv)) < 0) {
if (errno != EINTR) {
if ( errno == EBADF ) {
- seen_bad_fd = rtsTrue;
+ seen_bad_fd = true;
break;
} else {
sysErrorBelch("select");
@@ -418,7 +418,7 @@ awaitEvent(rtsBool wait)
debugBelch("Killing blocked thread %lu on bad fd=%i\n",
(unsigned long)tso->id, fd));
raiseAsync(&MainCapability, tso,
- (StgClosure *)blockedOnBadFD_closure, rtsFalse, NULL);
+ (StgClosure *)blockedOnBadFD_closure, false, NULL);
break;
case RTS_FD_IS_READY:
IF_DEBUG(scheduler,
diff --git a/rts/posix/Signals.c b/rts/posix/Signals.c
index 97439c5120..80909f113f 100644
--- a/rts/posix/Signals.c
+++ b/rts/posix/Signals.c
@@ -331,7 +331,7 @@ unblockUserSignals(void)
sigprocmask(SIG_SETMASK, &savedSignals, NULL);
}
-rtsBool
+bool
anyUserHandlers(void)
{
return n_haskell_handlers != 0;
@@ -585,7 +585,7 @@ empty_handler (int sig STG_UNUSED)
-------------------------------------------------------------------------- */
static void sigtstp_handler(int sig);
-static void set_sigtstp_action (rtsBool handle);
+static void set_sigtstp_action (bool handle);
static void
sigtstp_handler (int sig STG_UNUSED)
@@ -612,7 +612,7 @@ sigtstp_handler (int sig STG_UNUSED)
}
static void
-set_sigtstp_action (rtsBool handle)
+set_sigtstp_action (bool handle)
{
struct sigaction sa;
if (handle) {
@@ -728,7 +728,7 @@ initDefaultHandlers(void)
sysErrorBelch("warning: failed to install SIGUSR2 handler");
}
- set_sigtstp_action(rtsTrue);
+ set_sigtstp_action(true);
}
void
@@ -749,7 +749,7 @@ resetDefaultHandlers(void)
sysErrorBelch("warning: failed to uninstall SIGPIPE handler");
}
- set_sigtstp_action(rtsFalse);
+ set_sigtstp_action(false);
}
#endif /* RTS_USER_SIGNALS */
diff --git a/rts/posix/Signals.h b/rts/posix/Signals.h
index bb9a7b58df..d281821400 100644
--- a/rts/posix/Signals.h
+++ b/rts/posix/Signals.h
@@ -17,7 +17,7 @@
#include "BeginPrivate.h"
-rtsBool anyUserHandlers(void);
+bool anyUserHandlers(void);
#if !defined(THREADED_RTS)
extern siginfo_t pending_handler_buf[];
diff --git a/rts/posix/itimer/Pthread.c b/rts/posix/itimer/Pthread.c
index 4f0d7509ec..3b31fe4103 100644
--- a/rts/posix/itimer/Pthread.c
+++ b/rts/posix/itimer/Pthread.c
@@ -198,7 +198,7 @@ stopTicker(void)
/* There may be at most one additional tick fired after a call to this */
void
-exitTicker (rtsBool wait)
+exitTicker (bool wait)
{
ASSERT(!exited);
exited = 1;
diff --git a/rts/posix/itimer/Setitimer.c b/rts/posix/itimer/Setitimer.c
index 30dfa211a7..bdf537d478 100644
--- a/rts/posix/itimer/Setitimer.c
+++ b/rts/posix/itimer/Setitimer.c
@@ -73,7 +73,7 @@ stopTicker(void)
}
void
-exitTicker (rtsBool wait STG_UNUSED)
+exitTicker (bool wait STG_UNUSED)
{
return;
}
diff --git a/rts/posix/itimer/TimerCreate.c b/rts/posix/itimer/TimerCreate.c
index a5fe8ce5f1..bee3108d38 100644
--- a/rts/posix/itimer/TimerCreate.c
+++ b/rts/posix/itimer/TimerCreate.c
@@ -76,7 +76,7 @@ stopTicker(void)
}
void
-exitTicker (rtsBool wait STG_UNUSED)
+exitTicker (bool wait STG_UNUSED)
{
// Before deleting the timer set the signal to ignore to avoid the
// possibility of the signal being delivered after the timer is deleted.