1
1

* Provide a hook so that a PLS can tell the orted it's starting that it

needs to override the default umask.  By default, this is not used
    since most environments do what the user would expect without any
    help.
  * Have TM use the newly added umask hook, so that processes inherit
    the user's umask from mpirun rather than the pbs_mom's umask, which
    the user has no control over.

This commit was SVN r15858.
Этот коммит содержится в:
Brian Barrett 2007-08-14 18:44:52 +00:00
родитель fa7f6f6722
Коммит 881dd0654e
2 изменённых файлов: 45 добавлений и 0 удалений

Просмотреть файл

@ -35,6 +35,9 @@
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
@ -139,6 +142,7 @@ static int pls_tm_launch_job(orte_jobid_t jobid)
int maxtime=0, mintime=99999999, maxiter = 0, miniter = 0, deltat;
float avgtime=0.0;
bool failed_launch = true;
mode_t current_umask;
/* check for timing request - get start time if so */
if (mca_pls_tm_component.timing) {
@ -237,6 +241,12 @@ static int pls_tm_launch_job(orte_jobid_t jobid)
*/
orte_pls_base_purge_mca_params(&env);
/* add our umask -- see big note in orted.c */
current_umask = umask(0);
umask(current_umask);
asprintf(&var, "0%o", current_umask);
opal_setenv("ORTE_DAEMON_UMASK_VALUE", var, true, &env);
/* If we have a prefix, then modify the PATH and
LD_LIBRARY_PATH environment variables. We only allow
a single prefix to be specified. Since there will

Просмотреть файл

@ -19,9 +19,44 @@
* $HEADER$
*/
#include "orte_config.h"
#include <stdlib.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
#include <stdio.h>
#include "orte/orted/orted.h"
int main(int argc, char *argv[])
{
/* Allow the PLS starters to pass us a umask to use, if required.
Most starters by default can do something sane with the umask,
but some (like TM) do not pass on the umask but instead inherit
it form the root level process starter. This has to happen
before opal_init and everything else so that the couple of
places that stash a umask end up with the correct value. Only
do it here (and not in orte_daemon) mainly to make it clear
that this should only happen when starting an orted for the
first time. All startes I'm aware of that don't require an
orted are smart enough to pass on a reasonable umask, so they
wouldn't need this functionality anyway. */
char *umask_str = getenv("ORTE_DAEMON_UMASK_VALUE");
if (NULL != umask_str) {
char *endptr;
long mask = strtol(umask_str, &endptr, 8);
if ((! (0 == mask && (EINVAL == errno || ERANGE))) &&
(*endptr == '\0')) {
umask(mask);
}
}
return orte_daemon(argc, argv);
}