cgroupsfs: new package
PATCH v2 1/1 cgroupsfs: new package
From: Niranjan <[email protected]>
This package consists of scripts that setup cgroups at boot without doing any cgroup management or classification of tasks into cgroups
---
Changes v1 -> v2:
- Changed navigation options in Config.in ( suggested by Arnout).
- Removed CGROUPFS_INSTALL_TARGET and cgroupfs-mount.upstart from cgroupfs.mk file as it was not required.
- Added S30cgroupfs startup script which gets installed to /etc/init.d
- Added details of version,copyright and licence file.
--- package/Config.in | 1 + package/cgroupfs/Config.in | 19 +++++++++++++++++ package/cgroupfs/S30cgroupfs | 50 ++++++++++++++++++++++++++++++++++++++++++++ package/cgroupfs/cgroupfs.mk | 22 +++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 package/cgroupfs/Config.in create mode 100644 package/cgroupfs/S30cgroupfs create mode 100644 package/cgroupfs/cgroupfs.mk
package/Config.in +1 -0
@@ -1571,6 +1571,7 @@ if BR2_PACKAGE_BUSYBOX_SHOW_OTHERS source "package/dcron/Config.in" source "package/debianutils/Config.in" endif + source "package/cgroupfs/Config.in" source "package/dsp-tools/Config.in" source "package/emlog/Config.in" source "package/ftop/Config.in"
package/cgroupfs/Config.in new file +19 -0
@@ -0,0 +1,19 @@ +config BR2_PACKAGE_CGROUPFS + bool "cgroupfs" + depends on !BR2_INIT_SYSTEMD + help + cgroupfs mount and umount scripts. + + requires a Linux kernel >= 3.0 with the following options + enabled: + + - CONFIG_BLK_CGROUP + - CONFIG_CGROUPS + - CONFIG_CGROUP_CPUACCT + - CONFIG_CGROUP_DEVICE + - CONFIG_CGROUP_FREEZER + - CONFIG_CGROUP_WRITEBACK + - CONFIG_CGROUP_SCHED + - CONFIG_CGROUP_PIDS + + https://github.com/tianon/cgroupfs-mount
package/cgroupfs/S30cgroupfs new file +50 -0
50 lines not on this page · raw message
package/cgroupfs/cgroupfs.mk new file +22 -0
@@ -0,0 +1,22 @@ +############################################################# +# +# cgroupfs +# +############################################################# +CGROUPFS_VERSION = 7285bf44402029394808339f69f4f293730fc2c6 +CGROUPFS_SITE = $(call github,tianon,cgroupfs-mount,$(CGROUPFS_VERSION)) +CGROUPFS_LICENSE = GPL-3+ +CGROUPFS_LICENSE_FILES = COPYRIGHT + +define CGROUPFS_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/cgroupfs-mount $(TARGET_DIR)/usr/bin/cgroupfs-mount + $(INSTALL) -D -m 0755 $(@D)/cgroupfs-umount $(TARGET_DIR)/usr/bin/cgroupfs-umount +endef + +define CGROUPFS_INSTALL_INIT_SYSV + $(INSTALL) -m 0755 -D package/cgroupfs/S30cgroupfs \ + $(TARGET_DIR)/etc/init.d/S30cgroupfs + +endef + +$(eval $(generic-package))
Signature · 1 line
2.5.0
PATCH v2 1/1 cgroupsfs: new package
Hello,
Thanks for this new iteration! See some comments below.
Quoted 1 line · Niranjan Reddy
From: Niranjan <[email protected]>
We want the first name + last name in the From: field.
Quoted 6 lines
package/cgroupfs/S30cgroupfs new file +0
-0
package/cgroupfs/S30cgroupfs line 8
Quoted 8 lines
package/cgroupfs/S30cgroupfs new file +8
-0@@ -0,0 +1,50 @@ +#!/bin/sh +# +# cgroupfs: Set up cgroupfs mounts. +# +# description: Control groups are a kernel mechanism for tracking and imposing +# limits on resource usage on groups of tasks. +# +#
Generally speaking, you should look at some other init scripts in Buildroot, to be more similar to what they look like.
package/cgroupfs/S30cgroupfs line 13
Quoted 5 lines
package/cgroupfs/S30cgroupfs new file +5
-0+ +RETVAL=0 +case "$1" in + start) + test -x /usr/bin/cgroupfs-mount || exit 0
Not needed.
package/cgroupfs/S30cgroupfs line 14
Quoted 1 line
package/cgroupfs/S30cgroupfs new file +1
-0+ echo "Mounting cgroupfs hierarchy"
Use printf here
package/cgroupfs/S30cgroupfs line 15
Quoted 1 line
package/cgroupfs/S30cgroupfs new file +1
-0+ /usr/bin/cgroupfs-mount
And do something like:
printf "Mounting cgroupfs hierarchy: " /usr/bin/cgroupfs-mount [ $? = 0 ] && echo "OK" || echo "FAIL"
package/cgroupfs/S30cgroupfs line 16
Quoted 1 line
package/cgroupfs/S30cgroupfs new file +1
-0+ RETVAL=$?
I don't think there's any need for a RETVAL variable, just do exit $? at the end of the script, like S50dropbear is doing.
Quoted 9 lines
package/cgroupfs/S30cgroupfs new file +9
-0+ ;; + + stop) + test -x /usr/bin/cgroupfs-umount || exit 0 + echo "Unmounting cgroupfs hierarchy" + /usr/bin/cgroupfs-umount + RETVAL=$? + ;; +
package/cgroupfs/S30cgroupfs line 35
Quoted 10 lines
package/cgroupfs/S30cgroupfs new file +10
-0+ restart|force-reload) + if mountpoint -q /sys/fs/cgroup; then + $0 stop + fi + exec $0 start + ;; + + status) + if mountpoint -q /sys/fs/cgroup; then + # TODO decide whether to detect "partial mounted" status (ie, whether all available subsystems are mounted correctly)
This comment needs to be wrapped. Or handled :)
package/cgroupfs/S30cgroupfs line 48
Quoted 13 lines
package/cgroupfs/S30cgroupfs new file +13
-0+ echo "cgroupfs hierarchy is mounted" + exit 0 + else + echo "cgroupfs hierarchy is not mounted" + exit 1 + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esac
Also, we often put the start(), stop() and status() code in functions, so that the indentation remains more reasonable. Again, see S50dropbear for a pretty good example.
package/cgroupfs/cgroupfs.mk line 5
Quoted 11 lines
package/cgroupfs/cgroupfs.mk new file +5
-0@@ -0,0 +1,22 @@ +############################################################# +# +# cgroupfs +# +#############################################################
We want 80 hash signs here. Yes that's silly. But we like it :)
And also, an empty new line between this comment header and the first variable.
package/cgroupfs/cgroupfs.mk line 8
Quoted 3 lines
package/cgroupfs/cgroupfs.mk new file +3
-0+CGROUPFS_VERSION = 7285bf44402029394808339f69f4f293730fc2c6 +CGROUPFS_SITE = $(call github,tianon,cgroupfs-mount,$(CGROUPFS_VERSION)) +CGROUPFS_LICENSE = GPL-3+
Should be GPLv3+
package/cgroupfs/cgroupfs.mk line 17
Quoted 9 lines
package/cgroupfs/cgroupfs.mk new file +9
-0+CGROUPFS_LICENSE_FILES = COPYRIGHT + +define CGROUPFS_INSTALL_TARGET_CMDS + $(INSTALL) -D -m 0755 $(@D)/cgroupfs-mount $(TARGET_DIR)/usr/bin/cgroupfs-mount + $(INSTALL) -D -m 0755 $(@D)/cgroupfs-umount $(TARGET_DIR)/usr/bin/cgroupfs-umount +endef + +define CGROUPFS_INSTALL_INIT_SYSV + $(INSTALL) -m 0755 -D package/cgroupfs/S30cgroupfs \
You can use $(CGROUPFS_PKGDIR) instead of package/cgroupfs/
Also, your should add a .hash file to this package.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v2 1/1 cgroupsfs: new package
Quoted 6 lines · Thomas Petazzoni
Hello,
Thanks for this new iteration! See some comments below.
Quoted 1 line · Niranjan Reddy
From: Niranjan <[email protected]>
[snip]
Quoted 5 lines
package/cgroupfs/S30cgroupfs line 35
Quoted 3 lines
package/cgroupfs/S30cgroupfs new file +3
-0+ status) + if mountpoint -q /sys/fs/cgroup; then + # TODO decide whether to detect "partial mounted" status (ie, whether all available subsystems are mounted correctly)This comment needs to be wrapped. Or handled :)
Actually, we don't need status, only very old init scripts (or init scripts
delivered by the package) have that.
Regards,
Arnout
Quoted 19 lines
Quoted 4 lines
package/cgroupfs/S30cgroupfs new file +3
-0+ echo "cgroupfs hierarchy is mounted" + exit 0 + elsepackage/cgroupfs/S30cgroupfs line 48
Quoted 10 lines
package/cgroupfs/S30cgroupfs new file +10
-0+ echo "cgroupfs hierarchy is not mounted" + exit 1 + fi + ;; + + *) + echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esacAlso, we often put the
start(),stop()andstatus()code in functions, so that the indentation remains more reasonable. Again, see S50dropbear for a pretty good example.
[snip]
Signature · 6 lines
Arnout Vandecappelle arnout dot vandecappelle at essensium dot com Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile) Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v2 1/1 cgroupsfs: new package
Hi Arnout & Thomas,
updated all your comments and sent new version (v3) of Patch.
Thanks,
Niranjan Reddy
Quoted 51 lines · Arnout Vandecappelle
Quoted 6 lines · Thomas Petazzoni
Hello,
Thanks for this new iteration! See some comments below.
Quoted 1 line · Niranjan Reddy
From: Niranjan <[email protected]>
[snip]
Quoted 3 lines
package/cgroupfs/S30cgroupfs
Quoted 3 lines
package/cgroupfs/S30cgroupfs new file +3
-0+ status) + if mountpoint -q /sys/fs/cgroup; then + # TODO decide whether to detect "partial mounted"status (ie, whether all available subsystems are mounted correctly)
Quoted 2 lines
This comment needs to be wrapped. Or handled :)
Actually, we don't need status, only very old init scripts (or init
scripts
delivered by the package) have that.Regards,
ArnoutQuoted 10 lines
Quoted 10 lines
package/cgroupfs/S30cgroupfs new file +9
-0+ echo "cgroupfs hierarchy is mounted" + exit 0 + else + echo "cgroupfs hierarchy is not mounted" + exit 1 + fi + ;; + + *)Quoted 9 lines
package/cgroupfs/S30cgroupfs line 48
Quoted 4 lines
package/cgroupfs/S30cgroupfs new file +4
-0+ echo "Usage: $0 {start|stop|restart|status}" + exit 1 + ;; +esacAlso, we often put the
start(),stop()andstatus()code in functions, so that the indentation remains more reasonable. Again, see S50dropbear for a pretty good example.[snip]
--
Arnout Vandecappelle arnout dot vandecappelle at essensium dot com
Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile) Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven
Quoted 8 lines
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20160216/8713ce6c/attachment.html>