Visit Our UNIX and Linux User Community


Detecting interruptions in C


 
Thread Tools Search this Thread
Top Forums Programming Detecting interruptions in C
# 1  
Old 12-06-2007
Detecting interruptions in C

Hi. You may know how to detect when a interruption succeeded programming in C. Just like receiving a signal without blocking. Knowing when it was a keystroke (IRQ 2), or a mouse movement (12), or a disk access, etc. and getting actually for example the letter typed.

Thanks a lot.
# 2  
Old 12-06-2007
With what operating system, environment, hardware etc?

If you are talking about DOS, just stick in a simple TSR with redirector, if you are talking about a more complex OS it's a driver responsibility.

Out of interest, why, as a program, would you care whether a disk access has occurred?
# 3  
Old 12-06-2007
Working on Linux. But it shouldn't matter. There is not a standard C routine to know when a interruption succeeded? A way to handle signals/events generated from interruptions, for example.

I want to know this to implement a random bit generator. You have to check different sources like the time delaying between keystrokes or maybe the change of the temperature.
# 4  
Old 12-06-2007
Quote:
Originally Posted by Ashrentum
There is not a standard C routine to know when a interruption succeeded?
No. The standard C library works at a much higher level. Signal only refers to your process.

You could open an HTTP connection to a weather site.....?
# 5  
Old 12-06-2007
I am just asking for an API, like in Unix the system calls are wrapped in C functions. If there isn't something like this, do you know a library to solve it?
# 6  
Old 12-06-2007
Quote:
Originally Posted by Ashrentum
I am just asking for an API, like in Unix the system calls are wrapped in C functions. If there isn't something like this, do you know a library to solve it?
If I was on Solaris 9 and above I would just use "/dev/random" and be done.

rand(3): pseudo-random number generator - Linux man page
# 7  
Old 12-06-2007
I know the existence of /dev/random. I just wanna play with the sources by myself, mixing them, etc. But I just don't how to get that information. I have seen some OpenGL libraries but seems too complicate for something I think should be a basic routine of an OS.

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need help in detecting errors

Hi All , I need a script to find errors in a particular and in a particular path Actually in my logs i`ve so many kinds of errors(i can even say as 100 types also).if i run the script i need to know the error (some errors can aviod ) so finally the script o/p should be a numeric... (3 Replies)
Discussion started by: radha254
3 Replies

2. UNIX for Advanced & Expert Users

detecting the running services

I did search on the subject on services in linux and they do explain how to find what are the services that loaded when the linux boot. however I have not find how to detect what services run right now. I would like to now that and how to kill services. Thanks. (3 Replies)
Discussion started by: programAngel
3 Replies

3. UNIX for Dummies Questions & Answers

detecting consecutive filenames

I have a series of filenames of the format junk_x_###.txt where x and ### are numbers. I need to detect when at least 30 consecutive files (e.g. junk_1_001.txt, junk_1_002.txt.....) are in the directory. There are sets of files with similar names that need to be grouped together and counted... (0 Replies)
Discussion started by: stanleymacc
0 Replies

4. Solaris

Detecting Harddrive Errors

I am looking for some tips or suggestions in how to do the following. 1) From a Solaris server, I run the command iostat -En and receive output that is similiar to the following which shows your disks along with the cdrom/dvdrom: c0t2d0 Soft Errors: 0 Hard Errors: 0 Transport... (1 Reply)
Discussion started by: sunsysadm2003
1 Replies

5. SCO

lan card not detecting

hi all i have installed SCO 5.0.5 on a "Netfinity 5000" IBM server. But the OS is not detecting the lan card. how can i detect it.... help and thanks in advance . bidhayak (3 Replies)
Discussion started by: bidhayakm
3 Replies

6. Shell Programming and Scripting

detecting multiple instances

Hi Gurus I have a requirement like this. i use solaris OS.. if there are 2 instances of the same ksh file running in the directory, i need to kill the ksh file that started to run latest. suppose ragha.ksh starts running thru cron in abc/xyz directory now ragha.ksh started running by any... (3 Replies)
Discussion started by: ragha81
3 Replies

7. Shell Programming and Scripting

Detecting Vmware on Linux

Hi, I need help to detect Vmware on Linux and SunOS. I need to know if Vmware is installed on the box. If yes then if it is a physical or a virtual machine. Thanks in advance, amittal (2 Replies)
Discussion started by: amittal
2 Replies

8. UNIX for Dummies Questions & Answers

Detecting Second disk

Hello all, first of all, I apologise if I may ask stupid or obvious questions, but I'm new to UNIX and I think I need a little bit of help before I start gearing up :) Anyway, I have installed a Solaris 8 on a Sun machine, and it has 2 physical disks in it. However, it seems that it is only... (7 Replies)
Discussion started by: dragunu
7 Replies

9. Programming

Detecting a key combination

Could anybody tell me how I can detect a particular key combination and perform a particular task on that event. e.g. if I press Ctrl + L on the shell then it clears the screen. Please tell me how it can be performed on my shell. And how the Arrow Keys can be detected. I tried but pressing a key... (11 Replies)
Discussion started by: mobile01
11 Replies

10. UNIX for Dummies Questions & Answers

detecting drives

I know that Unix is different from windows in that it needs more manual configuring but how do I get Solaris 8 (Intel version) to recognize my floppy drive and cd-rom?? I mean does it automatically detect the drives at startup and I have to mount them or do I have to create the drives somehow and... (1 Reply)
Discussion started by: eloquent99
1 Replies

Featured Tech Videos