1 /*****************************************************************************\ 2 * opt.h - definitions for sattach option processing 3 ***************************************************************************** 4 * Copyright (C) 2002-2006 The Regents of the University of California. 5 * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). 6 * Written by Mark Grondona <grondona1@llnl.gov>, 7 * Christopher J. Morrone <morrone2@llnl.gov>, et. al. 8 * CODE-OCEC-09-009. All rights reserved. 9 * 10 * This file is part of Slurm, a resource management program. 11 * For details, see <https://slurm.schedmd.com/>. 12 * Please also read the included file: DISCLAIMER. 13 * 14 * Slurm is free software; you can redistribute it and/or modify it under 15 * the terms of the GNU General Public License as published by the Free 16 * Software Foundation; either version 2 of the License, or (at your option) 17 * any later version. 18 * 19 * Slurm is distributed in the hope that it will be useful, but WITHOUT ANY 20 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 21 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 22 * details. 23 * 24 * You should have received a copy of the GNU General Public License along 25 * with Slurm; if not, write to the Free Software Foundation, Inc., 26 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 27 \*****************************************************************************/ 28 29 #ifndef _HAVE_OPT_H 30 #define _HAVE_OPT_H 31 32 #include <time.h> 33 #include <sys/types.h> 34 #include <unistd.h> 35 36 #include "slurm/slurm.h" 37 38 #include "src/common/macros.h" /* true and false */ 39 #include "src/common/env.h" 40 41 42 /* global variables relating to user options */ 43 extern int _verbose; 44 45 typedef struct sbatch_options { 46 char *progname; /* argv[0] of this program or 47 * configuration file if multi_prog */ 48 char *user; /* local username */ 49 uid_t uid; /* local uid */ 50 gid_t gid; /* local gid */ 51 uid_t euid; /* effective user --uid=user */ 52 gid_t egid; /* effective group --gid=group */ 53 char *job_name; /* --job-name=, -J name */ 54 uint32_t jobid; 55 uint32_t stepid; 56 bool jobid_set; /* true of jobid explicitly set */ 57 int quiet; 58 int verbose; 59 char *ctrl_comm_ifhn; 60 bool labelio; 61 slurm_step_io_fds_t fds; 62 bool layout_only; 63 bool debugger_test; 64 uint32_t input_filter; 65 bool input_filter_set; 66 uint32_t output_filter; 67 bool output_filter_set; 68 uint32_t error_filter; 69 bool error_filter_set; 70 bool pty; /* --pty */ 71 } opt_t; 72 73 extern opt_t opt; 74 extern int error_exit; 75 76 /* process options: 77 * 1. set defaults 78 * 2. update options with env vars 79 * 3. update options with commandline args 80 * 4. perform some verification that options are reasonable 81 */ 82 int initialize_and_process_args(int argc, char **argv); 83 84 /* set options based upon commandline args */ 85 void set_options(const int argc, char **argv); 86 87 88 #endif /* _HAVE_OPT_H */ 89