AC_CHECK_HEADERS(netinet/in.h netdb.h sys/fcntl.h sys/mnttab.h sys/mntent.h)
AC_CHECK_HEADERS(mntent.h sys/vfs.h sys/param.h sys/fs_types.h sys/fstyp.h)
AC_CHECK_HEADERS(sys/mount.h strings.h termios.h signal.h sys/pag.h)
-AC_CHECK_HEADERS(windows.h direct.h sys/ipc.h)
+AC_CHECK_HEADERS(windows.h direct.h sys/ipc.h sys/resource.h)
AC_CHECK_HEADERS(security/pam_modules.h ucontext.h regex.h sys/statvfs.h sys/statfs.h sys/bitypes.h)
AC_CHECK_HEADERS(linux/errqueue.h,,,[#include <linux/types.h>])
AC_CHECK_HEADERS(et/com_err.h)
fi
AC_SUBST(BUILD_LOGIN)
-AC_CHECK_FUNCS(snprintf strlcat strlcpy flock)
+AC_CHECK_FUNCS(snprintf strlcat strlcpy flock getrlimit)
AC_CHECK_FUNCS(setprogname getprogname sigaction mkstemp vsnprintf strerror strcasestr)
AC_CHECK_FUNCS(setvbuf vsyslog getcwd)
AC_CHECK_FUNCS(regcomp regexec regerror)
B<bosserver> [B<-noauth>] [B<-log>] [B<-enable_peer_stats>]
S<<< [B<-auditlog> <I<log path>>] >>> [B<-audit-interface> (file | sysvmq)]
[B<-enable_process_stats>] [B<-allow-dotted-principals>]
+ [B<-cores=>(none|<I<path>>)]
[B<-restricted>] [B<-help>]
=for html
successfully issue a privileged B<bos> command (one that requires being
listed in the F</usr/afs/etc/UserList> file).
+=item B<-cores=>none|<I<path>>
+
+The argument none turns off core file generation. Otherwise, the
+argument is a path where core files will be stored.
+
=item B<-auditlog> <I<log path>>
Turns on audit logging, and sets the path for the audit log. The audit
int weirdPids;
} bnode_stats;
+extern const char *DoCore;
#ifndef AFS_NT40_ENV
extern char **environ; /* env structure */
#endif
int
bnode_CoreName(register struct bnode *abnode, char *acoreName, char *abuffer)
{
- strcpy(abuffer, AFSDIR_SERVER_CORELOG_FILEPATH);
+ if (DoCore) {
+ strcpy(abuffer, DoCore);
+ strcat(abuffer, "/");
+ strcat(abuffer, AFSDIR_CORE_FILE);
+ } else
+ strcpy(abuffer, AFSDIR_SERVER_CORELOG_FILEPATH);
if (acoreName) {
strcat(abuffer, acoreName);
strcat(abuffer, ".");
{
char tbuffer[256];
struct stat tstat;
- register afs_int32 code;
+ register afs_int32 code = 0;
char *corefile = NULL;
#ifdef BOZO_SAVE_CORES
struct timeval Start;
/* Linux always appends the PID to core dumps from threaded processes, so
* we have to scan the directory to find core files under another name. */
- code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
+ if (DoCore) {
+ strcpy(tbuffer, DoCore);
+ strcat(tbuffer, "/");
+ strcat(tbuffer, AFSDIR_CORE_FILE);
+ } else
+ code = stat(AFSDIR_SERVER_CORELOG_FILEPATH, &tstat);
if (code) {
DIR *logdir;
struct dirent *file;
size_t length;
unsigned long pid;
+ const char *coredir = AFSDIR_LOGS_DIR;
+
+ if (DoCore)
+ coredir = DoCore;
- logdir = opendir(AFSDIR_LOGS_DIR);
+ logdir = opendir(coredir);
if (logdir == NULL)
return;
while ((file = readdir(logdir)) != NULL) {
continue;
pid = atol(file->d_name + 5);
if (pid == aproc->pid) {
- length = strlen(AFSDIR_LOGS_DIR) + strlen(file->d_name) + 2;
+ length = strlen(coredir) + strlen(file->d_name) + 2;
corefile = malloc(length);
if (corefile == NULL) {
closedir(logdir);
return;
}
- snprintf(corefile, length, "%s/%s", AFSDIR_LOGS_DIR,
- file->d_name);
+ snprintf(corefile, length, "%s/%s", coredir, file->d_name);
code = 0;
break;
}
}
closedir(logdir);
+ } else {
+ corefile = strdup(tbuffer);
}
if (code)
return;
TimeFields->tm_hour, TimeFields->tm_min, TimeFields->tm_sec);
strcpy(tbuffer, FileName);
#endif
- if (corefile == NULL)
- code = renamefile(AFSDIR_SERVER_CORELOG_FILEPATH, tbuffer);
- else {
- code = renamefile(corefile, tbuffer);
- free(corefile);
- }
+ code = renamefile(corefile, tbuffer);
+ free(corefile);
}
int
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_RESOURCE_H
+#include <sys/resource.h>
+#endif
#ifdef AFS_NT40_ENV
#include <winsock2.h>
#include <direct.h>
const char *bozo_fileName;
FILE *bozo_logFile;
+const char *DoCore;
int DoLogging = 0;
int DoSyslog = 0;
#ifndef AFS_NT40_ENV
/* create all the bozo dirs */
static int
-CreateDirs(void)
+CreateDirs(const char *coredir)
{
if ((!strncmp
(AFSDIR_USR_DIRPATH, AFSDIR_CLIENT_ETC_DIRPATH,
symlink(AFSDIR_SERVER_CELLSERVDB_FILEPATH,
AFSDIR_CLIENT_CELLSERVDB_FILEPATH);
#endif /* AFS_NT40_ENV */
+ if (coredir)
+ MakeDir(coredir);
return 0;
}
/* some path inits */
bozo_fileName = AFSDIR_SERVER_BOZCONF_FILEPATH;
+ DoCore = AFSDIR_SERVER_LOGS_DIRPATH;
/* initialize the list of dirpaths that the bosserver has
* an interest in monitoring */
} else if (strncmp(argv[code], "-syslog=", 8) == 0) {
DoSyslog = 1;
DoSyslogFacility = atoi(argv[code] + 8);
+ } else if (strncmp(argv[code], "-cores=", 7) == 0) {
+ if (strcmp((argv[code]+7), "none") == 0)
+ DoCore = 0;
+ else
+ DoCore = (argv[code]+7);
} else if (strcmp(argv[code], "-nofork") == 0) {
nofork = 1;
}
"[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
"[-syslog[=FACILITY]] "
"[-enable_peer_stats] [-enable_process_stats] "
+ "[-cores=<none|path>] \n"
"[-nofork] " "[-help]\n");
#else
printf("Usage: bosserver [-noauth] [-log] "
"[-audit-interafce <file|sysvmq> (default is file)] "
"[-rxmaxmtu <bytes>] [-rxbind] [-allow-dotted-principals]"
"[-enable_peer_stats] [-enable_process_stats] "
+ "[-cores=<none|path>] \n"
"[-help]\n");
#endif
fflush(stdout);
bnode_Register("cron", &cronbnode_ops, 2);
/* create useful dirs */
- CreateDirs();
+ CreateDirs(DoCore);
/* chdir to AFS log directory */
- chdir(AFSDIR_SERVER_LOGS_DIRPATH);
+ if (DoCore)
+ chdir(DoCore);
+ else
+ chdir(AFSDIR_SERVER_LOGS_DIRPATH);
#if 0
fputs(AFS_GOVERNMENT_MESSAGE, stdout);
#endif
}
+#if defined(RLIMIT_CORE) && defined(HAVE_GETRLIMIT)
+ {
+ struct rlimit rlp;
+ getrlimit(RLIMIT_CORE, &rlp);
+ if (!DoCore)
+ rlp.rlim_cur = 0;
+ else
+ rlp.rlim_max = rlp.rlim_cur = RLIM_INFINITY;
+ setrlimit(RLIMIT_CORE, &rlp);
+ getrlimit(RLIMIT_CORE, &rlp);
+ bozo_Log("Core limits now %d %d\n",(int)rlp.rlim_cur,(int)rlp.rlim_max);
+ }
+#endif
+
/* Write current state of directory permissions to log file */
DirAccessOK();