Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (16 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/util-linux/ipcrm.c

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    2  * ipcrm.c -- utility to allow removal of IPC objects and data structures.
     3 * ipcrm.c - utility to allow removal of IPC objects and data structures.
    34 *
    45 * 01 Sept 2004 - Rodney Radford <rradford@mindspring.com>
    56 * Adapted for busybox from util-linux-2.12a.
    67 *
    7  * This program is free software; you can redistribute it and/or modify
    8  * it under the terms of the GNU General Public License as published by
    9  * the Free Software Foundation; either version 2 of the License, or
    10  * (at your option) any later version.
    11  *
    12  * This program is distributed in the hope that it will be useful,
    13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    15  * General Public License for more details.
    16  *
    17  * You should have received a copy of the GNU General Public License
    18  * along with this program; if not, write to the Free Software
    19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    20  *
    21  * --- Pre-busybox history from util-linux-2.12a ------------------------
    22  *
    23  * 1999-04-02 frank zago
    24  * - can now remove several id's in the same call
    25  *
    26  * 1999-02-22 Arkadiusz Miÿkiewicz <misiek@pld.ORG.PL>
    27  * - added Native Language Support
    28  *
    29  * Original author - krishna balasubramanian 1993
     8 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
    309 */
    3110
    32 #include <stdio.h>
    33 #include <stdlib.h>
    34 #include <string.h>
    35 #include <errno.h>
    36 
    37 #include <sys/types.h>
     11#include "libbb.h"
     12
     13/* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
     14/* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
    3815#include <sys/ipc.h>
    3916#include <sys/shm.h>
     
    4118#include <sys/sem.h>
    4219
    43 /* X/OPEN tells us to use <sys/{types,ipc,sem}.h> for semctl() */
    44 /* X/OPEN tells us to use <sys/{types,ipc,msg}.h> for msgctl() */
    45 /* for getopt */
    46 #include <unistd.h>
    47 
    48 /* for tolower and isupper */
    49 #include <ctype.h>
    50 
    51 #include "busybox.h"
    52 
    53 #if defined (__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
     20#if defined(__GNU_LIBRARY__) && !defined(_SEM_SEMUN_UNDEFINED)
    5421/* union semun is defined by including <sys/sem.h> */
    5522#else
     
    6330#endif
    6431
     32#define IPCRM_LEGACY 1
     33
     34
     35#if IPCRM_LEGACY
     36
    6537typedef enum type_id {
    6638    SHM,
     
    6941} type_id;
    7042
    71 static int
    72 remove_ids(type_id type, int argc, char **argv) {
    73     int id;
    74     int ret = 0;        /* for gcc */
    75     char *end;
     43static int remove_ids(type_id type, int argc, char **argv)
     44{
     45    unsigned long id;
     46    int ret = 0;        /* silence gcc */
    7647    int nb_errors = 0;
    7748    union semun arg;
     
    7950    arg.val = 0;
    8051
    81     while(argc) {
    82 
    83         id = strtoul(argv[0], &end, 10);
    84 
    85         if (*end != 0) {
    86             bb_printf ("invalid id: %s\n", argv[0]);
    87             nb_errors ++;
     52    while (argc) {
     53        id = bb_strtoul(argv[0], NULL, 10);
     54        if (errno || id > INT_MAX) {
     55            bb_error_msg("invalid id: %s", argv[0]);
     56            nb_errors++;
    8857        } else {
    89             switch(type) {
    90             case SEM:
    91                 ret = semctl (id, 0, IPC_RMID, arg);
    92                 break;
    93 
    94             case MSG:
    95                 ret = msgctl (id, IPC_RMID, NULL);
    96                 break;
    97 
    98             case SHM:
    99                 ret = shmctl (id, IPC_RMID, NULL);
    100                 break;
    101             }
     58            if (type == SEM)
     59                ret = semctl(id, 0, IPC_RMID, arg);
     60            else if (type == MSG)
     61                ret = msgctl(id, IPC_RMID, NULL);
     62            else if (type ==  SHM)
     63                ret = shmctl(id, IPC_RMID, NULL);
    10264
    10365            if (ret) {
    104                 bb_printf ("cannot remove id %s (%s)\n",
    105                     argv[0], strerror(errno));
    106                 nb_errors ++;
     66                bb_perror_msg("cannot remove id %s", argv[0]);
     67                nb_errors++;
    10768            }
    10869        }
     
    11172    }
    11273
    113     return(nb_errors);
     74    return nb_errors;
    11475}
    115 
    116 static int deprecated_main(int argc, char **argv)
    117 {
    118     if (argc < 3) {
    119         bb_show_usage();
    120         bb_fflush_stdout_and_exit(1);
    121     }
    122 
    123     if (!strcmp(argv[1], "shm")) {
    124         if (remove_ids(SHM, argc-2, &argv[2]))
    125             bb_fflush_stdout_and_exit(1);
    126     }
    127     else if (!strcmp(argv[1], "msg")) {
    128         if (remove_ids(MSG, argc-2, &argv[2]))
    129             bb_fflush_stdout_and_exit(1);
    130     }
    131     else if (!strcmp(argv[1], "sem")) {
    132         if (remove_ids(SEM, argc-2, &argv[2]))
    133             bb_fflush_stdout_and_exit(1);
    134     }
    135     else {
    136         bb_printf ("unknown resource type: %s\n", argv[1]);
    137         bb_show_usage();
    138         bb_fflush_stdout_and_exit(1);
    139     }
    140 
    141     bb_printf ("resource(s) deleted\n");
    142     return 0;
    143 }
    144 
    145 
     76#endif /* IPCRM_LEGACY */
     77
     78
     79int ipcrm_main(int argc, char **argv);
    14680int ipcrm_main(int argc, char **argv)
    14781{
    148     int   c;
    149     int   error = 0;
    150     char *prog = argv[0];
     82    int c;
     83    int error = 0;
    15184
    15285    /* if the command is executed without parameters, do nothing */
    15386    if (argc == 1)
    15487        return 0;
    155 
     88#if IPCRM_LEGACY
    15689    /* check to see if the command is being invoked in the old way if so
    157        then run the old code */
    158     if (strcmp(argv[1], "shm") == 0 ||
    159         strcmp(argv[1], "msg") == 0 ||
    160         strcmp(argv[1], "sem") == 0)
    161         return deprecated_main(argc, argv);
     90       then run the old code. Valid commands are msg, shm, sem. */
     91    {
     92        type_id what = 0; /* silence gcc */
     93        char w;
     94
     95        w=argv[1][0];
     96        if ( ((w == 'm' && argv[1][1] == 's' && argv[1][2] == 'g')
     97               || (argv[1][0] == 's'
     98                   && ((w=argv[1][1]) == 'h' || w == 'e')
     99                   && argv[1][2] == 'm')
     100             ) && argv[1][3] == '\0'
     101        ) {
     102
     103            if (argc < 3)
     104                bb_show_usage();
     105
     106            if (w == 'h')
     107                what = SHM;
     108            else if (w == 'm')
     109                what = MSG;
     110            else if (w == 'e')
     111                what = SEM;
     112
     113            if (remove_ids(what, argc-2, &argv[2]))
     114                fflush_stdout_and_exit(1);
     115            printf("resource(s) deleted\n");
     116            return 0;
     117        }
     118    }
     119#endif /* IPCRM_LEGACY */
    162120
    163121    /* process new syntax to conform with SYSV ipcrm */
     
    165123        int result;
    166124        int id = 0;
    167         int iskey = isupper(c);
     125        int iskey = (isupper)(c);
    168126
    169127        /* needed to delete semaphores */
    170128        union semun arg;
     129
    171130        arg.val = 0;
    172131
    173         if ((c == '?') || (c == 'h'))
    174         {
     132        if ((c == '?') || (c == 'h')) {
    175133            bb_show_usage();
    176             return 0;
    177134        }
    178135
     
    180137        c = tolower(c);
    181138
    182         /* make sure the option is in range */
     139        /* make sure the option is in range: allowed are q, m, s */
    183140        if (c != 'q' && c != 'm' && c != 's') {
    184141            bb_show_usage();
    185             error++;
    186             return error;
    187142        }
    188143
    189144        if (iskey) {
    190145            /* keys are in hex or decimal */
    191             key_t key = strtoul(optarg, NULL, 0);
     146            key_t key = xstrtoul(optarg, 0);
     147
    192148            if (key == IPC_PRIVATE) {
    193149                error++;
    194                 bb_fprintf(stderr, "%s: illegal key (%s)\n",
    195                     prog, optarg);
     150                bb_error_msg("illegal key (%s)", optarg);
    196151                continue;
    197152            }
     
    199154            /* convert key to id */
    200155            id = ((c == 'q') ? msgget(key, 0) :
    201                   (c == 'm') ? shmget(key, 0, 0) :
    202                   semget(key, 0, 0));
     156                  (c == 'm') ? shmget(key, 0, 0) : semget(key, 0, 0));
    203157
    204158            if (id < 0) {
    205                 char *errmsg;
     159                const char *errmsg;
     160
    206161                error++;
    207                 switch(errno) {
     162                switch (errno) {
    208163                case EACCES:
    209                     errmsg = "permission denied for key";
     164                    errmsg = "permission denied for";
    210165                    break;
    211166                case EIDRM:
    212                     errmsg = "already removed key";
     167                    errmsg = "already removed";
    213168                    break;
    214169                case ENOENT:
    215                     errmsg = "invalid key";
     170                    errmsg = "invalid";
    216171                    break;
    217172                default:
    218                     errmsg = "unknown error in key";
     173                    errmsg = "unknown error in";
    219174                    break;
    220175                }
    221                 bb_fprintf(stderr, "%s: %s (%s)\n",
    222                     prog, errmsg, optarg);
     176                bb_error_msg("%s %s (%s)", errmsg, "key", optarg);
    223177                continue;
    224178            }
    225179        } else {
    226180            /* ids are in decimal */
    227             id = strtoul(optarg, NULL, 10);
     181            id = xatoul(optarg);
    228182        }
    229183
    230184        result = ((c == 'q') ? msgctl(id, IPC_RMID, NULL) :
    231               (c == 'm') ? shmctl(id, IPC_RMID, NULL) :
    232               semctl(id, 0, IPC_RMID, arg));
    233 
    234         if (result < 0) {
    235             char *errmsg;
     185                  (c == 'm') ? shmctl(id, IPC_RMID, NULL) :
     186                  semctl(id, 0, IPC_RMID, arg));
     187
     188        if (result) {
     189            const char *errmsg;
     190            const char *const what = iskey ? "key" : "id";
     191
    236192            error++;
    237             switch(errno) {
     193            switch (errno) {
    238194            case EACCES:
    239195            case EPERM:
    240                 errmsg = iskey
    241                     ? "permission denied for key"
    242                     : "permission denied for id";
     196                errmsg = "permission denied for";
    243197                break;
    244198            case EINVAL:
    245                 errmsg = iskey
    246                     ? "invalid key"
    247                     : "invalid id";
     199                errmsg = "invalid";
    248200                break;
    249201            case EIDRM:
    250                 errmsg = iskey
    251                     ? "already removed key"
    252                     : "already removed id";
     202                errmsg = "already removed";
    253203                break;
    254204            default:
    255                 errmsg = iskey
    256                     ? "unknown error in key"
    257                     : "unknown error in id";
    258                 break;
    259             }
    260             bb_fprintf(stderr, "%s: %s (%s)\n",
    261                 prog, errmsg, optarg);
     205                errmsg = "unknown error in";
     206                break;
     207            }
     208            bb_error_msg("%s %s (%s)", errmsg, what, optarg);
    262209            continue;
    263210        }
Note: See TracChangeset for help on using the changeset viewer.