summaryrefslogtreecommitdiff
path: root/src/lib/dev.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-05 18:52:12 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-07-05 19:07:25 +0200
commitbc9c60382b226e5a75a11a99364b9b799dc2b0c2 (patch)
treef9072634e81bc152c0ca52b927ab9984a845e0e8 /src/lib/dev.c
parentdb96f7d488681be47abfeec6c636fd4159a37660 (diff)
downloadouroboros-bc9c60382b226e5a75a11a99364b9b799dc2b0c2.tar.gz
ouroboros-bc9c60382b226e5a75a11a99364b9b799dc2b0c2.zip
lib: Change invalid pid to -1
The stack used pid 0 (the scheduler) to indicate an invalid process instance, probably as a leftover from the deprecated application process instance id. Using -1 is a better solution. Fixes #16.
Diffstat (limited to 'src/lib/dev.c')
-rw-r--r--src/lib/dev.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/dev.c b/src/lib/dev.c
index 19bc90e5..d85afc45 100644
--- a/src/lib/dev.c
+++ b/src/lib/dev.c
@@ -93,7 +93,7 @@ int ap_init(char * ap_name)
for (i = 0; i < AP_MAX_FLOWS; ++i) {
_ap_instance->flows[i].rb = NULL;
_ap_instance->flows[i].port_id = -1;
- _ap_instance->flows[i].api = 0; /* API_INVALID */
+ _ap_instance->flows[i].api = -1;
}
pthread_rwlock_init(&_ap_instance->flows_lock, NULL);
@@ -397,7 +397,7 @@ int flow_dealloc(int fd)
_ap_instance->flows[fd].port_id = -1;
shm_ap_rbuff_close(_ap_instance->flows[fd].rb);
_ap_instance->flows[fd].rb = NULL;
- _ap_instance->flows[fd].api = 0;
+ _ap_instance->flows[fd].api = -1;
bmp_release(_ap_instance->fds, fd);
@@ -543,7 +543,7 @@ ssize_t flow_read(int fd, void * buf, size_t count)
if (_ap_instance->flows[fd].oflags & FLOW_O_NONBLOCK) {
idx = shm_ap_rbuff_read_port(_ap_instance->rb,
- _ap_instance->flows[fd].port_id);
+ _ap_instance->flows[fd].port_id);
} else { /* block */
while ((idx =
shm_ap_rbuff_read_port(_ap_instance->rb,