Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 155247 Details for
Bug 175783
dev-db/mysql-init-scripts: convert to POSIX for use with dash/etc... and openrc
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Add ewaitfile to openrc
ewaitfile.diff (text/plain), 2.60 KB, created by
Roy Marples
on 2008-06-02 15:49:08 UTC
(
hide
)
Description:
Add ewaitfile to openrc
Filename:
MIME Type:
Creator:
Roy Marples
Created:
2008-06-02 15:49:08 UTC
Size:
2.60 KB
patch
obsolete
>diff --git a/src/rc/Makefile b/src/rc/Makefile >index 17d6330..206d66b 100644 >--- a/src/rc/Makefile >+++ b/src/rc/Makefile >@@ -13,7 +13,7 @@ LINKDIR= ${PREFIX}/${LIBNAME}/${PROG} > BINLINKS= rc-status > SBINLINKS= rc-service rc-update runscript start-stop-daemon > RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \ >- eindent eoutdent esyslog eval_ecolors \ >+ eindent eoutdent esyslog eval_ecolors ewaitfile \ > veinfo vewarn vebegin veend vewend veindent veoutdent \ > service_starting service_started \ > service_stopping service_stopped \ >diff --git a/src/rc/rc-applets.c b/src/rc/rc-applets.c >index 60c0c27..189acfd 100644 >--- a/src/rc/rc-applets.c >+++ b/src/rc/rc-applets.c >@@ -51,6 +51,10 @@ > #include "einfo.h" > #include "rc-misc.h" > >+/* usecs to wait while we poll the file existance */ >+#define WAIT_INTERVAL 20000000 >+#define ONE_SECOND 690000000 >+ > /* Applet is first parsed in rc.c - no point in doing it again */ > extern const char *applet; > >@@ -77,6 +81,8 @@ static int do_e(int argc, char **argv) > char *p; > int level = 0; > const char *fmt = "%s"; >+ struct timespec ts; >+ struct timeval stop, now; > > /* Punt applet */ > argc--; >@@ -97,11 +103,14 @@ static int do_e(int argc, char **argv) > if (strcmp(applet, "eend") == 0 || > strcmp(applet, "ewend") == 0 || > strcmp(applet, "veend") == 0 || >- strcmp(applet, "vweend") == 0) >+ strcmp(applet, "vweend") == 0 || >+ strcmp(applet, "ewaitfile") == 0) > { > errno = 0; >- retval = (int) strtoimax(argv[0], NULL, 0); >- if (errno != 0) >+ retval = (int)strtoimax(argv[0], &p, 0); >+ if (!p || *p != '\0') >+ errno = EINVAL; >+ if (errno) > retval = EXIT_FAILURE; > else { > argc--; >@@ -124,6 +133,38 @@ static int do_e(int argc, char **argv) > } > } > >+ if (strcmp(applet, "ewaitfile") == 0) { >+ if (errno) >+ eerrorx("%s: invalid timeout", applet); >+ if (argc == 0) >+ eerrorx("%s: not enough arguments", applet); >+ >+ gettimeofday(&stop, NULL); >+ stop.tv_sec += retval; >+ ts.tv_sec = 0; >+ ts.tv_nsec = WAIT_INTERVAL; >+ /* retval stores the timeout */ >+ for (i = 0; i < argc; i++) { >+ ebeginv("Waiting for %s", argv[i]); >+ for (;;){ >+ if (exists(argv[i])) >+ break; >+ if (nanosleep(&ts, NULL) == -1) >+ return EXIT_FAILURE; >+ gettimeofday(&now, NULL); >+ if (retval <= 0) >+ continue; >+ if (timercmp(&now, &stop, <)) >+ continue; >+ eendv(EXIT_FAILURE, >+ "timed out waiting for %s", argv[i]); >+ return EXIT_FAILURE; >+ } >+ eendv(EXIT_SUCCESS, NULL); >+ } >+ return EXIT_SUCCESS; >+ } >+ > if (argc > 0) { > for (i = 0; i < argc; i++) > l += strlen(argv[i]) + 1;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 175783
:
120196
|
155247
|
191550
|
235857