From f3962fe2428e403fdad463cdcbdb85d6ce97c5c96bf94d68cf08003e62ed928a Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Sat, 16 Aug 2008 00:57:09 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysvinit?expand=0&rev=22 --- startpar-0.52.dif | 112 ++++++++++++++++++++++++++++++++++++++++++++++ sysvinit.changes | 6 +++ sysvinit.spec | 9 ++-- 3 files changed, 124 insertions(+), 3 deletions(-) create mode 100644 startpar-0.52.dif diff --git a/startpar-0.52.dif b/startpar-0.52.dif new file mode 100644 index 0000000..07939ef --- /dev/null +++ b/startpar-0.52.dif @@ -0,0 +1,112 @@ +--- makeboot.c ++++ makeboot.c 2008-08-13 16:34:52.985916688 +0200 +@@ -13,6 +13,12 @@ + #include + #include + #include "makeboot.h" ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++# include ++# include ++# include ++static int o_flags = O_RDONLY; ++#endif + + + int tree_entries = 0; +@@ -158,11 +164,28 @@ void parse_makefile(const char *path) + char *s, *strp, *p; + struct makenode *node; + +- if ((fp = fopen(path, "r")) == NULL) { ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ int fd; ++ ++ if (getuid() == (uid_t)0) ++ o_flags |= O_NOATIME; ++ if ((fd = open(path, o_flags)) < 0) { ++ fprintf(stderr, "Can't open %s: %s\n", path, strerror(errno)); ++ exit(1); ++ } ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED); ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL); ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE); ++ ++ if ((fp = fdopen(fd, "r")) == NULL) ++#else ++ if ((fp = fopen(path, "r")) == NULL) ++#endif ++ { + fprintf(stderr, "Can't open %s: %s\n", path, strerror(errno)); + exit(1); + } +- ++ + while (fgets(buf, sizeof(buf), fp)) { + for (s = buf; *s && isspace(*s); s++) + ; +@@ -198,6 +221,11 @@ void parse_makefile(const char *path) + } + } + } ++ ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); ++#endif ++ + fclose(fp); + + for (node = tree_list; node; node = node->next) { +@@ -234,7 +262,17 @@ static void filter_files(const char *dir + + filter_prefix = prefix; + snprintf(path, sizeof(path), "/etc/init.d/%s.d", dir); ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ if ((i = open(path, o_flags|O_DIRECTORY|O_LARGEFILE)) >= 0) { ++ (void)posix_fadvise(i, 0, 0, POSIX_FADV_SEQUENTIAL); ++ (void)posix_fadvise(i, 0, 0, POSIX_FADV_NOREUSE); ++ } ++#endif + ndirs = scandir(path, &dirlist, dirfilter, alphasort); ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ if (i >= 0) ++ (void)posix_fadvise(i, 0, 0, POSIX_FADV_DONTNEED); ++#endif + /* mark all matching nodes */ + for (i = 0; i < ndirs; i++) { + t = lookup_target(dirlist[i]->d_name + 3); +@@ -342,6 +380,17 @@ struct makenode *pickup_task(void) + } + } + if (best) { ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ char path[128]; ++ int fd; ++ snprintf(path, sizeof(path), "/etc/init.d/%s", best->name); ++ if ((fd = open(path, o_flags|O_DIRECT)) >= 0) { ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_WILLNEED); ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL); ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_NOREUSE); ++ close(fd); ++ } ++#endif + blogger("service %s", best->name); + best->status = T_RUNNING; + } +@@ -359,6 +408,17 @@ void finish_task(struct makenode *node) + return; + for (n = node->select; n; n = n->next) + n->node->num_deps--; ++#if defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 600 ++ { ++ char path[128]; ++ int fd; ++ snprintf(path, sizeof(path), "/etc/init.d/%s", node->name); ++ if ((fd = open(path, o_flags|O_DIRECT)) >= 0) { ++ (void)posix_fadvise(fd, 0, 0, POSIX_FADV_DONTNEED); ++ close(fd); ++ } ++ } ++#endif + node->status = T_FINISHED; + blogger("service %s done", node->name); + } diff --git a/sysvinit.changes b/sysvinit.changes index 5dca28e..12c3616 100644 --- a/sysvinit.changes +++ b/sysvinit.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 13 16:40:49 CEST 2008 - werner@suse.de + +- Startpar: give posix_fadvise a try on boot scripts even if most + of them are very small + ------------------------------------------------------------------- Mon Aug 4 19:36:29 CEST 2008 - werner@suse.de diff --git a/sysvinit.spec b/sysvinit.spec index c9f4f6d..65f81bf 100644 --- a/sysvinit.spec +++ b/sysvinit.spec @@ -30,7 +30,7 @@ Group: System/Base PreReq: coreutils AutoReqProv: on Version: 2.86 -Release: 163 +Release: 167 Summary: SysV-Style init BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: sysvinit-2.86.tar.bz2 @@ -56,7 +56,7 @@ Patch10: showconsole-1.09.dif Patch11: sysvinit-2.86-race.patch Patch12: sysvinit-2.86-lib64.patch Patch13: sysvinit-2.82-multiline.patch -#Patch14: startpar-0.52.dif +Patch14: startpar-0.52.dif Patch15: sysvinit-2.86-usage-message.patch Patch16: sysvinit-2.86-full-time.patch Patch17: sysvinit-2.86-hddown.patch @@ -104,7 +104,7 @@ pushd ../showconsole-%{SCVER} %patch -P 10 popd pushd ../startpar-%{START} -#%patch -P 14 +%patch -P 14 popd %_fixowner . %_fixgroup . @@ -307,6 +307,9 @@ rm -rf ${RPM_BUILD_ROOT} %doc %{_mandir}/man8/startpar.8.gz %changelog +* Wed Aug 13 2008 werner@suse.de +- Startpar: give posix_fadvise a try on boot scripts even if most + of them are very small * Mon Aug 04 2008 werner@suse.de - Imake chroot detections to handle inodes and devices (bnc#408959) * Wed Jul 23 2008 hare@suse.de