Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 524962 Details for
Bug 651246
sys-apps/openrc patch (for 0.34.11) to decrease openrc starting time
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
caching patch
cache_holder.patch (text/plain), 2.76 KB, created by
nobody
on 2018-03-23 10:51:11 UTC
(
hide
)
Description:
caching patch
Filename:
MIME Type:
Creator:
nobody
Created:
2018-03-23 10:51:11 UTC
Size:
2.76 KB
patch
obsolete
>diff -ru openrc-orig/src/includes/rc-misc.h openrc-0.34.11/src/includes/rc-misc.h >--- openrc-orig/src/includes/rc-misc.h 2017-11-29 23:10:02.000000000 +0100 >+++ openrc-0.34.11/src/includes/rc-misc.h 2018-01-12 01:32:50.508998843 +0100 >@@ -32,6 +32,7 @@ > #define RC_LEVEL_DEFAULT "default" > > #define RC_DEPTREE_CACHE RC_SVCDIR "/deptree" >+#define RC_DEPTREE_CACHE_BOOT RC_SYSCONFDIR "/rc_deptree_boot" > #define RC_DEPTREE_SKEWED RC_SVCDIR "/clock-skewed" > #define RC_KRUNLEVEL RC_SVCDIR "/krunlevel" > #define RC_STARTING RC_SVCDIR "/rc.starting" >diff -ru openrc-orig/src/rc/rc-misc.c openrc-0.34.11/src/rc/rc-misc.c >--- openrc-orig/src/rc/rc-misc.c 2017-11-29 23:10:02.000000000 +0100 >+++ openrc-0.34.11/src/rc/rc-misc.c 2018-01-22 01:20:08.152241549 +0100 >@@ -354,6 +354,8 @@ > RC_DEPTREE * _rc_deptree_load(int force, int *regen) > { > int fd; >+ int fd_boot; >+ char ch; > int retval; > int serrno = errno; > int merrno; >@@ -362,16 +364,37 @@ > struct stat st; > struct utimbuf ut; > FILE *fp; >+ >+ struct timeval t_b, t_a, t_r; > >+ /* Test if we have permission to update the deptree */ >+ fd = open(RC_DEPTREE_CACHE, O_WRONLY | O_NOFOLLOW); >+ merrno = errno; >+ errno = serrno; >+ if (fd == -1 && merrno == EACCES) >+ return rc_deptree_load(); >+ close(fd); >+ >+ /* bench */ >+ gettimeofday(&t_b, NULL); >+ >+ /* If RC_DEPTREE_CACHE_BOOT exists and RC_DEPTREE_CACHE doesn't exists, we're booting and we will reuse RC_DEPTREE_CACHE_BOOT */ >+ if (!exists(RC_DEPTREE_CACHE) && exists(RC_DEPTREE_CACHE_BOOT)) { >+ fd_boot = fopen(RC_DEPTREE_CACHE_BOOT, "r"); >+ if (fd_boot != NULL) { >+ fd = fopen(RC_DEPTREE_CACHE, "w"); >+ if (fd != NULL) { >+ ebegin("Reusing service dependencies cache"); >+ while( ( ch = fgetc(fd_boot) ) != EOF ) >+ fputc(ch, fd); >+ fclose(fd); >+ } >+ fclose(fd_boot); >+ } >+ } >+ > t = 0; > if (rc_deptree_update_needed(&t, file) || force != 0) { >- /* Test if we have permission to update the deptree */ >- fd = open(RC_DEPTREE_CACHE, O_WRONLY); >- merrno = errno; >- errno = serrno; >- if (fd == -1 && merrno == EACCES) >- return rc_deptree_load(); >- close(fd); > > if (regen) > *regen = 1; >@@ -380,7 +403,10 @@ > eend (retval, "Failed to update the dependency tree"); > > if (retval == 0) { >- stat(RC_DEPTREE_CACHE, &st); >+ if (stat(RC_DEPTREE_CACHE, &st) != 0) { >+ eerror("stat(%s): %s", RC_DEPTREE_CACHE, strerror(errno)); >+ return NULL; >+ } > if (st.st_mtime < t) { > eerror("Clock skew detected with `%s'", file); > eerrorn("Adjusting mtime of `" RC_DEPTREE_CACHE >@@ -401,6 +427,9 @@ > if (force == -1 && regen != NULL) > *regen = retval; > } >+ gettimeofday(&t_a, NULL); >+ timersub(&t_a, &t_b, &t_r); >+ ebegin("Time elapsed: %ld.%06ld\n", (long int)t_r.tv_sec, (long int)t_r.tv_usec); > return rc_deptree_load(); > } >
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 651246
: 524962