- 论坛徽章:
- 5
|
原帖由 richardhesidu 于 2009-8-5 16:31 发表 ![]()
3. Linux的实现技术,比如sockets, softirqs等。
请教一下,
1, 软中断和tasklet最显著的区别在哪里?
2, 我有一个防火墙设备,内核是linux,没有自己的ip,要怎么在应用层抓到防火墙保护的网站服务器发出 ...
刚开始学Linux的kernel,一直做应用来着
问一下
第一个问题是不是我该看下面这段啊?
- 398 /* Tasklets --- multithreaded analogue of BHs.
- 399
- 400 Main feature differing them of generic softirqs: tasklet
- 401 is running only on one CPU simultaneously.
- 402
- 403 Main feature differing them of BHs: different tasklets
- 404 may be run simultaneously on different CPUs.
- 405
- 406 Properties:
- 407 * If tasklet_schedule() is called, then tasklet is guaranteed
- 408 to be executed on some cpu at least once after this.
- 409 * If the tasklet is already scheduled, but its excecution is still not
- 410 started, it will be executed only once.
- 411 * If this tasklet is already running on another CPU (or schedule is called
- 412 from tasklet itself), it is rescheduled for later.
- 413 * Tasklet is strictly serialized wrt itself, but not
- 414 wrt another tasklets. If client needs some intertask synchronization,
- 415 he makes it with spinlocks.
- 416 */
复制代码
- 879 /**
- 880 * request_threaded_irq - allocate an interrupt line
- 881 * @irq: Interrupt line to allocate
- 882 * @handler: Function to be called when the IRQ occurs.
- 883 * Primary handler for threaded interrupts
- 884 * @thread_fn: Function called from the irq handler thread
- 885 * If NULL, no irq thread is created
- 886 * @irqflags: Interrupt type flags
- 887 * @devname: An ascii name for the claiming device
- 888 * @dev_id: A cookie passed back to the handler function
- 889 *
- 890 * This call allocates interrupt resources and enables the
- 891 * interrupt line and IRQ handling. From the point this
- 892 * call is made your handler function may be invoked. Since
- 893 * your handler function must clear any interrupt the board
- 894 * raises, you must take care both to initialise your hardware
- 895 * and to set up the interrupt handler in the right order.
- 896 *
- 897 * If you want to set up a threaded irq handler for your device
- 898 * then you need to supply @handler and @thread_fn. @handler ist
- 899 * still called in hard interrupt context and has to check
- 900 * whether the interrupt originates from the device. If yes it
- 901 * needs to disable the interrupt on the device and return
- 902 * IRQ_WAKE_THREAD which will wake up the handler thread and run
- 903 * @thread_fn. This split handler design is necessary to support
- 904 * shared interrupts.
- 905 *
- 906 * Dev_id must be globally unique. Normally the address of the
- 907 * device data structure is used as the cookie. Since the handler
- 908 * receives this value it makes sense to use it.
- 909 *
- 910 * If your interrupt is shared you must pass a non NULL dev_id
- 911 * as this is required when freeing the interrupt.
- 912 *
- 913 * Flags:
- 914 *
- 915 * IRQF_SHARED Interrupt is shared
- 916 * IRQF_DISABLED Disable local interrupts while processing
- 917 * IRQF_SAMPLE_RANDOM The interrupt can be used for entropy
- 918 * IRQF_TRIGGER_* Specify active edge(s) or level
- 919 *
- 920 */
复制代码 |
|