Ignore:
Timestamp:
Feb 25, 2011, 9:26:54 PM (13 years ago)
Author:
Bruno Cornec
Message:
  • Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.9/mindi-busybox/sysklogd/logread.c

    r1765 r2725  
    77 * Maintainer: Gennady Feldman <gfeldman@gena01.com> as of Mar 12, 2001
    88 *
    9  * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
     9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
    1010 */
    1111
     
    1717#define DEBUG 0
    1818
     19/* our shared key (syslogd.c and logread.c must be in sync) */
    1920enum { KEY_ID = 0x414e4547 }; /* "GENA" */
    2021
    21 static struct shbuf_ds {
     22struct shbuf_ds {
    2223    int32_t size;           // size of data - 1
    2324    int32_t tail;           // end of message list
    2425    char data[1];           // messages
    25 } *shbuf;
     26};
    2627
    27 // Semaphore operation structures
    28 static struct sembuf SMrup[1] = {{0, -1, IPC_NOWAIT | SEM_UNDO}}; // set SMrup
    29 static struct sembuf SMrdn[2] = {{1, 0}, {0, +1, SEM_UNDO}}; // set SMrdn
     28static const struct sembuf init_sem[3] = {
     29    {0, -1, IPC_NOWAIT | SEM_UNDO},
     30    {1, 0}, {0, +1, SEM_UNDO}
     31};
    3032
     33struct globals {
     34    struct sembuf SMrup[1]; // {0, -1, IPC_NOWAIT | SEM_UNDO},
     35    struct sembuf SMrdn[2]; // {1, 0}, {0, +1, SEM_UNDO}
     36    struct shbuf_ds *shbuf;
     37} FIX_ALIASING;
     38#define G (*(struct globals*)&bb_common_bufsiz1)
     39#define SMrup (G.SMrup)
     40#define SMrdn (G.SMrdn)
     41#define shbuf (G.shbuf)
     42#define INIT_G() do { \
     43    memcpy(SMrup, init_sem, sizeof(init_sem)); \
     44} while (0)
    3145
    32 static void error_exit(const char *str) ATTRIBUTE_NORETURN;
     46static void error_exit(const char *str) NORETURN;
    3347static void error_exit(const char *str)
    3448{
     
    4761}
    4862
    49 static void interrupted(int sig ATTRIBUTE_UNUSED)
     63static void interrupted(int sig UNUSED_PARAM)
    5064{
    5165    signal(SIGINT, SIG_IGN);
    5266    shmdt(shbuf);
    53     exit(0);
     67    exit(EXIT_SUCCESS);
    5468}
    5569
    56 int logread_main(int argc, char **argv);
    57 int logread_main(int argc, char **argv)
     70int logread_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
     71int logread_main(int argc UNUSED_PARAM, char **argv)
    5872{
    59     int cur;
     73    unsigned cur;
    6074    int log_semid; /* ipc semaphore id */
    6175    int log_shmid; /* ipc shared memory id */
    6276    smallint follow = getopt32(argv, "f");
     77
     78    INIT_G();
    6379
    6480    log_shmid = shmget(KEY_ID, 0, 0);
     
    120136            if (cur == shbuf_tail) {
    121137                sem_up(log_semid);
    122                 fflush(stdout);
     138                fflush_all();
    123139                sleep(1); /* TODO: replace me with a sleep_on */
    124140                continue;
Note: See TracChangeset for help on using the changeset viewer.