1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
|
/****************** Start of $RCSfile: sysutils.h,v $ ****************
*
* $Source: /home/alb/afbackup/afbackup-3.3.8beta7/RCS/sysutils.h,v $
* $Id: sysutils.h,v 1.4 2004/07/08 20:34:45 alb Exp alb $
* $Date: 2004/07/08 20:34:45 $
* $Author: alb $
*
*
******* description ***********************************************
*
*
*
*******************************************************************/
#ifndef __SYSUTILS_H
#define __SYSUTILS_H __SYSUTILS_H
#include <signal.h>
#include <sys/types.h>
#include <fcntl.h>
#include <stdarg.h>
#include <syslog.h>
#include <netdb.h>
#include <genutils.h>
#ifdef __FreeBSD__
#ifndef O_SYNC
#define O_SYNC O_FSYNC
#endif
#endif
#ifndef MAXHOSTNAMELEN
#define MAXHOSTNAMELEN 200 /* should be almost sufficient */
#endif
typedef struct _complete_user_spec {
uid_t uid;
gid_t gid;
int ngids;
gid_t *gids;
} UGIDS;
typedef struct __mnt_ent_ {
dev_t dev;
UChar *dir;
UChar *typestr;
UChar *devstr;
} MntEnt;
#ifdef __QNX__
#define ITIMER_REAL 0 /* Real time */
#define ITIMER_VIRTUAL 1 /* Per-process time */
#define ITIMER_PROF 2 /* Per-process user time */
#if 0
/* seems to exist already */
struct timeval {
int tv_sec; /* seconds */
int tv_usec; /* microseconds */
};
struct itimerval {
struct timeval it_interval; /* timer interval */
struct timeval it_value; /* current value */
};
#endif /* 0 */
#ifdef __cplusplus
extern "C" {
#endif
extern int setitimer(int, struct itimerval *, struct itimerval *);
extern int getitimer(int, struct itimerval *);
#ifdef __cplusplus
}
#endif
#endif /* defined(__QNX__) */
#ifdef __cplusplus
extern "C" {
#endif
extern Int32 get_fs_space(UChar *, Real64 *);
extern Int32 get_fs_status(UChar *, Int32 *, Real64 *, Real64 *, Real64 *);
extern MntEnt *get_all_mounts(Int32 *);
extern MntEnt *find_mnt_by_devno_dir(MntEnt *, Int32, dev_t, UChar *);
#define find_mnt_by_devno(mnts, nmnts, devno) \
find_mnt_by_devno_dir(mnts, nmnts, devno, NULL)
extern UChar *get_fstype_by_devno_dir(dev_t, UChar *);
#define get_fstype_by_devno(devno) \
get_fstype_by_devno_dir(devno, NULL)
extern void free_mounts(MntEnt *);
extern Int32 free_fds();
extern Flag is_a_tty(int);
extern void gvsyslog(UChar *, int, int, int, UChar *, va_list);
extern void genlogmsg(UChar *, int, int, UChar *, ...);
extern int fd_system_fork(char *, int *);
extern int fp_system_fork(char *, FILE **);
extern int fdpopen(char *, int, int *);
extern Int32 bytes_free_real_mem_pag(Int32, Int32);
extern int open_to_pipe(UChar *, UChar *, UChar, int *, int);
extern int open_from_pipe(UChar *, UChar *, UChar, int *);
extern Int32 open_from_to_pipe(UChar *, int *, UChar, int *);
extern int open_to_pipe_sigblk(UChar *, UChar *, UChar,
int *, int, sigset_t *);
extern int open_from_pipe_sigblk(UChar *, UChar *, UChar,
int *, sigset_t *);
extern Int32 open_from_to_pipe_sigblk(UChar *, int *, UChar,
int *, sigset_t *);
extern int detach_from_tty();
extern void ms_sleep(Int32);
extern int set_eff_ugids(uid_t, gid_t, int, gid_t *);
extern int get_groups(int *, gid_t **);
extern Int32 set_env(UChar *, UChar *);
extern Int32 unset_env(UChar *);
extern Int32 to_other_user(uid_t, gid_t, UGIDS *);
extern Int32 to_org_user(UGIDS *);
extern int create_unix_socket(UChar *);
extern int open_uxsock_conn(UChar *);
extern Uns32 syslog_facility_from_string(UChar *);
#ifdef __cplusplus
}
#endif
/* according to experience and man-pages, FD_CLOEXEC is
* always the only bit that can be modified with F_SETFD
* and it always seems to be defined to 1 */
#ifndef FD_CLOEXEC
#define FD_CLOEXEC 1
#endif
#define set_closeonexec(fd) fcntl(fd, F_SETFD, fcntl(fd, F_GETFD) | FD_CLOEXEC)
#endif /* ! defined(__SYSUTILS_H) */
/************ end of $RCSfile: sysutils.h,v $ ******************/
|