home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ccut!wnoc-tyo-news!lkbreth!utnet-news!news.u-tokyo.ac.jp!enterprise!mech.t.u-tokyo.ac.jp!mech!t20258
- From: t20258@mech.t.u-tokyo.ac.jp (Eiji Inoue)
- Newsgroups: fj.questions.unix
- Subject: UNIX System call on 68
- Message-ID: <T20258.92Nov7114702@bacula.mech.t.u-tokyo.ac.jp>
- Date: 7 Nov 92 02:47:02 GMT
- Sender: news@mech.t.u-tokyo.AC.JP (News Operator)
- Distribution: fj
- Organization: Dept. of Mechanical Engineering, Univ. of Tokyo, Japan.
- Lines: 78
- Nntp-Posting-Host: bacula
-
-
- $@=i$a$F!"Ej9F$7$^$9!#(J
- $@$+$J$j!"5$?'$NJQ$o$C$?<ALd$+$bCN$l$^$;$s$,!"$3$N!"(JNG$@$KE,$5$J$$;~$O!"$I$3$GJ9$1(J$@$PNI$$$+65$($F2<$5$$!#(J
-
- $@!V<ALd!W(J
- $@:#!"#6#8#0#0#0$N%"%;%s%V%i!<$N%=!<%9$r0\?"$7$h$&$H$7$F$$$k$N$G$9(J$@$,!"(J
- $@$=$NCf$K!"(JUNIX$@$N(Jsystem call($@$"$k$$$O(Jfunction call$@$H$$$&$Y$-$J$N$+$J!K(J
- $@$,$"$C$F!"(Jdestination $@%7%9(J$@%F%`$O!"2?$N(JBIOS$@$b;}$C$F$J$$$h$&$J$b$N$J$N$G!"(J
- $@$=$NF0:n$d!"F/$-$J$I$O!"2?$H$$$&K\!?;qNA$r8+$l$P!"$o$+(J$@$k$N$G$7$g$&$+!)(J
- $@0lHL$N(JUNIX$@$NK\$G$O!"(Jsystem call$@$H$$$C$F$b!"(JC$@$+$i!"%i%$%V%i%j!<$r8F$V7A(J
- $@$G;H$o$l$F$$$k(J$@$N$G!"BP1~$7$F$$$k$+$b$o$+$j$^$;$s$7!":Y$+$$!J(Jstack work
- or register etc.$@!K$3$H$O!"$o$+$j$^$;$s!#(J
- $@%=(J$@!<%9$N$[$&$O!"0J2<$NMM$K!";H$o$l$F$$$^$9!#(J
-
- move.l #3,-(a7) ; Close all open files
- clr.l -(a7) ; Dummy place holder
- move.l #20,d3 ; How many units to close
- abor1 moveq #6,d0 ; UNIX "close" system call
- trap #0
- addq.l #1,4(a7) ; Move to next file descriptor
- dbra d3,abor1
- .
- .
- .
- move.b InUnit(a0),d0 ; Get file descriptor
- ext.w d0
- ext.l d0 ; Turn file descriptor into longword
- move.l #1024,-(a7) ; Third arg: # bytes
- move.l a0,-(a7) ; Second: store buffer
- move.l d0,-(a7) ; First arg is file descriptor
- clr.l -(a7) ; Dummy space holder
- moveq #3,d0 ; UNIX READ syscall
- trap #0
- bcc getl2 ; On carry set, abort on an I/O error
- jmp io_err
- .
- .
- .
- move.l #1,d0 ; Request 1 means "exit"
- clr.l -(a7) ; We will give a return code of 0
- clr.l -(a7)
- trap #0
- trap #1 ; Shouldn't reach here!
- .
- .
- .
- move.l ounit,a1 ; Build syscall parameters
- move.l d0,-(a7) ; Number of bytes
- move.l a0,-(a7) ; Buffer
- move.l (a1),-(a7) ; File descriptor
- clr.l -(a7) ; Dummy place holder
- move.l #4,d0 ; A write syscall
- trap #0 ; Do the call
- add.l #16,a7 ; Remove the arguments
- bcc prst3
- jmp io_err ; Complain if the I/O failed
- .
- .
- .
- clr.b (a1) ; Trailing NULL
- move.l a0,d6 ; update input pointer
- clr.l -(a7) ; Mode 0=read
- pea pad1 ; Pointer to file name
- clr.l -(a7) ; dummy space
- moveq #5,d0 ; Open request
- trap #0
- bcs input3
- add.l #12,a7 ; Get rid of parameters
- $@$3$l$G(J$@!"$[$\$9$Y$F$G$9$,!"2r@b$7$F$b$i$&$K$O!"BgJQ$@$H;W$$$^$9$N$G!"(J
- $@$I$N$h$&$J5!G=$,<B8=$5$l$F$$$k$N$+$N<j(J$@$,$+$j$d!">pJs$N$"$k$H$3$m$J$I$r!"(J
- $@65$($F2<$5$$!#(J
-
- --
- $@El5~Bg3X(J $@9)3XIt(J $@5!3#>pJs(J$@9)3X2J;0G/(J
- $@0f>e1Q<#(J Eiji Inoue
- E-mail: t20258@mech.t.u-tokyo.ac.jp
-
-
-