|                                                                                                        |

Copyright © h-peter recktenwald, berlin, 2000 - free for any related work and, non-commercial distribution.
text mode (Lynx, Printer) tables arranged to 110 chars/line.


 

[intro] [a:index] [s:index] [#:index] [sys_fcntl]
[1..64] [65..128] [129..192] [193..256] [257..] [ref] [struc] [fcntl] [ioctl] [pguide] [man2]
[next] [back] [linux] [main] [bot] [top]
Syscalls pages archive (110K->1M), updated (2.3.0, ver. 1.66) man 2 pages (170K->1,2M)

 







     

  1. getpgrp void           65  
      get group id of parent of current process
      return pid_t gid
      errors inval, perm, srch
         
  2.  


  3. setsid void           66  
      create session, set group id
      return pid_t gid
      errors perm
         
  4.  


  5. sigaction int signum, c struct old_sigaction *act, struct old_sigaction *oldact       67  
      set/get signal handler, signum re man 7 signal
      return -/-
      errors fault, intr, inval
      ref signal.h, asm/signal.h, include/signal.h
  6.  


  7.   sgetmask  void (*sighandler)(int)           68  
       library function, re [signal] & sigprocmask/siggetmask
      return  
      errors  
         
  8.  


  9.   ssetmask             69  
      re [signal] & sigprocmask/sigsetmask
      return  
      errors  
         
  10.  


  11.   setreuid uid_t ruid uid_t euid         70  
      set real and effective user id
      return -/-
      errors perm
         
  12.  


  13.   setregid gid_t rgid, gid_t egid         71  
      set real and effective group id
      return -/-
      errors perm
         
  14.  


  15.   sigsuspend             72  
      replacement for sigpause, re sigaction, [signal]
      return  
      errors  
         
  16.  


  17.   sigpending             73  
      get pending, but blocking signals, re sigaction
      return  
      errors  
         
  18.  


  19.   sethostname const char *name, size_t len         74  
      set system's hostname
      return -/-
      errors fault, inval, perm
      ref kernel/sys.c, syscall sysctl, /proc filesystem.
  20.  


  21.   setrlimit int resource, const struct rlimit *rlim         75  
      set resource limit
      return -/-
      errors fault, inval, perm
      ref linux/time.h, sys/time.h, sys/resource.h, unistd.h
  22.  


  23.   getrlimit int resource, struct rlimit *rlim         76  
      get resource limits
      return -/-
      errors fault, inval, perm
      refs include/linux/time.h,
    include/linux/resource.h,
    include/asm/resource.h
      K6 note rlimit limited to 2GB, re ugetrlimit
    kernel source explains: "Back compatible 2Gig limited rlimit".
    K2 sys_getrlimit renamed to sys_old_getrlimit in K4,
    K4 sys_old_getrlimit renamed to sys_getrlimit in K6.
  24.  


  25.   getrusage int who, struct rusage *usage         77  
      get resource useage
      return -/-
      errors fault, inval, perm
      ref include/linux/time.h,
    include/linux/resource.h,
  26.  


  27.   gettimeofday struct timeval *tv, struct timezone *tz         78  
      get timezone & seconds since 1-jan-1970 ("the epoch")
      arg eax 78
        ebx ptr to writable timeval struct
        ecx ptr to writable timezone struct
      return   result written to supplied data structures
      errors eax fault, inval, perm
      ref   sys/time.h, include/linux/time.h
    • NOTE that <timezone.tz_dsttime> is not a reliable item:
      • man 2 (falsely) stating "tz_dsttime" item of struct timezone not being used and, that any such usage in the kernel be a "bug" - which is just plain nonsense: re kernel source (fat, hfs, hpfs, isofs)...
  28.  



  29.   settimeofday c struct timeval *tv, c struct timezone *tz         79  
      set timezone & seconds since 1-jan-1970
      arg eax 79
        ebx ptr to timeval struct
        ecx ptr to timezone struct
      return   -/-
      errors eax fault, inval, perm
      ref   sys/time.h, include/linux/time.h, -re- note at gettimeofday
  30.  



  31. getgroups int size, gid_t list[]         80  
      get supplemental groups
      return no. of supplementary groups
      errors fault, inval, perm
         
  32.  


  33.   setgroups size_t size, const gid_t *list         81  
      set supplemental groups
      return -/-
      errors fault, inval, perm
         
  34.  


  35.   select K4:oldselect int n, fd_set *rfds, fdset *wfds, s timeval *t     82  
      re newselect K4:select
    suspend until action of a filedescriptor, synchronous i/o mux.
      return no. of zero descriptors before timeout
      errors intr, inval, nomem
      ref sys/time.h, sys/types.h, unistd.h
    man 2 select_tut
      source sys_i386.c
  36.  


  37. symlink const char *oldpath, const char *newpath         83  
      create symbolic link to a file
      return -/-
      errors (files & permissions errors)
         
  38.  


  39.   oldlstat             84  
      (removed)
  40.  


  41. readlink const char *path, char *buf, size_t bufsize       85  
      read value of a symbolic link
      return no. of bytes read
      errors (fs & permissions errors)
         
  42.  


  43.   uselib const char *library       86  
      use a shared library
      return -/-
      errors acces, noexec, (memory errors as from mmap)
         
  44.  


  45.   swapon           87  
      start swapping to a file/device
      return -/-
      errors inval, noent, nomem, perm (etc)
      source mm/swapfile.c
      ref unistd.h, asm/page.h, sys/swap.h, linux/swap.h
  46.  


  47. reboot int magic, int magic2, int flag, int void *arg     88  
      reboot or en-/disable CTR/ALT/DEL
      return -/-
      errors inval, perm
      ref unistd.h, linux/reboot.h
  48.  


  49.   readdir int readdir, uint fd, struct dirent *dirp, uint count     89  
      read a directory
      return -/-
      errors badf, fault, inval, noent, notdir
      ref unistd.h, linux dirent.h, linux/unistd.h
  50.  


  51.   mmap             90  
        map a file or device into memory
      arg eax  90
        ebx address of args struct, dword items:
    void *start,  page-aligned preferred memory address or, NULL
    size_t length,  page aligned file size
    int protany of PROT_READ, PROT_WRITE, PROT_EXEC
    int flagsone of MAP_SHARED, MAP_PRIVATE, MAP_ANONYMOUS,
    optionally ORed w. MAP_FIXED
    int fd,  file descriptor
    off_t offset, page aligned disp to 1st posn in file.
      ret eax ptr to mapped area, may be -ve!
      err eax acces, again, badf, inval, nomem, txtbusy
      ref unistd.h, sys/mman.h, linux/mm.h, syscall mmap2, glibc: malloc/malloc.c
      source sys_i386.c, mm/mmap.c, mm/filemap.c.
         
      note:  1)  MAP_ANONYMOUS maps a memory area without reference to a file.
         2)  PROT-flags enable the rsp. mode (i.e. UN-protect!)
         3)  PROT_NONE disables all!
         4)  memory "protection" may not become effective as expected! re mprotect flags
         5)  despite of manpages 'explanations', "mmap" access remains receiving it's args by ptr!
         6)  a file cannot be extended by writing to mapped memory (SIGBUS exception).
  52.  


  53.   munmap void *start, size_t length         91  
      unmap a file or device from memory
      return -/-
      errors acces, again, badf, inval, nomem, txtbusy
      ref unistd.h, asm/mman.h mm/mmap.c, libc: malloc/malloc.c
  54.  


  55.   truncate const char *path, off_t length         92  
      change file size to at most length bytes
      return -/-
      errors (file & access)
         
  56.  


  57.   ftruncate int fd, off_t length         93  
      change opened writable file size to at most length bytes
      return -/-
      errors (file & access)
         
  58.  


  59.   fchmod int fd, mode_t mode         94  
      change permissions of an open writable file
      return -/-
      errors (file & access)
      ref sys/types.hsys/stat.h, linux/stat.h -re- struct stat
  60.  


  61.   fchown int fd, uid_t owner, gid_t group       95  
      change owner of an open file 
      return -/-
      errors (file & access)
         
  62.  


  63.   getpriority int which, int who         96  
      get a process/group/users scheduling priority
      return int priority
      errors inval, srch
      ref sys/time.h, sys/resource.h
  64.  


  65.   setpriority int which, int who, int prio       97  
      set a process/group/users scheduling priority
      return -/-
      errors acces, inval, perm, srch
      ref sys/time.h, sys/resource.h
  66.  


  67.   profil char *buf, int bufsiz, int offset, int scale     98  
      execution time profile
      return 0
      errors -/-
      NOTE:  removed w. 2.4(.18) kernel
  68.  


  69.   statfs c ch *path, struct statfs *buf         99  
      get filesystem status (statistics)
      return -/-
      errors (file & access)
      rfs sys/vfs.h
  70.  


  71.   fstatfs int fd, struct statfs *buf         100  
      get opened filesystem status (statistics)
      return -/-
      errors (file & access)
      ref sys/vfs.h
  72.  


  73.   ioperm u long from, u long num, int turn_on       101  
      set selected i/o ports permissions; by 'super user', only.
      return -/-
      errors inval, perm, io
      ref unistd.h, sys/io.h, sys/perm.h; syscall iopl
      src arch/i386/kernel/ioport.c
  74.  


  75.   socketcall int call, u long *args         102  
      socket call multiplexer - re ipc
      return (?)
      errors (?)
      ref  man(2) pages: accept bind connect getpeername
    getsockname getsockopt listen recv recvfrom
    send sendto setsockopt shutdown socket socketpair
      src  net/core/sock.c (&c), linux/socket.h, linux/sockios.h.
  76.  


  77.   syslog int syslog, int type, c *bufp, int len     103  
      manipulate system logging,
    read/clear kernel msg buf, set console loglevel
      return according to type
      errors inval, perm, restartsys
      ref unistd.h, sys/unistd.h, kernel/printk.c (type values)
  78.  


  79.   setitimer int which, c struct itimerval *value, struct itimerval *ovalue       104  
      set interval timer
      return -/-
      errors fault, inval
      ref sys/time.h
  80.  


  81.   getitimer int which, struct itimerval *value         105  
      set interval timer
      return -/-
      errors fault, inval
      ref sys/time.h
  82.  


  83. stat const char *file_name, struct stat *buf         106  
      get file status
      arg eax 106
        ebx ptr to asciz file-name
        ecx ptr to struct stat in writable memory
      return   result written to data array at [ecx]
      errors eax acces, badf, fault, loop, nametoolong, noent, nomem, notdir
      ref   linux/stat.h, linux/major.h, sys/types.h, sys/stat.h
  84.  



  85.   lstat const char *file_name, struct stat *buf         107  
      get file status, re stat
      arg eax 107
        ebx ptr to asciz file-name
        ecx ptr to writable struct stat
      return   result written to data array at [ecx]
      errors eax acces, badf, fault, loop, nametoolong, noent, nomem, notdir
      ref   does not follw a link, otherwise identical with syscall stat
  86.  



  87. fstat int fd, struct stat *buf         108  
      get file status
      arg eax 108
        ebx file descriptor
        ecx ptr to writable struct stat
      return   result written to data array at [ecx]
      errors eax acces, badf, fault, loop, nametoolong, noent, nomem, notdir
      ref   sys/stat.h, unistd.h, linux/stat.h; syscall stat
  88.  



  89.   olduname             109  
      (removed)
      ref  utsname.h, struc oldoldutsname 
  90.  


  91.   iopl int level           110  
      set all (65536) i/o ports permissions; by 'super user', only.
      return -/-
      errors inval, perm
      ref unistd.h, sys/io.h, sys/perm.h; syscall ioperm
      src arch/i386/kernel/ioport.c
  92.  


  93.   vhangup void           111  
      simulate hang-up on current tty; by 'super user', only.
      return -/-
      errors perm
         
  94.  


  95.   idle             112  
      make a process a candidate for swap, make process 0 idle; system boot-up, only
      return "init" does not return, any other job returns EPERM
      errors perm (any job except, "init" at booting up)
      NOTE: sys_idle removed w/ kernel vers. 2.3.13
  96.  


  97.   vm86old struct vm86_struct *info           113  
      pre 2.0.38: enter virtual 8086 mode
      return -/-
      errors perm
      ref  syscall vm86
      note was "vm86" in pre 2.0.28 kernels
  98.  


  99.   wait4 pid_t pid, int status, int options, struct rusage *rusage     114  
      suspend current proc until child pid terminated or, signal received,
    -re- system call waitpid which implements a simplified variant.
      arg eax 114
        ebx ptr to int item for state information on 2nd-ary
        ecx target process id or, more general specification
        edx options, zero or
    WNOHANG don't block waiting,
    WUNTRACED report status of stopped 2nd-aries
        esi ptr to rusage structure of system statistics
      return eax int exitted childs process id
        ebx ptr to process state (somewhat confused, sort of) information
      errors eax child, restartsys
      source kernel/exit.c
      ref USE_BSD, sys/types.h, sys/resource.h, sys/wait.h, waitpid syscall
     
      libc from bits/waitstatus.h
        status supplied as
    exit code @status := byte return code from child << 8 | byte signal
    stop code @status := byte signal << 8 | 127
    can be interpretted
    WEXITSTATUS child's exit state in 2nd byte @status
    WIFEXITED  true if l.s. 7 bits @status = 0
    WIFSIGNALED signal number in/if l.s. 7 bits @status =/= 0 and byte @status =/= 127
    WIFSTOPPED  true if byte @status = 127
    WSTOPSIG  true if byte @status = 128
    WTERMSIG  terminating signal in l.s. 7 bits @status
      NOTE: verify! libc docs appear confused, inaccurate and carelessly compiled
    and, wrt "wait.." nothing at all is documented in the kernel sources!
  100.  



  101.   swapoff const char *path           115  
      stop swapping to file/dev
      return -/-
      errors inval, noent, nomem, perm
      source mm/swapfile.c
      ref unistd.h, sys/swap.h, linux/swap.h
  102.  


  103.   sysinfo struct sysinfo *sysinfo           116  
      get system statistics
      return -/-
      errors fault
      ref kernel/info.c
  104.  


  105.   ipc ui call, int first, int second, int third, void *ptr, long fifth 117  
      System V inter-process commumication system calls
      return depends on function call
      errors depend on function call
      man(2)  msgctl msgget msgrcv msgsnd semctl
    semget semop shmat shmctl shmdt shmget
      ref  linux/ipc.h asm/ipc.h, asm/ipcbuf.h
      source sys_i386.c
  106.  


  107.   fsync int fd           118  
      write file cache to disk
      return -/-
      errors badf, io, rofs
      source linux/fs/buffer.c
  108.  


  109.   sigreturn unsigned long __unused           119  
      return from signal handler & cleanup stack frame
      return no return
      errors (crash...)
      source kernel/signal.c, kernel/entry.S
  110.  


  111.   clone             120  
        configurably create resources sharing child process;
    P fork is a simplified "clone".
      arg ebx: clone flags
    ecx: ptr to top of (distinct!) stack space for clone
    pre-set to safe stack space if ecx=NULL
    edx: ptr tp pt_regs structure - or NULL
                 
      ret eax: pid of clone (caller), zero (clone)
      err again, nomem
      flags CLONE_VM memory identity
        CLONE_FS file system identity
        CLONE_FILES files access identity
        CLONE_SIGHAND signals handlers identity
        CLONE_PID process id identity
        CLONE_PTRACE ptrace continuation into clone
        CLONE_VFORK wait until clone's mm_release
        CSIGNAL mask for signal to send on exit (0x0ff)
      ref linux/sched.h, asm/ptrace.h.
      source arch/i386/kernel/process.c, kernel/fork.c
  112.  



  113.   setdomainname const char *name, size_t len         121  
      set the system's domain name
      return -/-
      errors inval, perm
      ref False manual page nameing: getdomainname
    which, in fact, is not implemented but, left to be read with uname
         
  114.  


  115. uname struct utsname *buf           122  
      get name of & information abaut current kernel
      return -/-
      errors fault
      ref utsname.h, struc oldoldutsname, sys/utsname.h
  116.  


  117.   modify_ldt int func, void *ptr, u l bytecount       123  
      get or set LDT
      arg eax 123
        ebx function code (lx 2.4.18):
    0 : read_ldt(ptr, bytecount);
    2 : read_default_ldt(ptr, bytecount);
    1 : write_ldt(ptr, bytecount, 1);
    17: write_ldt(ptr, bytecount, 0);
        ecx ptr to where the ldt data should be stored
        edx size per bytes of storeage area at [ecx].
      ret eax int no. of bytes read
      errors eax fault, inval, nosys
      ref asm/ldt.h, arch/i386/kernel/ldt.c
  118.  


  119.   adjtimex struct timex *buf           124  
      tune kernel clock
      return int clockstate
      errors fault, inval, perm
      ref sys/timex.h
  120.  


  121.   mprotect cont void *addr, size_t len, int prot       125  
      control access to a region of memory
      arg eax 125
        ebx page-aligned start address of memory region
        ecx page-aligned bytes' size of memory region
        edx 'protection' mode flags (which, in fact, are enabling bits):
    any of PROT_READ, PROT_WRITE, PROT_EXEC
      ret eax -/-
      errors eax acces, fault, inval, nomem
      ref sys/mman.h, syscall mmap2
      source /usr/src/linux/mm/mprotect.c
     
    In fact, i386+ "memory protection" is enabled by a cpu write protection bit for exactly that purpose, thus no distinction for 'executing' (i.e. code reading) mode exists. Which results to the possible memory access modes of rwx, r-x or, no access at all - re mm/mmap.c:
    		map_type	prot (i.e. enabled access)
    				PROT_NONE	PROT_READ	PROT_WRITE	PROT_EXEC
    		MAP_SHARED	r: (no) no	r: (yes) yes	r: (no) yes	r: (no) yes
    				w: (no) no	w: (no) no	w: (yes) yes	w: (no) no
    				x: (no) no	x: (no) yes	x: (no) yes	x: (yes) yes
    
    		MAP_PRIVATE	r: (no) no	r: (yes) yes	r: (no) yes	r: (no) yes
    				w: (no) no	w: (no) no	w: (copy) copy	w: (no) no
    				x: (no) no	x: (no) yes	x: (no) yes	x: (yes) yes
  122.  


  123.   sigprocmask int how, c sigset_t *set, sigset_t *oldset       126  
      POSIX signal handling
      return -/-
      errors fault, inval, intr
      ref signal.h, include/signal.h
  124.  


  125.   create_module const char *name, size_t size         127  
      create loadable module entry
    return caddr_t kernel address of module
      errors exist, fault, inval, nomem
      ref linux/module.h, asm/module.h and,
    header files specific to the particular module.
  126.  


  127.   init_module c ch *name, struct module *image         128  
      initialize loadable module entry
      return -/-
      errors busy, fault, inval, noent, perm
      ref linux/module.h asm/module.h and,
    header files specific to the particular module.

 


 

[next] [back] [bot] [top]
[intro] [a:index] [#:index] [1..64] [65..128] [129..192] [193..256] [257..] [ref] [struc] [ioctl] [pguide]

 


H.-Peter Recktenwald, Berlin, 18.Feb.2000 = .hpr.l0 = : 2647