linux/scripts/checksyscalls.sh
<<
>>
Prefs
   1#!/bin/sh
   2#
   3# Check if current architecture are missing any function calls compared
   4# to i386.
   5# i386 define a number of legacy system calls that are i386 specific
   6# and listed below so they are ignored.
   7#
   8# Usage:
   9# checksyscalls.sh gcc gcc-options
  10#
  11
  12ignore_list() {
  13cat << EOF
  14#include <asm/types.h>
  15#include <asm/unistd.h>
  16
  17/* *at */
  18#define __IGNORE_open           /* openat */
  19#define __IGNORE_link           /* linkat */
  20#define __IGNORE_unlink         /* unlinkat */
  21#define __IGNORE_mknod          /* mknodat */
  22#define __IGNORE_chmod          /* fchmodat */
  23#define __IGNORE_chown          /* fchownat */
  24#define __IGNORE_mkdir          /* mkdirat */
  25#define __IGNORE_rmdir          /* unlinkat */
  26#define __IGNORE_lchown         /* fchownat */
  27#define __IGNORE_access         /* faccessat */
  28#define __IGNORE_rename         /* renameat */
  29#define __IGNORE_readlink       /* readlinkat */
  30#define __IGNORE_symlink        /* symlinkat */
  31#define __IGNORE_utimes         /* futimesat */
  32#if BITS_PER_LONG == 64
  33#define __IGNORE_stat           /* fstatat */
  34#define __IGNORE_lstat          /* fstatat */
  35#else
  36#define __IGNORE_stat64         /* fstatat64 */
  37#define __IGNORE_lstat64        /* fstatat64 */
  38#endif
  39
  40/* CLOEXEC flag */
  41#define __IGNORE_pipe           /* pipe2 */
  42#define __IGNORE_dup2           /* dup3 */
  43#define __IGNORE_epoll_create   /* epoll_create1 */
  44#define __IGNORE_inotify_init   /* inotify_init1 */
  45#define __IGNORE_eventfd        /* eventfd2 */
  46#define __IGNORE_signalfd       /* signalfd4 */
  47
  48/* MMU */
  49#ifndef CONFIG_MMU
  50#define __IGNORE_madvise
  51#define __IGNORE_mbind
  52#define __IGNORE_mincore
  53#define __IGNORE_mlock
  54#define __IGNORE_mlockall
  55#define __IGNORE_munlock
  56#define __IGNORE_munlockall
  57#define __IGNORE_mprotect
  58#define __IGNORE_msync
  59#define __IGNORE_migrate_pages
  60#define __IGNORE_move_pages
  61#define __IGNORE_remap_file_pages
  62#define __IGNORE_get_mempolicy
  63#define __IGNORE_set_mempolicy
  64#define __IGNORE_swapoff
  65#define __IGNORE_swapon
  66#endif
  67
  68/* System calls for 32-bit kernels only */
  69#if BITS_PER_LONG == 64
  70#define __IGNORE_sendfile64
  71#define __IGNORE_ftruncate64
  72#define __IGNORE_truncate64
  73#define __IGNORE_stat64
  74#define __IGNORE_lstat64
  75#define __IGNORE_fstat64
  76#define __IGNORE_fcntl64
  77#define __IGNORE_fadvise64_64
  78#define __IGNORE_fstatat64
  79#define __IGNORE_fstatfs64
  80#define __IGNORE_statfs64
  81#define __IGNORE_llseek
  82#define __IGNORE_mmap2
  83#else
  84#define __IGNORE_sendfile
  85#define __IGNORE_ftruncate
  86#define __IGNORE_truncate
  87#define __IGNORE_stat
  88#define __IGNORE_lstat
  89#define __IGNORE_fstat
  90#define __IGNORE_fcntl
  91#define __IGNORE_fadvise64
  92#define __IGNORE_newfstatat
  93#define __IGNORE_fstatfs
  94#define __IGNORE_statfs
  95#define __IGNORE_lseek
  96#define __IGNORE_mmap
  97#endif
  98
  99/* i386-specific or historical system calls */
 100#define __IGNORE_break
 101#define __IGNORE_stty
 102#define __IGNORE_gtty
 103#define __IGNORE_ftime
 104#define __IGNORE_prof
 105#define __IGNORE_lock
 106#define __IGNORE_mpx
 107#define __IGNORE_ulimit
 108#define __IGNORE_profil
 109#define __IGNORE_ioperm
 110#define __IGNORE_iopl
 111#define __IGNORE_idle
 112#define __IGNORE_modify_ldt
 113#define __IGNORE_ugetrlimit
 114#define __IGNORE_vm86
 115#define __IGNORE_vm86old
 116#define __IGNORE_set_thread_area
 117#define __IGNORE_get_thread_area
 118#define __IGNORE_madvise1
 119#define __IGNORE_oldstat
 120#define __IGNORE_oldfstat
 121#define __IGNORE_oldlstat
 122#define __IGNORE_oldolduname
  24#de1ine __IGNORE_mkdir     umoun"scripts/checksyscalls.sh#L122" id="L125" class="line" name="L25">  25#de1ine __IGNORE_rmdir     waitpi"scripts/checksyscalls.sh#L116" id="L16" class=1"line" name="L26">  26#de1ine __IGNORE_lchown    sef="scripts/checksyscalls.sh#L104" id="L17" class=1"line" name="L27">  27#de1ine __IGNORE_access    nic"scripts/checksyscalls.sh#L104" id="L178" class="line" name="L28">  28#de1ine __IGNORE_rename    */
  29#de1ine __IGNORE_readlink  */
ax+*" scripts/checksyscalls.sh#L13" id="L13"0" class="line" name="L30">  30#de1ine __IGNORE_symlink    _armas"scripts/checksyscalls.sh#L106" id="L11" class=1"line" name="L31">  31#de1ine __IGNORE_utimes    */
sur h="scripts/checksyscalls.sh#L52" id="L512" class=1"line" name="L32">  32#if13ne __IGNORE_oldoldunam*/
 h="ingscripts/checksyscalls.sh#L52" id="L512" class="lline" name="L13">  13alls.ine __IGNORE_stat       sarmas"scripts/checksyscalls.sh#L106" id="L114" class="line" name="L34">  34#de1ine __IGNORE_lstat       35#el13ne __IGNORE_swapon
  36#de1ine __IGNORE_stat64    ip"scripts/checksyscalls.sh#L59" id="L517" class=1"line" name="L37">  37#de1ine __IGNORE_lstat64   */
se;">
scripts/checksyscalls.sh#L59" id="L5178" class="line" name="L38">  38#en13ne __IGNORE_rename    */
hrecmas"scripts/checksyscalls.sh#L106" id="L119" class="line" name="L39">  39
  40/* 14ne __IGNORE_symlink    href="scripts/checksyscalls.sh#L82" id="L811" class=1"line" name="L41">  41#de1ine __IGNORE_pipe      t
  42#de1ine __IGNORE_dup2      
  43#de1ine __IGNORE_epoll_creaqueryt
  14>#de1ine __IGNORE_inotify_in_arely */
    "scripts/checksyscalls.sh#L10" id="L105" class=1"line" name="L45">  45#de1ine __IGNORE_eventfd   h#L="scripts/checksyscalls.sh#L95" id="L916" class=1"line" name="L46">  46#de1ine __IGNORE_signalfd  u   ibscripts/checksyscalls.sh#L95" id="L916" class=1"line" name="L47">  47
  48/* 14ref="scripts/checksyscalls.sh#L99" id="L919" class=1"line" name="L49">  49#if1486-speci... t;asm/nctithe "
  50#de1ine __IGNORE_madvise
  51#de1ine __IGNORE_mbind
  52#de1ine __IGNORE_mincore
  53#de1ine __IGNORE_mlock
  54#de1ine __IGNORE_mlockall
<_aregid3"scripts/checksyscalls.sh#L83" id="L811" class=1"line" name="L55">  55#de1ine __IGNORE_munlock
  56#de1ine __IGNORE_munlockallsarregid3"scripts/checksyscalls.sh#L83" id="L811" class=1"line" name="L57">  57#de1ine __IGNORE_mprotect
<_argroups3"scripts/checksyscalls.sh#L83" id="L811" class=1"line" name="L58">  58#de1ine __IGNORE_msync
  59#de1ine __IGNORE_migrate_paf    /3"scripts/checksyscalls.sh#L83" id="L810" class=1"line" name="L60">  60#de1ine __IGNORE_move_pagessarresuid3"scripts/checksyscalls.sh#L83" id="L811" class=1"line" name="L61">  61#de1ine __IGNORE_remap_filegarresuid3"scripts/checksyscalls.sh#L83" id="L811" class=1"line" name="L62">  62#de1ine __IGNORE_get_mempolsarresgid3"scripts/checksyscalls.sh#L83" id="L813" class=1"line" name="L63">  63#de1ine __IGNORE_set_mempolgarresgid3"scripts/checksyscalls.sh#L83" id="L813" class=""line" name="L64">  64#de1ine __IGNORE_swapoff
  65#de1ine __IGNORE_swapon
  16>#de16ne __IGNORE_munlockallsargid3"scripts/checksyscalls.sh#L83" id="L813" class=1"line" name="L67">  67
  68/* 16ne __IGNORE_msync
  69#if16ref="scripts/checksyscalls.sh#L40" id="L410" class=1"line" name="L70">  70#de17OEXEC flthese can be expressed uunctiother  71#de1ine __IGNORE_ftruncate6alarm/* dup3 */
  72#de1ine __IGNORE_truncate64
  73#de1ine __IGNORE_stat64
  74#de1ine __IGNORE_lstat64
  75#de1ine __IGNORE_fstat64
  76#de1ine __IGNORE_fcntl64
  17>
  78#de1ine __IGNORE_fstatat64
e1 * /* pipe2 */
  79#de1ine __IGNORE_fstatfs64
      80#de1ine __IGNORE_statfs64
  81#de1ine __IGNORE_llseek
  82#de1ine __IGNORE_mmap2
  83#el18ne __IGNORE_ugetrlimit
    /* fstatat */href="/="scripts/checksyscalls.sh#L69" id="L612" class=""line" name="L84">  84#de1ine __IGNORE_sendfile
  85#de1ine __IGNORE_ftruncate
vfor  /* linkat*/
cloE_s="scripts/checksyscalls.sh#L100" id="L16" class=1"line" name="L86">  86#de18ref="scripts/checksyscalls.sh#L17" id="L177" class=1"line" name="L87">  87#de18t */
  88#de1ine __Iif_MMU__NR_ef="s
  89#de1ine __IGNORE_fstat
  90#de1ine __Iref="scripts/checksyscalls.sh#L98" id="L911" class=1"line" name="L91">  91#de19ref="scripts/checksyscalls.sh#L12" id="L122" class=1"line" name="L92">  92#de1ine __  93#de1ine __IGNORE_fstatfs
  94#de1ine __IGNORE_statfs
  95#de1ine __IGNORE_lseek
  96#de1ine __IGNORE_mmap
  97#en1if
  98
  19>#de19ref="scripts/checksyscalls.sh#L40" id="L4200" class2"line" name="L100"> 100<2a>#de2ine __h#L40"  101<2a>#de2ine __nkatgrep '^[0-9]' "$1"r| sort -nr| (scripts/checksyscalls.sh#L13" id="L120" class=""line" name="L102"> 102<2a>#de2ine __* linkatwh 1  clry ; doscripts/checksyscalls.sh#L13" id="L120" class=""line" name="L103"> 103<2a>#de2ine __ /* pipe2 * t; EOF
 104<2a>#de2ine __Iif !GNORE_d(__NR_${"> 1}) && !GNORE_d(__p
 1})scripts/checksyscalls.sh#L14" id="L1205" class2"line" name="L95">  95#de2ine __Iwarnnctih#L14"  ${"> 1} not implea nt="scripts/checksyscalls.sh#L4" id="L4"206" class2"line" name="L106"> 106<2a>#de20f
 107<2a>#de20f
 108<2a>#de2ine __pipe2 * d8/8scripts/checksyscalls.sh#L14" id="L120" class=""line" name="L109"> 109<2a>#de2ine __2 * )scripts/checksyscalls.sh#L14" id="L1210" class2"line" name="L110"> 110<2a>#de2ine __}scripts/checksyscalls.sh#L14" id="L1211" class2"line" name="L111"> 111<2a>#de2href="scripts/checksyscalls.sh#L12" id="L1212" class2"line" name="L112"> 112<2a>#de2ine __(t() {
 1 $0)/../re a/x86/h#L12" i/h#L12" _32.tbl)r| \scripts/checksyscalls.sh#L12" id="L121" class=""line" name="L113"> 113<2a>#de2ine __$* -E -x c - ef=" /dev/nu" scripts/checksyscalls.sh#L19" id="L1214" class2"line" name="L114"> 114<2a>#de2ine __
iv id="contene" namefooter"> The original LXR softwd. LXR communitye __, experlxr@l4/sc.noe __. iv id="ontene" namesubfooter"> lxr.l4/sc.no kindly ho so thy cripts/chhttp://www.redpill-l4/pro.no">Redpill L4/pro ASe __, providcy sysL4/sc con nctionda raref=" servic "/sincee19r5. iv id="co/body="o/htmlv>