newbie to unix programming in C, needed a few simple prgs on these functions!
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
newbie to unix programming in C, needed a few simple prgs on these functions!
Hi all,
I am a newbie to unix programming using C..
So i would like to have a few simple C programs to start off with..
I wanted programs on learning ,
abort,kill and raise,alarm and pause,
I would also like to know how to use the vfork()
It would be really great if i can have these programs
Play around with 'signal' and 'alarm'. If you're a beginner there's no way you'll understand the actual programs that make use of these. It's better to practice by building your own toy program which does nothing useful but you can make quick changes to make sure you understand what's going on.
man sigaction
Just create signal handlers that print something out as you send different signals (SIGUSR1/2, SIGINT, SIGTERM, SIGPIPE ... etc etc etc).
For 'alarm', you just have to handle 'SIGALRM'.
For 'pause' - similar to 'alarm' - once you have actually implemented signal handlers, it's easy to use.
For 'vfork' do the same - write a small program that does nothing useful but prints out statements to show you that you got things right and can tell the difference between the child and parent process.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.