📄 nint.h
字号:
/* @(#)nint.h 1.1 92/07/30 SMI *//* * Copyright (c) 1985 by Sun Microsystems, Inc. *//* * Nint.h - Private header file for the interposer part of the notifier. * The interposer is responsible for managing the interposition stack * during notifications (callouts) to clients. It is used both by the * detector and the dispatcher parts of the notifier. */#ifndef NINT_DEFINED#define NINT_DEFINED#ifdef COMMENTThe interposition stack is independent of the detector and dispatcher.Interposition stuff is prefaced with nint_. Interposition is only viablewith static conditions. The number of interpositions is limitedto the max size of the fast allocaction node (about 6 levels deep).The truth of the function list (interposition list) is kept by thedetector.Keeping track of which function to call when running down theinterposition list is done by maintaining an "interposition stack".This is a stack of conditions that currently have callouts outstanding.Before an initial callout is made, a copy of the condition is pushedonto the top of the stack. The first callout is made and the func_nextindex is set to 1.When a notify_next_*_func call is made, the top of the interposition stackis supposed to be the relevent condition. Some consistency checks are doneto check this. The next function for that condition is called.When the initial callout returns, the condition is popped from theinterposition stack. If a condition is removed from the notifier thatis currently on the interposition stack, nothing is done to theinterposition stack. It is assumed that higher levels of softwarewouldn't call notify_next_*_func for that condition.********************** Public Interface Supporting *********************The public programming interface that the interposer supports follows:notify_interpose_input_funcnotify_interpose_output_funcnotify_interpose_exception_funcnotify_interpose_itimer_funcnotify_interpose_signal_funcnotify_interpose_wait3_funcnotify_interpose_destroy_funcnotify_interpose_event_funcnotify_next_input_funcnotify_next_output_funcnotify_next_exception_funcnotify_next_itimer_funcnotify_next_signal_funcnotify_next_wait3_funcnotify_next_destroy_funcnotify_next_event_funcnotify_remove_input_funcnotify_remove_output_funcnotify_remove_exception_funcnotify_remove_itimer_funcnotify_remove_signal_funcnotify_remove_wait3_funcnotify_remove_destroy_funcnotify_remove_event_func#endif COMMENT/* Private to interposer */extern NTFY_CONDITION *nint_stack; /* Condition stack */extern int nint_stack_size; /* Length of condition stack */extern int nint_stack_next; /* Next empty slot in condition stack */extern Notify_error nint_alloc_stack();/* (Pre)allocate enough stack space */extern Notify_func nint_set_func(); /* (NTFY_CONDITION *cond, Notify_func new_func) Call while in critical section. */extern Notify_func nint_get_func(); /* (NTFY_CONDITION *cond) Call while in critical section. */extern Notify_error nint_interpose_func(); /* (Notify_client nclient, Notify_func func, NTFY_TYPE type, caddr_t data, int use_data) */extern Notify_error nint_remove_func(); /* (Notify_client nclient, Notify_func func, NTFY_TYPE type, caddr_t data, int use_data) */extern Notify_error nint_interpose_fd_func(); /* (Notify_client nclient, Notify_func func, NTFY_TYPE type, int fd) */extern Notify_value nint_next_fd_func(); /* (Notify_client nclient, NTFY_TYPE type, int fd) */extern Notify_error nint_remove_fd_func(); /* (Notify_client nclient, Notify_func func, NTFY_TYPE type, int fd) */extern Notify_error nint_copy_callout(); /* (NTFY_CONDITION *new_cond, NTFY_CONDITION *old_cond) Overwrites new_cond->callout with newly allocated node filled with old_cond stuff */extern Notify_func nint_push_callout(); /* (NTFY_CLIENT *client, NTFY_CONDITION *cond) Assumes being called while critical area protected. */extern Notify_func nint_next_callout(); /* (Notify_client nclient, NTFY_TYPE type) */extern void nint_pop_callout(); /* () Enters critical section to do work. */extern void nint_unprotected_pop_callout(); /* () Like nint_pop_callout exceptdoes assumes in critical section*/#endif NINT_DEFINED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -