| 1 | /* clang-format off */ |
| 2 | /* |
| 3 | * Copyright © 2006 Robert Millan |
| 4 | * Copyright © 2008-2011 Guillem Jover <[email protected]> |
| 5 | * |
| 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | * modification, are permitted provided that the following conditions |
| 8 | * are met: |
| 9 | * 1. Redistributions of source code must retain the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer. |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer in the |
| 13 | * documentation and/or other materials provided with the distribution. |
| 14 | * 3. The name of the author may not be used to endorse or promote products |
| 15 | * derived from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY |
| 19 | * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL |
| 20 | * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
| 23 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
| 25 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF |
| 26 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifdef LIBBSD_OVERLAY |
| 30 | #include_next <unistd.h> |
| 31 | #else |
| 32 | #include <unistd.h> |
| 33 | #endif |
| 34 | |
| 35 | #ifndef LIBBSD_UNISTD_H |
| 36 | #define LIBBSD_UNISTD_H |
| 37 | |
| 38 | #include "bsd/cdefs.h" |
| 39 | #include <sys/stat.h> |
| 40 | |
| 41 | #ifndef S_ISTXT |
| 42 | #define S_ISTXT S_ISVTX |
| 43 | #endif |
| 44 | |
| 45 | __BEGIN_DECLS |
| 46 | extern int optreset; |
| 47 | |
| 48 | #ifdef LIBBSD_OVERLAY |
| 49 | #undef getopt |
| 50 | #define getopt(argc, argv, optstr) bsd_getopt(argc, argv, optstr) |
| 51 | #endif |
| 52 | |
| 53 | int bsd_getopt(int argc, char * const argv[], const char *shortopts); |
| 54 | |
| 55 | mode_t getmode(const void *set, mode_t mode); |
| 56 | void *setmode(const char *mode_str); |
| 57 | |
| 58 | #if defined (__DragonFly__) |
| 59 | int closefrom(int lowfd); |
| 60 | #else |
| 61 | void closefrom(int lowfd); |
| 62 | #endif |
| 63 | |
| 64 | /* Compatibility with sendmail implementations. */ |
| 65 | #define initsetproctitle(c, a, e) setproctitle_init((c), (a), (e)) |
| 66 | |
| 67 | void setproctitle_init(int argc, char *argv[], char *envp[]); |
| 68 | void setproctitle(const char *fmt, ...); |
| 69 | |
| 70 | __END_DECLS |
| 71 | |
| 72 | #endif |