1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2015 Joyent, Inc.
  14  */
  15 
  16 #ifndef _LX_SYSCALL_H
  17 #define _LX_SYSCALL_H
  18 
  19 #include <sys/lx_brand.h>
  20 
  21 #ifdef __cplusplus
  22 extern "C" {
  23 #endif
  24 
  25 /*
  26  * The br_scall_args field of lx_lwp_data is going to be populated with
  27  * pointers to structs. The types of these structs should be defined in this
  28  * header file.  These are Linux specific arguments to system calls that don't
  29  * exist in illumos. Each section should be labelled with which system call it
  30  * belongs to.
  31  */
  32 
  33 /* arguments for waitpid(2) */
  34 /* see comments in usr/src/lib/brand/lx/lx_brand/common/wait.c */
  35 #define LX_WNOTHREAD    0x20000000 /* Do not wait on siblings' children */
  36 #define LX_WALL         0x40000000 /* Wait on all children */
  37 #define LX_WCLONE       0x80000000 /* Wait only on clone children */
  38 
  39 /* For arch_prctl(2) */
  40 #define LX_ARCH_SET_GS  0x1001
  41 #define LX_ARCH_SET_FS  0x1002
  42 #define LX_ARCH_GET_FS  0x1003
  43 #define LX_ARCH_GET_GS  0x1004
  44 
  45 /*
  46  * For ptrace(2):
  47  */
  48 #define LX_PTRACE_TRACEME       0
  49 #define LX_PTRACE_PEEKTEXT      1
  50 #define LX_PTRACE_PEEKDATA      2
  51 #define LX_PTRACE_PEEKUSER      3
  52 #define LX_PTRACE_POKETEXT      4
  53 #define LX_PTRACE_POKEDATA      5
  54 #define LX_PTRACE_POKEUSER      6
  55 #define LX_PTRACE_CONT          7
  56 #define LX_PTRACE_KILL          8
  57 #define LX_PTRACE_SINGLESTEP    9
  58 #define LX_PTRACE_GETREGS       12
  59 #define LX_PTRACE_SETREGS       13
  60 #define LX_PTRACE_GETFPREGS     14
  61 #define LX_PTRACE_SETFPREGS     15
  62 #define LX_PTRACE_ATTACH        16
  63 #define LX_PTRACE_DETACH        17
  64 #define LX_PTRACE_GETFPXREGS    18
  65 #define LX_PTRACE_SETFPXREGS    19
  66 #define LX_PTRACE_SYSCALL       24
  67 #define LX_PTRACE_SETOPTIONS    0x4200
  68 #define LX_PTRACE_GETEVENTMSG   0x4201
  69 #define LX_PTRACE_GETSIGINFO    0x4202
  70 
  71 /*
  72  * For clone(2):
  73  */
  74 #define LX_CSIGNAL              0x000000ff
  75 #define LX_CLONE_VM             0x00000100
  76 #define LX_CLONE_FS             0x00000200
  77 #define LX_CLONE_FILES          0x00000400
  78 #define LX_CLONE_SIGHAND        0x00000800
  79 #define LX_CLONE_PID            0x00001000
  80 #define LX_CLONE_PTRACE         0x00002000
  81 #define LX_CLONE_VFORK          0x00004000
  82 #define LX_CLONE_PARENT         0x00008000
  83 #define LX_CLONE_THREAD         0x00010000
  84 #define LX_CLONE_SYSVSEM        0x00040000
  85 #define LX_CLONE_SETTLS         0x00080000
  86 #define LX_CLONE_PARENT_SETTID  0x00100000
  87 #define LX_CLONE_CHILD_CLEARTID 0x00200000
  88 #define LX_CLONE_DETACH         0x00400000
  89 #define LX_CLONE_CHILD_SETTID   0x01000000
  90 
  91 #ifdef  __cplusplus
  92 }
  93 #endif
  94 
  95 #endif  /* _LX_SYSCALL_H */