Annotation of researchv10dc/man/adm/man9/request.9, revision 1.1

1.1     ! root        1: .TH REQUEST 9.2
        !             2: .CT 2 comm_term time_man proc_man
        !             3: .SH NAME
        !             4: request, own, wait, alarm, sleep, nap, kbdchar, rcvchar, realtime, sendchar, sendnchars, kill, exit \- 5620 input/output requests
        !             5: .SH SYNOPSIS
        !             6: .B #include <jerq.h>
        !             7: .PP
        !             8: .B void request(r) int r;
        !             9: .PP
        !            10: .B int own(r) int r;
        !            11: .PP
        !            12: .B int wait(r) int r;
        !            13: .PP
        !            14: .B void alarm(t) unsigned t;
        !            15: .PP
        !            16: .B void sleep(t) unsigned t;
        !            17: .PP
        !            18: .B void nap(t) unsigned t;
        !            19: .PP
        !            20: .B long realtime();
        !            21: .PP
        !            22: .B int kbdchar();
        !            23: .PP
        !            24: .B int rcvchar();
        !            25: .PP
        !            26: .B void sendchar(c) int c;
        !            27: .PP
        !            28: .B "void sendnchars(n, cp) int n; char *cp;"
        !            29: .PP
        !            30: .B void kill(s)
        !            31: .B int s;
        !            32: .PP
        !            33: .B void exit();
        !            34: .SH DESCRIPTION
        !            35: .I Request
        !            36: announces a program's intent to use I/O devices and resources,
        !            37: and is usually called once early in a program.
        !            38: The bit vector
        !            39: .I r
        !            40: indicates which resources are to be used by
        !            41: OR'ing together one or more of the elements
        !            42: .B KBD
        !            43: (keyboard),
        !            44: .BR MOUSE ,
        !            45: .B RCV
        !            46: (characters received by terminal from Unix),
        !            47: .B SEND
        !            48: (characters sent from terminal to Unix)
        !            49: and
        !            50: .BR ALARM .
        !            51: For example,
        !            52: .B request(MOUSE|KBD)
        !            53: indicates that the process
        !            54: wants to use the mouse and keyboard.
        !            55: If the keyboard is not requested,
        !            56: characters typed will be sent to the standard input of the Unix process.
        !            57: If the mouse is not requested,
        !            58: mouse events in the process's layer will be interpreted by the
        !            59: system rather than passed to the process.
        !            60: .B SEND
        !            61: and
        !            62: .B CPU
        !            63: (see 
        !            64: .B wait
        !            65: below) are always implicitly
        !            66: requested.
        !            67: .I Request
        !            68: sleeps for one clock tick to synchronize mouse control with the kernel.
        !            69: .PP
        !            70: .I Own
        !            71: returns a bit vector
        !            72: of which I/O resources have data available.
        !            73: For example,
        !            74: .BR own()&KBD
        !            75: indicates
        !            76: whether a character is available to be read by
        !            77: .I kbdchar
        !            78: (see below),
        !            79: .B own()&MOUSE
        !            80: tells if the process's
        !            81: .B mouse
        !            82: structure (see
        !            83: .IR button (9.2))
        !            84: is current, and
        !            85: .B own()&ALARM
        !            86: indicates whether the alarm timer has fired.
        !            87: .PP
        !            88: .IR Wait 's
        !            89: argument
        !            90: .I r
        !            91: is a bit vector composed as for
        !            92: .IR request .
        !            93: .I Wait
        !            94: suspends the process,
        !            95: enabling others,
        !            96: until at least one of the requested resources is available.
        !            97: The return value is a bit vector indicating which of the requested resources
        !            98: are available \(em the same as
        !            99: .BR own()&r .
        !           100: .PP
        !           101: Processes wishing to give up the processor to enable other processes to run
        !           102: may call
        !           103: .BR wait(CPU) ;
        !           104: it will return as soon as all other active processes have had a chance to run.
        !           105: .B CPU
        !           106: is a fake resource which is always
        !           107: requested.
        !           108: The
        !           109: .B SEND
        !           110: pseudo-resource is unused;
        !           111: .B wait(SEND)
        !           112: always succeeds.
        !           113: .PP
        !           114: .I Alarm
        !           115: starts a timer which will fire
        !           116: .I t
        !           117: ticks (60ths of a second) into the future.
        !           118: A pseudo-resource
        !           119: .B ALARM
        !           120: can be used to check the status of the timer with
        !           121: .I own
        !           122: or
        !           123: .IR wait .
        !           124: Calling
        !           125: .I alarm
        !           126: implicitly requests the
        !           127: .B ALARM
        !           128: pseudo-resource.
        !           129: .PP
        !           130: .I Nap
        !           131: busy loops for
        !           132: .I t
        !           133: ticks of the 60Hz internal clock.
        !           134: To avoid beating with the display, programs drawing rapidly changing scenes
        !           135: should
        !           136: .I nap
        !           137: for two ticks
        !           138: between updates, to synchronize the display and memory.
        !           139: .I Nap
        !           140: busy loops until the time is up;
        !           141: .I sleep
        !           142: is identical except that it
        !           143: gives up the processor for the interval.
        !           144: Except when unwilling to give up
        !           145: the mouse, a program should call
        !           146: .I sleep
        !           147: in preference to
        !           148: .IR nap .
        !           149: .I Sleep
        !           150: does not interfere with
        !           151: .IR alarm ,
        !           152: and vice versa.
        !           153: .PP
        !           154: .I Realtime
        !           155: returns the number of 60Hz clock ticks since
        !           156: .I mux
        !           157: started.
        !           158: .PP
        !           159: .I Kbdchar
        !           160: returns the next keyboard character typed to the process.
        !           161: If no characters have been typed, or
        !           162: .B KBD
        !           163: has not been
        !           164: .IR request ed,
        !           165: .I kbdchar
        !           166: returns
        !           167: \-1.
        !           168: .PP
        !           169: .I Rcvchar
        !           170: returns the next character received from the host,
        !           171: typically written on the standard output of a Unix process.
        !           172: If there are no characters available, or
        !           173: .B RCV
        !           174: has not been
        !           175: .IR request ed,
        !           176: .I rcvchar
        !           177: returns
        !           178: \-1.
        !           179: .PP
        !           180: .I Sendchar
        !           181: sends a single byte to the host,
        !           182: which will normally be read on the standard input of the Unix process.
        !           183: .I Sendnchars
        !           184: sends to the host
        !           185: .I n
        !           186: characters pointed to by
        !           187: .IR p .
        !           188: .PP
        !           189: .I Kill
        !           190: sends the associated Unix process the signal
        !           191: .IR s ;
        !           192: see 
        !           193: .IR signal (2).
        !           194: .PP
        !           195: .I Exit
        !           196: terminates the process.
        !           197: Unlike on Unix,
        !           198: .I exit
        !           199: does not return an exit status to a parent.
        !           200: Calling
        !           201: .I exit
        !           202: replaces the running process by the default terminal program.
        !           203: Any associated Unix process must arrange for its own demise;
        !           204: .I exit
        !           205: is a purely local function.
        !           206: When a process calls
        !           207: .IR exit ,
        !           208: all local resources: keyboard, mouse, storage, etc.,
        !           209: are deallocated automatically.
        !           210: .PP
        !           211: .I Realtime
        !           212: returns the number of sixtieths of a second elapsed since
        !           213: .IR mux (9.1)
        !           214: was started.
        !           215: .SH EXAMPLES
        !           216: .EX
        !           217: request(KBD|RCV);
        !           218: for(;;){
        !           219:        r=wait(KBD|RCV);
        !           220:        if(r&KBD)
        !           221:                keyboard(kbdchar());
        !           222:        if(r&RCV)
        !           223:                receive(rcvchar());
        !           224: }
        !           225: .EE
        !           226: .PD0
        !           227: .IP
        !           228: Take input from either the keyboard or the host.
        !           229: .PD
        !           230: .SH SEE ALSO
        !           231: .IR button (9.2)
        !           232: .SH BUGS
        !           233: .B own()&MOUSE
        !           234: does not guarantee that you own the mouse.
        !           235: The correct test is
        !           236: .EX
        !           237:        (own()&MOUSE) && ptinrect(mouse.xy, Drect)
        !           238: .EE

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.