% define stdin 0 % define stdout 1 % define stderr 2
Als Nächstes erzeugen wir einen symbolischen Namen für jeden Systemaufruf:
%define SYS_nosys 0 %define SYS_exit 1 %define SYS_fork 2 %define SYS_read 3 %define SYS_write 4 ;
www.freebsd.org% define stdin 0 % define stdout 1 % define stderr 2
Next, we create a symbolic name for each system call:
%define SYS_nosys 0 %define SYS_exit 1 %define SYS_fork 2 %define SYS_read 3 %define SYS_write 4 ;
www.freebsd.orgint 80h ret
Wir erzeugen ein Makro, das ein Argument erwartet, die Systemaufruf-Nummer:
%macro system 1 mov eax, %1 call access.the.bsd.kernel %endmacro
www.freebsd.orgint 80h ret
We create a macro which takes one argument, the syscall number:
%macro system 1 mov eax, %1 call access.the.bsd.kernel %endmacro
www.freebsd.org# . / procsystime -n csh Tracin … Hit Ctrl-C to en … ^ C Elapsed Times for processes csh, SYSCALL TIME ( ns ) getpid 6131 sigreturn 8121 close 19127 fcntl 19959 dup 26955 setpgid 28070 stat 31899 setitimer 40938 wait4 62717 sigaction 67372 sigprocmask 119091 gettimeofday 183710 write 263242 execve 492547 ioctl 770073 vfork 3258923 sigsuspend 6985124 read 3988049784
Wie aus der Ausgabe ersichtlich ist, verbraucht der read()-Systemaufruf die meiste Zeit in Nanosekunden, während der Systemaufruf getpid() hingegen am schnellsten läft.
Navigation footer
www.freebsd.org# . / procsystime -n csh Tracin … Hit Ctrl-C to en … ^ C Elapsed Times for processes csh, SYSCALL TIME ( ns ) getpid 6131 sigreturn 8121 close 19127 fcntl 19959 dup 26955 setpgid 28070 stat 31899 setitimer 40938 wait4 62717 sigaction 67372 sigprocmask 119091 gettimeofday 183710 write 263242 execve 492547 ioctl 770073 vfork 3258923 sigsuspend 6985124 read 3988049784
As shown, the read() system call used the most time in nanoseconds while the getpid() system call used the least amount of time.
Navigation footer
www.freebsd.orgVoulez-vous ajouter des mots, des phrases ou des traductions ?
Proposez de créer une nouvelle entrée pour un mot.