* 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.
Этот коммит содержится в:
родитель
fa7f6f6722
Коммит
881dd0654e
@ -35,6 +35,9 @@
|
|||||||
#ifdef HAVE_SYS_TYPES_H
|
#ifdef HAVE_SYS_TYPES_H
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef HAVE_SYS_STAT_H
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#endif
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#endif
|
#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;
|
int maxtime=0, mintime=99999999, maxiter = 0, miniter = 0, deltat;
|
||||||
float avgtime=0.0;
|
float avgtime=0.0;
|
||||||
bool failed_launch = true;
|
bool failed_launch = true;
|
||||||
|
mode_t current_umask;
|
||||||
|
|
||||||
/* check for timing request - get start time if so */
|
/* check for timing request - get start time if so */
|
||||||
if (mca_pls_tm_component.timing) {
|
if (mca_pls_tm_component.timing) {
|
||||||
@ -236,6 +240,12 @@ static int pls_tm_launch_job(orte_jobid_t jobid)
|
|||||||
* won't work on remote nodes
|
* won't work on remote nodes
|
||||||
*/
|
*/
|
||||||
orte_pls_base_purge_mca_params(&env);
|
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
|
/* If we have a prefix, then modify the PATH and
|
||||||
LD_LIBRARY_PATH environment variables. We only allow
|
LD_LIBRARY_PATH environment variables. We only allow
|
||||||
|
@ -19,9 +19,44 @@
|
|||||||
* $HEADER$
|
* $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"
|
#include "orte/orted/orted.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
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);
|
return orte_daemon(argc, argv);
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user