1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright (c) 1999-2000 Damien Miller. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 5*7c478bd9Sstevel@tonic-gate * modification, are permitted provided that the following conditions 6*7c478bd9Sstevel@tonic-gate * are met: 7*7c478bd9Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 8*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 9*7c478bd9Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 10*7c478bd9Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 11*7c478bd9Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 12*7c478bd9Sstevel@tonic-gate * 13*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14*7c478bd9Sstevel@tonic-gate * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15*7c478bd9Sstevel@tonic-gate * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16*7c478bd9Sstevel@tonic-gate * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17*7c478bd9Sstevel@tonic-gate * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18*7c478bd9Sstevel@tonic-gate * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19*7c478bd9Sstevel@tonic-gate * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20*7c478bd9Sstevel@tonic-gate * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21*7c478bd9Sstevel@tonic-gate * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22*7c478bd9Sstevel@tonic-gate * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23*7c478bd9Sstevel@tonic-gate */ 24*7c478bd9Sstevel@tonic-gate 25*7c478bd9Sstevel@tonic-gate #ifndef _BSD_MISC_H 26*7c478bd9Sstevel@tonic-gate #define _BSD_MISC_H 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 29*7c478bd9Sstevel@tonic-gate 30*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 31*7c478bd9Sstevel@tonic-gate extern "C" { 32*7c478bd9Sstevel@tonic-gate #endif 33*7c478bd9Sstevel@tonic-gate 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate /* $Id: bsd-misc.h,v 1.6 2002/06/13 21:34:58 mouring Exp $ */ 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate #include "config.h" 38*7c478bd9Sstevel@tonic-gate 39*7c478bd9Sstevel@tonic-gate char *get_progname(char *argv0); 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate #ifndef HAVE_SETSID 42*7c478bd9Sstevel@tonic-gate #define setsid() setpgrp(0, getpid()) 43*7c478bd9Sstevel@tonic-gate #endif /* !HAVE_SETSID */ 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #ifndef HAVE_SETENV 46*7c478bd9Sstevel@tonic-gate int setenv(const char *name, const char *value, int overwrite); 47*7c478bd9Sstevel@tonic-gate #endif /* !HAVE_SETENV */ 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate #ifndef HAVE_SETLOGIN 50*7c478bd9Sstevel@tonic-gate int setlogin(const char *name); 51*7c478bd9Sstevel@tonic-gate #endif /* !HAVE_SETLOGIN */ 52*7c478bd9Sstevel@tonic-gate 53*7c478bd9Sstevel@tonic-gate #ifndef HAVE_INNETGR 54*7c478bd9Sstevel@tonic-gate int innetgr(const char *netgroup, const char *host, 55*7c478bd9Sstevel@tonic-gate const char *user, const char *domain); 56*7c478bd9Sstevel@tonic-gate #endif /* HAVE_INNETGR */ 57*7c478bd9Sstevel@tonic-gate 58*7c478bd9Sstevel@tonic-gate #if !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) 59*7c478bd9Sstevel@tonic-gate int seteuid(uid_t euid); 60*7c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_SETEUID) && defined(HAVE_SETREUID) */ 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate #if !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) 63*7c478bd9Sstevel@tonic-gate int setegid(uid_t egid); 64*7c478bd9Sstevel@tonic-gate #endif /* !defined(HAVE_SETEGID) && defined(HAVE_SETRESGID) */ 65*7c478bd9Sstevel@tonic-gate 66*7c478bd9Sstevel@tonic-gate #if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) && defined(HAVE_SYS_NERR) 67*7c478bd9Sstevel@tonic-gate const char *strerror(int e); 68*7c478bd9Sstevel@tonic-gate #endif 69*7c478bd9Sstevel@tonic-gate 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #ifndef HAVE_UTIMES 72*7c478bd9Sstevel@tonic-gate #ifndef HAVE_STRUCT_TIMEVAL 73*7c478bd9Sstevel@tonic-gate struct timeval { 74*7c478bd9Sstevel@tonic-gate long tv_sec; 75*7c478bd9Sstevel@tonic-gate long tv_usec; 76*7c478bd9Sstevel@tonic-gate } 77*7c478bd9Sstevel@tonic-gate #endif /* HAVE_STRUCT_TIMEVAL */ 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate int utimes(char *filename, struct timeval *tvp); 80*7c478bd9Sstevel@tonic-gate #endif /* HAVE_UTIMES */ 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #ifndef HAVE_TRUNCATE 83*7c478bd9Sstevel@tonic-gate int truncate (const char *path, off_t length); 84*7c478bd9Sstevel@tonic-gate #endif /* HAVE_TRUNCATE */ 85*7c478bd9Sstevel@tonic-gate 86*7c478bd9Sstevel@tonic-gate #if !defined(HAVE_SETGROUPS) && defined(SETGROUPS_NOOP) 87*7c478bd9Sstevel@tonic-gate int setgroups(size_t size, const gid_t *list); 88*7c478bd9Sstevel@tonic-gate #endif 89*7c478bd9Sstevel@tonic-gate 90*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 91*7c478bd9Sstevel@tonic-gate } 92*7c478bd9Sstevel@tonic-gate #endif 93*7c478bd9Sstevel@tonic-gate 94*7c478bd9Sstevel@tonic-gate #endif /* _BSD_MISC_H */ 95