Changed execute delay method
This commit is contained in:
parent
e2c1df6639
commit
0d2fc1c841
10
ChangeLog
10
ChangeLog
@ -1,10 +1,5 @@
|
|||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
If you feel lucky then try this version, if not just wait
|
|
||||||
a few days so that I fix the destructive bugs that might
|
|
||||||
be present in this version.
|
|
||||||
One found, destroyed 5 fileareas, don't think it won't happen!
|
|
||||||
|
|
||||||
|
|
||||||
v0.51.2 06-Mar-2004
|
v0.51.2 06-Mar-2004
|
||||||
|
|
||||||
@ -26,6 +21,11 @@ v0.51.2 06-Mar-2004
|
|||||||
Removed all references to costsharing for ticfiles which wasn't
|
Removed all references to costsharing for ticfiles which wasn't
|
||||||
fully implemented.
|
fully implemented.
|
||||||
|
|
||||||
|
libcommon.a:
|
||||||
|
Moved the initial delay in the execute functions to the child
|
||||||
|
process, that may be the trick to work around the lost child
|
||||||
|
messages.
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
Updated file request function to new files database structure.
|
Updated file request function to new files database structure.
|
||||||
Fixed a compile problem on FreeBSD 5.1
|
Fixed a compile problem on FreeBSD 5.1
|
||||||
|
4
TODO
4
TODO
@ -1,6 +1,6 @@
|
|||||||
$Id$
|
$Id$
|
||||||
|
|
||||||
MBSE BBS V0.51.1 TODO list.
|
MBSE BBS V0.51.2 TODO list.
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
These are a list of things that must be implemented one way or
|
These are a list of things that must be implemented one way or
|
||||||
@ -127,8 +127,6 @@ mbfido:
|
|||||||
just handle the record as a dupe (In test again).
|
just handle the record as a dupe (In test again).
|
||||||
|
|
||||||
mbcico:
|
mbcico:
|
||||||
N: Further investigate binkp tty_error hangup (Seems Oke).
|
|
||||||
|
|
||||||
L: Implement binkp option ND.
|
L: Implement binkp option ND.
|
||||||
|
|
||||||
N: Implement PLZ turn off m_get command.
|
N: Implement PLZ turn off m_get command.
|
||||||
|
@ -36,8 +36,8 @@ int e_pid = 0; /* Execute child pid */
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int _execute(char **, char *, char *, char *);
|
int _execute(char **, char *, char *, char *, int);
|
||||||
int _execute(char **args, char *in, char *out, char *err)
|
int _execute(char **args, char *in, char *out, char *err, int priority)
|
||||||
{
|
{
|
||||||
char buf[PATH_MAX];
|
char buf[PATH_MAX];
|
||||||
int i, pid, terrno = 0, status = 0, rc = 0;
|
int i, pid, terrno = 0, status = 0, rc = 0;
|
||||||
@ -55,6 +55,12 @@ int _execute(char **args, char *in, char *out, char *err)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
|
/*
|
||||||
|
* A delay in the child to prevent it returns before the main
|
||||||
|
* process sess it ever started.
|
||||||
|
*/
|
||||||
|
msleep(150);
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
close(0);
|
close(0);
|
||||||
if (open(in,O_RDONLY) != 0) {
|
if (open(in,O_RDONLY) != 0) {
|
||||||
@ -78,15 +84,16 @@ int _execute(char **args, char *in, char *out, char *err)
|
|||||||
}
|
}
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
if (priority) {
|
||||||
rc = getpriority(PRIO_PROCESS, 0);
|
rc = getpriority(PRIO_PROCESS, 0);
|
||||||
if (errno == 0) {
|
if (errno == 0) {
|
||||||
rc = setpriority(PRIO_PROCESS, 0, 15);
|
rc = setpriority(PRIO_PROCESS, 0, priority);
|
||||||
if (rc)
|
if (rc)
|
||||||
WriteError("$execv can't set priority to 15");
|
WriteError("$execv can't set priority to %d", priority);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
rc = execv(args[0],args);
|
rc = execv(args[0],args);
|
||||||
WriteError("$execv \"%s\" returned %d", MBSE_SS(args[0]), rc);
|
WriteError("$execv \"%s\" returned %d", MBSE_SS(args[0]), rc);
|
||||||
setpriority(PRIO_PROCESS, 0, 0);
|
|
||||||
exit(MBERR_EXEC_FAILED);
|
exit(MBERR_EXEC_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,6 +105,7 @@ int _execute(char **args, char *in, char *out, char *err)
|
|||||||
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
} while (((rc > 0) && (rc != pid)) || ((rc == -1) && (errno == EINTR)));
|
||||||
|
|
||||||
terrno = errno;
|
terrno = errno;
|
||||||
|
if (priority)
|
||||||
setpriority(PRIO_PROCESS, 0, 0);
|
setpriority(PRIO_PROCESS, 0, 0);
|
||||||
errno = terrno;
|
errno = terrno;
|
||||||
|
|
||||||
@ -144,8 +152,7 @@ int execute(char **args, char *in, char *out, char *err)
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
sync();
|
sync();
|
||||||
#endif
|
#endif
|
||||||
msleep(300);
|
rc = _execute(args, in, out, err, 15);
|
||||||
rc = _execute(args, in, out, err);
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
sync();
|
sync();
|
||||||
#endif
|
#endif
|
||||||
@ -237,6 +244,12 @@ int _execsh(char *cmd, char *in, char *out, char *err)
|
|||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
|
||||||
if ((pid = fork()) == 0) {
|
if ((pid = fork()) == 0) {
|
||||||
|
/*
|
||||||
|
* A delay in the child to prevent it returns before the main
|
||||||
|
* process sess it ever started.
|
||||||
|
*/
|
||||||
|
msleep(300);
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
close(0);
|
close(0);
|
||||||
if (open(in, O_RDONLY) != 0) {
|
if (open(in, O_RDONLY) != 0) {
|
||||||
@ -291,7 +304,6 @@ int execsh(char *cmd, char *in, char *out, char *err)
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
sync();
|
sync();
|
||||||
#endif
|
#endif
|
||||||
msleep(300);
|
|
||||||
rc = _execsh(cmd, in, out, err);
|
rc = _execsh(cmd, in, out, err);
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
sync();
|
sync();
|
||||||
|
Reference in New Issue
Block a user