Skip to contentSkip to conversation

initscripts: add usleep support from RHEL

PATCH In review Ming Liu 4 participants 7 messages Jul 2, 2014 – Jul 4, 2014

lore
Share & tools
lore

Ming Liu

author
#0 lore raw

PATCH 1/1 initscripts: add usleep support from RHEL

Add usleep in to support sleeping some number of microseconds.

---
 .../initscripts/initscripts-1.0/usleep.1           | 25 +++++++
 .../initscripts/initscripts-1.0/usleep.c           | 82 ++++++++++++++++++++++
 meta/recipes-core/initscripts/initscripts_1.0.bb   | 13 +++-
 3 files changed, 119 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-core/initscripts/initscripts-1.0/usleep.1
 create mode 100644 meta/recipes-core/initscripts/initscripts-1.0/usleep.c
meta/recipes-core/initscripts/initscripts-1.0/usleep.1 new file +25 -0
new file mode 100644
index 0000000..2d7520f
@@ -0,0 +1,25 @@
+.TH USLEEP 1 "Red Hat, Inc" \" -*- nroff -*-
+.SH NAME
+usleep \- sleep some number of microseconds
+.SH SYNOPSIS
+.B usleep
+[\fInumber\fP]
+.SH DESCRIPTION
+.B usleep
+sleeps some number of microseconds.  The default is 1.
+.SH OPTIONS
+\fI--usage\fP
+Show short usage message.
+.TP
+\fI--help, -?\fP
+Print help information.
+.TP
+\fI-v, --version\fP
+Print version information.
+.SH BUGS
+Probably not accurate on many machines down to the microsecond.  Count
+on precision only to -4 or maybe -5.
+.SH AUTHOR
+Donald Barnes <[email protected]>
+.br
+Erik Troan <[email protected]>
meta/recipes-core/initscripts/initscripts-1.0/usleep.c new file +82 -0

82 lines not on this page · raw message

meta/recipes-core/initscripts/initscripts_1.0.bb +12 -1
index 7273a82..456aed4 100644
@@ -5,7 +5,7 @@ LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
 PR = "r155"
 
-INHIBIT_DEFAULT_DEPS = "1"
+S = "${WORKDIR}"
 
 SRC_URI = "file://functions \
            file://halt \
@@ -33,6 +33,8 @@ SRC_URI = "file://functions \
            file://GPLv2.patch \
            file://dmesg.sh \
            file://logrotate-dmesg.conf \
+           file://usleep.c \
+           file://usleep.1 \
 "
 
 SRC_URI_append_arm = " file://alignment.sh"
@@ -42,6 +44,7 @@ KERNEL_VERSION = ""
 inherit update-alternatives
 DEPENDS_append = " update-rc.d-native"
 DEPENDS_append = " ${@bb.utils.contains('DISTRO_FEATURES','systemd','systemd-systemctl-native','',d)}"
+DEPENDS_append = " popt"
 
 PACKAGES =+ "${PN}-functions"
 RDEPENDS_${PN} = "${PN}-functions"
@@ -58,6 +61,10 @@ do_configure() {
 	sed -i -e "s:SED_HALTARGS:${HALTARGS}:g" ${WORKDIR}/reboot
 }
 
+do_compile() {
+	${CC} ${CFLAGS} ${LDFLAGS} usleep.c -o usleep -lpopt
+}
+
 do_install () {
 #
 # Create directories and install device independent scripts
@@ -75,6 +82,8 @@ do_install () {
 	install -d ${D}${sysconfdir}/default/volatiles
 	# Holds state information pertaining to urandom
 	install -d ${D}/var/lib/urandom
+	install -d ${D}${base_bindir}
+	install -d ${D}${mandir}/man1
 
 	install -m 0644    ${WORKDIR}/functions		${D}${sysconfdir}/init.d
 	install -m 0755    ${WORKDIR}/bootmisc.sh	${D}${sysconfdir}/init.d
@@ -98,6 +107,8 @@ do_install () {
 	install -m 0644    ${WORKDIR}/volatiles		${D}${sysconfdir}/default/volatiles/00_core
 	install -m 0755    ${WORKDIR}/dmesg.sh		${D}${sysconfdir}/init.d
 	install -m 0644    ${WORKDIR}/logrotate-dmesg.conf ${D}${sysconfdir}/
+	install -m 0755    ${WORKDIR}/usleep            ${D}${base_bindir}
+	install -m 0644    ${WORKDIR}/usleep.1          ${D}${mandir}/man1
 
 	if [ "${TARGET_ARCH}" = "arm" ]; then
 		install -m 0755 ${WORKDIR}/alignment.sh	${D}${sysconfdir}/init.d
Signature · 1 line
1.8.4.1
#1 lore raw
Quoted 4 lines · Ming Liu

Add usleep in to support sleeping some number of microseconds.

Maybe it's just me, but initscripts seems like a horrible place to put this.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
#2 lore raw
Quoted 6 lines · Christopher Larson
Quoted 3 lines

Add usleep in to support sleeping some number of microseconds.

Maybe it's just me, but initscripts seems like a horrible place to put this.

Agreed. Also is there a rationale for adding this?

Ross

#3 lore raw
In reply to Christopher Larson
Quoted 11 lines · Christopher Larson
Quoted 4 lines · Ming Liu

Add usleep in to support sleeping some number of microseconds.

Maybe it's just me, but initscripts seems like a horrible place to put this.

It's not just you! Not sure why it's being added here and I don't see any usage of it, so more information is required.

Sau!

author
#4 lore raw
Quoted 5 lines · Saul Wold
Quoted 4 lines · Christopher Larson
Quoted 2 lines · Ming Liu

Add usleep in to support sleeping some number of microseconds.

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

Maybe it's just me, but initscripts seems like a horrible place to put this.

It's not just you! Not sure why it's being added here and I don't see any usage of it, so more information is required.

Why I've sent this is because I noticed there was no usleep binary in any of the packages in oe repositories, and I assumed that the end user might like to use it in their rootfs, so I migrated it from initscripts package of RHEL. Anyway, if all you guys think it's not necessary and not appropriate, I will not insist it, we could just ignore my proposal. :)

the best,
thank you

Quoted 4 lines

Sau!

#5 lore raw
Quoted 17 lines · Ming Liu
Quoted 15 lines · Saul Wold
Quoted 13 lines · Christopher Larson

On Wed, Jul 2, 2014 at 12:33 AM, Ming Liu <[email protected]> wrote:

Add usleep in to support sleeping some number of microseconds.

Quoted 4 lines

Maybe it's just me, but initscripts seems like a horrible place to put this.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

It's not just you! Not sure why it's being added here and I don't see

any usage of it, so more information is required.

Why I've sent this is because I noticed there was no usleep binary in any of the packages in oe repositories, and I assumed that the end user might like to use it in their rootfs, so I migrated it from initscripts package of RHEL. Anyway, if all you guys think it's not necessary and not appropriate, I will not insist it, we could just ignore my proposal. :)

The tool itself sounds like it could be of use, but it should likely get its own recipe in meta-oe until/if something in oe-core actually needs it.

Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
author
#6 lore raw
Quoted 34 lines · Christopher Larson

On Wed, Jul 2, 2014 at 7:26 PM, Ming Liu <[email protected] <mailto:[email protected]>> wrote:

On 07/03/2014 03:39 AM, Saul Wold wrote:

On 07/02/2014 10:37 AM, Christopher Larson wrote:

On Wed, Jul 2, 2014 at 12:33 AM, Ming Liu <[email protected] <mailto:[email protected]>> wrote:

Add usleep in to support sleeping some number of microseconds.

<mailto:[email protected]>>

Maybe it's just me, but initscripts seems like a horrible place to put this.

It's not just you! Not sure why it's being added here and I don't see any usage of it, so more information is required.

Why I've sent this is because I noticed there was no usleep binary in any of the packages in oe repositories, and I assumed that the end user might like to use it in their rootfs, so I migrated it from initscripts package of RHEL. Anyway, if all you guys think it's not necessary and not appropriate, I will not insist it, we could just ignore my proposal. :)

Quoted 1 line

The tool itself sounds like it could be of use, but it should likely get its own recipe in meta-oe until/if something in oe-core actually needs it.

Got it, thanks! I will do that.

the best,
thank you

Quoted 6 lines
Signature · 5 lines
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics