Print this page
OS-3149 lx brand always sends SIGCHLD to parent processes, regardless of how clone was invoked
OS-2887 lxbrand add WALL, WCLONE, WNOTHREAD support to waitid
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


 144  *      pcnt    - the number of words currently pushed onto the stack
 145  *      var     - the variable to lookup
 146  *      reg     - a register to read the variable into, or
 147  *                a register to write to the variable
 148  */
 149 #define V_OFFSET(pcnt, var)                                             \
 150         (var + (pcnt * CLONGSIZE))
 151 
 152 #define GET_V(sp, pcnt, var, reg)                                       \
 153         mov     V_OFFSET(pcnt, var)(sp), reg
 154 
 155 #define SET_V(sp, pcnt, var, reg)                                       \
 156         mov     reg, V_OFFSET(pcnt, var)(sp)
 157 
 158 #define GET_PROCP(sp, pcnt, reg)                                        \
 159         GET_V(sp, pcnt, V_LWP, reg);            /* get lwp pointer */   \
 160         mov     LWP_PROCP(reg), reg             /* get proc pointer */
 161 
 162 #define GET_P_BRAND_DATA(sp, pcnt, reg)                                 \
 163         GET_PROCP(sp, pcnt, reg);                                       \
 164         mov     P_BRAND_DATA(reg), reg          /* get p_brand_data */
 165 
 166 /*
 167  * Each of the following macros returns to the standard syscall codepath if
 168  * it detects that this process is not able, or intended, to emulate this
 169  * system call.  They all assume that the routine provides a 'bail-out'
 170  * label of '9'.
 171  */
 172 
 173 /*
 174  * See if this process has a user-space handler registered for it.  For the
 175  * brand, the per-process brand data holds the address of the handler.
 176  * As shown in the stack diagrams above, the callback code leaves the lwp
 177  * pointer at well-defined offsets, so check if proc_data_t->X_handler is
 178  * non-NULL.  For each brand, the handler parameter refers to the brand's
 179  * user-space handler variable name.
 180  */
 181 #define CHECK_FOR_HANDLER(scr, handler)                                 \
 182         GET_P_BRAND_DATA(SP_REG, 0, scr);       /* get p_brand_data */  \
 183         cmp     $0, scr;                                                \
 184         je      9f;                                                     \




 144  *      pcnt    - the number of words currently pushed onto the stack
 145  *      var     - the variable to lookup
 146  *      reg     - a register to read the variable into, or
 147  *                a register to write to the variable
 148  */
 149 #define V_OFFSET(pcnt, var)                                             \
 150         (var + (pcnt * CLONGSIZE))
 151 
 152 #define GET_V(sp, pcnt, var, reg)                                       \
 153         mov     V_OFFSET(pcnt, var)(sp), reg
 154 
 155 #define SET_V(sp, pcnt, var, reg)                                       \
 156         mov     reg, V_OFFSET(pcnt, var)(sp)
 157 
 158 #define GET_PROCP(sp, pcnt, reg)                                        \
 159         GET_V(sp, pcnt, V_LWP, reg);            /* get lwp pointer */   \
 160         mov     LWP_PROCP(reg), reg             /* get proc pointer */
 161 
 162 #define GET_P_BRAND_DATA(sp, pcnt, reg)                                 \
 163         GET_PROCP(sp, pcnt, reg);                                       \
 164         mov     __P_BRAND_DATA(reg), reg        /* get p_brand_data */
 165 
 166 /*
 167  * Each of the following macros returns to the standard syscall codepath if
 168  * it detects that this process is not able, or intended, to emulate this
 169  * system call.  They all assume that the routine provides a 'bail-out'
 170  * label of '9'.
 171  */
 172 
 173 /*
 174  * See if this process has a user-space handler registered for it.  For the
 175  * brand, the per-process brand data holds the address of the handler.
 176  * As shown in the stack diagrams above, the callback code leaves the lwp
 177  * pointer at well-defined offsets, so check if proc_data_t->X_handler is
 178  * non-NULL.  For each brand, the handler parameter refers to the brand's
 179  * user-space handler variable name.
 180  */
 181 #define CHECK_FOR_HANDLER(scr, handler)                                 \
 182         GET_P_BRAND_DATA(SP_REG, 0, scr);       /* get p_brand_data */  \
 183         cmp     $0, scr;                                                \
 184         je      9f;                                                     \