LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.

Notices


Reply
  Search this Thread
Old 07-23-2010, 01:44 PM   #1
Neo_6
LQ Newbie
 
Registered: Jul 2010
Posts: 2

Rep: Reputation: 0
sleep on Linux from scratch


Hi to everyone,
I am using linux from scratch and I was trying to implement the sleep function in a simple main in c++.
Can it be that on Linux from scratch the sleep function is not recognised?If I am right do you know any other way to "sleep" the process for 1 second?
Thank you in advance.
 
Old 07-23-2010, 01:56 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

You are using LFS? To do what?

LFS is just a very basic linux environment and not (very) useful to do day-to-day stuff with.

You need at least the first three chapters of BLFS and even then you don't have too much to work with. BLFS makes LFS workable and fills the bare LFS framework with goodies and must haves.

For example: BLFS adds a sane user environment (which is not done in LFS).

Hope this clears things up.
 
Old 08-03-2010, 09:41 AM   #3
hoes
Member
 
Registered: Sep 2005
Distribution: debian, linux from scratch
Posts: 190

Rep: Reputation: 51
According to my build of LFS-6.3 using the live-cd sleep is provided by LFS.
It is part of the coreutils package and is found in /bin.

It should also be present on newer versions like LFS-6.6:
file:///home/hoes/Desktop/book-lfs/LFS-BOOK-6.6-HTML/chapter06/coreutils.html.

But note that sleep is a bash program.
If you are programming in C++ you can't just call shell programs.
You need to use libraries with the appropriate commands.

Maybe this thread in the ubuntu forum is of use to you:
http://ubuntuforums.org/showthread.php?t=296142
It refers to a library that contains sleep and a way to create sleep using the time library.

Your question is more about programming in general than about LFS.
I hope this is helpful, but maybe it's also a good idea to look up a tutorial on c++ programming and library calls on linux.

Good luck.
 
1 members found this post helpful.
Old 08-03-2010, 09:52 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
@hoes:
Quote:
Your question is more about programming in general than about LFS.
If the OP only installed LFS, s/he doesn't have a good working environment yet (see post #2) and would make the problem LFS specific and not c(++) specific.

Last edited by druuna; 08-03-2010 at 10:43 AM. Reason: fixed typo
 
0 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching for Server (BOOTP/DHCP) <sleep> <sleep> .. .. Eileen Linux - Networking 12 10-21-2005 01:14 AM
linux sleep() bobbens Programming 5 01-15-2005 12:48 PM
Linux Won't Recover after Sleep lramos85 Linux - Laptop and Netbook 0 05-15-2004 12:23 AM
How do sleep under 20 ms in Linux? vedion Linux - Software 1 04-23-2004 06:03 AM
ali aladdin v agp stinks :scratch: :scratch: :scratch: Mr Marmmalade Linux - Hardware 1 07-08-2003 05:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 07:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration