• Main Page
  • Data Structures
  • Files
  • File List
  • Globals

include/common.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: common.h 47 2010-11-24 01:59:04Z julianthome $
00003  *
00004  *   pam_netns - Linux-PAM module for instantiating session network namespaces
00005  *
00006  *   Copyright (C) 2010 Wilhelm Meier (wilhelm.meier@informatik.fh-kl.de)
00007  *
00008  *   This program is free software; you can redistribute it and/or modify it under the terms of
00009  *   the GNU General Public License as published by the Free Software Foundation;
00010  *   either version 3 of the License, or (at your option) any later version.
00011  *
00012  *   This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
00013  *   without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00014  *   See the GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License along with this program;
00017  *   if not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00027 #ifndef COMMON_H
00028 #define COMMON_H
00029 
00030 // we require POSIX 200809 compytibility
00031 
00032 #define _POSIX_C_SOURCE 200809L
00033 #ifndef _XOPEN_SOURCE
00034 #define _XOPEN_SOURCE   700
00035 #endif
00036 
00037 #ifndef UNIX_PATH_MAX
00038 #define UNIX_PATH_MAX 108       // see <linux/un.h>
00039 #endif
00040 
00041 // needed for unshare()
00042 #define _BSD_SOURCE
00043 #define _GNU_SOURCE
00044 #include <unistd.h>
00045 #include <limits.h>
00046 #include <time.h>
00047 #include <stdarg.h>
00048 #include <stdio.h>
00049 #include <stdlib.h>
00050 #include <fcntl.h>
00051 #include <pwd.h>
00052 #include <string.h>
00053 #include <signal.h>
00054 #include <errno.h>
00055 #include <syslog.h>
00056 #include <sys/select.h>
00057 #include <sys/types.h>
00058 #include <sys/wait.h>
00059 #include <sys/utsname.h>
00060 #include <sys/stat.h>
00061 #include <sys/socket.h>
00062 #include <sys/un.h>
00063 #include <netinet/in.h>
00064 #include <arpa/inet.h>
00065 #include <dirent.h>
00066 #include <sched.h>
00067 #include <stddef.h>
00068 #include <stdbool.h>
00069 #include <assert.h>
00070 
00071 #include <libintl.h>
00072 #include <locale.h>
00073 
00074 #if defined(_POSIX_THREADS) && ((_POSIX_THREADS - 0) >= 0)
00075 #include <pthread.h>
00076 #endif
00077 
00078 #if (_POSIX_MAPPED_FILES - 0) >= 0 || (_POSIX_SHARED_MEMORY_OBJECTS - 0) >= 0 || \
00079 (_POSIX_MEMLOCK - 0) >= 0 || (_POSIX_MEMORY_PROTECTION - 0) >= 0 || \
00080 (_POSIX_TYPED_MEMORY_OBJECTS - 0) >= 0 || (_POSIX_SYNCHRONIZED_IO - 0) >= 0 || \
00081 (_POSIX_ADVISORY_INFO - 0) >= 0
00082 #include <sys/mman.h>
00083 #endif
00084 
00085 #if (_POSIX_MAPPED_FILES - 0) >= 0 || (_POSIX_SHARED_MEMORY_OBJECTS - 0) >= 0 || \
00086 (_POSIX_TYPED_MEMORY_OBJECTS - 0) >= 0
00087 #define _MC3                    /* see POSIX Standard margin notes */
00088 #endif
00089 
00090 #if defined(_POSIX_MESSAGE_PASSING) && ((_POSIX_MESSAGE_PASSING - 0) >= 0)
00091 #include <mqueue.h>
00092 #endif
00093 
00094 #ifdef _XOPEN_UNIX
00095 #include <strings.h>
00096 #include <utmpx.h>
00097 #include <sys/resource.h>
00098 #include <sys/uio.h>
00099 #include <sys/time.h>
00100 #include <sys/shm.h>
00101 #include <sys/ipc.h>
00102 #include <sys/sem.h>
00103 #include <sys/msg.h>
00104 #ifndef CYGWIN
00105 #include <ftw.h>
00106 #endif
00107 #endif
00108 
00109 #define PIPE_READ 0
00110 #define PIPE_WRITE 1
00111 
00118 #ifdef _NO_PAM_SYSLOG
00119 #define logdbg(...)                     syslog(LOG_AUTHPRIV | LOG_DEBUG, __VA_ARGS__)
00120 #define loginfo(...)                    syslog(LOG_AUTHPRIV | LOG_INFO, __VA_ARGS__)
00121 #define logerr(...)                     syslog(LOG_AUTHPRIV | LOG_ERR, __VA_ARGS__ )
00122 
00123 #else
00124 
00125 #define logdbg(...)                     if ( pam_netns_options.debug != 0 ) \
00126                                                  pam_syslog(pam_netns_options.pamh, LOG_DEBUG, __VA_ARGS__)
00127 #define loginfo(...)                    pam_syslog(pam_netns_options.pamh, LOG_INFO, __VA_ARGS__)
00128 #define logerr(...)                     pam_syslog(pam_netns_options.pamh, LOG_ERR, __VA_ARGS__ )
00129 #endif
00130 typedef struct ucred ucred_t;
00131 
00132 #ifndef UNUSED
00133 #ifdef __GNUC__
00134 #define UNUSED __attribute__ ((unused))
00135 #else
00136 #define UNUSED
00137 #endif
00138 #endif
00139 
00140 #endif

Generated on Thu Dec 2 2010 13:12:28 for pam_netns by  doxygen 1.7.1