Browse Source

Merge branch 'master' of github.com:Tommoa/relibc

Tom Almeida 7 years ago
parent
commit
122f6cfef5
62 changed files with 237 additions and 164 deletions
  1. 79 77
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 1 1
      cbindgen
  4. 2 0
      include/stdint.h
  5. 0 39
      include/sys/stat.h
  6. 3 0
      src/lib.rs
  7. 2 1
      src/resource/cbindgen.toml
  8. 5 7
      src/stat/build.rs
  9. 1 0
      src/stat/cbindgen.toml
  10. 24 2
      src/stdlib/src/lib.rs
  11. 2 2
      src/string/src/lib.rs
  12. 5 0
      src/sys_time/src/lib.rs
  13. 3 6
      test.sh
  14. 3 4
      tests/.gitignore
  15. 21 15
      tests/Makefile
  16. 1 1
      tests/alloc.c
  17. 1 0
      tests/args.c
  18. 1 1
      tests/brk.c
  19. 1 0
      tests/chdir.c
  20. 1 0
      tests/dup.c
  21. 1 0
      tests/error.c
  22. 0 2
      tests/expected/alloc.stdout
  23. 0 2
      tests/expected/chdir.stdout
  24. 0 1
      tests/expected/getid.stdout
  25. 1 0
      tests/expected/link.stderr
  26. 1 0
      tests/expected/math.stdout
  27. 0 0
      tests/expected/mem.stderr
  28. 3 0
      tests/expected/mem.stdout
  29. 3 0
      tests/expected/sleep.stderr
  30. 0 0
      tests/expected/sleep.stdout
  31. 0 0
      tests/expected/sprintf.stderr
  32. 0 0
      tests/expected/sprintf.stdout
  33. 0 0
      tests/expected/stdlib/a64l.stderr
  34. 2 0
      tests/expected/stdlib/a64l.stdout
  35. 0 0
      tests/expected/stdlib/strtol.stderr
  36. 12 0
      tests/expected/stdlib/strtol.stdout
  37. 0 0
      tests/expected/string/strchr.stderr
  38. 3 0
      tests/expected/string/strchr.stdout
  39. 0 0
      tests/expected/string/strcspn.stderr
  40. 2 0
      tests/expected/string/strcspn.stdout
  41. 0 0
      tests/expected/string/strncmp.stderr
  42. 6 0
      tests/expected/string/strncmp.stdout
  43. 0 0
      tests/expected/string/strrchr.stderr
  44. 1 0
      tests/expected/string/strrchr.stdout
  45. 0 0
      tests/expected/string/strspn.stderr
  46. 3 0
      tests/expected/string/strspn.stdout
  47. 1 0
      tests/expected/unlink.stderr
  48. 0 0
      tests/expected/unlink.stdout
  49. 1 0
      tests/fchdir.c
  50. 1 0
      tests/fcntl.c
  51. 1 0
      tests/fsync.c
  52. 2 1
      tests/ftruncate.c
  53. 1 0
      tests/getid.c
  54. 2 0
      tests/link.c
  55. 5 1
      tests/math.c
  56. 1 0
      tests/mem.c
  57. 1 0
      tests/pipe.c
  58. 1 0
      tests/rmdir.c
  59. 1 0
      tests/setid.c
  60. 1 0
      tests/sleep.c
  61. 22 0
      tests/stdlib/a64l.c
  62. 1 0
      tests/unlink.c

+ 79 - 77
Cargo.lock

@@ -1,14 +1,17 @@
 [[package]]
 name = "ansi_term"
-version = "0.10.2"
+version = "0.11.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
+]
 
 [[package]]
 name = "atty"
-version = "0.2.6"
+version = "0.2.8"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
  "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -20,12 +23,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "cbindgen"
-version = "0.5.0"
+version = "0.5.1"
 dependencies = [
- "clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "clap 2.31.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_json 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)",
  "standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)",
  "tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
  "toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -33,7 +36,7 @@ dependencies = [
 
 [[package]]
 name = "cc"
-version = "1.0.5"
+version = "1.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -43,11 +46,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "clap"
-version = "2.30.0"
+version = "2.31.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
  "bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "textwrap 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -71,7 +74,7 @@ dependencies = [
 name = "ctype"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -84,7 +87,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "errno"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -92,7 +95,7 @@ dependencies = [
 name = "fcntl"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -100,7 +103,7 @@ dependencies = [
 name = "fenv"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -108,7 +111,7 @@ dependencies = [
 name = "float"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "fenv 0.1.0",
  "platform 0.1.0",
 ]
@@ -131,7 +134,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "grp"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -151,7 +154,7 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.37"
+version = "0.2.39"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
@@ -174,7 +177,7 @@ dependencies = [
 name = "mman"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -205,7 +208,7 @@ name = "parking_lot_core"
 version = "0.2.13"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
  "rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -219,10 +222,21 @@ dependencies = [
  "sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
+[[package]]
+name = "proc-macro2"
+version = "0.2.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+]
+
 [[package]]
 name = "quote"
-version = "0.3.15"
+version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
+dependencies = [
+ "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+]
 
 [[package]]
 name = "ralloc"
@@ -246,7 +260,7 @@ version = "0.4.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
  "winapi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
@@ -302,7 +316,7 @@ dependencies = [
 name = "resource"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
  "sys_time 0.1.0",
 ]
@@ -392,46 +406,47 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "semaphore"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
 [[package]]
 name = "serde"
-version = "1.0.27"
+version = "1.0.29"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "serde_derive"
-version = "1.0.27"
+version = "1.0.29"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "serde_derive_internals"
-version = "0.19.0"
+version = "0.20.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
- "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "serde_json"
-version = "1.0.10"
+version = "1.0.11"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
  "dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
  "itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
  "num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -477,7 +492,7 @@ dependencies = [
 name = "stat"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -485,7 +500,7 @@ dependencies = [
 name = "stdio"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "errno 0.1.0",
  "platform 0.1.0",
  "va_list 0.1.0",
@@ -495,7 +510,7 @@ dependencies = [
 name = "stdlib"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "ctype 0.1.0",
  "errno 0.1.0",
  "platform 0.1.0",
@@ -506,7 +521,8 @@ dependencies = [
 name = "string"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
+ "compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)",
  "errno 0.1.0",
  "platform 0.1.0",
  "stdlib 0.1.0",
@@ -519,27 +535,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [[package]]
 name = "syn"
-version = "0.11.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
- "synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)",
- "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
-name = "synom"
-version = "0.11.3"
+version = "0.12.14"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
+ "proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
 name = "sys_time"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -566,7 +574,7 @@ name = "termion"
 version = "1.5.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)",
  "redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)",
  "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
@@ -583,7 +591,7 @@ dependencies = [
 name = "time"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -592,7 +600,7 @@ name = "toml"
 version = "0.4.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 dependencies = [
- "serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)",
+ "serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -605,11 +613,6 @@ name = "unicode-width"
 version = "0.1.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
-[[package]]
-name = "unicode-xid"
-version = "0.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
 [[package]]
 name = "unicode-xid"
 version = "0.1.0"
@@ -619,7 +622,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "unistd"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -634,7 +637,7 @@ dependencies = [
 name = "va_list-helper"
 version = "0.0.2"
 dependencies = [
- "cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
+ "cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
 ]
 
 [[package]]
@@ -646,7 +649,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 name = "wait"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
  "resource 0.1.0",
 ]
@@ -655,7 +658,7 @@ dependencies = [
 name = "wctype"
 version = "0.1.0"
 dependencies = [
- "cbindgen 0.5.0",
+ "cbindgen 0.5.1",
  "platform 0.1.0",
 ]
 
@@ -689,26 +692,27 @@ version = "0.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [metadata]
-"checksum ansi_term 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6b3568b48b7cefa6b8ce125f9bb4989e52fbcc29ebea88df04cc7c5f12f70455"
-"checksum atty 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8352656fd42c30a0c3c89d26dea01e3b77c0ab2af18230835c15e2e13cd51859"
+"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
+"checksum atty 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "af80143d6f7608d746df1520709e5d141c96f240b0e62b0aa41bdfb53374d9d4"
 "checksum bitflags 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b3c30d3802dfb7281680d6285f2ccdaa8c2d8fee41f93805dba5c4cf50dc23cf"
-"checksum cc 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "9be26b24e988625409b19736d130f0c7d224f01d06454b5f81d8d23d6c1a618f"
+"checksum cc 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fedf677519ac9e865c4ff43ef8f930773b37ed6e6ea61b6b83b400a7b5787f49"
 "checksum cfg-if 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4c819a1287eb618df47cc647173c5c4c66ba19d888a6e50d605672aed3140de"
-"checksum clap 2.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1c07b9257a00f3fc93b7f3c417fc15607ec7a56823bc2c37ec744e266387de5b"
+"checksum clap 2.31.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dc18f6f4005132120d9711636b32c46a233fad94df6217fa1d81c5e97a9f200"
 "checksum compiler_builtins 0.1.0 (git+https://github.com/rust-lang-nursery/compiler-builtins.git)" = "<none>"
 "checksum dtoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "09c3753c3db574d215cba4ea76018483895d7bff25a31b49ba45db21c48e50ab"
 "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
 "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
 "checksum itoa 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8324a32baf01e2ae060e9de58ed0bc2320c9a2833491ee36cd3b4c414de4db8c"
 "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
-"checksum libc 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)" = "56aebce561378d99a0bb578f8cb15b6114d2a1814a6c7949bbe646d968bb4fa9"
+"checksum libc 0.2.39 (registry+https://github.com/rust-lang/crates.io-index)" = "f54263ad99207254cf58b5f701ecb432c717445ea2ee8af387334bdd1a03fdff"
 "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b"
 "checksum log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "89f010e843f2b1a31dbd316b3b8d443758bc634bed37aabade59c686d644e0a2"
 "checksum num-traits 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3c2bd9b9d21e48e956b763c9f37134dc62d9e95da6edb3f672cacb6caf3cd3"
 "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
 "checksum parking_lot 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "9fd9d732f2de194336fb02fe11f9eed13d9e76f13f4315b4d88a14ca411750cd"
 "checksum parking_lot_core 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "538ef00b7317875071d5e00f603f24d16f0b474c1a5fc0ccb8b454ca72eafa79"
-"checksum quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
+"checksum proc-macro2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cd07deb3c6d1d9ff827999c7f9b04cdfd66b1b17ae508e14fe47b620f2282ae0"
+"checksum quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1eca14c727ad12702eb4b6bfb5a232287dcf8385cb8ca83a3eeaf6519c44c408"
 "checksum rand 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "eba5f8cb59cc50ed56be8880a5c7b496bfd9bd26394e176bc67884094145c2c5"
 "checksum redox_syscall 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "0d92eecebad22b767915e4d529f89f28ee96dbbf5a4810d2b844373f136417fd"
 "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
@@ -721,18 +725,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum rustc-ap-syntax 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b6e525fc674e8a75eaed08a90a6df7adfa73a66135056577722185dd7ca0771"
 "checksum rustc-ap-syntax_pos 40.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e157f53ad5c4a6cf9ae5b5be15325dd2eeca190c03ab9873cc1460788767e5e9"
 "checksum sc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4ebbb026ba4a707c25caec2db5ef59ad8b41f7ad77cad06257e06229c891f376"
-"checksum serde 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "db99f3919e20faa51bb2996057f5031d8685019b5a06139b1ce761da671b8526"
-"checksum serde_derive 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "f4ba7591cfe93755e89eeecdbcc668885624829b020050e6aec99c2a03bd3fd0"
-"checksum serde_derive_internals 0.19.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6e03f1c9530c3fb0a0a5c9b826bdd9246a5921ae995d75f512ac917fc4dd55b5"
-"checksum serde_json 1.0.10 (registry+https://github.com/rust-lang/crates.io-index)" = "57781ed845b8e742fc2bf306aba8e3b408fe8c366b900e3769fbc39f49eb8b39"
+"checksum serde 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "4763b773978e495252615e814d2ad04773b2c1f85421c7913869a537f35cb406"
+"checksum serde_derive 1.0.29 (registry+https://github.com/rust-lang/crates.io-index)" = "8ab31f00ae5574bb643c196d5e302961c122da1c768604c6d16a35c5d551948a"
+"checksum serde_derive_internals 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1fc848d073be32cd982380c06587ea1d433bc1a4c4a111de07ec2286a3ddade8"
+"checksum serde_json 1.0.11 (registry+https://github.com/rust-lang/crates.io-index)" = "fab6c4d75bedcf880711c85e39ebf8ccc70d0eba259899047ec5d7436643ee17"
 "checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
 "checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
 "checksum standalone-proc-macro2 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "04b0e28c7fb04d85743490bd2a24bd0ec0ff6efc74e7c848748fd9fd2b105410"
 "checksum standalone-quote 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45bd227b8113ff91db4f6eadcc73928dc602af00a851f4fe65f3c1cb1a96b5e1"
 "checksum standalone-syn 0.12.10 (registry+https://github.com/rust-lang/crates.io-index)" = "d800cb9b3b2e08877667aace544bb0882ea3d5cf3ae83c2730a9032becf1f6bd"
 "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
-"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
-"checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
+"checksum syn 0.12.14 (registry+https://github.com/rust-lang/crates.io-index)" = "8c5bc2d6ff27891209efa5f63e9de78648d7801f085e4653701a692ce938d6fd"
 "checksum tempdir 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f73eebdb68c14bcb24aef74ea96079830e7fa7b31a6106e42ea7ee887c1e134e"
 "checksum term 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "fa63644f74ce96fbeb9b794f66aff2a52d601cbd5e80f4b97123e3899f4570f1"
 "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
@@ -740,7 +743,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 "checksum toml 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7540f4ffc193e0d3c94121edb19b055670d369f77d5804db11ae053a45b6e7e"
 "checksum unborrow 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e92e959f029e4f8ee25d70d15ab58d2b46f98a17bc238b9265ff0c26f6f3d67f"
 "checksum unicode-width 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "bf3a113775714a22dcb774d8ea3655c53a32debae63a063acc00a91cc586245f"
-"checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
 "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
 "checksum vec_map 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "887b5b631c2ad01628bbbaa7dd4c869f80d3186688f8d0b6f58774fbe324988c"
 "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"

+ 1 - 1
Cargo.toml

@@ -18,10 +18,10 @@ fcntl = { path = "src/fcntl" }
 fenv = { path = "src/fenv" }
 float = { path = "src/float" }
 grp = { path = "src/grp" }
-semaphore = { path = "src/semaphore" }
 mman = { path = "src/mman" }
 platform = { path = "src/platform" }
 resource = { path = "src/resource" }
+semaphore = { path = "src/semaphore" }
 stat = { path = "src/stat" }
 stdio = { path = "src/stdio" }
 stdlib = { path = "src/stdlib" }

+ 1 - 1
cbindgen

@@ -1 +1 @@
-Subproject commit 97ceb5862f397b14c5b63cd60af7f5f345ad065c
+Subproject commit fe26d47afd3e959a8cd73f81f430b061d28c4c3b

+ 2 - 0
include/stdint.h

@@ -49,4 +49,6 @@ typedef int64_t intmax_t;
 #define UINTMAX_MAX UINT64_MAX
 typedef uint64_t uintmax_t;
 
+#define SIZE_MAX UINT64_MAX
+
 #endif /* _STDINT_H */

+ 0 - 39
include/sys/stat.h

@@ -1,39 +0,0 @@
-#ifndef _STAT_H
-#define _STAT_H
-
-#include <sys/types.h>
-
-struct stat {
-  dev_t st_dev;
-  ino_t st_ino;
-  nlink_t st_nlink;
-  mode_t st_mode;
-  uid_t st_uid;
-  gid_t st_gid;
-  dev_t st_rdev;
-  off_t st_size;
-  blksize_t st_blksize;
-  time_t st_atim;
-  time_t st_mtim;
-  time_t st_ctim;
-};
-
-int chmod(const char *path, mode_t mode);
-
-int fchmod(int fildes, mode_t mode);
-
-int fstat(int fildes, struct stat *buf);
-
-int lstat(const char *path, struct stat *buf);
-
-int mkdir(const char *path, mode_t mode);
-
-int mkfifo(const char *path, mode_t mode);
-
-int mknod(const char *path, mode_t mode, dev_t dev);
-
-int stat(const char *file, struct stat *buf);
-
-mode_t umask(mode_t mask);
-
-#endif /* _STAT_H */

+ 3 - 0
src/lib.rs

@@ -7,8 +7,11 @@ extern crate platform;
 extern crate ctype;
 extern crate errno;
 extern crate fcntl;
+extern crate fenv;
+extern crate float;
 extern crate grp;
 extern crate mman;
+extern crate resource;
 extern crate semaphore;
 extern crate stat;
 extern crate stdio;

+ 2 - 1
src/resource/cbindgen.toml

@@ -1,6 +1,7 @@
-sys_includes = ["sys/types.h"]
+sys_includes = ["sys/types.h", "sys/time.h"]
 include_guard = "_SYS_RESOURCE_H"
 language = "C"
+style = "Tag"
 
 [enum]
 prefix_with_name = true

+ 5 - 7
src/stat/build.rs

@@ -3,11 +3,9 @@ extern crate cbindgen;
 use std::{env, fs};
 
 fn main() {
-    /*
-     *let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
-     *fs::create_dir_all("../../target/include").expect("failed to create include directory");
-     *cbindgen::generate(crate_dir)
-     *  .expect("failed to generate bindings")
-     *  .write_to_file("../../target/include/sys/stat.h");
-     */
+    let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
+    fs::create_dir_all("../../target/include").expect("failed to create include directory");
+    cbindgen::generate(crate_dir)
+        .expect("failed to generate bindings")
+        .write_to_file("../../target/include/sys/stat.h");
 }

+ 1 - 0
src/stat/cbindgen.toml

@@ -1,6 +1,7 @@
 sys_includes = ["sys/types.h"]
 include_guard = "_SYS_STAT_H"
 language = "C"
+style = "Tag"
 
 [enum]
 prefix_with_name = true

+ 24 - 2
src/stdlib/src/lib.rs

@@ -23,8 +23,30 @@ pub const EXIT_SUCCESS: c_int = 0;
 static mut ATEXIT_FUNCS: [Option<extern "C" fn()>; 32] = [None; 32];
 
 #[no_mangle]
-pub extern "C" fn a64l(s: *const c_char) -> c_long {
-    unimplemented!();
+pub unsafe extern "C" fn a64l(s: *const c_char) -> c_long {
+    if s.is_null() {
+        return 0;
+    }
+    let mut l: c_long = 0;
+    // a64l does not support more than 6 characters at once
+    for x in 0..6 {
+        let c = *s.offset(x);
+        if c == 0 {
+            // string is null terminated
+            return l;
+        }
+        // ASCII to base64 conversion:
+        let mut bits: c_long = if c < 58 {
+            (c - 46) as c_long // ./0123456789
+        } else if c < 91 {
+            (c - 53) as c_long // A-Z
+        } else {
+            (c - 59) as c_long // a-z
+        };
+        bits <<= 6 * x;
+        l |= bits;
+    }
+    return l;
 }
 
 #[no_mangle]

+ 2 - 2
src/string/src/lib.rs

@@ -127,7 +127,7 @@ pub unsafe extern "C" fn strcspn(s1: *const c_char, s2: *const c_char) -> c_ulon
 
     // The below logic is effectively ripped from the musl implementation
 
-    let mut byteset = [0u8; 32 / mem::size_of::<usize>()];
+    let mut byteset = [0usize; 32 / mem::size_of::<usize>()];
 
     let mut i = 0;
     while *s2.offset(i) != 0 {
@@ -279,7 +279,7 @@ pub unsafe extern "C" fn strspn(s1: *const c_char, s2: *const c_char) -> c_ulong
 
     // The below logic is effectively ripped from the musl implementation
 
-    let mut byteset = [0u8; 32 / mem::size_of::<usize>()];
+    let mut byteset = [0usize; 32 / mem::size_of::<usize>()];
 
     let mut i = 0;
     while *s2.offset(i) != 0 {

+ 5 - 0
src/sys_time/src/lib.rs

@@ -23,10 +23,12 @@ pub struct fd_set {
     pub fds_bits: [c_long; 16usize],
 }
 
+#[no_mangle]
 pub extern "C" fn getitimer(which: c_int, value: *mut itimerval) -> c_int {
     unimplemented!();
 }
 
+#[no_mangle]
 pub extern "C" fn setitimer(
     which: c_int,
     value: *const itimerval,
@@ -35,10 +37,12 @@ pub extern "C" fn setitimer(
     unimplemented!();
 }
 
+#[no_mangle]
 pub extern "C" fn gettimeofday(tp: *mut timeval, tzp: *const c_void) -> c_int {
     unimplemented!();
 }
 
+#[no_mangle]
 pub extern "C" fn select(
     nfds: c_int,
     readfds: *mut fd_set,
@@ -49,6 +53,7 @@ pub extern "C" fn select(
     unimplemented!();
 }
 
+#[no_mangle]
 pub extern "C" fn utimes(path: *const c_char, times: [timeval; 2]) -> c_int {
     unimplemented!();
 }

+ 3 - 6
test.sh

@@ -4,10 +4,7 @@ set -ex
 cargo build
 cargo build --manifest-path src/crt0/Cargo.toml
 
-cd openlibm
-make
-cd ..
+CFLAGS=-fno-stack-protector make -C openlibm
 
-cd tests
-make clean
-make run
+make -C tests clean
+make -C tests run

+ 3 - 4
tests/.gitignore

@@ -1,3 +1,4 @@
+/*.out
 /gen/
 /alloc
 /args
@@ -6,19 +7,15 @@
 /brk
 /chdir
 /create
-/create.out
 /ctype
 /dup
-/dup.out
 /error
 /fchdir
 /fcntl
 /fsync
 /ftruncate
-/ftruncate.out
 /getid
 /link
-/link.out
 /math
 /mem
 /setid
@@ -29,6 +26,7 @@
 /setid
 /sprintf
 /stdlib/strtol
+/stdlib/a64l
 /string/strncmp
 /string/strcspn
 /string/strchr
@@ -36,3 +34,4 @@
 /string/strspn
 /unlink
 /write
+

+ 21 - 15
tests/Makefile

@@ -1,10 +1,9 @@
-BINS=\
-	alloc \
+# Binaries that should generate the same output every time
+EXPECT_BINS=\
 	atof \
 	atoi \
 	brk \
 	args \
-	chdir \
 	create \
 	ctype \
 	dup \
@@ -13,17 +12,16 @@ BINS=\
 	fcntl \
 	fsync \
 	ftruncate \
-	getid \
 	link \
 	math \
 	mem \
 	pipe \
 	printf \
 	rmdir \
-	setid \
 	sleep \
 	sprintf \
 	stdlib/strtol \
+	stdlib/a64l \
 	string/strncmp \
 	string/strcspn \
 	string/strchr \
@@ -32,38 +30,46 @@ BINS=\
 	unlink \
 	write
 
+# Binaries that may generate varied output
+BINS=\
+	$(EXPECT_BINS) \
+	alloc \
+	chdir \
+	getid \
+	setid
+
 all: $(BINS)
 
 clean:
 	rm -f $(BINS) *.out
 
 run: $(BINS)
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
-		"./$${bin}" test args; \
+		"./$${bin}" test args || exit $$?; \
 	done
 
-expected: $(BINS)
+expected: $(EXPECT_BINS)
 	rm -rf expected
 	mkdir -p expected
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p expected/`dirname $${bin}`; \
-		"./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr"; \
+		"./$${bin}" test args > "expected/$${bin}.stdout" 2> "expected/$${bin}.stderr" || exit $$?; \
 	done
 
-verify: $(BINS)
+verify: $(EXPECT_BINS)
 	rm -rf gen
 	mkdir -p gen
-	for bin in $(BINS); \
+	for bin in $^; \
 	do \
 		echo "# $${bin} #"; \
 		mkdir -p gen/`dirname $${bin}`; \
-		"./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr"; \
-		diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout"; \
-		diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr"; \
+		"./$${bin}" test args > "gen/$${bin}.stdout" 2> "gen/$${bin}.stderr" || exit $$?; \
+		diff -u "gen/$${bin}.stdout" "expected/$${bin}.stdout" || exit $$?; \
+		diff -u "gen/$${bin}.stderr" "expected/$${bin}.stderr" || exit $$?; \
 	done
 
 GCCHEAD=\

+ 1 - 1
tests/alloc.c

@@ -16,5 +16,5 @@ int main(int argc, char ** argv) {
         ptrc[i] = (char)i;
     }
     free(ptrc);
-
+    return 0;
 }

+ 1 - 0
tests/args.c

@@ -8,4 +8,5 @@ int main(int argc, char ** argv) {
         write(STDOUT_FILENO, " ", 1);
     }
     write(STDOUT_FILENO, "\n", 1);
+    return 0;
 }

+ 1 - 1
tests/brk.c

@@ -4,5 +4,5 @@
 int main(int argc, char** argv) {
     int status = brk((void*)100);
     printf("brk exited with status code %d\n", status);
+    return 0;
 }
-

+ 1 - 0
tests/chdir.c

@@ -12,4 +12,5 @@ int main(int argc, char** argv) {
     getcwd(cwd2, 4096);
     printf("final cwd: %s\n", cwd2);
     free(cwd2);
+    return 0;
 }

+ 1 - 0
tests/dup.c

@@ -13,4 +13,5 @@ int main(int argc, char** argv) {
     dup2(fd3, 1);
     printf("hello fd %d", fd3);
     close(fd3);
+    return 0;
 }

+ 1 - 0
tests/error.c

@@ -7,4 +7,5 @@ int main(int argc, char** argv) {
     chdir("nonexistent");
     printf("errno: %d = %s\n", errno, strerror(errno));
     perror("perror");
+    return 0;
 }

+ 0 - 2
tests/expected/alloc.stdout

@@ -1,2 +0,0 @@
-malloc 0x55ac6c472618
-calloc 0x55ac6c472618

+ 0 - 2
tests/expected/chdir.stdout

@@ -1,2 +0,0 @@
-initial cwd: /home/jeremy/Projects/relibc/tests
-final cwd: /home/jeremy/Projects/relibc

+ 0 - 1
tests/expected/getid.stdout

@@ -1 +0,0 @@
-egid: 1000, euid: 1000, gid: 1000, pgid: 23916, pid: 23933, ppid 23918, uid 1000

+ 1 - 0
tests/expected/link.stderr

@@ -0,0 +1 @@
+link: File exists

+ 1 - 0
tests/expected/math.stdout

@@ -0,0 +1 @@
+cos(3.14) = -0.9999987483024597

+ 0 - 0
tests/expected/alloc.stderr → tests/expected/mem.stderr


+ 3 - 0
tests/expected/mem.stdout

@@ -0,0 +1,3 @@
+# mem #
+Correct memchr
+Correct memccpy

+ 3 - 0
tests/expected/sleep.stderr

@@ -0,0 +1,3 @@
+sleep: Success
+usleep: Success
+nanosleep: Success

+ 0 - 0
tests/expected/chdir.stderr → tests/expected/sleep.stdout


+ 0 - 0
tests/expected/getid.stderr → tests/expected/sprintf.stderr


+ 0 - 0
tests/fcntl.out → tests/expected/sprintf.stdout


+ 0 - 0
tests/expected/stdlib/a64l.stderr


+ 2 - 0
tests/expected/stdlib/a64l.stdout

@@ -0,0 +1,2 @@
+Correct a64l: azAZ9. = 194301926
+Correct a64l: azA = 53222

+ 0 - 0
tests/expected/stdlib/strtol.stderr


+ 12 - 0
tests/expected/stdlib/strtol.stdout

@@ -0,0 +1,12 @@
+-42
+555
+1234567890
+-42
+555
+1234567890
+38acf
+abcdef12
+731
+731
+0
+0

+ 0 - 0
tests/expected/string/strchr.stderr


+ 3 - 0
tests/expected/string/strchr.stdout

@@ -0,0 +1,3 @@
+ello
+ld
+

+ 0 - 0
tests/expected/string/strcspn.stderr


+ 2 - 0
tests/expected/string/strcspn.stdout

@@ -0,0 +1,2 @@
+2
+6

+ 0 - 0
tests/expected/string/strncmp.stderr


+ 6 - 0
tests/expected/string/strncmp.stdout

@@ -0,0 +1,6 @@
+-97
+-195
+1
+-255
+-2
+0

+ 0 - 0
tests/expected/string/strrchr.stderr


+ 1 - 0
tests/expected/string/strrchr.stdout

@@ -0,0 +1 @@
+strrch PASS, exiting with status code 0

+ 0 - 0
tests/expected/string/strspn.stderr


+ 3 - 0
tests/expected/string/strspn.stdout

@@ -0,0 +1,3 @@
+5
+1
+0

+ 1 - 0
tests/expected/unlink.stderr

@@ -0,0 +1 @@
+unlink: File exists

+ 0 - 0
tests/expected/unlink.stdout


+ 1 - 0
tests/fchdir.c

@@ -8,4 +8,5 @@ int main (int argc, char** argv) {
     status = fchdir(fd);
     printf("fchdir exited with status code %d\n", status);
     close(fd);
+    return 0;
 }

+ 1 - 0
tests/fcntl.c

@@ -10,4 +10,5 @@ int main() {
     printf("fd %d duped into fd %d\n", newfd, newfd2);
     close(newfd);
     close(newfd2);
+    return 0;
 }

+ 1 - 0
tests/fsync.c

@@ -8,4 +8,5 @@ int main (int argc, char** argv) {
     status = fsync(fd);
     printf("fsync exited with status code %d\n", status);
     close(fd);
+    return 0;
 }

+ 2 - 1
tests/ftruncate.c

@@ -3,9 +3,10 @@
 #include <stdio.h>
 
 int main (int argc, char** argv) {
-    int fd = creat("ftruncate.out", 0777); 
+    int fd = creat("ftruncate.out", 0777);
     int status;
     status = ftruncate(fd, 100);
     printf("ftruncate exited with status code %d\n", status);
     close(fd);
+    return 0;
 }

+ 1 - 0
tests/getid.c

@@ -11,4 +11,5 @@ int main(int argc, char** argv) {
     uid_t uid = getuid();
     printf("egid: %d, euid: %d, gid: %d, pgid: %d, pid: %d, ppid %d, uid %d\n",
             egid, euid, gid, pgid, pid, ppid, uid);
+    return 0;
 }

+ 2 - 0
tests/link.c

@@ -1,6 +1,8 @@
+#include <stdio.h>
 #include <unistd.h>
 
 int main(int argc, char** argv) {
     link("./link.c", "./link.out");
     perror("link");
+    return 0;
 }

+ 5 - 1
tests/math.c

@@ -1,5 +1,9 @@
 #include <math.h>
+#include <stdio.h>
 
 int main(int argc, char ** argv) {
-    float c = cos(3.14);
+    double pi = 3.14;
+    float c = cos(pi);
+    printf("cos(%f) = %f\n", pi, c);
+    return 0;
 }

+ 1 - 0
tests/mem.c

@@ -20,4 +20,5 @@ int main(int argc, char ** argv) {
 		exit(1);
 	}
 	printf("Correct memccpy\n");
+    return 0;
 }

+ 1 - 0
tests/pipe.c

@@ -30,4 +30,5 @@ int main()
         /* close read end */
         close(pip[0]);
     }
+    return 0;
 }

+ 1 - 0
tests/rmdir.c

@@ -6,4 +6,5 @@ int main(int argc, char** argv) {
     mkdir("foo", 0);
     int status = rmdir("foo");
     printf("rmdir exited with status code %d\n", status);
+    return 0;
 }

+ 1 - 0
tests/setid.c

@@ -23,4 +23,5 @@ int main( void )
         perror( "setreuid" );
     }
     printf("%d has euid %d and uid %d\n", getpid(), geteuid(), getuid());
+    return 0;
   }

+ 1 - 0
tests/sleep.c

@@ -10,4 +10,5 @@ int main(int argc, char** argv) {
     timespec tm = {0, 10000};
     nanosleep(&tm, NULL);
     perror("nanosleep");
+    return 0;
 }

+ 22 - 0
tests/stdlib/a64l.c

@@ -0,0 +1,22 @@
+#include <stdlib.h>
+#include <stdio.h>
+
+int main(int argc, char* argv[]) {
+    char * s = "azAZ9."; // test boundaries
+    long l = a64l(s);
+    if (l != 194301926) {
+        printf("Invalid result: a64l(%s) = %ld\n", s, l);
+        return 1;
+    }
+    printf("Correct a64l: %s = %ld\n", s, l);
+
+    
+    s = "azA"; // test null terminated string
+    l = a64l(s);
+    if (l != 53222) {
+        printf("Invalid result: a64l(%s) = %ld\n", s, l);
+        return 1;
+    }
+    printf("Correct a64l: %s = %ld\n", s, l);
+    return 0;
+}

+ 1 - 0
tests/unlink.c

@@ -4,4 +4,5 @@
 int main(int argc, char** argv) {
     link("./unlink.c", "./unlink.out");
     perror("unlink");
+    return 0;
 }