static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) { R2Pipe *r2p = NULL; if (__check (io, pathname, 0)) { r2p = r2p_open (pathname + 9); } return r2p? r_io_desc_new (io, &r_io_plugin_r2pipe, pathname, rw, mode, r2p): NULL; }
int check(int base, int start_digit, int inc_digit_count) { int count = 9-start_digit; int inval_bound = 3-start_digit; int increment = 0; int i; get_increments(inc_digit_count); for (i = 0; i < increments_size; i++) if (__check(base, increments[i], count, inval_bound)) return 1; return 0; }
pascal int InsertIntoReadyList(hTCB ht) { hTCB hq; TCB *p, *q; __check(ht >=0 && ht < NR_TCB); p = &tcbs[ht]; if (p->priority > 077 || p->priority < 000) return E_BadPriority; if (p->priority < 003) hasUltraHighPriorityTasks |= (1 << p->priority); p->status = TS_READY; hq = readyQ[p->priority>>3]; // Ready list empty ? if (hq<0) { p->next = ht; p->prev = ht; readyQ[p->priority>>3] = ht; return E_Ok; }
static RIODesc *__open(RIO *io, const char *pathname, int rw, int mode) { if (__check (io, pathname, 0)) { RIOMalloc *mal = R_NEW0 (RIOMalloc); if (!mal) return NULL; rw = 7; // RWX mal->fd = -2; /* causes r_io_desc_new() to set the correct fd */ if (!strncmp (pathname, "hex://", 6)) { mal->size = strlen (pathname); mal->buf = malloc (mal->size + 1); if (!mal->buf) { free (mal); return NULL; } mal->offset = 0; memset (mal->buf, 0, mal->size); mal->size = r_hex_str2bin (pathname + 6, mal->buf); if ((int)mal->size < 1) { R_FREE (mal->buf); } } else { mal->size = r_num_math (NULL, pathname + 9); if (((int)mal->size) <= 0) { free (mal); eprintf ("Cannot allocate (%s) 0 bytes\n", pathname + 9); return NULL; } mal->offset = 0; mal->buf = calloc (1, mal->size + 1); } if (mal->buf) { RETURN_IO_DESC_NEW (&r_io_plugin_malloc, mal->fd, pathname, rw, mode, mal); } eprintf ("Cannot allocate (%s) %d bytes\n", pathname + 9, mal->size); free (mal); } return NULL; }