Changes in / [4f102fa:116a2ea]
- Files:
-
- 6 deleted
- 5 edited
-
libcfa/src/concurrency/io.cfa (modified) (4 diffs)
-
libcfa/src/concurrency/io/types.hfa (modified) (1 diff)
-
libcfa/src/concurrency/kernel/cluster.hfa (modified) (3 diffs)
-
libcfa/src/parseargs.cfa (modified) (6 diffs)
-
tests/configs/.expect/parsebools.txt (deleted)
-
tests/configs/.expect/parsenums.x64.txt (deleted)
-
tests/configs/.expect/parsenums.x86.txt (deleted)
-
tests/configs/parsebools.cfa (deleted)
-
tests/configs/parsenums.cfa (deleted)
-
tests/meta/fork+exec.cfa (modified) (2 diffs)
-
tests/meta/fork+exec.hfa (deleted)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/concurrency/io.cfa
r4f102fa r116a2ea 551 551 enqueue(this.pending, (__outstanding_io&)pa); 552 552 553 wait( pa. waitctx);553 wait( pa.sem ); 554 554 555 555 return pa.ctx; … … 578 578 pa.ctx = ctx; 579 579 580 post( pa. waitctx);580 post( pa.sem ); 581 581 } 582 582 … … 613 613 } 614 614 615 wait( ei. waitctx);615 wait( ei.sem ); 616 616 617 617 __cfadbg_print_safe(io, "Kernel I/O : %u submitted from arbiter\n", have); … … 631 631 __submit_only(&ctx, ei.idxs, ei.have); 632 632 633 post( ei. waitctx);633 post( ei.sem ); 634 634 } 635 635 -
libcfa/src/concurrency/io/types.hfa
r4f102fa r116a2ea 107 107 struct __outstanding_io { 108 108 inline Colable; 109 oneshot waitctx;109 single_sem sem; 110 110 }; 111 111 static inline __outstanding_io *& Next( __outstanding_io * n ) { return (__outstanding_io *)Next( (Colable *)n ); } -
libcfa/src/concurrency/kernel/cluster.hfa
r4f102fa r116a2ea 21 21 22 22 #include <limits.h> 23 #include <inttypes.h>24 23 25 24 #include "clock.hfa" … … 31 30 32 31 // warn normally all ints 33 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %' " PRId64 "ms \n", old_avg, old_avg, program()`ms )34 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %' " PRId64 "ms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg )32 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'ldms \n", old_avg, old_avg, program()`ms ) 33 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'ldms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ) 35 34 36 35 // 8X linear factor is just 8 * x … … 42 41 static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2(intsc); } 43 42 44 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %' " PRId64 "ms \n", old_avg, program()`ms )45 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %' " PRId64 "ms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \43 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'ldms \n", old_avg, program()`ms ) 44 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'ldms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \ 46 45 verify(ret >= 0) 47 46 -
libcfa/src/parseargs.cfa
r4f102fa r116a2ea 1 1 #include "parseargs.hfa" 2 2 3 #include <ctype.h>4 3 #include <stdint.h> 5 4 #include <string.h> 6 5 #include <errno.h> 7 6 #include <unistd.h> 7 #include <assert.h> 8 8 9 9 extern "C" { … … 74 74 75 75 int maxv = 'h'; 76 char optstring[(opt_count * 3) + 2] = { '\0' }; 76 assert( opt_count > 0 ); 77 char optstring[opt_count * 3] = { '\0' }; 77 78 { 78 79 int idx = 0; … … 271 272 bool parse(const char * arg, int & value) { 272 273 char * end; 273 274 errno = 0; 275 long long int r = strtoll(arg, &end, 0); 276 if(errno) return false; 274 int r = strtoll(arg, &end, 10); 277 275 if(*end != '\0') return false; 278 if(r > (int)MAX) return false;279 if(r < (int)MIN) return false;280 276 281 277 value = r; … … 283 279 } 284 280 285 static unsigned long long int strict_strtoull( const char * arg, int base) {286 errno = 0;287 {288 const char * in = arg;289 for() {290 if('\0' == *in) {291 errno = EINVAL;292 return 0;293 }294 if(!isspace(*in)) break;295 in++;296 }297 if(!isdigit(*in)) {298 errno = EINVAL;299 return 0;300 }301 }302 303 *char end;304 unsigned long long int r = strtoull(arg, &end, base);305 if(*end != '\0') errno = EINVAL;306 if(errno) return 0;307 return r;308 }309 310 281 bool parse(const char * arg, unsigned & value) { 311 unsigned long long int r = strict_strtoull(arg, 0); 312 if(errno) return false; 282 char * end; 283 unsigned long long int r = strtoull(arg, &end, 10); 284 if(*end != '\0') return false; 313 285 if(r > (unsigned)MAX) return false; 314 286 … … 318 290 319 291 bool parse(const char * arg, unsigned long & value) { 320 unsigned long long int r = strict_strtoull(arg, 0); 321 if(errno) return false; 292 char * end; 293 unsigned long long int r = strtoull(arg, &end, 10); 294 if(*end != '\0') return false; 322 295 if(r > (unsigned long)MAX) return false; 323 296 … … 327 300 328 301 bool parse(const char * arg, unsigned long long & value) { 329 unsigned long long int r = strict_strtoull(arg, 0); 330 if(errno) return false; 331 if(r > (unsigned long long)MAX) return false; 332 333 value = r; 334 return true; 302 char * end; 303 unsigned long long int r = strtoull(arg, &end, 10); 304 if(*end != '\0') return false; 305 if(r > (unsigned long long)MAX) return false; 306 307 value = r; 308 return true; 335 309 } 336 310 -
tests/meta/fork+exec.cfa
r4f102fa r116a2ea 13 13 // Update Count : 14 14 // 15 #include <stdlib.h> 16 #include <stdio.h> 17 #include <string.h> 15 18 16 #include "fork+exec.hfa" 19 #include <errno.h> 20 #include <signal.h> 21 22 extern "C" { 23 #include <sys/types.h> 24 #include <sys/wait.h> 25 #include <unistd.h> 26 } 27 28 int true_main(const char * exec); 17 29 18 30 int main(int argc, char * argv[]) { 19 check_main(argv[0]);31 if(!getenv("CFATEST_FORK_EXEC_TEXT")) return true_main(argv[0]); 20 32 21 33 printf("arguments are:\n"); … … 30 42 } 31 43 44 int do_wait(pid_t pid) { 45 int wstatus; 46 int options = 0; 47 pid_t ret = waitpid(pid, &wstatus, options); 48 fflush(stdout); 49 if(ret < 0) { 50 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno)); 51 exit(1); 52 } 53 return wstatus; 54 } 32 55 56 pid_t strict_fork(void) { 57 fflush(stdout); 58 pid_t ret = fork(); 59 if(ret < 0) { 60 fprintf(stderr, "Fork returned with error: %d '%s'\n", errno, strerror(errno)); 61 exit(1); 62 } 63 return ret; 64 } 33 65 34 int true_main(const char * path, char * env[]) { 66 void print_status(int wstatus) { 67 printf("Child status:\n"); 68 printf(" WIFEXITED : %d\n", WIFEXITED(wstatus)); 69 printf(" WEXITSTATUS : %d\n", WEXITSTATUS(wstatus)); 70 printf(" WIFSIGNALED : %d\n", WIFSIGNALED(wstatus)); 71 printf(" WTERMSIG : %d\n", WTERMSIG(wstatus)); 72 printf(" WCOREDUMP : %d\n", WCOREDUMP(wstatus)); 73 printf(" WIFSTOPPED : %d\n", WIFSTOPPED(wstatus)); 74 printf(" WSTOPSIG : %d\n", WSTOPSIG(wstatus)); 75 printf(" WIFCONTINUED: %d\n", WIFCONTINUED(wstatus)); 76 } 77 78 int true_main(const char * path) { 79 char * env[] = { "CFATEST_FORK_EXEC_TEXT=1", 0p }; 80 35 81 printf("no arg:\n"); 36 82 if(pid_t child = strict_fork(); child == 0) {
Note:
See TracChangeset
for help on using the changeset viewer.