VirtualBox

Changeset 2140 in kBuild for trunk


Ignore:
Timestamp:
Dec 25, 2008 7:10:32 PM (16 years ago)
Author:
bird
Message:

ash: Changed opentrace so that the trace file get's a high file descriptor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ash/show.c

    r809 r2140  
    4747#include <stdarg.h>
    4848#include <stdlib.h>
     49#include <sys/fcntl.h>
     50#include <unistd.h>
    4951
    5052#include "shell.h"
     
    385387        int flags;
    386388#endif
     389#if 1
     390        int fd;
     391#endif
    387392
    388393        if (debug != 1) {
     
    413418                        return;
    414419                }
     420                trace("opentrace: fno=%d - freopen\n", fileno(tracefile));
    415421        } else {
     422#if 0
    416423                if ((tracefile = fopen(s, "a")) == NULL) {
     424#else
     425                fd = open(s, O_APPEND | O_RDWR | O_CREAT, 0600);
     426                if (fd != -1) {
     427                        int fd2 = fcntl(fd, F_DUPFD, 199);
     428                        if (fd2 == -1)
     429                                fd2 = fcntl(fd, F_DUPFD, 99);
     430                        if (fd2 == -1)
     431                                fd2 = fcntl(fd, F_DUPFD, 49);
     432                        if (fd2 == -1)
     433                                fd2 = fcntl(fd, F_DUPFD, 18);
     434                        if (fd2 == -1)
     435                                fd2 = fcntl(fd, F_DUPFD, 10);
     436                        if (fd2 != -1) {
     437                                close(fd);
     438                                fd = fd2;
     439                        }
     440                }
     441                if (fd == -1 || (tracefile = fdopen(fd, "a")) == NULL) {
     442#endif
    417443                        fprintf(stderr, "Can't open %s\n", s);
    418444                        debug = 0;
    419445                        return;
    420446                }
     447                trace("opentrace: fno=%d\n", fileno(tracefile));
    421448        }
    422449#ifdef O_APPEND
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette