~ubuntu-branches/ubuntu/vivid/slurm-llnl/vivid

« back to all changes in this revision

Viewing changes to src/common/parse_config.c

  • Committer: Bazaar Package Importer
  • Author(s): Gennaro Oliva
  • Date: 2009-09-24 23:28:15 UTC
  • mfrom: (1.1.11 upstream) (3.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20090924232815-enh65jn32q1ebg07
Tags: 2.0.5-1
* New upstream release 
* Changed dependecy from lib-mysqlclient15 to lib-mysqlclient 
* Added Default-Start for runlevel 2 and 4 and $remote_fs requirement in
  init.d scripts (Closes: #541252)
* Postinst checks for wrong runlevels 2 and 4 links
* Upgraded to standard version 3.8.3
* Add lintian overrides for missing slurm-llnl-configurator.html in doc
  base registration
* modified postrm scripts to ignore pkill return value in order to avoid
  postrm failure when no slurm process is running
* Checking for slurmctld.pid before cancelling running and pending
  jobs during package removal 

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
 *  NOTE: when you see the prefix "s_p_", think "slurm parser".
5
5
 *****************************************************************************
6
6
 *  Copyright (C) 2006-2007 The Regents of the University of California.
7
 
 *  Copyright (C) 2008 Lawrence Livermore National Security.
 
7
 *  Copyright (C) 2008-2009 Lawrence Livermore National Security.
8
8
 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
9
9
 *  Written by Christopher J. Morrone <morrone2@llnl.gov>.
10
 
 *  LLNL-CODE-402394.
 
10
 *  CODE-OCEC-09-009. All rights reserved.
11
11
 *  
12
12
 *  This file is part of SLURM, a resource management program.
13
 
 *  For details, see <http://www.llnl.gov/linux/slurm/>.
 
13
 *  For details, see <https://computing.llnl.gov/linux/slurm/>.
 
14
 *  Please also read the included file: DISCLAIMER.
14
15
 *  
15
16
 *  SLURM is free software; you can redistribute it and/or modify it under
16
17
 *  the terms of the GNU General Public License as published by the Free
18
19
 *  any later version.
19
20
 *
20
21
 *  In addition, as a special exception, the copyright holders give permission 
21
 
 *  to link the code of portions of this program with the OpenSSL library under 
 
22
 *  to link the code of portions of this program with the OpenSSL library under
22
23
 *  certain conditions as described in each individual source file, and 
23
24
 *  distribute linked combinations including the two. You must obey the GNU 
24
25
 *  General Public License in all respects for all of the code used other than 
376
377
                          const char *value, const char *line, char **leftover)
377
378
{
378
379
        if (v->data_count != 0) {
379
 
                debug("%s specified more than once", v->key);
 
380
                error("%s specified more than once, latest value used", 
 
381
                      v->key);
380
382
                xfree(v->data);
381
383
                v->data_count = 0;
382
384
        }
400
402
                        const char *value, const char *line, char **leftover)
401
403
{
402
404
        if (v->data_count != 0) {
403
 
                debug("%s specified more than once", v->key);
 
405
                error("%s specified more than once, latest value used", 
 
406
                      v->key);
404
407
                xfree(v->data);
405
408
                v->data_count = 0;
406
409
        }
421
424
                    || (*endptr != '\0')) {
422
425
                        if (strcasecmp(value, "UNLIMITED") == 0
423
426
                            || strcasecmp(value, "INFINITE") == 0) {
424
 
                                num = (long)-1;
 
427
                                num = (long) INFINITE;
425
428
                        } else {
426
429
                                error("\"%s\" is not a valid number", value);
427
430
                                return -1;
442
445
                          const char *value, const char *line, char **leftover)
443
446
{
444
447
        if (v->data_count != 0) {
445
 
                debug("%s specified more than once", v->key);
 
448
                error("%s specified more than once, latest value used", 
 
449
                      v->key);
446
450
                xfree(v->data);
447
451
                v->data_count = 0;
448
452
        }
464
468
                    || (*endptr != '\0')) {
465
469
                        if (strcasecmp(value, "UNLIMITED") == 0
466
470
                            || strcasecmp(value, "INFINITE") == 0) {
467
 
                                num = (uint16_t)-1;
 
471
                                num = (uint16_t) INFINITE;
468
472
                        } else {
469
473
                                error("%s value \"%s\" is not a valid number", 
470
474
                                        v->key, value);
474
478
                        error("%s value (%s) is out of range", v->key, value);
475
479
                        return -1;
476
480
                } else if (value[0] == '-') {
477
 
                        error("%s value (%s) is less than zero", v->key, value);
 
481
                        error("%s value (%s) is less than zero", v->key, 
 
482
                              value);
478
483
                        return -1;
479
484
                } else if (num > 0xffff) {
480
485
                        error("%s value (%s) is greater than 65535", v->key,
493
498
                          const char *value, const char *line, char **leftover)
494
499
{
495
500
        if (v->data_count != 0) {
496
 
                debug("%s specified more than once", v->key);
 
501
                error("%s specified more than once, latest value used", 
 
502
                      v->key);
497
503
                xfree(v->data);
498
504
                v->data_count = 0;
499
505
        }
519
525
                    || (*endptr != '\0')) {
520
526
                        if ((strcasecmp(value, "UNLIMITED") == 0) ||
521
527
                            (strcasecmp(value, "INFINITE")  == 0)) {
522
 
                                num = (uint32_t)-1;
 
528
                                num = (uint32_t) INFINITE;
523
529
                        } else {
524
530
                                error("%s value (%s) is not a valid number", 
525
531
                                        v->key, value);
529
535
                        error("%s value (%s) is out of range", v->key, value);
530
536
                        return -1;
531
537
                } else if (value[0] == '-') {
532
 
                        error("%s value (%s) is less than zero", v->key, value);
 
538
                        error("%s value (%s) is less than zero", v->key, 
 
539
                              value);
533
540
                        return -1;
534
541
                } else if (num > 0xffffffff) {
535
542
                        error("%s value (%s) is greater than 4294967295", 
545
552
}
546
553
 
547
554
static int _handle_pointer(s_p_values_t *v,
548
 
                           const char *value, const char *line, char **leftover)
 
555
                           const char *value, const char *line, 
 
556
                           char **leftover)
549
557
{
550
558
        if (v->handler != NULL) {
551
559
                /* call the handler function */
556
564
                        return rc == 0 ? 0 : -1;
557
565
        } else {
558
566
                if (v->data_count != 0) {
559
 
                        debug("%s specified more than once", v->key);
 
567
                        error("%s specified more than once, "
 
568
                              "latest value used", v->key);
560
569
                        xfree(v->data);
561
570
                        v->data_count = 0;
562
571
                }
592
601
}
593
602
 
594
603
static int _handle_boolean(s_p_values_t *v,
595
 
                           const char *value, const char *line, char **leftover)
 
604
                           const char *value, const char *line, 
 
605
                           char **leftover)
596
606
{
597
607
        if (v->data_count != 0) {
598
 
                debug("%s specified more than once", v->key);
 
608
                error("%s specified more than once, latest value used", 
 
609
                      v->key);
599
610
                xfree(v->data);
600
611
                v->data_count = 0;
601
612
        }
808
819
        int merged_lines;
809
820
        int inc_rc;
810
821
 
811
 
        if(!filename) {
 
822
        if (!filename) {
812
823
                error("s_p_parse_file: No filename given.");
813
824
                return SLURM_ERROR;
814
825
        }
823
834
        }
824
835
 
825
836
        line_number = 1;
826
 
        while((merged_lines = _get_next_line(line, BUFFER_SIZE, f)) > 0) {
 
837
        while ((merged_lines = _get_next_line(line, BUFFER_SIZE, f)) > 0) {
827
838
                /* skip empty lines */
828
839
                if (line[0] == '\0') {
829
840
                        line_number += merged_lines;
1064
1075
 * that element contains a pointer to the newly parsed value.  You can
1065
1076
 * think of this as being an array of S_P_POINTER types.
1066
1077
 *
1067
 
 * OUT ptr_array - pointer to a void pointer-pointer where the value is returned
 
1078
 * OUT ptr_array - pointer to void pointer-pointer where the value is returned
1068
1079
 * OUT count - length of ptr_array
1069
1080
 * IN key - hash table key
1070
1081
 * IN hashtbl - hash table created by s_p_hashtbl_create()