make(1) build broken

2011-09-20 Thread Michael W. Bombardieri
Hi all,

I noticed that the make(1) build is broken for non-gcc compilers.
The following diff stops the build from breaking for pcc and llvm/clang.
Comments?

- Michael


Index: targ.h
===
RCS file: /usr/src/cvs/src/usr.bin/make/targ.h,v
retrieving revision 1.9
diff -u -r1.9 targ.h
--- targ.h  19 Jul 2010 19:46:44 -  1.9
+++ targ.h  21 Sep 2011 02:38:05 -
@@ -59,10 +59,7 @@
 extern inline GNode *
 Targ_FindNodeh(const char *, size_t, uint32_t, int);
 extern inline GNode *
-Targ_FindNodeh(const char *name, size_t n, uint32_t hv, int flags)
-{
-   return Targ_FindNodeih(name, name + n - 1, hv, flags);
-}
+Targ_FindNodeh(const char *, size_t, uint32_t, int);
 extern void Targ_FindList(Lst, Lst);
 extern bool Targ_Ignore(GNode *);
 extern bool Targ_Silent(GNode *);



[patch] sys/arch/macppc rcs ids

2011-09-20 Thread Daniel Dickman
fix rcs ids.

Index: elf32_powerpc_merge.x
===
RCS file: /home/cvs/src/sys/arch/macppc/stand/boot.mac/elf32_powerpc_merge.x,v
retrieving revision 1.1
diff -u -r1.1 elf32_powerpc_merge.x
--- elf32_powerpc_merge.x   5 Dec 2006 20:30:26 -   1.1
+++ elf32_powerpc_merge.x   2 Sep 2011 02:32:14 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: */
+/* $OpenBSD$ */
 OUTPUT_ARCH(powerpc)
 SECTIONS
 {
Index: fixcoff.c
===
RCS file: /home/cvs/src/sys/arch/macppc/stand/boot.mac/fixcoff.c,v
retrieving revision 1.1
diff -u -r1.1 fixcoff.c
--- fixcoff.c   5 Dec 2006 20:30:26 -   1.1
+++ fixcoff.c   2 Sep 2011 02:32:25 -
@@ -1,4 +1,4 @@
-/* $OpenBSD: */
+/* $OpenBSD$ */
 /* $NetBSD: fixcoff.c,v 1.10 2006/04/07 02:34:55 gdamore Exp $ */
 
 /*



Re:

2011-09-20 Thread Compumar
[IMAGE]

[IMAGE]

Ver mas info del producto haciendo click aqui

Envmos a todo el pams!

WWW.COMPUMAR.COM

Pablo
pablodemart...@compumar.com

(011) 4958-7775
Av. La Plata 444 - Caballito - Capital Federal
Buenos Aires - Argentina



MRT parser for bgpctl

2011-09-20 Thread Claudio Jeker
In short libbgpdump is a nightmare therefor I decided to make bgpctl read
bgp mrt dump files. Plus I have some evil ideas that needs this too.

This is the initial shot. It adds a "show mrt" command that will either
read a file (specified with "file /path/to/dump") or read from stdin.
Additionally almost all filters that can be used on show rib will work
here to.

Currently unimplemented VPNv4 handling and handling dumps with BGP
messages or state changes in them. Also missing is community / ext.
community filtering but I'm tired of this monster code.
-- 
:wq Claudio

Index: Makefile
===
RCS file: /cvs/src/usr.sbin/bgpctl/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile26 May 2010 16:44:32 -  1.11
+++ Makefile18 Sep 2011 12:11:59 -
@@ -5,7 +5,7 @@
 PROG=  bgpctl
 SRCS=  bgpctl.c parser.c util.c timer.c
 SRCS+= irrfilter.c whois.c irr_asset.c irr_prefix.c irr_output.c
-SRCS+= irr_parser.c
+SRCS+= irr_parser.c mrtparser.c
 CFLAGS+= -Wall
 CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
 CFLAGS+= -Wmissing-declarations
Index: bgpctl.c
===
RCS file: /cvs/src/usr.sbin/bgpctl/bgpctl.c,v
retrieving revision 1.161
diff -u -p -r1.161 bgpctl.c
--- bgpctl.c2 Sep 2010 14:03:21 -   1.161
+++ bgpctl.c20 Sep 2011 21:11:50 -
@@ -37,6 +37,7 @@
 #include "log.h"
 #include "parser.h"
 #include "irrfilter.h"
+#include "mrtparser.h"
 
 enum neighbor_views {
NV_DEFAULT,
@@ -74,6 +75,9 @@ const char *   print_origin(u_int8_t, int
 voidprint_flags(u_int8_t, int);
 int show_rib_summary_msg(struct imsg *);
 int show_rib_detail_msg(struct imsg *, int);
+voidshow_rib_brief(struct ctl_show_rib *, u_char *);
+voidshow_rib_detail(struct ctl_show_rib *, u_char *, int);
+voidshow_attr(void *, u_int16_t);
 voidshow_community(u_char *, u_int16_t);
 voidshow_ext_community(u_char *, u_int16_t);
 char   *fmt_mem(int64_t);
@@ -81,8 +85,13 @@ int   show_rib_memory_msg(struct imsg *)
 voidsend_filterset(struct imsgbuf *, struct filter_set_head *);
 static const char  *get_errstr(u_int8_t, u_int8_t);
 int show_result(struct imsg *);
+voidshow_mrt_dump(struct mrt_rib *, struct mrt_peer *, void *);
+voidshow_mrt_state(struct mrt_bgp_state *, void *);
+voidshow_mrt_msg(struct mrt_bgp_msg *, void *);
+voidmrt_to_bgpd_addr(union mrt_addr *, struct bgpd_addr *);
 
 struct imsgbuf *ibuf;
+struct mrt_parser show_mrt = { show_mrt_dump, show_mrt_state, show_mrt_msg };
 
 __dead void
 usage(void)
@@ -228,8 +237,7 @@ main(int argc, char *argv[])
sizeof(res->community));
type = IMSG_CTL_SHOW_RIB_COMMUNITY;
}
-   memcpy(&ribreq.neighbor, &neighbor,
-   sizeof(ribreq.neighbor));
+   memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor));
strlcpy(ribreq.rib, res->rib, sizeof(ribreq.rib));
ribreq.aid = res->aid;
ribreq.flags = res->flags;
@@ -237,6 +245,27 @@ main(int argc, char *argv[])
if (!(res->flags & F_CTL_DETAIL))
show_rib_summary_head();
break;
+   case SHOW_MRT:
+   close(fd);
+   bzero(&ribreq, sizeof(ribreq));
+   if (res->as.type != AS_NONE)
+   memcpy(&ribreq.as, &res->as, sizeof(res->as));
+   if (res->addr.aid) {
+   memcpy(&ribreq.prefix, &res->addr, sizeof(res->addr));
+   ribreq.prefixlen = res->prefixlen;
+   }
+   if (res->community.as != COMMUNITY_UNSET &&
+   res->community.type != COMMUNITY_UNSET)
+   memcpy(&ribreq.community, &res->community,
+   sizeof(res->community));
+   memcpy(&ribreq.neighbor, &neighbor, sizeof(ribreq.neighbor));
+   ribreq.aid = res->aid;
+   ribreq.flags = res->flags;
+   show_mrt.arg = &ribreq;
+   if (!(res->flags & F_CTL_DETAIL))
+   show_rib_summary_head();
+   mrt_parse(res->mrtfd, &show_mrt, 1);
+   exit(0);
case SHOW_RIB_MEM:
imsg_compose(ibuf, IMSG_CTL_SHOW_RIB_MEM, 0, 0, -1, NULL, 0);
break;
@@ -396,6 +425,7 @@ main(int argc, char *argv[])
case IRRFILTER:
case LOG_VERBOSE:
case LOG_BRIEF:
+   case SHOW_MRT:
break;
}
imsg_free(&imsg);
@@ -1124,27 +1154,14 @@ int
 show_rib_summary_msg(struct imsg *imsg)
 {
 

Re: /usr/local/share/terminfo (was: NEW: x11/st)

2011-09-20 Thread David Coppa
On Tue, Sep 20, 2011 at 7:20 PM, Nicholas Marriott
 wrote:

> Index: ncurses_cfg.h
> ===
> RCS file: /cvs/src/lib/libcurses/ncurses_cfg.h,v
> retrieving revision 1.26
> diff -u -p -r1.26 ncurses_cfg.h
> --- ncurses_cfg.h   23 Apr 2011 22:08:15 -  1.26
> +++ ncurses_cfg.h   19 Sep 2011 18:03:20 -
> @@ -160,7 +160,7 @@
>  #define STDC_HEADERS 1
>  #define SYSTEM_NAME "openbsd"
>  #define TERMINFO "/usr/share/terminfo"
> -#define TERMINFO_DIRS "/usr/share/terminfo"
> +#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/terminfo"
>  #define TIME_WITH_SYS_TIME 1
>  #define TYPEOF_CHTYPE long
>  #define USE_ASSUMED_COLOR 1
> Index: shlib_version
> ===
> RCS file: /cvs/src/lib/libcurses/shlib_version,v
> retrieving revision 1.18
> diff -u -p -r1.18 shlib_version
> --- shlib_version   6 Sep 2010 17:26:17 -   1.18
> +++ shlib_version   20 Sep 2011 17:16:32 -
> @@ -1,2 +1,2 @@
>  major=12
> -minor=0
> +minor=1
>

OK for me.

Thanks,
David



Re: Do less work under splusb()

2011-09-20 Thread Ariane van der Steldt
On Sun, Sep 18, 2011 at 10:27:37PM +0200, Michael Knudsen wrote:
> Does this make sense?

Since it's been taken off the list, the splusb is indeed no longer
required. Either way is fine with me though, I doubt the zeroing will
take that many cycles to really matter.

> Index: ehci.c
> ===
> RCS file: /var/ocvs/src/sys/dev/usb/ehci.c,v
> retrieving revision 1.118
> diff -u -p -r1.118 ehci.c
> --- ehci.c10 Jul 2011 17:34:53 -  1.118
> +++ ehci.c18 Sep 2011 20:11:10 -
> @@ -2478,10 +2478,10 @@ ehci_alloc_sqtd(ehci_softc_t *sc)
>   s = splusb();
>   sqtd = sc->sc_freeqtds;
>   sc->sc_freeqtds = sqtd->nextqtd;
> + splx(s);
>   memset(&sqtd->qtd, 0, sizeof(ehci_qtd_t));
>   sqtd->nextqtd = NULL;
>   sqtd->xfer = NULL;
> - splx(s);
>  
>   return (sqtd);
>  }

ok ariane@
-- 
Ariane



/usr/local/share/terminfo (was: NEW: x11/st)

2011-09-20 Thread Nicholas Marriott
Moving to tech@; this is so ports can install custom terminfo files
(notably st and rxvt-unicode which for one reason or another won't get
them into upstream ncurses).

On Tue, Sep 20, 2011 at 05:03:06PM +0200, David Coppa wrote:
> On Mon, Sep 19, 2011 at 8:12 PM, Nicholas Marriott
>  wrote:
> > I'm ok with doing this.
> 
> I think we should bump ncurses minor as well.
> 
> This is required so we can tighten library dependency for the ports
> that will use the new /usr/local/share/terminfo dir.
> 
> For example, I'd like to patch rxvt-unicode to use its "rxvt-unicode"
> terminfo database entry instead of "rxvt-256color" as it is now...

I don't object to bumping it, anyone else?


Index: ncurses_cfg.h
===
RCS file: /cvs/src/lib/libcurses/ncurses_cfg.h,v
retrieving revision 1.26
diff -u -p -r1.26 ncurses_cfg.h
--- ncurses_cfg.h   23 Apr 2011 22:08:15 -  1.26
+++ ncurses_cfg.h   19 Sep 2011 18:03:20 -
@@ -160,7 +160,7 @@
 #define STDC_HEADERS 1
 #define SYSTEM_NAME "openbsd"
 #define TERMINFO "/usr/share/terminfo"
-#define TERMINFO_DIRS "/usr/share/terminfo"
+#define TERMINFO_DIRS "/usr/share/terminfo:/usr/local/share/terminfo"
 #define TIME_WITH_SYS_TIME 1
 #define TYPEOF_CHTYPE long
 #define USE_ASSUMED_COLOR 1
Index: shlib_version
===
RCS file: /cvs/src/lib/libcurses/shlib_version,v
retrieving revision 1.18
diff -u -p -r1.18 shlib_version
@@ -1,2 +1,2 @@
 major=12
-minor=0
+minor=1



Re: compat linux pipe2() circus

2011-09-20 Thread Ariane van der Steldt
On Tue, Sep 20, 2011 at 09:47:45AM +0200, Mark Kettenis wrote:
> > Date: Tue, 20 Sep 2011 01:41:35 +0300
> > From: Paul Irofti 
> > 
> > Linux keeps surprising me everytime!
> > 
> > This time its their pipe2 system call which adds flags to the pipe call.
> > Its the unix-ish way apparently to turn pipes into files on a kernel
> > filesystem, or so they claim.
> > 
> > Anywho, this fixes glibc pipe2 system calls by wrapping against the
> > regular pipe systemcall if no flags are set and by signaling we don't
> > support that if they are.
> > 
> > Okay?
> > 
> > 
> > Index: linux_ipc.c
> > ===
> > RCS file: /cvs/src/sys/compat/linux/linux_ipc.c,v
> > retrieving revision 1.11
> > diff -u -p -r1.11 linux_ipc.c
> > --- linux_ipc.c 5 Sep 2009 10:28:43 -   1.11
> > +++ linux_ipc.c 19 Sep 2011 22:37:33 -
> > @@ -719,3 +719,21 @@ linux_shmctl(p, v, retval)
> > }
> >  }
> >  #endif /* SYSVSHM */
> > +
> > +int
> > +linux_sys_pipe2(struct proc *p, void *v, register_t *retval)
> > +{
> > +   struct linux_sys_pipe2_args *uap = v;
> > +   struct sys_pipe_args pargs;
> > +
> > +   /*
> > +* We don't really support pipe2, but glibc falls back to pipe
> > +* we return signal that.
> > +* /
> > +   if (SCARG(uap, flags) != 0)
> > +   return ENOSYS;
> 
> Don't unimplemented system calls return ENOSYS already?  Then the
> comment makes no sense.  Because if glibc falls back on pipe if pipe2
> fails, you don't need this code at all.

The comment is wrong.
Glibc invokes the pipe2 syscall when the pipe() function is called.
Linux does still have the regular pipe() system call, it's a wrapper
around pipe2 (ofcourse that doesn't help us if glibc doesn't use it).

> > +
> > +   /* If no flag is set then the this is a plain pipe call. */
> > +   SCARG(&pargs, fdp) = SCARG(uap, fdp);
> > +   return sys_pipe(p, &pargs, retval);
> > +}
> 

The comment should change, but I'm fine with the code.
-- 
Ariane



Re: wscanf

2011-09-20 Thread Stefan Sperling
On Tue, Sep 20, 2011 at 12:01:18PM +0200, Stefan Sperling wrote:
> wscanf based on our scanf implementation. The delta from narrow
> to wide character support was obtained from FreeBSD and modified
> to fit our code.
> 
> Does not include a libc bump yet!

Here are corresponding libstdc++ changes, also without bumps.

The gcc3 version will have to be revisited once we also get wcsftime.
But for now it should work like this (the configure script doesn't define
_GLIBCPP_USE_WCHAR_T unless it finds all wchar functions it wants).

Not sure if the c_compatibility change is really needed.
We didn't update it for wprintf (by accident?)

As with wprintf, no actual changes for gcc2 -- we'll just bump the lib
for safety.

Can someone run this (together with the libc wscanf diff) through a build
on gcc2 and gcc3 architectures?

Index: gcc/libstdc++-v3/include/c_compatibility/wchar.h
===
RCS file: /cvs/src/gnu/gcc/libstdc++-v3/include/c_compatibility/wchar.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 wchar.h
--- gcc/libstdc++-v3/include/c_compatibility/wchar.h15 Oct 2009 17:11:32 
-  1.1.1.1
+++ gcc/libstdc++-v3/include/c_compatibility/wchar.h20 Sep 2011 14:36:35 
-
@@ -45,32 +45,24 @@ using std::fgetws;
 using std::fputwc;
 using std::fputws;
 using std::fwide;
-#if !defined(__OpenBSD__)
 using std::fwprintf;
 using std::fwscanf;
 using std::swprintf;
 using std::swscanf;
 using std::vfwprintf;
-#endif
 #if _GLIBCXX_HAVE_VFWSCANF
 using std::vfwscanf;
 #endif
-#if !defined(__OpenBSD__)
 using std::vswprintf;
-#endif
 #if _GLIBCXX_HAVE_VSWSCANF
 using std::vswscanf;
 #endif
-#if !defined(__OpenBSD__)
 using std::vwprintf;
-#endif
 #if _GLIBCXX_HAVE_VWSCANF
 using std::vwscanf;
 #endif
-#if !defined(__OpenBSD__)
 using std::wprintf;
 using std::wscanf;
-#endif
 using std::getwc;
 using std::getwchar;
 using std::mbsinit;
Index: gcc/libstdc++-v3/include/c_std/std_cwchar.h
===
RCS file: /cvs/src/gnu/gcc/libstdc++-v3/include/c_std/std_cwchar.h,v
retrieving revision 1.4
diff -u -p -r1.4 std_cwchar.h
--- gcc/libstdc++-v3/include/c_std/std_cwchar.h 28 Apr 2011 17:39:59 -  
1.4
+++ gcc/libstdc++-v3/include/c_std/std_cwchar.h 20 Sep 2011 13:54:40 -
@@ -152,9 +152,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   using ::fputws;
   using ::fwide;
   using ::fwprintf;
-#if !defined(__OpenBSD__)
   using ::fwscanf;
-#endif
   using ::getwc;
   using ::getwchar;
   using ::mbrlen;
@@ -164,9 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   using ::putwc;
   using ::putwchar;
   using ::swprintf;
-#if !defined(__OpenBSD__)
   using ::swscanf;
-#endif
   using ::ungetwc;
   using ::vfwprintf;
 #if _GLIBCXX_HAVE_VFWSCANF
@@ -209,9 +205,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
   using ::wmemmove;
   using ::wmemset;
   using ::wprintf;
-#if !defined(__OpenBSD__)
   using ::wscanf;
-#endif
 
   using ::wcschr;
 
Index: lib/libstdc++/libstdc++/include/c_std/std_cwchar.h
===
RCS file: /cvs/src/gnu/lib/libstdc++/libstdc++/include/c_std/std_cwchar.h,v
retrieving revision 1.4
diff -u -p -r1.4 std_cwchar.h
--- lib/libstdc++/libstdc++/include/c_std/std_cwchar.h  28 Apr 2011 17:41:37 
-  1.4
+++ lib/libstdc++/libstdc++/include/c_std/std_cwchar.h  20 Sep 2011 14:30:48 
-
@@ -141,18 +141,18 @@ namespace std
   using ::fputws;
   using ::fwide;
 #if defined(_GLIBCPP_USE_WCHAR_T)
+  using ::wcsftime;
+#endif
   using ::fwscanf;
   using ::swscanf;
   using ::vfwscanf;
   using ::vswscanf;
   using ::vwscanf;
-  using ::wcsftime;
   using ::wcstod;
   using ::wcstof;
   using ::wcstol;
   using ::wcstoul;
   using ::wscanf;
-#endif
   using ::fwprintf;
   using ::swprintf;
   using ::vfwprintf;
Index: lib/libstdc++-v3/config.h
===
RCS file: /cvs/src/gnu/lib/libstdc++-v3/config.h,v
retrieving revision 1.2
diff -u -p -r1.2 config.h
--- lib/libstdc++-v3/config.h   9 May 2010 09:46:26 -   1.2
+++ lib/libstdc++-v3/config.h   20 Sep 2011 14:14:33 -
@@ -382,13 +382,13 @@
 #define HAVE_UNISTD_H 1
 
 /* Defined if vfwscanf exists. */
-/* #undef HAVE_VFWSCANF */
+#define HAVE_VFWSCANF 1
 
 /* Defined if vswscanf exists. */
-/* #undef HAVE_VSWSCANF */
+#define HAVE_VSWSCANF 1
 
 /* Defined if vwscanf exists. */
-/* #undef HAVE_VWSCANF */
+#define HAVE_VWSCANF 1
 
 /* Define to 1 if you have the  header file. */
 #define HAVE_WCHAR_H 1



Re: etc/rc.d/ldapd stop - pexp - ldapd: ldap server

2011-09-20 Thread Gleydson Soares
On Tue, Sep 20, 2011 at 04:33:10PM +0200, MERIGHI Marcus wrote:
> anyone?

it is in,
already committed.

> 
> mcmer-open...@tor.at (MERIGHI Marcus), 2011.09.09 (Fri) 16:22 (CEST):
> > Hello, 
> > 
> > the stock 
> > $ /etc/rc.d/ldapd stop 
> > does not work for me. The diff below makes it work.
> > 
> > Index: ldapd
> > ===
> > RCS file: /cvs/src/etc/rc.d/ldapd,v
> > retrieving revision 1.1
> > diff -u -r1.1 ldapd
> > --- ldapd   6 Jul 2011 18:55:36 -   1.1
> > +++ ldapd   9 Sep 2011 14:14:15 -
> > @@ -6,4 +6,6 @@
> >  
> >  . /etc/rc.d/rc.subr
> >  
> > +pexp="ldapd: ldap server.*"
> > +
> >  rc_cmd $1



etc/rc.d/ldapd stop - pexp - ldapd: ldap server

2011-09-20 Thread MERIGHI Marcus
Hello, 

the stock 
$ /etc/rc.d/smtpd stop 
does not work for me. The diff below makes it work.

Index: src/etc/rc.d/smtpd
===
RCS file: /cvs/src/etc/rc.d/smtpd,v
retrieving revision 1.1
diff -u -r1.1 smtpd
--- src/etc/rc.d/smtpd  6 Jul 2011 18:55:36 -   1.1
+++ src/etc/rc.d/smtpd  20 Sep 2011 14:00:37 -
@@ -6,4 +6,6 @@
 
 . /etc/rc.d/rc.subr
 
+pexp="smtpd: smtp server"
+
 rc_cmd $1
Index: src/etc/rc.d/smtpd
===
RCS file: /cvs/src/etc/rc.d/smtpd,v
retrieving revision 1.1
diff -u -r1.1 smtpd
--- src/etc/rc.d/smtpd  6 Jul 2011 18:55:36 -   1.1
+++ src/etc/rc.d/smtpd  20 Sep 2011 14:00:37 -
@@ -6,4 +6,6 @@
 
 . /etc/rc.d/rc.subr
 
+pexp="smtpd: smtp server"
+
 rc_cmd $1



Re: etc/rc.d/ldapd stop - pexp - ldapd: ldap server

2011-09-20 Thread MERIGHI Marcus
anyone?

mcmer-open...@tor.at (MERIGHI Marcus), 2011.09.09 (Fri) 16:22 (CEST):
> Hello, 
> 
> the stock 
> $ /etc/rc.d/ldapd stop 
> does not work for me. The diff below makes it work.
> 
> Index: ldapd
> ===
> RCS file: /cvs/src/etc/rc.d/ldapd,v
> retrieving revision 1.1
> diff -u -r1.1 ldapd
> --- ldapd 6 Jul 2011 18:55:36 -   1.1
> +++ ldapd 9 Sep 2011 14:14:15 -
> @@ -6,4 +6,6 @@
>  
>  . /etc/rc.d/rc.subr
>  
> +pexp="ldapd: ldap server.*"
> +
>  rc_cmd $1



rdomain support for ntpd

2011-09-20 Thread Peter Hessler
To add rtable support for most daemons, we just run them multiple times.

with ntpd, that turns into hilarity as each daemon thinks it has
exclusive control over the clock.  watching the time skew when you have
3 or 4 is a fun thing for a rainy afternoon.

since it isn't raining today, I'm sending out the patch that adds the
necessary support.

This adds a new keyword to the "listen on", "server" and "servers"
keywords, "rtable %d".  If you do not specify an rtable, then it
defaults to the current rtable.  "listen on *" listens to all addresses
in the current rtable, but not for all rtables that exist.

OK?


Index: client.c
===
RCS file: /cvs/openbsd/src/usr.sbin/ntpd/client.c,v
retrieving revision 1.88
diff -u -p -r1.88 client.c
--- client.c24 Jun 2009 17:34:32 -  1.88
+++ client.c20 Sep 2011 10:44:43 -
@@ -134,12 +134,20 @@ client_query(struct ntp_peer *p)
if (p->state < STATE_DNS_DONE || p->addr == NULL)
return (-1);
 
+   if (p->addr->ss.ss_family != AF_INET && p->rtable != -1)
+   return (-1);
+
if (p->query->fd == -1) {
struct sockaddr *sa = (struct sockaddr *)&p->addr->ss;
 
if ((p->query->fd = socket(p->addr->ss.ss_family, SOCK_DGRAM,
0)) == -1)
fatal("client_query socket");
+
+   if (p->addr->ss.ss_family == AF_INET && p->rtable != -1 &&
+   setsockopt(p->query->fd, IPPROTO_IP, SO_RTABLE,
+   &p->rtable, sizeof(p->rtable)) == -1)
+   fatal("client_query setsockopt SO_RTABLE");
if (connect(p->query->fd, sa, SA_LEN(sa)) == -1) {
if (errno == ECONNREFUSED || errno == ENETUNREACH ||
errno == EHOSTUNREACH || errno == EADDRNOTAVAIL) {
@@ -243,6 +251,11 @@ client_dispatch(struct ntp_peer *p, u_in
return (0);
}
 
+   if (p->rtable != -1 &&
+   setsockopt(p->query->fd, IPPROTO_IP, SO_RTABLE, &p->rtable,
+   sizeof(p->rtable)) == -1)
+   fatal("client_dispatch setsockopt SO_RTABLE");
+
for (cmsg = CMSG_FIRSTHDR(&somsg); cmsg != NULL;
cmsg = CMSG_NXTHDR(&somsg, cmsg)) {
if (cmsg->cmsg_level == SOL_SOCKET &&
@@ -374,8 +387,10 @@ client_dispatch(struct ntp_peer *p, u_in
}
 
log_debug("reply from %s: offset %f delay %f, "
-   "next query %ds", log_sockaddr((struct sockaddr *)&p->addr->ss),
-   p->reply[p->shift].offset, p->reply[p->shift].delay, interval);
+   "next query %ds %s",
+   log_sockaddr((struct sockaddr *)&p->addr->ss),
+   p->reply[p->shift].offset, p->reply[p->shift].delay, interval,
+   print_rtable(p->rtable));
 
client_update(p);
if (settime)
Index: ntp.c
===
RCS file: /cvs/openbsd/src/usr.sbin/ntpd/ntp.c,v
retrieving revision 1.116
diff -u -p -r1.116 ntp.c
--- ntp.c   17 Jun 2011 18:12:05 -  1.116
+++ ntp.c   20 Sep 2011 10:31:20 -
@@ -245,8 +245,9 @@ ntp_main(int pipe_prnt[2], struct ntpd_c
if (p->deadline > 0 && p->deadline <= getmonotime()) {
timeout = 300;
log_debug("no reply from %s received in time, "
-   "next query %ds", log_sockaddr(
-   (struct sockaddr *)&p->addr->ss), timeout);
+   "next query %ds %s", log_sockaddr(
+   (struct sockaddr *)&p->addr->ss), timeout,
+   print_rtable(p->rtable));
if (p->trustlevel >= TRUSTLEVEL_BADPEER &&
(p->trustlevel /= 2) < TRUSTLEVEL_BADPEER)
log_info("peer %s now invalid",
@@ -482,6 +483,7 @@ ntp_dispatch_imsg_dns(void)
npeer->addr_head.name =
peer->addr_head.name;
npeer->addr_head.pool = 1;
+   npeer->rtable = peer->rtable;
client_peer_init(npeer);
npeer->state = STATE_DNS_DONE;
peer_add(npeer);
@@ -770,8 +772,9 @@ report_peers(int always)
(struct sockaddr *)&p->addr->ss);
if (p->addr_head.pool)
pool = "from pool ";
-   log_warnx("bad peer %s%s (%s)",  pool,
-   p->addr_head.name, a);
+   log_warnx("bad peer %s%s (%s) %s",
+  

wscanf

2011-09-20 Thread Stefan Sperling
wscanf based on our scanf implementation. The delta from narrow
to wide character support was obtained from FreeBSD and modified
to fit our code.

Does not include a libc bump yet!

Please also review the diff between vfscanf.c and vfwscanf.c after
applying this. Thanks.

Index: include/wchar.h
===
RCS file: /cvs/src/include/wchar.h,v
retrieving revision 1.19
diff -u -p -r1.19 wchar.h
--- include/wchar.h 4 Jul 2011 04:37:34 -   1.19
+++ include/wchar.h 20 Sep 2011 09:09:23 -
@@ -188,6 +188,13 @@ int vswprintf(wchar_t * __restrict, size
 int vwprintf(const wchar_t * __restrict, __va_list);
 int wprintf(const wchar_t * __restrict, ...);
 
+int fwscanf(FILE * __restrict, const wchar_t * __restrict, ...);
+int swscanf(const wchar_t * __restrict, const wchar_t * __restrict, ...);
+int vfwscanf(FILE * __restrict, const wchar_t * __restrict, __va_list);
+int vswscanf(const wchar_t * __restrict, const wchar_t * __restrict, 
__va_list);
+int vwscanf(const wchar_t * __restrict, __va_list);
+int wscanf(const wchar_t * __restrict, ...);
+
 #define getwc(f) fgetwc(f)
 #define getwchar() getwc(stdin)
 #define putwc(wc, f) fputwc((wc), (f))
Index: lib/libc/stdio/Makefile.inc
===
RCS file: /cvs/src/lib/libc/stdio/Makefile.inc,v
retrieving revision 1.18
diff -u -p -r1.18 Makefile.inc
--- lib/libc/stdio/Makefile.inc 6 Jul 2011 19:53:52 -   1.18
+++ lib/libc/stdio/Makefile.inc 20 Sep 2011 08:51:24 -
@@ -17,12 +17,13 @@ SRCS+=  asprintf.c clrerr.c fclose.c fdop
wbuf.c wsetup.c flockfile.c __svfscanf.c \
fgetwc.c fgetws.c fputwc.c fputws.c fwide.c getwc.c getwchar.c \
putwc.c putwchar.c ungetwc.c \
-   fwprintf.c swprintf.c vfwprintf.c vswprintf.c vwprintf.c wprintf.c
+   fwprintf.c swprintf.c vfwprintf.c vswprintf.c vwprintf.c wprintf.c \
+   fwscanf.c swscanf.c vfwscanf.c vswscanf.c vwscanf.c wscanf.c
 
 MAN+=  fclose.3 ferror.3 fflush.3 fgetln.3 fgets.3 fopen.3 fputs.3 \
fread.3 fseek.3 funopen.3 getc.3 mktemp.3 perror.3 printf.3 putc.3 \
remove.3 scanf.3 setbuf.3 stdio.3 tmpnam.3 ungetc.3 \
-   fgetws.3 fputws.3 fwide.3 getwc.3 putwc.3 ungetwc.3 wprintf.3
+   fgetws.3 fputws.3 fwide.3 getwc.3 putwc.3 ungetwc.3 wprintf.3 wscanf.3
 
 MLINKS+=ferror.3 clearerr.3 ferror.3 feof.3 ferror.3 fileno.3
 MLINKS+=fflush.3 fpurge.3
@@ -47,6 +48,8 @@ MLINKS+=setbuf.3 setbuffer.3 setbuf.3 se
 MLINKS+=tmpnam.3 tempnam.3 tmpnam.3 tmpfile.3
 MLINKS+=wprintf.3 fwprintf.3 wprintf.3 swprintf.3 wprintf.3 vwprintf.3 \
wprintf.3 vfwprintf.3 wprintf.3 vswprintf.3
+MLINKS+=wscanf.3 fwscanf.3 wscanf.3 swscanf.3 wscanf.3 vfwscanf.3 wscanf.3 \
+   vswscanf.3 wscanf.3 vwscanf.3
 
 MLINKS+=getwc.3 fgetwc.3 getwc.3 getwchar.3
 MLINKS+=putwc.3 fputwc.3 putwc.3 putwchar.3
Index: lib/libc/stdio/fwscanf.c
===
RCS file: lib/libc/stdio/fwscanf.c
diff -N lib/libc/stdio/fwscanf.c
--- /dev/null   1 Jan 1970 00:00:00 -
+++ lib/libc/stdio/fwscanf.c20 Sep 2011 08:30:30 -
@@ -0,0 +1,45 @@
+/* $OpenBSD$ */
+
+/*-
+ * Copyright (c) 2002 Tim J. Robbins
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+int
+fwscanf(FILE * __restrict fp, const wchar_t * __restrict fmt, ...)
+{
+   va_list ap;
+   int r;
+
+   va_start(ap, fmt);
+   r = vfwscanf(fp, fmt, ap);
+   va_end(ap);
+
+   return (r);
+}
Index: lib/libc/stdio/local.h
===
RCS file: /cvs/src/lib/libc/stdio/local.h

Re: compat linux pipe2() circus

2011-09-20 Thread Mark Kettenis
> Date: Tue, 20 Sep 2011 01:41:35 +0300
> From: Paul Irofti 
> 
> Linux keeps surprising me everytime!
> 
> This time its their pipe2 system call which adds flags to the pipe call.
> Its the unix-ish way apparently to turn pipes into files on a kernel
> filesystem, or so they claim.
> 
> Anywho, this fixes glibc pipe2 system calls by wrapping against the
> regular pipe systemcall if no flags are set and by signaling we don't
> support that if they are.
> 
> Okay?
> 
> 
> Index: linux_ipc.c
> ===
> RCS file: /cvs/src/sys/compat/linux/linux_ipc.c,v
> retrieving revision 1.11
> diff -u -p -r1.11 linux_ipc.c
> --- linux_ipc.c   5 Sep 2009 10:28:43 -   1.11
> +++ linux_ipc.c   19 Sep 2011 22:37:33 -
> @@ -719,3 +719,21 @@ linux_shmctl(p, v, retval)
>   }
>  }
>  #endif /* SYSVSHM */
> +
> +int
> +linux_sys_pipe2(struct proc *p, void *v, register_t *retval)
> +{
> + struct linux_sys_pipe2_args *uap = v;
> + struct sys_pipe_args pargs;
> +
> + /*
> +  * We don't really support pipe2, but glibc falls back to pipe
> +  * we return signal that.
> +  * /
> + if (SCARG(uap, flags) != 0)
> + return ENOSYS;

Don't unimplemented system calls return ENOSYS already?  Then the
comment makes no sense.  Because if glibc falls back on pipe if pipe2
fails, you don't need this code at all.

> +
> + /* If no flag is set then the this is a plain pipe call. */
> + SCARG(&pargs, fdp) = SCARG(uap, fdp);
> + return sys_pipe(p, &pargs, retval);
> +}