John Scott jscott

jscott pushed to master at jscott/which

  • 61fc96e376 Define _XOPEN_SOURCE to 700. I hadn't realized that lfind and lsearch were XSI extensions.

2 years ago

jscott pushed to master at jscott/which

  • 984f08d8c7 Use reallocarray() instead of abusing calloc(). We now only use calloc() where we actually want the memory to be zero-initialized, such as for our thread_is_running booleans. We also remove a useless check for whether argc exceeds SIZE_MAX. This is impossible, since the size of a pointer, as for any object, must be at least one, and *argv occupies a contiguous region of memory from argv[0] to argv[argc], which must necessarily be less than SIZE_MAX.

2 years ago

jscott pushed to master at jscott/wc

  • c4434bab96 Stop relying on strerror() being thread-safe. Also, don't call cancellation points prior to aborting.

2 years ago

jscott pushed to master at jscott/which

  • d00a50c71b Stop assuming strerror() is thread-safe. Thread safety by usage of thread-local storage or otherwise is the exception, not the norm, even on other Unix systems. In particular, the BSDs seem not to support it. Using strerror_r() is easy enough, and since we only call strerror_r() just prior to aborting anyway, it's okay to abort on its failure. The GNU C Library is not POSIX-conforming, so we need a hack to make it build there. It's well-known in both its source code and documentation elsewhere that a buffer of 1024 bytes always suffices.

2 years ago

jscott pushed to master at jscott/which

  • e88ac7f8ba Use posix_madvise() to optimize when PATH contains many directories This doesn't seem to make a notable difference in my limited benchmarking, but I still think it's a worthy addition. Note that we still read the memory region sequentially even when it gets split up by strtok(), since we read each of the directory names sequentially.

2 years ago

jscott pushed to master at jscott/which

  • c280779707 Fix an off-by-one error in counting directories in PATH This could give an assertion failure or result in a heap buffer overwrite if assertions were disabled.

2 years ago

jscott pushed to master at jscott/which

2 years ago

jscott created new branch master at jscott/which

2 years ago

jscott created repository jscott/which

2 years ago

jscott pushed to master at jscott/wc

  • 1c49581afd Disable buffering on standard output This is an alternative to always having to make sure to flush the stream. This shouldn't really incur any performance penalty, since we craft each of the lines we output with a memory stream before printing them anyway.
  • b0e9423636 Refactor thread_stop() to take care of (un)locking the mutex This way we need less nonsense with wrapper functions.
  • View comparison for these 2 commits »

2 years ago

jscott pushed to master at jscott/wc

  • 9f36d1fb6a Add an assertion check. This would've caught the bug from before where we weren't setting the thread_is_running variables properly.

2 years ago

jscott pushed to master at jscott/wc

  • f4ceb2bb28 Set seq_thread_id Previously, all threads got zero.

2 years ago

jscott pushed to master at jscott/wc

2 years ago

jscott pushed to master at jscott/wc

2 years ago

jscott created new branch master at jscott/wc

2 years ago

jscott created repository jscott/wc

2 years ago

jscott commented on issue libreboot/libreboot#373

We need a team of testers, for new upcoming libreboot release

I can test on my X200.

6 years ago