diff --git a/configure.ac b/configure.ac index 0724abe5dda0eedb69ac201b5723adb8cd1d4cb0..30ba55e18b94ca037e0b2ae67a5fa0b82f844371 100644 --- a/configure.ac +++ b/configure.ac @@ -206,6 +206,7 @@ AC_CONFIG_FILES([Makefile src/plugins/jobcomp/none/Makefile src/plugins/jobcomp/script/Makefile src/plugins/proctrack/Makefile + src/plugins/proctrack/aix/Makefile src/plugins/proctrack/sid/Makefile src/plugins/sched/Makefile src/plugins/sched/backfill/Makefile diff --git a/doc/man/man5/slurm.conf.5 b/doc/man/man5/slurm.conf.5 index 1fd5115a58cc1d72f565069a8a6a3a44d2f356ee..a4805a9b2cc8ca61d9df0487ec98c77c4b1065c6 100644 --- a/doc/man/man5/slurm.conf.5 +++ b/doc/man/man5/slurm.conf.5 @@ -186,7 +186,7 @@ The default value is "/usr/local/lib/slurm". Identifies the plugin to be used for process tracking. The slurmd daemon uses this mechanism to identify all processes which are children of processes it spawns for a user job. -Acceptable vlues at present include "proctrack/kern_ext" (which +Acceptable values at present include "proctrack/aix" (which is the default for AIX systems) and "proctrack/sid" (which is the default for all other systems). The slurmd daemon must be restarted for a change in ProctrackType diff --git a/etc/slurm.conf.example b/etc/slurm.conf.example index 28fc8c2f8d67da0d6defbeb23d8fd1895a232ea6..aae21ca01faaeefcfb67112e8de1507b9096e773 100644 --- a/etc/slurm.conf.example +++ b/etc/slurm.conf.example @@ -202,11 +202,11 @@ # # o Define the process tracking mechanism in use. # -# "ProctrackType" : the type of process tracking mechanism -# "proctrack/kern_ext" : use AIX kernel extension for process tracking, -# the default value on AIX computers -# "proctrack/sid" : use Unix session ID for process tracking, -# the default value on all other computers +# "ProctrackType" : the type of process tracking mechanism +# "proctrack/aix" : use AIX kernel extension for process tracking, +# the default value on AIX computers +# "proctrack/sid" : use Unix session ID for process tracking, +# the default value on all other computers # # ProctrackType=proctrack/sid diff --git a/slurm.spec.in b/slurm.spec.in index 4de16414be22b0f13b90d9d67a20eddbd1befa57..dd1714ae0a7989577f783749128f3176ff4d3946 100644 --- a/slurm.spec.in +++ b/slurm.spec.in @@ -181,6 +181,7 @@ rm -rf $RPM_BUILD_ROOT %{_libdir}/slurm/jobcomp_none.so %{_libdir}/slurm/jobcomp_filetxt.so %{_libdir}/slurm/jobcomp_script.so +%{_libdir}/slurm/proctrack_aix.so %{_libdir}/slurm/proctrack_sid.so %{_libdir}/slurm/sched_backfill.so %{_libdir}/slurm/sched_builtin.so @@ -268,6 +269,8 @@ fi %changelog +* Fri Mar 04 2005 Morris Jette <jette1@llnl.gov> +- added proctrack_aix plugin * Fri Feb 25 2005 Morris Jette <jette1@llnl.gov> - added proctrack_sid plugin * Thu Feb 24 2005 Morris Jette <jette1@llnl.gov> diff --git a/src/common/read_config.h b/src/common/read_config.h index 714decea8e4c1ec3e8c678dc1bb5947f3c39ed8f..7f4f9416a77a128b4998dbd8994718ac99849122 100644 --- a/src/common/read_config.h +++ b/src/common/read_config.h @@ -44,7 +44,7 @@ #define DEFAULT_MIN_JOB_AGE 300 #define DEFAULT_MPICH_GM_DIR 0 #ifdef HAVE_AIX /* AIX specific default configuration parameters */ -# define DEFAULT_PROCTRACK_TYPE "proctrack/ker_ext" +# define DEFAULT_PROCTRACK_TYPE "proctrack/aix" #else # define DEFAULT_PROCTRACK_TYPE "proctrack/sid" #endif diff --git a/src/plugins/proctrack/Makefile.am b/src/plugins/proctrack/Makefile.am index 9d73fdb4d5ce35bed7c1a80033ce762b283eb449..cc680d33937a1e2c9be7d74092dcab77eba4811d 100644 --- a/src/plugins/proctrack/Makefile.am +++ b/src/plugins/proctrack/Makefile.am @@ -1,4 +1,4 @@ # $Id$ # Makefile for proctrack plugins -SUBDIRS = sid +SUBDIRS = aix sid diff --git a/src/plugins/proctrack/aix/Makefile.am b/src/plugins/proctrack/aix/Makefile.am new file mode 100644 index 0000000000000000000000000000000000000000..41a97132a8dd872d433e6c108b57ab09991401ff --- /dev/null +++ b/src/plugins/proctrack/aix/Makefile.am @@ -0,0 +1,18 @@ +# $Id$ +# Makefile for proctrack/aix plugin + +AUTOMAKE_OPTIONS = foreign + +PLUGIN_FLAGS = -module -avoid-version --export-dynamic + +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/src/common + +pkglib_LTLIBRARIES = proctrack_aix.la + +# AIX process tracking kernel extension plugin. +proctrack_aix_la_SOURCES = proctrack_aix.c +proctrack_aix_la_LDFLAGS = $(SO_LDFLAGS) $(PLUGIN_FLAGS) + +if HAVE_AIX +proctrack_aix_la_LIBADD = $(top_builddir)/src/common/libcommon.la +endif diff --git a/src/plugins/proctrack/aix/proctrack_aix.c b/src/plugins/proctrack/aix/proctrack_aix.c new file mode 100644 index 0000000000000000000000000000000000000000..de715099d65e92b9b158038449c7ea970f15816d --- /dev/null +++ b/src/plugins/proctrack/aix/proctrack_aix.c @@ -0,0 +1,139 @@ +/*****************************************************************************\ + * proctrack_aix.c - process tracking via AIX kernel extension. + ***************************************************************************** + * Copyright (C) 2005 The Regents of the University of California. + * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). + * Written by Morris Jette <jette1@llnl.gov> et. al. + * UCRL-CODE-2002-040. + * + * This file is part of SLURM, a resource management program. + * For details, see <http://www.llnl.gov/linux/slurm/>. + * + * SLURM is free software; you can redistribute it and/or modify it under + * the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * SLURM is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along + * with SLURM; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +\*****************************************************************************/ + +#if HAVE_CONFIG_H +# include "config.h" +#endif + +#if HAVE_STDINT_H +# include <stdint.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#endif + +#include <sys/types.h> +#include <signal.h> +#include <stdlib.h> +#include <unistd.h> +#include <slurm/slurm.h> +#include <slurm/slurm_errno.h> +#include "src/common/log.h" + +#ifndef __USE_XOPEN_EXTENDED +extern pid_t getsid(pid_t pid); /* missing from <unistd.h> */ +extern pid_t setsid(void); /* missing from <unistd.h> */ +#endif + +/* + * These variables are required by the generic plugin interface. If they + * are not found in the plugin, the plugin loader will ignore it. + * + * plugin_name - a string giving a human-readable description of the + * plugin. There is no maximum length, but the symbol must refer to + * a valid string. + * + * plugin_type - a string suggesting the type of the plugin or its + * applicability to a particular form of data or method of data handling. + * If the low-level plugin API is used, the contents of this string are + * unimportant and may be anything. SLURM uses the higher-level plugin + * interface which requires this string to be of the form + * + * <application>/<method> + * + * where <application> is a description of the intended application of + * the plugin (e.g., "jobcomp" for SLURM job completion logging) and <method> + * is a description of how this plugin satisfies that application. SLURM will + * only load job completion logging plugins if the plugin_type string has a + * prefix of "jobcomp/". + * + * plugin_version - an unsigned 32-bit integer giving the version number + * of the plugin. If major and minor revisions are desired, the major + * version number may be multiplied by a suitable magnitude constant such + * as 100 or 1000. Various SLURM versions will likely require a certain + * minimum versions for their plugins as the job completion logging API + * matures. + */ +const char plugin_name[] = "Process tracking via AIX kernel extension plugin"; +const char plugin_type[] = "proctrack/aix"; +const uint32_t plugin_version = 90; + +/* + * init() is called when the plugin is loaded, before any other functions + * are called. Put global initialization here. + */ +extern int init ( void ) +{ + return SLURM_SUCCESS; +} + +extern int fini ( void ) +{ + return SLURM_SUCCESS; +} + +/* + * For this plugin, we ignore the job_id. + * To generate a unique container ID, we use setsid. + */ +extern uint32_t slurm_create_container ( uint32_t job_id ) +{ + pid_t pid = setsid(); + (void) setpgrp(); + + if (pid < 0) { + error("slurm_create_container: setpsid: %m"); + return (uint32_t) 0; + } + return (uint32_t) pid; +} + +extern int slurm_add_container ( uint32_t id ) +{ + return SLURM_SUCCESS; +} + +extern int slurm_signal_container ( uint32_t id, int signal ) +{ + pid_t pid = (pid_t) id; + + if (!id) /* no container ID */ + return ESRCH; + + return killpg(pid, signal); +} + +extern int slurm_destroy_container ( uint32_t id ) +{ + return SLURM_SUCCESS; +} + +extern uint32_t +slurm_find_container(pid_t pid) +{ + return (uint32_t) getsid(pid); +} + diff --git a/src/plugins/proctrack/sid/proctrack_sid.c b/src/plugins/proctrack/sid/proctrack_sid.c index d6a8fb3f514ac357b0c01619bba18c679638edc4..4a30881033fa0e429e1fbe99870b2301e0a8512a 100644 --- a/src/plugins/proctrack/sid/proctrack_sid.c +++ b/src/plugins/proctrack/sid/proctrack_sid.c @@ -44,6 +44,7 @@ #include "src/common/log.h" #ifndef __USE_XOPEN_EXTENDED +extern pid_t getsid(pid_t pid); /* missing from <unistd.h> */ extern pid_t setsid(void); /* missing from <unistd.h> */ #endif