azalia_free_dmamem()

2018-01-08 Thread Michael W. Bombardieri
Hello,

This free function in azalia driver can be converted to void
because it has nothing useful to return. The old return value
was never used.
azalia's other free function azalia_freem() is already void.

- Michael


Index: azalia.c
===
RCS file: /cvs/src/sys/dev/pci/azalia.c,v
retrieving revision 1.239
diff -u -p -u -r1.239 azalia.c
--- azalia.c23 Dec 2017 01:44:24 -  1.239
+++ azalia.c9 Jan 2018 06:59:13 -
@@ -211,7 +211,7 @@ int azalia_get_response(azalia_t *, uint
 void   azalia_rirb_kick_unsol_events(void *);
 void   azalia_rirb_intr(azalia_t *);
 intazalia_alloc_dmamem(azalia_t *, size_t, size_t, azalia_dma_t *);
-intazalia_free_dmamem(const azalia_t *, azalia_dma_t*);
+void   azalia_free_dmamem(const azalia_t *, azalia_dma_t*);
 
 intazalia_codec_init(codec_t *);
 intazalia_codec_delete(codec_t *);
@@ -1331,17 +1331,16 @@ free:
return err;
 }
 
-int
+void
 azalia_free_dmamem(const azalia_t *az, azalia_dma_t* d)
 {
if (d->addr == NULL)
-   return 0;
+   return;
bus_dmamap_unload(az->dmat, d->map);
bus_dmamap_destroy(az->dmat, d->map);
bus_dmamem_unmap(az->dmat, d->addr, d->size);
bus_dmamem_free(az->dmat, d->segments, 1);
d->addr = NULL;
-   return 0;
 }
 
 int



Re: LibreSSL patch for AIX

2018-01-08 Thread Kinichiro Inoguchi
Hi,

I would like to see that patch.
Since I thought autotools could adjust the differences between OSs,
I didn't know that a special patch needed for AIX.

Best regards,
Kinichiro Inoguchi


cloned interface malloc wait

2018-01-08 Thread Alexander Bluhm
Hi,

Creating a cloned interface could return ENOMEM during a temporary
memory shortage.  As it is invoked from a system call, it should
not fail and wait instead.

ok?

bluhm

Index: net/if_bridge.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_bridge.c,v
retrieving revision 1.299
diff -u -p -r1.299 if_bridge.c
--- net/if_bridge.c 20 Nov 2017 10:17:40 -  1.299
+++ net/if_bridge.c 9 Jan 2018 00:13:05 -
@@ -156,10 +156,7 @@ bridge_clone_create(struct if_clone *ifc
struct ifnet *ifp;
int i;
 
-   sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
-   if (!sc)
-   return (ENOMEM);
-
+   sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
sc->sc_stp = bstp_create(&sc->sc_if);
if (!sc->sc_stp) {
free(sc, M_DEVBUF, sizeof *sc);
Index: net/if_etherip.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_etherip.c,v
retrieving revision 1.28
diff -u -p -r1.28 if_etherip.c
--- net/if_etherip.c20 Nov 2017 10:35:24 -  1.28
+++ net/if_etherip.c9 Jan 2018 00:13:21 -
@@ -99,9 +99,7 @@ etherip_clone_create(struct if_clone *if
struct ifnet *ifp;
struct etherip_softc *sc;
 
-   if ((sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO)) == NULL)
-   return ENOMEM;
-
+   sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
ifp = &sc->sc_ac.ac_if;
snprintf(ifp->if_xname, sizeof ifp->if_xname, "etherip%d", unit);
ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
Index: net/if_gif.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gif.c,v
retrieving revision 1.105
diff -u -p -r1.105 if_gif.c
--- net/if_gif.c20 Nov 2017 10:35:24 -  1.105
+++ net/if_gif.c9 Jan 2018 00:13:32 -
@@ -107,10 +107,7 @@ gif_clone_create(struct if_clone *ifc, i
 {
struct gif_softc *sc;
 
-   sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
-   if (!sc)
-   return (ENOMEM);
-
+   sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(sc->gif_if.if_xname, sizeof sc->gif_if.if_xname,
 "%s%d", ifc->ifc_name, unit);
sc->gif_if.if_mtu= GIF_MTU;
Index: net/if_gre.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_gre.c,v
retrieving revision 1.88
diff -u -p -r1.88 if_gre.c
--- net/if_gre.c20 Oct 2017 09:35:09 -  1.88
+++ net/if_gre.c9 Jan 2018 00:13:45 -
@@ -122,14 +122,11 @@ gre_clone_create(struct if_clone *ifc, i
 {
struct gre_softc *sc;
 
-   sc = malloc(sizeof(*sc), M_DEVBUF, M_NOWAIT|M_ZERO);
-   if (!sc)
-   return (ENOMEM);
+   sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(sc->sc_if.if_xname, sizeof sc->sc_if.if_xname, "%s%d",
ifc->ifc_name, unit);
sc->sc_if.if_softc = sc;
sc->sc_if.if_type = IFT_TUNNEL;
-   sc->sc_if.if_addrlen = 0;
sc->sc_if.if_hdrlen = 24; /* IP + GRE */
sc->sc_if.if_mtu = GREMTU;
sc->sc_if.if_flags = IFF_POINTOPOINT|IFF_MULTICAST;
@@ -137,11 +134,6 @@ gre_clone_create(struct if_clone *ifc, i
sc->sc_if.if_output = gre_output;
sc->sc_if.if_ioctl = gre_ioctl;
sc->sc_if.if_rtrequest = p2p_rtrequest;
-   sc->sc_if.if_collisions = 0;
-   sc->sc_if.if_ierrors = 0;
-   sc->sc_if.if_oerrors = 0;
-   sc->sc_if.if_ipackets = 0;
-   sc->sc_if.if_opackets = 0;
sc->g_dst.s_addr = sc->g_src.s_addr = INADDR_ANY;
sc->sc_ka_state = GRE_STATE_UKNWN;
 
Index: net/if_loop.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_loop.c,v
retrieving revision 1.84
diff -u -p -r1.84 if_loop.c
--- net/if_loop.c   15 Dec 2017 01:37:30 -  1.84
+++ net/if_loop.c   9 Jan 2018 00:00:07 -
@@ -167,10 +167,7 @@ loop_clone_create(struct if_clone *ifc, 
 {
struct ifnet *ifp;
 
-   ifp = malloc(sizeof(*ifp), M_DEVBUF, M_NOWAIT|M_ZERO);
-   if (ifp == NULL)
-   return (ENOMEM);
-
+   ifp = malloc(sizeof(*ifp), M_DEVBUF, M_WAITOK|M_ZERO);
snprintf(ifp->if_xname, sizeof ifp->if_xname, "lo%d", unit);
ifp->if_softc = NULL;
ifp->if_mtu = LOMTU;
@@ -181,7 +178,6 @@ loop_clone_create(struct if_clone *ifc, 
ifp->if_output = looutput;
ifp->if_type = IFT_LOOP;
ifp->if_hdrlen = sizeof(u_int32_t);
-   ifp->if_addrlen = 0;
if (unit == 0) {
if_attachhead(ifp);
if_addgroup(ifp, ifc->ifc_name);
Index: net/if_mpe.c
===
RCS file: /data/mirror/openbsd/cvs/src/sys/net/if_mpe.c

Re: interface tx mitigation, with NET LOCK fixes

2018-01-08 Thread Alexander Bluhm
On Mon, Jan 08, 2018 at 03:07:34PM +0100, Martin Pieuchot wrote:
> Well if_start() is a driver function.  It should not require the
> NET_LOCK().  pf(4) has been fixed to not be re-entrant so the same
> thing has to be done for pseudo-driver.  I like the fact that your
> diff is defining a new boundary between driver protected states and
> stack protected states.
> 
> Here's a diff for gif(4), ok?

OK bluhm@

> Index: net/if_gif.c
> ===
> RCS file: /cvs/src/sys/net/if_gif.c,v
> retrieving revision 1.105
> diff -u -p -r1.105 if_gif.c
> --- net/if_gif.c  20 Nov 2017 10:35:24 -  1.105
> +++ net/if_gif.c  8 Jan 2018 14:05:45 -
> @@ -231,17 +231,11 @@ gif_start(struct ifnet *ifp)
>  
>   switch (sc->gif_psrc->sa_family) {
>   case AF_INET:
> - ip_output(m, NULL, NULL, 0, NULL, NULL, 0);
> + ip_send(m);
>   break;
>  #ifdef INET6
>   case AF_INET6:
> - /*
> -  * force fragmentation to minimum MTU, to avoid path
> -  * MTU discovery. It is too painful to ask for resend
> -  * of inner packet, to achieve path MTU discovery for
> -  * encapsulated packets.
> -  */
> - ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL);
> + ip6_send(m);
>   break;
>  #endif
>   default:



Re: sosetstate/soclrstate

2018-01-08 Thread Alexander Bluhm
On Mon, Jan 08, 2018 at 03:50:14PM +0100, Martin Pieuchot wrote:
> ok?

OK bluhm@ with a few remarks.

> @@ -1422,12 +1422,12 @@ somove(struct socket *so, int wait)
>  
>   /* Receive buffer did shrink by len bytes, adjust oob. */
>   state = so->so_state;
> - so->so_state &= ~SS_RCVATMARK;
> + soclrstate(so, SS_RCVATMARK);
>   oobmark = so->so_oobmark;
>   so->so_oobmark = oobmark > len ? oobmark - len : 0;
>   if (oobmark) {

Can we make the "state" also u_int?

> @@ -198,7 +198,7 @@ sonewconn(struct socket *head, int conns
>   if (connstatus) {
>   sorwakeup(head);
>   wakeup(&head->so_timeo);
> - so->so_state |= connstatus;
> + sosetstate(so, connstatus);
>   }
>   return (so);
>  }

"connstatus" should be u_int.

> @@ -112,8 +112,8 @@ sys_socket(struct proc *p, void *v, regi
>   fdpunlock(fdp);
>   } else {
>   if (type & SOCK_NONBLOCK)
> - so->so_state |= SS_NBIO;
> - so->so_state |= ss;
> + sosetstate(so, SS_NBIO);
> + sosetstate(so, ss);
>   fp->f_data = so;
>   FILE_SET_MATURE(fp, p);
>   *retval = fd;

"ss" should be u_int for consistency.  And pledge_socket() still
takes the state as signed int.

> @@ -181,7 +181,7 @@ fifo_open(void *v)
>   goto bad;
>   }
>   if (fip->fi_writers == 1) {
> - rso->so_state &= ~(SS_CANTRCVMORE|SS_ISDISCONNECTED);
> + soclrstate(rso, (SS_CANTRCVMORE|SS_ISDISCONNECTED));
>   if (fip->fi_readers > 0)
>   wakeup(&fip->fi_readers);
>   }

There are more () than needed.

> @@ -585,9 +585,9 @@ tcp_attach(struct socket *so, int proto)
>   if (tp == NULL) {
>   int nofd = so->so_state & SS_NOFDREF;   /* XXX */
>  
> - so->so_state &= ~SS_NOFDREF;/* don't free the socket yet */
> + soclrstate(so, SS_NOFDREF); /* don't free the socket yet */
>   in_pcbdetach(inp);
> - so->so_state |= nofd;
> + sosetstate(so, nofd);
>   return (ENOBUFS);
>   }
>   tp->t_state = TCPS_CLOSED;

nofd should be u_int.



Re: ksh: Update comments

2018-01-08 Thread Sebastian Benoit
commited, thanks

Klemens Nanni(k...@posteo.org) on 2018.01.08 23:13:39 +0100:
> There were left behind in the recent unifdef JOB commit.
> 
> diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
> index c2742ebf72c..7f528f7e68d 100644
> --- a/bin/ksh/jobs.c
> +++ b/bin/ksh/jobs.c
> @@ -921,7 +921,7 @@ j_async(void)
>  
>  /* Make j the last async process
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  j_set_async(Job *j)
> @@ -957,7 +957,7 @@ j_set_async(Job *j)
>  
>  /* Start a job: set STARTED, check for held signals and set j->last_proc
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  j_startjob(Job *j)
> @@ -979,7 +979,7 @@ j_startjob(Job *j)
>  /*
>   * wait for job to complete or change state
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static int
>  j_waitj(Job *j,
> @@ -1103,7 +1103,7 @@ j_waitj(Job *j,
>  
>  /* SIGCHLD handler to reap children and update job states
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  j_sigchld(int sig)
> @@ -1176,7 +1176,7 @@ finished:
>   * and state are updated, asynchronous job notification is done and,
>   * if unneeded, the job is removed.
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  check_job(Job *j)
> @@ -1278,7 +1278,7 @@ check_job(Job *j)
>  /*
>   * Print job status in either short, medium or long format.
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  j_print(Job *j, int how, struct shf *shf)
> @@ -1385,7 +1385,7 @@ j_print(Job *j, int how, struct shf *shf)
>  
>  /* Convert % sequence to job
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static Job *
>  j_lookup(const char *cp, int *ecodep)
> @@ -1486,7 +1486,7 @@ static Proc *free_procs;
>  
>  /* allocate a new job and fill in the job number.
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static Job *
>  new_job(void)
> @@ -1514,7 +1514,7 @@ new_job(void)
>  
>  /* Allocate new process struct
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static Proc *
>  new_proc(void)
> @@ -1533,7 +1533,7 @@ new_proc(void)
>  /* Take job out of job_list and put old structures into free list.
>   * Keeps nzombies, last_job and async_job up to date.
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  remove_job(Job *j, const char *where)
> @@ -1570,10 +1570,10 @@ remove_job(Job *j, const char *where)
>   async_job = NULL;
>  }
>  
> -/* put j in a particular location (taking it out job_list if it is there
> - * already)
> +/* Put j in a particular location (taking it out of job_list if it is
> + * there already)
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static void
>  put_job(Job *j, int where)
> @@ -1608,7 +1608,7 @@ put_job(Job *j, int where)
>  
>  /* nuke a job (called when unable to start full job).
>   *
> - * If jobs are compiled in then this routine expects sigchld to be blocked.
> + * Expects sigchld to be blocked.
>   */
>  static int
>  kill_job(Job *j, int sig)
> -- 
> 2.15.1
> 
> 



ksh: Update comments

2018-01-08 Thread Klemens Nanni
There were left behind in the recent unifdef JOB commit.

diff --git a/bin/ksh/jobs.c b/bin/ksh/jobs.c
index c2742ebf72c..7f528f7e68d 100644
--- a/bin/ksh/jobs.c
+++ b/bin/ksh/jobs.c
@@ -921,7 +921,7 @@ j_async(void)
 
 /* Make j the last async process
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 j_set_async(Job *j)
@@ -957,7 +957,7 @@ j_set_async(Job *j)
 
 /* Start a job: set STARTED, check for held signals and set j->last_proc
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 j_startjob(Job *j)
@@ -979,7 +979,7 @@ j_startjob(Job *j)
 /*
  * wait for job to complete or change state
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static int
 j_waitj(Job *j,
@@ -1103,7 +1103,7 @@ j_waitj(Job *j,
 
 /* SIGCHLD handler to reap children and update job states
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 j_sigchld(int sig)
@@ -1176,7 +1176,7 @@ finished:
  * and state are updated, asynchronous job notification is done and,
  * if unneeded, the job is removed.
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 check_job(Job *j)
@@ -1278,7 +1278,7 @@ check_job(Job *j)
 /*
  * Print job status in either short, medium or long format.
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 j_print(Job *j, int how, struct shf *shf)
@@ -1385,7 +1385,7 @@ j_print(Job *j, int how, struct shf *shf)
 
 /* Convert % sequence to job
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static Job *
 j_lookup(const char *cp, int *ecodep)
@@ -1486,7 +1486,7 @@ static Proc   *free_procs;
 
 /* allocate a new job and fill in the job number.
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static Job *
 new_job(void)
@@ -1514,7 +1514,7 @@ new_job(void)
 
 /* Allocate new process struct
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static Proc *
 new_proc(void)
@@ -1533,7 +1533,7 @@ new_proc(void)
 /* Take job out of job_list and put old structures into free list.
  * Keeps nzombies, last_job and async_job up to date.
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 remove_job(Job *j, const char *where)
@@ -1570,10 +1570,10 @@ remove_job(Job *j, const char *where)
async_job = NULL;
 }
 
-/* put j in a particular location (taking it out job_list if it is there
- * already)
+/* Put j in a particular location (taking it out of job_list if it is
+ * there already)
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static void
 put_job(Job *j, int where)
@@ -1608,7 +1608,7 @@ put_job(Job *j, int where)
 
 /* nuke a job (called when unable to start full job).
  *
- * If jobs are compiled in then this routine expects sigchld to be blocked.
+ * Expects sigchld to be blocked.
  */
 static int
 kill_job(Job *j, int sig)
-- 
2.15.1




LibreSSL patch for AIX

2018-01-08 Thread Garrick Trowsdale
Hello,

LibreSSL up to version 2.5.0 builds under AIX 5.3, 6.1 and 7.1 with the IBM XLC 
compiler without any patches.

LibreSSL 2.5.1 introduced use of the -export-symbols linker flag and 
corresponding symbol files:

libressl-2.5.1/crypto/crypto.sym
libressl-2.5.1/crypto/crypto_portable.sym
libressl-2.5.1/ssl/ssl.sym
libressl-2.5.1/tls/tls.sym

To build under AIX with the IBM XLC compiler, patches are needed for version 
2.5.1, 2.5.2 and 2.6.1

libressl-2.5.1-aix-symbols.patch
libressl-2.5.2-aix-symbols.patch
libressl-2.6.1-aix-symbols.patch

I can submit the patches if the project has interest in these platform/compiler 
combinations.

Garrick


Re: ifconfig & wpa keys

2018-01-08 Thread Jeremie Courreges-Anglas
On Mon, Jan 08 2018, Martin Pieuchot  wrote:
> On 06/01/18(Sat) 09:24, Theo de Raadt wrote:
>> We used to try to create ifconfig output that someone could cut'n'paste
>> back in as input, when it was reasonable.  Therefore ifconfig output
>> was a human hint suggesting what ifconfig command takes as input.
>> 
>> But this one doesn't bother me, since for this line it doesn't work
>> and making it shorter will make the lines cleaner.
>> 
>> Same thing for nwkey?
>
> Here you go.

ok jca@

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: mess with regression tests

2018-01-08 Thread Alexander Bluhm
On Fri, Jan 05, 2018 at 07:01:56PM +0300, Sergey Bronnikov wrote:
> I have updated patch for bin/ed and now the most part of tests are
> works.

I have converted your work into a single Makefile.  It is easier
to have everything in one place.  So mkscripts.sh and ckscripts.sh
are implemented as make rule.  This gives more flexibility to create
the files in our obj directory.

> Tests i3.red, nl.red and s2.red still fails and require some attention.

I am reluctant to commit something to regress that fails.
Could you investigate why they are broken?

> - rename =.err to something else, for example eq.err,
>  otherwise make will fail

Yes, that makes Makefile scripting easier.

Below is my Makefile, it works with and without obj directory.

bluhm

# $OpenBSD$

ED ?=   /bin/ed
TESTDIR =   ${.CURDIR}/../../../bin/ed/test

TS !=   cd ${TESTDIR} && ls *.t
ERRS != cd ${TESTDIR} && ls *.err
CLEANFILES =*.t *.d *.ed *.err *.red *.o !.z stamp-*

.for t in ${TS:R}
# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
$t.ed: ${TESTDIR}/$t.t ${TESTDIR}/$t.d Makefile
@echo '\n setup $t.ed '
cp ${TESTDIR}/$t.t ${TESTDIR}/$t.d .
( \
echo "#!/bin/sh -"; \
echo "${ED} - <<\EOT"; \
echo H; \
echo "r $t.d"; \
cat $t.t; \
echo "w $t.o"; \
echo EOT; \
) >$t.tmp
mv $t.tmp $t.ed
chmod +x $t.ed

REGRESS_TARGETS +=  run-regress-$t.ed
# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
run-regress-$t.ed: $t.ed
@echo '\n $t.ed '
./$t.ed
cmp -s $t.o ${TESTDIR}/$t.r
.endfor

.for t in ${ERRS:R}
# from /usr/src/bin/ed/test/mkscripts.sh, converted to make rule
$t.red: ${TESTDIR}/$t.err Makefile
@echo '\n setup $t.red '
cp ${TESTDIR}/$t.err .
( \
echo "#!/bin/sh -"; \
echo "${ED} - <<\EOT"; \
echo H; \
echo "r $t.err"; \
cat $t.err; \
echo "w $t.o"; \
echo EOT; \
) >$t.tmp
mv $t.tmp $t.red
chmod +x $t.red

REGRESS_TARGETS +=  run-regress-$t.red
# from /usr/src/bin/ed/test/ckscripts.sh, converted to make rule
run-regress-$t.red: $t.red
@echo '\n $t.red '
! ./$t.red
.endfor

# from /usr/src/bin/ed/test/README, known failing tests
REGRESS_SKIP_TARGETS+=  run-regress-eq.red \
run-regress-a1.red \
run-regress-i1.red \
run-regress-k1.red \
run-regress-r1.red

.PHONY: ${REGRESS_TARGETS}

.include 



Re: ifdef bwfm_pci_debug_console()

2018-01-08 Thread Patrick Wildt
On Mon, Jan 08, 2018 at 10:53:48AM +0800, Michael W. Bombardieri wrote:
> Hello,
> 
> I noticed that calls to the function bwfm_pci_debug_console() 
> are wrapped in ifdef but the function itself isn't.
> 
> - Michael

Fixed that and also changed it so it only prints it when we're
running with a higher debug mode.  Thanks!

> 
> Index: if_bwfm_pci.c
> ===
> RCS file: /cvs/src/sys/dev/pci/if_bwfm_pci.c,v
> retrieving revision 1.8
> diff -u -p -u -r1.8 if_bwfm_pci.c
> --- if_bwfm_pci.c 8 Jan 2018 00:46:15 -   1.8
> +++ if_bwfm_pci.c 8 Jan 2018 02:29:14 -
> @@ -255,7 +255,9 @@ void   bwfm_pci_flowring_delete(struct b
>  
>  void  bwfm_pci_stop(struct bwfm_softc *);
>  int   bwfm_pci_txdata(struct bwfm_softc *, struct mbuf *);
> +#ifdef BWFM_DEBUG
>  void  bwfm_pci_debug_console(struct bwfm_pci_softc *);
> +#endif
>  
>  int   bwfm_pci_msgbuf_query_dcmd(struct bwfm_softc *, int,
>   int, char *, size_t *);
> @@ -1666,6 +1668,7 @@ bwfm_pci_txdata(struct bwfm_softc *bwfm,
>   return 0;
>  }
>  
> +#ifdef BWFM_DEBUG
>  void
>  bwfm_pci_debug_console(struct bwfm_pci_softc *sc)
>  {
> @@ -1685,6 +1688,7 @@ bwfm_pci_debug_console(struct bwfm_pci_s
>   printf("%c", ch);
>   }
>  }
> +#endif 
>  
>  int
>  bwfm_pci_intr(void *v)
> 



Re: ksh: State of NOTES and PROJECTS

2018-01-08 Thread Klemens Nanni
On Mon, Jan 08, 2018 at 03:06:32PM +0100, Jeremie Courreges-Anglas wrote:
> On Mon, Jan 08 2018, Jeremie Courreges-Anglas  wrote:
> > On Mon, Jan 08 2018, Klemens Nanni  wrote:
> > Looks good, except you give no rationale for moving the FPATH quirk
> > from "known differences [...] that are not likely to change" to "known
> > differences [...] that may change".
I checked ksh88 but not ksh93, my bad.

> > IIUC ksh93 now documents this behavior:
> >
> >   FPATH  The search path for function definitions.  The
> >  directories in this path are searched for a file with 
> > the
> >  same name as the function or command when a function 
> > with
> >  the -u attribute is referenced and when a command is 
> > not
> >  found.  If an executable file with the name of that
> >  command is found, then it is read and executed in the
> >  current environment. [...]
> >
> > (Actually ksh93 doesn't require the file to be executable.)
> >
> > Right now I'm tempted to leave the FPATH bits as is or to amend them,
> > not to move them to the "may change later" section.
> 
> Another small round of fixes.
> - unreadable/setuid scripts... what?
> - BUG-REPORTS has been moved to Attic
> - s/effect/affect where relevant
> - tweak the note about FPATH
> - pdksh "understand[s] C integer constants (ie, 0x123, 0177)"
These all look good so far, thanks.

> I've been tempted to remove the second paragraph in POSIX sh bugs, but
> I don't know whether ksh handles all the details of parameter
> expansions.
Tilde expansion is not performed in double quoted words of parameter
expansions:

$ unset v
$ echo ${v:=~root}  # assigns expanded word
/root
$ echo ${v+"~root"} # substitutes unexpanded word
~root

Other expansion operators (-, ?, #, ##, %, %%) behave the same. So I'd
say it's safe to remove that, too.



Re: ifconfig & wpa keys

2018-01-08 Thread Martin Pieuchot
On 06/01/18(Sat) 09:24, Theo de Raadt wrote:
> We used to try to create ifconfig output that someone could cut'n'paste
> back in as input, when it was reasonable.  Therefore ifconfig output
> was a human hint suggesting what ifconfig command takes as input.
> 
> But this one doesn't bother me, since for this line it doesn't work
> and making it shorter will make the lines cleaner.
> 
> Same thing for nwkey?

Here you go.

Index: ifconfig.c
===
RCS file: /cvs/src/sbin/ifconfig/ifconfig.c,v
retrieving revision 1.351
diff -u -p -r1.351 ifconfig.c
--- ifconfig.c  17 Nov 2017 18:04:51 -  1.351
+++ ifconfig.c  8 Jan 2018 14:53:09 -
@@ -2124,70 +2124,11 @@ ieee80211_status(void)
}
}
 
-   if (inwkey == 0 && nwkey.i_wepon > IEEE80211_NWKEY_OPEN) {
-   fputs(" nwkey ", stdout);
-   /* try to retrieve WEP keys */
-   for (i = 0; i < IEEE80211_WEP_NKID; i++) {
-   nwkey.i_key[i].i_keydat = keybuf[i];
-   nwkey.i_key[i].i_keylen = sizeof(keybuf[i]);
-   }
-   if (ioctl(s, SIOCG80211NWKEY, (caddr_t)&nwkey) == -1) {
-   fputs("", stdout);
-   } else {
-   nwkey_verbose = 0;
-   /*
-* check to see non default key
-* or multiple keys defined
-*/
-   if (nwkey.i_defkid != 1) {
-   nwkey_verbose = 1;
-   } else {
-   for (i = 1; i < IEEE80211_WEP_NKID; i++) {
-   if (nwkey.i_key[i].i_keylen != 0) {
-   nwkey_verbose = 1;
-   break;
-   }
-   }
-   }
-   /* check extra ambiguity with keywords */
-   if (!nwkey_verbose) {
-   if (nwkey.i_key[0].i_keylen >= 2 &&
-   isdigit((unsigned 
char)nwkey.i_key[0].i_keydat[0]) &&
-   nwkey.i_key[0].i_keydat[1] == ':')
-   nwkey_verbose = 1;
-   else if (nwkey.i_key[0].i_keylen >= 7 &&
-   strncasecmp("persist",
-   (char *)nwkey.i_key[0].i_keydat, 7) == 0)
-   nwkey_verbose = 1;
-   }
-   if (nwkey_verbose)
-   printf("%d:", nwkey.i_defkid);
-   for (i = 0; i < IEEE80211_WEP_NKID; i++) {
-   if (i > 0)
-   putchar(',');
-   if (nwkey.i_key[i].i_keylen < 0) {
-   fputs("persist", stdout);
-   } else {
-   /*
-* XXX
-* sanity check nwkey.i_key[i].i_keylen
-*/
-   print_string(nwkey.i_key[i].i_keydat,
-   nwkey.i_key[i].i_keylen);
-   }
-   if (!nwkey_verbose)
-   break;
-   }
-   }
-   }
+   if (inwkey == 0 && nwkey.i_wepon > IEEE80211_NWKEY_OPEN)
+   fputs(" nwkey", stdout);
 
-   if (ipsk == 0 && psk.i_enabled) {
-   fputs(" wpakey ", stdout);
-   if (psk.i_enabled == 2)
-   fputs("", stdout);
-   else
-   print_string(psk.i_psk, sizeof(psk.i_psk));
-   }
+   if (ipsk == 0 && psk.i_enabled)
+   fputs(" wpakey", stdout);
if (iwpa == 0 && wpa.i_enabled) {
const char *sep;
 



sosetstate/soclrstate

2018-01-08 Thread Martin Pieuchot
Diff below changes the type of `so_state' and `so_error' to int.  It
also introduces two new wrappers to set & clear state bits atomically.

My goal is to prevent a second CPU from reading garbage when looking
at these two fields in filt_soread() and filt_sowrite().  The values
might be outdated though.

This should be the last requirement before unlocking the receiving path.

ok?

Index: kern/uipc_socket.c
===
RCS file: /cvs/src/sys/kern/uipc_socket.c,v
retrieving revision 1.213
diff -u -p -r1.213 uipc_socket.c
--- kern/uipc_socket.c  2 Jan 2018 12:54:07 -   1.213
+++ kern/uipc_socket.c  8 Jan 2018 14:32:33 -
@@ -139,7 +139,7 @@ socreate(int dom, struct socket **aso, i
s = solock(so);
error = (*prp->pr_attach)(so, proto);
if (error) {
-   so->so_state |= SS_NOFDREF;
+   sosetstate(so, SS_NOFDREF);
sofree(so);
sounlock(s);
return (error);
@@ -275,7 +275,7 @@ drop:
 discard:
if (so->so_state & SS_NOFDREF)
panic("soclose NOFDREF: so %p, so_type %d", so, so->so_type);
-   so->so_state |= SS_NOFDREF;
+   sosetstate(so, SS_NOFDREF);
sofree(so);
sounlock(s);
return (error);
@@ -299,7 +299,7 @@ soaccept(struct socket *so, struct mbuf 
 
if ((so->so_state & SS_NOFDREF) == 0)
panic("soaccept !NOFDREF: so %p, so_type %d", so, so->so_type);
-   so->so_state &= ~SS_NOFDREF;
+   soclrstate(so, SS_NOFDREF);
if ((so->so_state & SS_ISDISCONNECTED) == 0 ||
(so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0)
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, NULL,
@@ -425,7 +425,7 @@ sosend(struct socket *so, struct mbuf *a
 restart:
if ((error = sblock(so, &so->so_snd, SBLOCKWAIT(flags))) != 0)
goto out;
-   so->so_state |= SS_ISSENDING;
+   sosetstate(so, SS_ISSENDING);
do {
if (so->so_state & SS_CANTSENDMORE)
snderr(EPIPE);
@@ -455,7 +455,7 @@ restart:
snderr(EWOULDBLOCK);
sbunlock(so, &so->so_snd);
error = sbwait(so, &so->so_snd);
-   so->so_state &= ~SS_ISSENDING;
+   soclrstate(so, SS_ISSENDING);
if (error)
goto out;
goto restart;
@@ -481,7 +481,7 @@ restart:
top->m_flags |= M_EOR;
}
if (resid == 0)
-   so->so_state &= ~SS_ISSENDING;
+   soclrstate(so, SS_ISSENDING);
if (top && so->so_options & SO_ZEROIZE)
top->m_flags |= M_ZEROIZE;
error = (*so->so_proto->pr_usrreq)(so,
@@ -496,7 +496,7 @@ restart:
} while (resid);
 
 release:
-   so->so_state &= ~SS_ISSENDING;
+   soclrstate(so, SS_ISSENDING);
sbunlock(so, &so->so_snd);
 out:
sounlock(s);
@@ -857,7 +857,7 @@ dontblock:
panic("receive 3: so %p, so_type %d, m %p, m_type %d",
so, so->so_type, m, m->m_type);
 #endif
-   so->so_state &= ~SS_RCVATMARK;
+   soclrstate(so, SS_RCVATMARK);
len = uio->uio_resid;
if (so->so_oobmark && len > so->so_oobmark - offset)
len = so->so_oobmark - offset;
@@ -932,7 +932,7 @@ dontblock:
if ((flags & MSG_PEEK) == 0) {
so->so_oobmark -= len;
if (so->so_oobmark == 0) {
-   so->so_state |= SS_RCVATMARK;
+   sosetstate(so, SS_RCVATMARK);
break;
}
} else {
@@ -1292,7 +1292,7 @@ somove(struct socket *so, int wait)
goto release;
len = space;
}
-   sosp->so_state |= SS_ISSENDING;
+   sosetstate(sosp, SS_ISSENDING);
 
SBLASTRECORDCHK(&so->so_rcv, "somove 1");
SBLASTMBUFCHK(&so->so_rcv, "somove 1");
@@ -1422,12 +1422,12 @@ somove(struct socket *so, int wait)
 
/* Receive buffer did shrink by len bytes, adjust oob. */
state = so->so_state;
-   so->so_state &= ~SS_RCVATMARK;
+   soclrstate(so, SS_RCVATMARK);
oobmark = so->so_oobmark;
so->so_oobmark = oobmark > len ? oobmark - len : 0;
if (oobmark) {
if (oobmark == len)
-   so->so_state |= SS_RCVATMARK;
+   sosetstate(so, SS_RCVATMARK);
if (oobmark >= len)
oobmark = 0;
}
@@ -1485,7 +1485,7 

Re: make mpls_input take struct ifnet *ifp as an argument

2018-01-08 Thread Claudio Jeker
On Mon, Jan 08, 2018 at 11:50:54AM +0100, Alexander Bluhm wrote:
> On Mon, Jan 08, 2018 at 11:49:05AM +1000, David Gwynne wrote:
> > i want this so it makes mpls_input have the same function signature
> > as all the other protocol input functions we care about.
> > 
> > it also helps mpls_input because it looks up the interface the mpls
> > packet was received on, but it's always called by the interface
> > that the packet was receieved on.
> > 
> > on a related note, does anyone have an opinion on what a representative
> > mpls test setup looks like?
> > 
> > anyway, ok?
> 
> OK bluhm@

This is also fine by me.

As a simple test setup I would use static mpls routes. Need to dig out the
commands to do that easily.
 
> > Index: net/if.c
> > ===
> > RCS file: /cvs/src/sys/net/if.c,v
> > retrieving revision 1.534
> > diff -u -p -r1.534 if.c
> > --- net/if.c4 Jan 2018 10:48:02 -   1.534
> > +++ net/if.c8 Jan 2018 01:43:50 -
> > @@ -756,7 +756,7 @@ if_input_local(struct ifnet *ifp, struct
> >  #endif /* INET6 */
> >  #ifdef MPLS
> > case AF_MPLS:
> > -   mpls_input(m);
> > +   mpls_input(ifp, m);
> > break;
> >  #endif /* MPLS */
> > default:
> > Index: net/if_ethersubr.c
> > ===
> > RCS file: /cvs/src/sys/net/if_ethersubr.c,v
> > retrieving revision 1.248
> > diff -u -p -r1.248 if_ethersubr.c
> > --- net/if_ethersubr.c  4 Jan 2018 00:33:54 -   1.248
> > +++ net/if_ethersubr.c  8 Jan 2018 01:43:50 -
> > @@ -434,7 +434,7 @@ ether_input(struct ifnet *ifp, struct mb
> >  #ifdef MPLS
> > case ETHERTYPE_MPLS:
> > case ETHERTYPE_MPLS_MCAST:
> > -   mpls_input(m);
> > +   mpls_input(ifp, m);
> > return (1);
> >  #endif
> > default:
> > Index: netinet/ip_ether.c
> > ===
> > RCS file: /cvs/src/sys/netinet/ip_ether.c,v
> > retrieving revision 1.97
> > diff -u -p -r1.97 ip_ether.c
> > --- netinet/ip_ether.c  20 Nov 2017 10:35:24 -  1.97
> > +++ netinet/ip_ether.c  8 Jan 2018 01:43:50 -
> > @@ -130,7 +130,7 @@ mplsip_decap(struct mbuf *m, int iphlen)
> > pf_pkt_addr_changed(m);
> >  #endif
> >  
> > -   mpls_input(m);
> > +   mpls_input(&sc->gif_if, m);
> >  }
> >  
> >  struct gif_softc *
> > Index: netinet/ip_gre.c
> > ===
> > RCS file: /cvs/src/sys/netinet/ip_gre.c,v
> > retrieving revision 1.68
> > diff -u -p -r1.68 ip_gre.c
> > --- netinet/ip_gre.c20 Nov 2017 10:35:24 -  1.68
> > +++ netinet/ip_gre.c8 Jan 2018 01:43:50 -
> > @@ -175,7 +175,7 @@ gre_input2(struct mbuf *m, int hlen, int
> >  #ifdef MPLS
> > case ETHERTYPE_MPLS:
> > case ETHERTYPE_MPLS_MCAST:
> > -   mpls_input(m);
> > +   mpls_input(&sc->sc_if, m);
> > return (1);
> >  #endif
> > default:   /* others not yet supported */
> > Index: netmpls/mpls.h
> > ===
> > RCS file: /cvs/src/sys/netmpls/mpls.h,v
> > retrieving revision 1.37
> > diff -u -p -r1.37 mpls.h
> > --- netmpls/mpls.h  28 Feb 2017 07:07:07 -  1.37
> > +++ netmpls/mpls.h  8 Jan 2018 01:43:50 -
> > @@ -185,6 +185,6 @@ struct mbuf *mpls_shim_push(struct mbuf 
> >  
> >  int mpls_output(struct ifnet *, struct mbuf *, struct 
> > sockaddr *,
> > struct rtentry *);
> > -voidmpls_input(struct mbuf *);
> > +voidmpls_input(struct ifnet *, struct mbuf *);
> >  
> >  #endif /* _KERNEL */
> > Index: netmpls/mpls_input.c
> > ===
> > RCS file: /cvs/src/sys/netmpls/mpls_input.c,v
> > retrieving revision 1.65
> > diff -u -p -r1.65 mpls_input.c
> > --- netmpls/mpls_input.c8 Dec 2017 22:10:34 -   1.65
> > +++ netmpls/mpls_input.c8 Jan 2018 01:43:50 -
> > @@ -53,36 +53,32 @@ struct mbuf *mpls_ip6_adjttl(struct mbuf
> >  struct mbuf*mpls_do_error(struct mbuf *, int, int, int);
> >  
> >  void
> > -mpls_input(struct mbuf *m)
> > +mpls_input(struct ifnet *ifp, struct mbuf *m)
> >  {
> > struct sockaddr_mpls *smpls;
> > struct sockaddr_mpls sa_mpls;
> > struct shim_hdr *shim;
> > struct rtentry *rt;
> > struct rt_mpls *rt_mpls;
> > -   struct ifnet   *ifp;
> > u_int8_t ttl;
> > int hasbos;
> >  
> > -   if ((ifp = if_get(m->m_pkthdr.ph_ifidx)) == NULL ||
> > -   !ISSET(ifp->if_xflags, IFXF_MPLS)) {
> > +   if (!ISSET(ifp->if_xflags, IFXF_MPLS)) {
> > m_freem(m);
> > -   if_put(ifp);
> > return;
> > }
> >  
> > /* drop all broadcast and multicast packets */
> > if (m->m_flags & (M_BCAST | M

Re: ksh: State of NOTES and PROJECTS

2018-01-08 Thread Jeremie Courreges-Anglas
On Mon, Jan 08 2018, Jeremie Courreges-Anglas  wrote:
> On Mon, Jan 08 2018, Klemens Nanni  wrote:
>
> [...]
>
>> See attached diff for the first NOTES changes.
>
> [...]
>
>> Regarding "POSIX sh questions", we should probably unreference the 1992
>> standard.
>>
>> POSIX.1-2008, 2.6.2 Parameter Expansion:
>>
>>  In each case that a value of word is needed (based on the state
>>  of parameter, as described below), word shall be subjected to
>>  tilde expansion, [...]
>
> Looks good, except you give no rationale for moving the FPATH quirk
> from "known differences [...] that are not likely to change" to "known
> differences [...] that may change".
>
> IIUC ksh93 now documents this behavior:
>
>   FPATH  The search path for function definitions.  The
>  directories in this path are searched for a file with the
>  same name as the function or command when a function with
>  the -u attribute is referenced and when a command is not
>  found.  If an executable file with the name of that
>  command is found, then it is read and executed in the
>  current environment. [...]
>
> (Actually ksh93 doesn't require the file to be executable.)
>
> Right now I'm tempted to leave the FPATH bits as is or to amend them,
> not to move them to the "may change later" section.

Another small round of fixes.
- unreadable/setuid scripts... what?
- BUG-REPORTS has been moved to Attic
- s/effect/affect where relevant
- tweak the note about FPATH
- pdksh "understand[s] C integer constants (ie, 0x123, 0177)"

I've been tempted to remove the second paragraph in POSIX sh bugs, but
I don't know whether ksh handles all the details of parameter
expansions.


Index: NOTES
===
RCS file: /cvs/src/bin/ksh/NOTES,v
retrieving revision 1.15
diff -u -p -r1.15 NOTES
--- NOTES   8 Jan 2018 13:39:06 -   1.15
+++ NOTES   8 Jan 2018 14:00:45 -
@@ -6,12 +6,10 @@ General features of at&t ksh88 that are 
 - signals/traps not cleared during functions.
 - trap DEBUG, local ERR and EXIT traps in functions.
 - ERRNO parameter.
-- use of an `agent' to execute unreadable/setuid/setgid shell scripts
-  (don't ask).
 - read/select aren't hooked in to the command line editor
 - the last command of a pipeline is not run in the parent shell
 
-Known bugs (see also BUG-REPORTS and PROJECTS files):
+Known bugs (see also PROJECTS files):
 Variable parsing, Expansion:
- some specials behave differently when unset (eg, IFS behaves like
  " \t\n") others lose their special meaning.  IFS/PATH taken care of,
@@ -25,9 +23,9 @@ Known bugs (see also BUG-REPORTS and PRO
 Commands,Execution:
- setting special parameters that have side effects when
  changed/restored (ie, HISTFILE, OPTIND, RANDOM) in front
- of a command (eg, HISTFILE=/foo/bar echo hi) effects the parent
+ of a command (eg, HISTFILE=/foo/bar echo hi) affects the parent
  shell.  Note that setting other (not so special) parameters
- does not effect the parent shell.
+ does not affect the parent shell.
- `echo hi | exec cat -n' causes at&t to exit, `exec echo hi | cat -n'
  does not.  pdksh exits for neither.  Don't think POSIX requires
  an exit, but not sure.
@@ -239,8 +237,8 @@ Oddities in ksh (pd & at&t):
 - when tracing (set -x), and a command's stderr is redirected, the trace
   output is also redirected. so "set -x; echo foo 2> /tmp/O > /dev/null"
   will create /tmp/foo with the lines "+ > /dev/null" and "+ echo foo".
-- undocumented at&t ksh feature: FPATH is searched after PATH if no
-  executable is found, even if typeset -uf wasn't used.
+- undocumented at&t ksh88, documented in ksh93: FPATH is searched
+  after PATH if no executable is found, even if typeset -uf wasn't used.
 
 POSIX sh questions (references are to POSIX 1003.2-1992)
- arithmetic expressions: how are empty expressions treated?
@@ -276,9 +274,6 @@ POSIX sh bugs (references are to POSIX 1
  functions don't do the save/restore automatically).  Restoring
  OPTIND is kind of dumb since getopts may have been in the middle
  of parsing a group of flags (eg, -abc).
-   - unclear whether arithmetic expressions (eg, $((..))) should
- understand C integer constants (ie, 0x123, 0177).  at&t ksh doesn't
- and neither does pdksh.
- `...` definition (3.6.3) says nothing about backslash followed by
  a newline, which sh and at&t ksh strip out completely.  e.g.,
$ show-args `echo 'X


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: interface tx mitigation, with NET LOCK fixes

2018-01-08 Thread Martin Pieuchot
On 08/01/18(Mon) 11:13, David Gwynne wrote:
> this is tx mitigation again, ie, defer calling an interfaces start
> routine until at least 4 packets are queued, or a task fires.
> 
> the task firing is a problem for things like gif or vxlan that encap
> a packet in ip and send it through the ip stack again. the ip stack
> expects NET_RLOCK to be held. that is implicitly true when sending
> out of the network stack, but not when the bundle task fires.

Well if_start() is a driver function.  It should not require the
NET_LOCK().  pf(4) has been fixed to not be re-entrant so the same
thing has to be done for pseudo-driver.  I like the fact that your
diff is defining a new boundary between driver protected states and
stack protected states.

Here's a diff for gif(4), ok?

Index: net/if_gif.c
===
RCS file: /cvs/src/sys/net/if_gif.c,v
retrieving revision 1.105
diff -u -p -r1.105 if_gif.c
--- net/if_gif.c20 Nov 2017 10:35:24 -  1.105
+++ net/if_gif.c8 Jan 2018 14:05:45 -
@@ -231,17 +231,11 @@ gif_start(struct ifnet *ifp)
 
switch (sc->gif_psrc->sa_family) {
case AF_INET:
-   ip_output(m, NULL, NULL, 0, NULL, NULL, 0);
+   ip_send(m);
break;
 #ifdef INET6
case AF_INET6:
-   /*
-* force fragmentation to minimum MTU, to avoid path
-* MTU discovery. It is too painful to ask for resend
-* of inner packet, to achieve path MTU discovery for
-* encapsulated packets.
-*/
-   ip6_output(m, 0, NULL, IPV6_MINMTU, 0, NULL);
+   ip6_send(m);
break;
 #endif
default:



Re: ksh: State of NOTES and PROJECTS

2018-01-08 Thread Jeremie Courreges-Anglas
On Mon, Jan 08 2018, Klemens Nanni  wrote:

[...]

> See attached diff for the first NOTES changes.

[...]

> Regarding "POSIX sh questions", we should probably unreference the 1992
> standard.
>
> POSIX.1-2008, 2.6.2 Parameter Expansion:
>
>   In each case that a value of word is needed (based on the state
>   of parameter, as described below), word shall be subjected to
>   tilde expansion, [...]

Looks good, except you give no rationale for moving the FPATH quirk
from "known differences [...] that are not likely to change" to "known
differences [...] that may change".

IIUC ksh93 now documents this behavior:

  FPATH  The search path for function definitions.  The
 directories in this path are searched for a file with the
 same name as the function or command when a function with
 the -u attribute is referenced and when a command is not
 found.  If an executable file with the name of that
 command is found, then it is read and executed in the
 current environment. [...]

(Actually ksh93 doesn't require the file to be executable.)

Right now I'm tempted to leave the FPATH bits as is or to amend them,
not to move them to the "may change later" section.

> diff --git a/bin/ksh/NOTES b/bin/ksh/NOTES
> index 5fc1080bfbd..af0f1230af9 100644
> --- a/bin/ksh/NOTES
> +++ b/bin/ksh/NOTES
> @@ -6,7 +6,6 @@ General features of at&t ksh88 that are not (yet) in pdksh:
>  - signals/traps not cleared during functions.
>  - trap DEBUG, local ERR and EXIT traps in functions.
>  - ERRNO parameter.
> -- doesn't have posix file globbing (eg, [[:alpha:]], etc.).
>  - use of an `agent' to execute unreadable/setuid/setgid shell scripts
>(don't ask).
>  - read/select aren't hooked in to the command line editor
> @@ -34,7 +33,6 @@ Known bugs (see also BUG-REPORTS and PROJECTS files):
> an exit, but not sure.
>   - `echo foo | read bar; echo $bar' prints foo in at&t ksh, nothing
> in pdksh (ie, the read is done in a separate process in pdksh).
> -Misc:
>  
>  Known problems not caused by ksh:
>  - after stoping a job, emacs/vi is not re-entered.  Hitting return
> @@ -80,6 +78,8 @@ Known differences between pdksh & at&t ksh (that may change)
> in pdksh it changes.
>   - Value of LINENO after it has been set by the script in one file
> is bizarre when used in another file.
> +- FPATH is searched after PATH if no executable is found, even if
> +  typeset -uf wasn't used. Documented in pdksh but not at&t.
>  
>  Known differences between pdksh & at&t ksh (that are not likely to change)
>  - at&t ksh seems to catch or ignore SIGALRM - pdksh dies upon receipt
> @@ -241,23 +241,19 @@ Oddities in ksh (pd & at&t):
>  - when tracing (set -x), and a command's stderr is redirected, the trace
>output is also redirected. so "set -x; echo foo 2> /tmp/O > /dev/null"
>will create /tmp/foo with the lines "+ > /dev/null" and "+ echo foo".
> -- undocumented at&t ksh feature: FPATH is searched after PATH if no
> -  executable is found, even if typeset -uf wasn't used.
>  
>  POSIX sh questions (references are to POSIX 1003.2-1992)
>   - arithmetic expressions: how are empty expressions treated?
> (eg, echo $((  ))).  at&t ksh (and now pdksh) echo 0.
> Same question goes for `test "" -eq 0' - does this generate an error
> or, if not, what is the exit code?
> - - should tilde expansion occur after :'s in the word part of ${..=..}?
> -   (me thinks it should)
>   - if a signal is received during the execution of a built-in,
> does the builtin command exit or the whole shell?
>   - is it legal to execute last command of pipeline in current
> execution environment (eg, can "echo foo | read bar" set
> bar?)
>   - what action should be taken if there is an error doing a dup due
> -   to system limits (eg, not enough feil destriptors): is this
> +   to system limits (eg, not enough file destriptors): is this
> a "redirection error" (in which case a script will exit iff the
> error occured while executing a special built-in)?
> IMHO, shell should exit script.  Couldn't find a blanket statement
>

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE



Re: malloc cleanup and small optimization (step 3)

2018-01-08 Thread Otto Moerbeek
On Wed, Jan 03, 2018 at 01:56:43PM +0100, Otto Moerbeek wrote:

> Hi,
> 
> this is mostly kshe's work, with an additional change on the cache
> maintenance by me.
> 
> I did not take the ffs change yet, since I want to measure the impact
> separately.

no feedback :-(

I'm going to commit this soon to force testing for machines running
snaps or current.

-Otto

> 
> Index: malloc.c
> ===
> RCS file: /cvs/src/lib/libc/stdlib/malloc.c,v
> retrieving revision 1.238
> diff -u -p -r1.238 malloc.c
> --- malloc.c  1 Jan 2018 12:41:48 -   1.238
> +++ malloc.c  3 Jan 2018 12:52:14 -
> @@ -376,12 +376,11 @@ omalloc_parseopt(char opt)
>   case 'X':
>   mopts.malloc_xmalloc = 1;
>   break;
> - default: {
> + default:
>   dprintf(STDERR_FILENO, "malloc() warning: "
>  "unknown char in MALLOC_OPTIONS\n");
>   break;
>   }
> - }
>  }
>  
>  static void
> @@ -448,9 +447,6 @@ omalloc_init(void)
>   ;
>  }
>  
> -/*
> - * Initialize a dir_info, which should have been cleared by caller
> - */
>  static void
>  omalloc_poolinit(struct dir_info **dp)
>  {
> @@ -502,7 +498,7 @@ omalloc_grow(struct dir_info *d)
>   size_t i;
>   struct region_info *p;
>  
> - if (d->regions_total > SIZE_MAX / sizeof(struct region_info) / 2 )
> + if (d->regions_total > SIZE_MAX / sizeof(struct region_info) / 2)
>   return 1;
>  
>   newtotal = d->regions_total * 2;
> @@ -641,9 +637,9 @@ static void
>  unmap(struct dir_info *d, void *p, size_t sz, int clear)
>  {
>   size_t psz = sz >> MALLOC_PAGESHIFT;
> - size_t rsz, tounmap;
> + size_t rsz;
>   struct region_info *r;
> - u_int i, offset;
> + u_int i, offset, mask;
>  
>   if (sz != PAGEROUND(sz))
>   wrterror(d, "munmap round");
> @@ -662,30 +658,34 @@ unmap(struct dir_info *d, void *p, size_
>   STATS_SUB(d->malloc_used, sz);
>   return;
>   }
> - tounmap = 0;
> - if (psz > rsz)
> - tounmap = psz - rsz;
>   offset = getrbyte(d);
> - for (i = 0; tounmap > 0 && i < mopts.malloc_cache; i++) {
> - r = &d->free_regions[(i + offset) & (mopts.malloc_cache - 1)];
> - if (r->p != NULL) {
> - rsz = r->size << MALLOC_PAGESHIFT;
> - if (munmap(r->p, rsz))
> - wrterror(d, "munmap %p", r->p);
> - r->p = NULL;
> - if (tounmap > r->size)
> - tounmap -= r->size;
> - else
> - tounmap = 0;
> - d->free_regions_size -= r->size;
> - r->size = 0;
> - STATS_SUB(d->malloc_used, rsz);
> + mask = mopts.malloc_cache - 1;
> + if (psz > rsz) {
> + size_t tounmap = psz - rsz;
> + i = 0;
> + for (;;) {
> + r = &d->free_regions[(i + offset) & mask];
> + if (r->p != NULL) {
> + rsz = r->size << MALLOC_PAGESHIFT;
> + if (munmap(r->p, rsz))
> + wrterror(d, "munmap %p", r->p);
> + r->p = NULL;
> + if (tounmap > r->size)
> + tounmap -= r->size;
> + else
> + tounmap = 0;
> + d->free_regions_size -= r->size;
> + STATS_SUB(d->malloc_used, rsz);
> + if (tounmap == 0) {
> + offset = i;
> + break;
> + }
> + }
> + i++;
>   }
>   }
> - if (tounmap > 0)
> - wrterror(d, "malloc cache underflow");
> - for (i = 0; i < mopts.malloc_cache; i++) {
> - r = &d->free_regions[(i + offset) & (mopts.malloc_cache - 1)];
> + for (i = 0; ; i++) {
> + r = &d->free_regions[(i + offset) & mask];
>   if (r->p == NULL) {
>   if (clear)
>   memset(p, 0, sz - mopts.malloc_guard);
> @@ -702,8 +702,6 @@ unmap(struct dir_info *d, void *p, size_
>   break;
>   }
>   }
> - if (i == mopts.malloc_cache)
> - wrterror(d, "malloc free slot lost");
>   if (d->free_regions_size > mopts.malloc_cache)
>   wrterror(d, "malloc cache overflow");
>  }
> @@ -723,7 +721,6 @@ zapcacheregion(struct dir_info *d, void 
>   wrterror(d, "munmap %p", r->p);
>   r->p = NULL;
>   d->free_regions_size -= r->size;
> - 

Re: make mpls_input take struct ifnet *ifp as an argument

2018-01-08 Thread Alexander Bluhm
On Mon, Jan 08, 2018 at 11:49:05AM +1000, David Gwynne wrote:
> i want this so it makes mpls_input have the same function signature
> as all the other protocol input functions we care about.
> 
> it also helps mpls_input because it looks up the interface the mpls
> packet was received on, but it's always called by the interface
> that the packet was receieved on.
> 
> on a related note, does anyone have an opinion on what a representative
> mpls test setup looks like?
> 
> anyway, ok?

OK bluhm@

> Index: net/if.c
> ===
> RCS file: /cvs/src/sys/net/if.c,v
> retrieving revision 1.534
> diff -u -p -r1.534 if.c
> --- net/if.c  4 Jan 2018 10:48:02 -   1.534
> +++ net/if.c  8 Jan 2018 01:43:50 -
> @@ -756,7 +756,7 @@ if_input_local(struct ifnet *ifp, struct
>  #endif /* INET6 */
>  #ifdef MPLS
>   case AF_MPLS:
> - mpls_input(m);
> + mpls_input(ifp, m);
>   break;
>  #endif /* MPLS */
>   default:
> Index: net/if_ethersubr.c
> ===
> RCS file: /cvs/src/sys/net/if_ethersubr.c,v
> retrieving revision 1.248
> diff -u -p -r1.248 if_ethersubr.c
> --- net/if_ethersubr.c4 Jan 2018 00:33:54 -   1.248
> +++ net/if_ethersubr.c8 Jan 2018 01:43:50 -
> @@ -434,7 +434,7 @@ ether_input(struct ifnet *ifp, struct mb
>  #ifdef MPLS
>   case ETHERTYPE_MPLS:
>   case ETHERTYPE_MPLS_MCAST:
> - mpls_input(m);
> + mpls_input(ifp, m);
>   return (1);
>  #endif
>   default:
> Index: netinet/ip_ether.c
> ===
> RCS file: /cvs/src/sys/netinet/ip_ether.c,v
> retrieving revision 1.97
> diff -u -p -r1.97 ip_ether.c
> --- netinet/ip_ether.c20 Nov 2017 10:35:24 -  1.97
> +++ netinet/ip_ether.c8 Jan 2018 01:43:50 -
> @@ -130,7 +130,7 @@ mplsip_decap(struct mbuf *m, int iphlen)
>   pf_pkt_addr_changed(m);
>  #endif
>  
> - mpls_input(m);
> + mpls_input(&sc->gif_if, m);
>  }
>  
>  struct gif_softc *
> Index: netinet/ip_gre.c
> ===
> RCS file: /cvs/src/sys/netinet/ip_gre.c,v
> retrieving revision 1.68
> diff -u -p -r1.68 ip_gre.c
> --- netinet/ip_gre.c  20 Nov 2017 10:35:24 -  1.68
> +++ netinet/ip_gre.c  8 Jan 2018 01:43:50 -
> @@ -175,7 +175,7 @@ gre_input2(struct mbuf *m, int hlen, int
>  #ifdef MPLS
>   case ETHERTYPE_MPLS:
>   case ETHERTYPE_MPLS_MCAST:
> - mpls_input(m);
> + mpls_input(&sc->sc_if, m);
>   return (1);
>  #endif
>   default:   /* others not yet supported */
> Index: netmpls/mpls.h
> ===
> RCS file: /cvs/src/sys/netmpls/mpls.h,v
> retrieving revision 1.37
> diff -u -p -r1.37 mpls.h
> --- netmpls/mpls.h28 Feb 2017 07:07:07 -  1.37
> +++ netmpls/mpls.h8 Jan 2018 01:43:50 -
> @@ -185,6 +185,6 @@ struct mbuf   *mpls_shim_push(struct mbuf 
>  
>  int   mpls_output(struct ifnet *, struct mbuf *, struct sockaddr *,
>   struct rtentry *);
> -void  mpls_input(struct mbuf *);
> +void  mpls_input(struct ifnet *, struct mbuf *);
>  
>  #endif /* _KERNEL */
> Index: netmpls/mpls_input.c
> ===
> RCS file: /cvs/src/sys/netmpls/mpls_input.c,v
> retrieving revision 1.65
> diff -u -p -r1.65 mpls_input.c
> --- netmpls/mpls_input.c  8 Dec 2017 22:10:34 -   1.65
> +++ netmpls/mpls_input.c  8 Jan 2018 01:43:50 -
> @@ -53,36 +53,32 @@ struct mbuf   *mpls_ip6_adjttl(struct mbuf
>  struct mbuf  *mpls_do_error(struct mbuf *, int, int, int);
>  
>  void
> -mpls_input(struct mbuf *m)
> +mpls_input(struct ifnet *ifp, struct mbuf *m)
>  {
>   struct sockaddr_mpls *smpls;
>   struct sockaddr_mpls sa_mpls;
>   struct shim_hdr *shim;
>   struct rtentry *rt;
>   struct rt_mpls *rt_mpls;
> - struct ifnet   *ifp;
>   u_int8_t ttl;
>   int hasbos;
>  
> - if ((ifp = if_get(m->m_pkthdr.ph_ifidx)) == NULL ||
> - !ISSET(ifp->if_xflags, IFXF_MPLS)) {
> + if (!ISSET(ifp->if_xflags, IFXF_MPLS)) {
>   m_freem(m);
> - if_put(ifp);
>   return;
>   }
>  
>   /* drop all broadcast and multicast packets */
>   if (m->m_flags & (M_BCAST | M_MCAST)) {
>   m_freem(m);
> - if_put(ifp);
>   return;
>   }
>  
> - if (m->m_len < sizeof(*shim))
> - if ((m = m_pullup(m, sizeof(*shim))) == NULL) {
> - if_put(ifp);
> + if (m->m_len < sizeof(*shim)) {
> + m = m_pullup(m, sizeof(*shim));
> + if (m == NULL)
>   return;
> -  

Re: interface tx mitigation, with NET LOCK fixes

2018-01-08 Thread Theo Buehler
On Mon, Jan 08, 2018 at 11:13:33AM +1000, David Gwynne wrote:
> this is tx mitigation again, ie, defer calling an interfaces start
> routine until at least 4 packets are queued, or a task fires.
> 
> the task firing is a problem for things like gif or vxlan that encap
> a packet in ip and send it through the ip stack again. the ip stack
> expects NET_RLOCK to be held. that is implicitly true when sending
> out of the network stack, but not when the bundle task fires.
> 
> this has the bundle tasks take the network read lock on behalf of
> the start routines, like the stack does. this avoids having to patch
> every driver to cope with this.
> 
> tests?
> 

Unfortunately, suspend/resume is still broken with this on my x230: when
I do 'zzz', the screen goes dark, the LED around the power button starts
blinking and the machine seems to lock up. No key strokes seem to have
any effect and it doesn't react to pings.

> Index: ifq.c
> ===
> RCS file: /cvs/src/sys/net/ifq.c,v
> retrieving revision 1.21
> diff -u -p -r1.21 ifq.c
> --- ifq.c 4 Jan 2018 11:02:57 -   1.21
> +++ ifq.c 8 Jan 2018 01:09:05 -
> @@ -70,9 +70,16 @@ struct priq {
>  void ifq_start_task(void *);
>  void ifq_restart_task(void *);
>  void ifq_barrier_task(void *);
> +void ifq_bundle_task(void *);
>  
>  #define TASK_ONQUEUE 0x1
>  
> +static inline void
> +ifq_run_start(struct ifqueue *ifq)
> +{
> + ifq_serialize(ifq, &ifq->ifq_start);
> +}
> +
>  void
>  ifq_serialize(struct ifqueue *ifq, struct task *t)
>  {
> @@ -114,6 +121,16 @@ ifq_is_serialized(struct ifqueue *ifq)
>  }
>  
>  void
> +ifq_start(struct ifqueue *ifq)
> +{
> + if (ifq_len(ifq) >= min(4, ifq->ifq_maxlen)) {
> + task_del(ifq->ifq_softnet, &ifq->ifq_bundle);
> + ifq_run_start(ifq);
> + } else
> + task_add(ifq->ifq_softnet, &ifq->ifq_bundle);
> +}
> +
> +void
>  ifq_start_task(void *p)
>  {
>   struct ifqueue *ifq = p;
> @@ -137,11 +154,36 @@ ifq_restart_task(void *p)
>  }
>  
>  void
> +ifq_bundle_task(void *p)
> +{
> + struct ifqueue *ifq = p;
> + int s;
> +
> + NET_RLOCK();
> + s = splnet();
> + ifq_run_start(ifq);
> + splx(s);
> + NET_RUNLOCK();
> +}
> +
> +void
>  ifq_barrier(struct ifqueue *ifq)
>  {
>   struct cond c = COND_INITIALIZER();
>   struct task t = TASK_INITIALIZER(ifq_barrier_task, &c);
>  
> + if (!task_del(ifq->ifq_softnet, &ifq->ifq_bundle)) {
> + int netlocked = (rw_status(&netlock) == RW_WRITE);
> +
> + if (netlocked) /* XXXSMP breaks atomicity */
> + NET_UNLOCK();
> +
> + taskq_barrier(ifq->ifq_softnet);
> +
> + if (netlocked)
> + NET_LOCK();
> + }
> +
>   if (ifq->ifq_serializer == NULL)
>   return;
>  
> @@ -166,6 +208,7 @@ void
>  ifq_init(struct ifqueue *ifq, struct ifnet *ifp, unsigned int idx)
>  {
>   ifq->ifq_if = ifp;
> + ifq->ifq_softnet = net_tq(ifp->if_index);
>   ifq->ifq_softc = NULL;
>  
>   mtx_init(&ifq->ifq_mtx, IPL_NET);
> @@ -187,6 +230,7 @@ ifq_init(struct ifqueue *ifq, struct ifn
>   mtx_init(&ifq->ifq_task_mtx, IPL_NET);
>   TAILQ_INIT(&ifq->ifq_task_list);
>   ifq->ifq_serializer = NULL;
> + task_set(&ifq->ifq_bundle, ifq_bundle_task, ifq);
>  
>   task_set(&ifq->ifq_start, ifq_start_task, ifq);
>   task_set(&ifq->ifq_restart, ifq_restart_task, ifq);
> @@ -237,6 +281,8 @@ void
>  ifq_destroy(struct ifqueue *ifq)
>  {
>   struct mbuf_list ml = MBUF_LIST_INITIALIZER();
> +
> + ifq_barrier(ifq); /* ensure nothing is running with the ifq */
>  
>   /* don't need to lock because this is the last use of the ifq */
>  
> Index: ifq.h
> ===
> RCS file: /cvs/src/sys/net/ifq.h,v
> retrieving revision 1.20
> diff -u -p -r1.20 ifq.h
> --- ifq.h 4 Jan 2018 11:02:57 -   1.20
> +++ ifq.h 8 Jan 2018 01:09:05 -
> @@ -25,6 +25,7 @@ struct ifq_ops;
>  
>  struct ifqueue {
>   struct ifnet*ifq_if;
> + struct taskq*ifq_softnet;
>   union {
>   void*_ifq_softc;
>   /*
> @@ -57,6 +58,7 @@ struct ifqueue {
>   struct mutex ifq_task_mtx;
>   struct task_list ifq_task_list;
>   void*ifq_serializer;
> + struct task  ifq_bundle;
>  
>   /* work to be serialised */
>   struct task  ifq_start;
> @@ -405,6 +407,7 @@ void   ifq_attach(struct ifqueue *, cons
>  void  ifq_destroy(struct ifqueue *);
>  void  ifq_add_data(struct ifqueue *, struct if_data *);
>  int   ifq_enqueue(struct ifqueue *, struct mbuf *);
> +void  ifq_start(struct ifqueue *);
>  struct mbuf  *ifq_deq_begin(struct ifqueue *);
>  void  ifq_deq_commit(struct ifqueue *, 

Re: interface tx mitigation, with NET LOCK fixes

2018-01-08 Thread Hrvoje Popovski
On 8.1.2018. 2:13, David Gwynne wrote:
> this is tx mitigation again, ie, defer calling an interfaces start
> routine until at least 4 packets are queued, or a task fires.
> 
> the task firing is a problem for things like gif or vxlan that encap
> a packet in ip and send it through the ip stack again. the ip stack
> expects NET_RLOCK to be held. that is implicitly true when sending
> out of the network stack, but not when the bundle task fires.
> 
> this has the bundle tasks take the network read lock on behalf of
> the start routines, like the stack does. this avoids having to patch
> every driver to cope with this.
> 
> tests?

with this diff i'm having same performance boost as with older versions..

from 1.1Mpps to 1.3Mpps on box with
12 x Intel(R) Xeon(R) CPU E5-2620 v2 @ 2.10GHz, 2400.00 MHz



Re: ksh: State of NOTES and PROJECTS

2018-01-08 Thread Klemens Nanni
On Mon, Jan 08, 2018 at 02:23:48AM +0100, Jeremie Courreges-Anglas wrote:
> On Sat, Jan 06 2018, Klemens Nanni  wrote:
> > Looking at the CVS log one can see that other legacies such as ChangeLog
> > have already been zapped. NOTES and PROJECTS have seen sporadic minor
> > updates since import and still list valid topics, but they lack other
> > long overdue correcttions. For example:
> >
> > - support for POSIX character class globbing was done in 2009
> > - EASY and COMPLEX history code got zapped in 2004
> > - `time' has a -p option since pdksh-5.2.14 from 1999
> >
> > Documentation is nice but wrong/outdated documentation sucks, so should
> > NOTES and PROJECTS be further maintained or removed as well?
> >
> > I prefer keeping them as of now since they're quite informative when
> > digging deeper into the sources. On the other hand, maintenance requires
> > history and knowledge of other shells when it comes to differences
> > between them - I'm clearly out here and cannot judge the amount of work
> > on that part.
> >
> > What do you think? Feedback is greatly appreciated.
> 
> NOTES is quite dense indeed, I think it can have value.
> 
> > If NOTES and PROJECTS stay, I'd be happy to remove/update some of the
> > topics.
> 
> Here's a first diff to kill the most obvious entries in PROJECTS.  The
> next steps will probably take more time.
Indeed.

See attached diff for the first NOTES changes.

> Index: PROJECTS
> ===
> RCS file: /d/cvs/src/bin/ksh/PROJECTS,v
> retrieving revision 1.8
> diff -u -p -r1.8 PROJECTS
> --- PROJECTS  14 Sep 2015 09:42:33 -  1.8
> +++ PROJECTS  8 Jan 2018 01:12:43 -
> @@ -22,31 +22,11 @@ Things to be done in pdksh (see also the
>  
>(ulimit also needs to be examined to check that it fits the posix 
> style)
>  
> -* test suite
> -  Ideally, as the builtin utilities are being POSIXized, short tests
> -  should be written to be used in regression testing.  The tests
> -  directory contains some tests, but many more need to be written.
> -
> -* internationalization
> -  Need to handle with the LANG and LC_* environment variables.  This
> -  involves changes to ensure  macros are being used (currently
> -  uses its own macros in many places), figuring out how to deal with
> -  bases (for integer arithmetic, eg, 12#1A), and (the nasty one) doing
> -  string look ups for error messages, etc..  It probably isn't worth
> -  translating strings to other languages yet as the code is likely
> -  to change a lot in the near future, but it would be good to have the
> -  code set up so string tables can be used.
> -
>  * trap code
>   * add the DEBUG trap.
>   * fix up signal handling code.  In particular, fatal vs tty signals,
> have signal routine to call to check for pending/fatal traps, etc.
>  
> -* parsing
> - * the time keyword needs to be hacked to accept options (!) since
> -   POSIX says it shall accept the -p option and must skip a -- argument
> -   (end of options).  Yuck.
> -
>  * lexing
>the lexing may need a re-write since it currently doesn't parse $( .. 
> ),
>$(( .. )), (( ... )) properly.
> @@ -68,30 +48,10 @@ Things to be done in pdksh (see also the
>in general, treatment of OPTIND/OPTARG,
>  
>  * history
> -  There are two versions of the history code, COMPLEX_HISTORY and
> -  EASY_HISTORY, which need to be merged.  COMPLEX does at&t style history
> -  where the history file is written after each command and checked when
> -  ever looking through the history (in case another shell has added
> -  something).  EASY simply reads the history file at startup and writes
> -  it before exiting.
> - * re-write the COMPLEX_HISTORY code so mmap() not needed (currently
> -   can't be used on machines without mmap()).
> - * Add multiline knowledge to COMPLEX_HISTORY (see EASY_HISTORY
> -   stuff).
> - * change COMPLEX_HISTORY code so concurrent history files are
> -   controlled by an option (set -o history-concurrent?).  Delete
> -   the EASY_HISTORY code.
> + * Add multiline knowledge
>   * bring history code up to POSIX standards (see POSIX description
> of fc, etc.).
>  
> -* documentation
> -  Some sort of tutorial with examples would be good.  Texinfo is probably
> -  the best medium for this.  Also, the man page could be converted to
> -  texinfo (if the tutorial and man page  are put in the same texinfo
> -  page, they should be somewhat distinct - i.e., the tutorial should
> -  be a separate thread - but there should be cross references between the
> -  two).
> -
>  * miscellaneous
>   * POSIX specifies what happens when various kinds of errors occur
> in special built-ins commands vs regular commands (builtin or
> @@ -104,8 +64,3 @@ Things to be done in pdksh (

Re: ksh: remove unused param from kb_add()

2018-01-08 Thread Anton Lindqvist
On Sun, Jan 07, 2018 at 12:26:22PM -0700, Todd C. Miller wrote:
> In kb_add(), the args parameter is always NULL.  Noticed by anton@

ok anton@