Elly Jones | cd7a904 | 2011-07-22 13:56:51 -0400 | [diff] [blame] | 1 | /* libminijail-private.h |
| 2 | * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 3 | * Use of this source code is governed by a BSD-style license that can be |
| 4 | * found in the LICENSE file. |
| 5 | * |
| 6 | * Values shared between libminijailpreload and libminijail, but not visible to |
| 7 | * the outside world. |
| 8 | */ |
| 9 | |
| 10 | #ifndef LIBMINIJAIL_PRIVATE_H |
| 11 | #define LIBMINIJAIL_PRIVATE_H |
| 12 | |
Will Drewry | 2f54b6a | 2011-09-16 13:45:31 -0500 | [diff] [blame] | 13 | static const char *kFdEnvVar = "__MINIJAIL_FD"; |
Ben Chan | 541c7e5 | 2011-08-26 14:55:53 -0700 | [diff] [blame] | 14 | static const char *kLdPreloadEnvVar = "LD_PRELOAD"; |
Elly Jones | cd7a904 | 2011-07-22 13:56:51 -0400 | [diff] [blame] | 15 | |
Will Drewry | 32ac9f5 | 2011-08-18 21:36:27 -0500 | [diff] [blame] | 16 | #define MINIJAIL_MAX_SECCOMP_FILTER_LINE 512 |
| 17 | |
Will Drewry | f89aef5 | 2011-09-16 16:48:57 -0500 | [diff] [blame^] | 18 | struct minijail; |
Will Drewry | 2ddaad0 | 2011-09-16 11:36:08 -0500 | [diff] [blame] | 19 | /* minijail_size returns the size of |j| if marshalled. |
| 20 | * 0 is returned on error. |
| 21 | */ |
| 22 | extern size_t minijail_size(const struct minijail *j); |
| 23 | /* minijail_marshal: serializes |j| to |buf| |
| 24 | * Writes |j| to |buf| such that it can be reparsed by the same |
| 25 | * library on the same architecture. This is meant to be used |
| 26 | * by minijail0.c and libminijailpreload.c. minijail flags that |
| 27 | * require minijail_run() will be excluded. |
| 28 | * |
| 29 | * The marshalled data is not robust to differences between the child |
| 30 | * and parent process (personality, etc). |
| 31 | * |
| 32 | * Returns 0 on success. |
| 33 | */ |
| 34 | extern int minijail_marshal(const struct minijail *j, |
| 35 | char *buf, |
| 36 | size_t available); |
| 37 | /* minijail_unmarshal: initializes minijail |j| from |serialized|. */ |
| 38 | extern int minijail_unmarshal(struct minijail *j, |
| 39 | char *serialized, |
| 40 | size_t length); |
Will Drewry | fe4a372 | 2011-09-16 14:50:50 -0500 | [diff] [blame] | 41 | /* Using minijail_unmarshal, build |j| from |fd|. */ |
| 42 | extern int minijail_from_fd(int fd, struct minijail *j); |
| 43 | /* Using minijail_marshal, sends |j| to |fd|. */ |
| 44 | extern int minijail_to_fd(struct minijail *j, int fd); |
| 45 | /* minijail_preexec: strips |j| of all options handled by minijail_enter(). */ |
| 46 | extern void minijail_preexec(struct minijail *j); |
Will Drewry | 2ddaad0 | 2011-09-16 11:36:08 -0500 | [diff] [blame] | 47 | /* minijail_preenter: strips |j| of all options handled by minijail_run(). */ |
| 48 | extern void minijail_preenter(struct minijail *j); |
| 49 | |
Elly Jones | cd7a904 | 2011-07-22 13:56:51 -0400 | [diff] [blame] | 50 | #endif /* !LIBMINIJAIL_PRIVATE_H */ |