| 237 | } |
| 238 | |
| 239 | static bool check_with_child(struct ptr_valid_batch *batch, |
| 240 | const void *p, size_t size, bool is_write) |
| 241 | { |
| 242 | char ret; |
| 243 | |
| 244 | if (!child_alive(batch)) { |
| 245 | if (!create_child(batch)) |
| 246 | return false; |
| 247 | } |
| 248 | |
| 249 | if (write(batch->to_child, &p, sizeof(p)) |
| 250 | + write(batch->to_child, &size, sizeof(size)) |
| 251 | + write(batch->to_child, &is_write, sizeof(is_write)) |
| 252 | != sizeof(p) + sizeof(size) + sizeof(is_write)) { |
| 253 | finish_child(batch); |
| 254 | errno = EFAULT; |
| 255 | return false; |
| 256 | } |
| 257 | |
| 258 | if (read(batch->from_child, &ret, sizeof(ret)) != sizeof(ret)) { |
| 259 | finish_child(batch); |
| 260 | errno = EFAULT; |
| 261 | return false; |
| 262 | } |
| 263 | return true; |
| 264 | } |
| 265 | |
| 266 | /* msync seems most well-defined test, but page could be mapped with |
| 267 | * no permissions, and can't distiguish readonly from writable. */ |
no test coverage detected