opkg

statically linked package installer
git clone anongit@rnpnr.xyz:opkg.git
Log | Files | Refs | Feed | Submodules | README | LICENSE

0003-Make-tcp_sysent-a-static-inline-function.patch (1042B)


      1 From 0355d08676cdc94354bd35f8d885984938645fb3 Mon Sep 17 00:00:00 2001
      2 From: Michael Forney <mforney@mforney.org>
      3 Date: Sat, 6 Jul 2019 01:40:36 -0700
      4 Subject: [PATCH] Make tcp_sysent a static inline function
      5 
      6 This way we can include the second operand to the conditional
      7 operator without evaluating the macro argument multiple times.
      8 ---
      9  src/defs.h | 8 ++++++--
     10  1 file changed, 6 insertions(+), 2 deletions(-)
     11 
     12 diff --git a/src/defs.h b/src/defs.h
     13 index d24b11884..60b9e3322 100644
     14 --- a/src/defs.h
     15 +++ b/src/defs.h
     16 @@ -398,8 +398,12 @@ struct tcb {
     17  # define syscall_tampered_nofail(tcp) ((tcp)->flags & TCB_TAMPERED_NO_FAIL)
     18  # define has_seccomp_filter(tcp)	((tcp)->flags & TCB_SECCOMP_FILTER)
     19  
     20 -extern const struct_sysent stub_sysent;
     21 -# define tcp_sysent(tcp) (tcp->s_ent ?: &stub_sysent)
     22 +static inline const struct_sysent *
     23 +tcp_sysent(struct tcb *tcp)
     24 +{
     25 +	extern const struct_sysent stub_sysent;
     26 +	return tcp->s_ent ? tcp->s_ent : &stub_sysent;
     27 +}
     28  # define n_args(tcp) (tcp_sysent(tcp)->nargs)
     29  
     30  # include "xlat.h"
     31 -- 
     32 2.37.3
     33