requests for perl XS code

2010-10-16 Thread Marc Espie
I could use bundled code to do the following:
1/ direct interface to mkstemp
so that we don't have to use the atrocious File::Temp big monstrosity.
2/ file descriptor passing over sockets
means redoing the stuff described in socket/recv/CMSG_DATA
so that we could have a simple interface to grab stuff in perl.

looking for prior art/someone with the time to do it as XS...

2/ would be useful for libtool: on slow machines, libtool startup time is
large, so it would be beneficial to start a libtool server at start of
build, and communicate with it using a (very small) c client.
Passing stdout/stderr/cwd to the server over the socket seems like the most
straightforward way to do stuff, especially since we wouldn't have to deal
with any kind of non-transparent buffering then...



Re: getmntinfo(3) sanity

2010-10-16 Thread Vladimir Kirillov
Hi, Ingo!

On 02:06 Fri 15 Oct, Ingo Schwarze wrote:
  so here's a diff to actually do pass a singly-malloced buffer
  to the caller who should free it manually.
 
 No, wait, you can't change the calling convention of an existing
 library function just like that.  That would turn all application
 code which is now correct into a horrible bunch of memory leaks,
 and all application code written for the new convention would
 result in double frees when linked against old libraries.

Right.

  It is good to subsequently replace all static stuff in libc, right?
 
 Not quite.
 Instead, some people double the number of libc functions by
 adding thread-safe versions, like in ctime() - ctime() and ctime_r(),
 and that is ugly enough.
 I'm pretty sure you must not change how existing functions work.
 
My primary goal of this is having a thread libc and a set of functions
in it to be safely used by daemons (getmntinfo(3) is used at least by
amd, mountd and snmpd) with controlled memory usage.

I've seen internal libc mutexes to protect usage of shared data in some
places, however they are likely to be stubs, right?

So, functions like getmntinfo() should be either internally protected or
provided a second *_r implementation.

Which method is the most preferred by the project?



Re: update pms driver

2010-10-16 Thread Alexandr Shadchin
On Sat, Oct 16, 2010 at 07:26:19AM -0400, Kenneth R Westerback wrote:
 
 Committed! Next? :-)
 
  Ken

ansify function definitions, no functional change.

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.9
diff -u -p -r1.9 pms.c
--- pms.c   16 Oct 2010 11:24:04 -  1.9
+++ pms.c   16 Oct 2010 12:30:19 -
@@ -119,10 +119,7 @@ pms_setintellimode(struct pms_softc *sc)
 }
 
 int
-pmsprobe(parent, match, aux)
-   struct device *parent;
-   void *match;
-   void *aux;
+pmsprobe(struct device *parent, void *match, void *aux;)
 {
struct pckbc_attach_args *pa = aux;
u_char cmd[1], resp[2];
@@ -160,9 +157,7 @@ pmsprobe(parent, match, aux)
 }
 
 void
-pmsattach(parent, self, aux)
-   struct device *parent, *self;
-   void *aux;
+pmsattach(struct device *parent, struct device *self, void *aux)
 {
struct pms_softc *sc = (void *)self;
struct pckbc_attach_args *pa = aux;
@@ -282,8 +277,7 @@ pms_change_state(struct pms_softc *sc, i
 }
 
 int
-pms_enable(v)
-   void *v;
+pms_enable(void *v)
 {
struct pms_softc *sc = v;
 
@@ -291,8 +285,7 @@ pms_enable(v)
 }
 
 void
-pms_disable(v)
-   void *v;
+pms_disable(void *v)
 {
struct pms_softc *sc = v;
 
@@ -300,12 +293,7 @@ pms_disable(v)
 }
 
 int
-pms_ioctl(v, cmd, data, flag, p)
-   void *v;
-   u_long cmd;
-   caddr_t data;
-   int flag;
-   struct proc *p;
+pms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
struct pms_softc *sc = v;
u_char kbcmd[2];
@@ -344,9 +332,7 @@ pms_ioctl(v, cmd, data, flag, p)
 #define PS2RBUTMASK 0x02
 #define PS2MBUTMASK 0x04
 
-void pmsinput(vsc, data)
-void *vsc;
-int data;
+void pmsinput(void *vsc, int data)
 {
struct pms_softc *sc = vsc;
signed char dz = 0;



Re: update pms driver

2010-10-16 Thread Nicholas Marriott
pmsinput could have a newline after the return type like the rest,
otherwise looks good for me.


On Sat, Oct 16, 2010 at 06:36:41PM +0600, Alexandr Shadchin wrote:
 On Sat, Oct 16, 2010 at 07:26:19AM -0400, Kenneth R Westerback wrote:
  
  Committed! Next? :-)
  
   Ken
 
 ansify function definitions, no functional change.
 
 -- 
 Alexandr Shadchin
 
 Index: pms.c
 ===
 RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
 retrieving revision 1.9
 diff -u -p -r1.9 pms.c
 --- pms.c 16 Oct 2010 11:24:04 -  1.9
 +++ pms.c 16 Oct 2010 12:30:19 -
 @@ -119,10 +119,7 @@ pms_setintellimode(struct pms_softc *sc)
  }
  
  int
 -pmsprobe(parent, match, aux)
 - struct device *parent;
 - void *match;
 - void *aux;
 +pmsprobe(struct device *parent, void *match, void *aux;)
  {
   struct pckbc_attach_args *pa = aux;
   u_char cmd[1], resp[2];
 @@ -160,9 +157,7 @@ pmsprobe(parent, match, aux)
  }
  
  void
 -pmsattach(parent, self, aux)
 - struct device *parent, *self;
 - void *aux;
 +pmsattach(struct device *parent, struct device *self, void *aux)
  {
   struct pms_softc *sc = (void *)self;
   struct pckbc_attach_args *pa = aux;
 @@ -282,8 +277,7 @@ pms_change_state(struct pms_softc *sc, i
  }
  
  int
 -pms_enable(v)
 - void *v;
 +pms_enable(void *v)
  {
   struct pms_softc *sc = v;
  
 @@ -291,8 +285,7 @@ pms_enable(v)
  }
  
  void
 -pms_disable(v)
 - void *v;
 +pms_disable(void *v)
  {
   struct pms_softc *sc = v;
  
 @@ -300,12 +293,7 @@ pms_disable(v)
  }
  
  int
 -pms_ioctl(v, cmd, data, flag, p)
 - void *v;
 - u_long cmd;
 - caddr_t data;
 - int flag;
 - struct proc *p;
 +pms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
  {
   struct pms_softc *sc = v;
   u_char kbcmd[2];
 @@ -344,9 +332,7 @@ pms_ioctl(v, cmd, data, flag, p)
  #define PS2RBUTMASK 0x02
  #define PS2MBUTMASK 0x04
  
 -void pmsinput(vsc, data)
 -void *vsc;
 -int data;
 +void pmsinput(void *vsc, int data)
  {
   struct pms_softc *sc = vsc;
   signed char dz = 0;



getfsstat(2) manual sync

2010-10-16 Thread Vladimir Kirillov
Hello, t...@!

The manual of getfsstat(2) contains the 4.3 struct statfs layout.

Index: getfsstat.2
===
RCS file: /cvs/src/lib/libc/sys/getfsstat.2,v
retrieving revision 1.17
diff -u -p -r1.17 getfsstat.2
--- getfsstat.2 5 Jun 2009 23:31:34 -   1.17
+++ getfsstat.2 16 Oct 2010 14:42:58 -
@@ -55,24 +55,34 @@ typedef struct { int32_t val[2]; } fsid_
 #define MNAMELEN 90/* length of buffer for returned name */
 
 struct statfs {
-u_int32_t  f_flags;   /* copy of mount flags */
-int32_tf_bsize;   /* fundamental file system block size */
-u_int32_t  f_iosize;  /* optimal transfer block size */
-u_int32_t  f_blocks;  /* total data blocks in file system */
-u_int32_t  f_bfree;   /* free blocks in fs */
-int32_tf_bavail;  /* free blocks avail to non-superuser */
-u_int32_t  f_files;   /* total file nodes in file system */
-u_int32_t  f_ffree;   /* free file nodes in fs */
-fsid_t f_fsid;/* file system id */
-uid_t  f_owner;   /* user that mounted the file system */
-u_int32_t  f_syncwrites;  /* count of sync writes since mount */
-u_int32_t  f_asyncwrites; /* count of async writes since mount */
-u_int32_t  f_ctime;   /* last mount [-u] time */
-u_int32_t  f_spare[3];/* spare for later */
-char   f_fstypename[MFSNAMELEN]; /* fs type name */
-char   f_mntonname[MNAMELEN];/* directory on which mounted */
-char   f_mntfromname[MNAMELEN];  /* mounted file system */
-union mount_info mount_info; /* per-filesystem mount options */
+u_int32_tf_flags;/* copy of mount flags */
+u_int32_tf_bsize;/* file system block size */
+u_int32_tf_iosize;   /* optimal transfer block size */
+
+ /* unit is f_bsize */
+u_int64_tf_blocks;   /* total data blocks in file system */
+u_int64_tf_bfree;/* free blocks in fs */
+int64_t  f_bavail;   /* free blocks avail to non-superuser */
+
+u_int64_tf_files;/* total file nodes in file system */
+u_int64_tf_ffree;/* free file nodes in fs */
+int64_t  f_favail;   /* free file nodes avail to non-root */
+
+u_int64_tf_syncwrites;  /* count of sync writes since mount */
+u_int64_tf_syncreads;   /* count of sync reads since mount */
+u_int64_tf_asyncwrites; /* count of async writes since mount */
+u_int64_tf_asyncreads;  /* count of async reads since mount */
+
+fsid_t   f_fsid; /* file system id */
+u_int32_tf_namemax;  /* maximum filename length */
+uid_tf_owner;/* user that mounted the file system */
+u_int32_tf_ctime;/* last mount [-u] time */
+u_int32_tf_spare[3]; /* spare for later */
+
+char f_fstypename[MFSNAMELEN]; /* fs type name */
+char f_mntonname[MNAMELEN];/* directory on which mounted */
+char f_mntfromname[MNAMELEN];  /* mounted file system */
+union mount_info mount_info;   /* per-filesystem mount options */
 };
 .Ed
 .Pp



Re: update pms driver

2010-10-16 Thread Alexandr Shadchin
On Sat, Oct 16, 2010 at 03:42:10PM +0100, Nicholas Marriott wrote:
 pmsinput could have a newline after the return type like the rest,
 otherwise looks good for me.
 

I agree, did not notice :)
Fixed

-- 
Alexandr Shadchin

Index: pms.c
===
RCS file: /cvs/src/sys/dev/pckbc/pms.c,v
retrieving revision 1.9
diff -u -p -r1.9 pms.c
--- pms.c   16 Oct 2010 11:24:04 -  1.9
+++ pms.c   16 Oct 2010 14:56:42 -
@@ -119,10 +119,7 @@ pms_setintellimode(struct pms_softc *sc)
 }
 
 int
-pmsprobe(parent, match, aux)
-   struct device *parent;
-   void *match;
-   void *aux;
+pmsprobe(struct device *parent, void *match, void *aux;)
 {
struct pckbc_attach_args *pa = aux;
u_char cmd[1], resp[2];
@@ -160,9 +157,7 @@ pmsprobe(parent, match, aux)
 }
 
 void
-pmsattach(parent, self, aux)
-   struct device *parent, *self;
-   void *aux;
+pmsattach(struct device *parent, struct device *self, void *aux)
 {
struct pms_softc *sc = (void *)self;
struct pckbc_attach_args *pa = aux;
@@ -282,8 +277,7 @@ pms_change_state(struct pms_softc *sc, i
 }
 
 int
-pms_enable(v)
-   void *v;
+pms_enable(void *v)
 {
struct pms_softc *sc = v;
 
@@ -291,8 +285,7 @@ pms_enable(v)
 }
 
 void
-pms_disable(v)
-   void *v;
+pms_disable(void *v)
 {
struct pms_softc *sc = v;
 
@@ -300,12 +293,7 @@ pms_disable(v)
 }
 
 int
-pms_ioctl(v, cmd, data, flag, p)
-   void *v;
-   u_long cmd;
-   caddr_t data;
-   int flag;
-   struct proc *p;
+pms_ioctl(void *v, u_long cmd, caddr_t data, int flag, struct proc *p)
 {
struct pms_softc *sc = v;
u_char kbcmd[2];
@@ -344,9 +332,8 @@ pms_ioctl(v, cmd, data, flag, p)
 #define PS2RBUTMASK 0x02
 #define PS2MBUTMASK 0x04
 
-void pmsinput(vsc, data)
-void *vsc;
-int data;
+void
+pmsinput(void *vsc, int data)
 {
struct pms_softc *sc = vsc;
signed char dz = 0;



I need your help...

2010-10-16 Thread H. Abery

Beloved,

My present condition is very unfortunate. I have been trying to contact you
about a huge donation to be made through you. Please reply for more
information.

Remain Blessed
Mrs Abery



Re: no need to link libdes for kerberos

2010-10-16 Thread Jonathan Gray
On Tue, Oct 12, 2010 at 10:40:19AM +0200, Landry Breuil wrote:
 On Tue, Oct 12, 2010 at 06:04:09AM +1100, Jonathan Gray wrote:
  The kerberosV code switched to using the version of DES
  in libcrypto when biorn imported heimdal 0.7.2 over four
  years ago, the following diff removes the uneeded linking
  to libdes.
  
  As the code in OpenSSL/libcrypto is based on the code
  in libdes it would be nice if we could move the following
  over to libcrypto and remove libdes at some point:
  
  libexec/login_tis
  libexec/login_token
  sbin/isakmpd
  usr.bin/passwd
  usr.bin/sectok
  usr.bin/telnet
  usr.bin/x99token/
  usr.sbin/ppp/ppp
  usr.sbin/tokenadm
  usr.sbin/tokeninit
  
  Builds work fine with the below but I'm not using kerberos/afs etc
  so test reports welcome.
 
 This might have effects (at least WANTLIB changes, to be handled) on
 the following ports:
 
 sqlite select fullpkgpath from wantlib where value like 'des';
 mail/alpine,-main
 mail/imap-uw,-server
 mail/imap-uw,-mailutil
 mail/mutt/stable
 mail/mutt/stable,compressed
 mail/mutt/snapshot
 mail/mutt/snapshot,sasl
 mail/mutt/snapshot,sidebar,compressed
 mail/mutt/snapshot,sasl,sidebar,compressed
 mail/mutt/snapshot,sasl,sidebar,slang,compressed
 security/dsniff
 security/dsniff,no_x11
 security/l0phtcrack
 x11/nx/nxssh

So nothing in src uses libdes now and diffs for all of the above ports
have been sent out to the relevant parties.  I am aware of nothing
else preventing libdes from being removed now.



Re: getfsstat(2) manual sync

2010-10-16 Thread Jason McIntyre
On Sat, Oct 16, 2010 at 05:44:24PM +0300, Vladimir Kirillov wrote:
 Hello, t...@!
 
 The manual of getfsstat(2) contains the 4.3 struct statfs layout.
 

fixed, thanks.
jmc

 Index: getfsstat.2
 ===
 RCS file: /cvs/src/lib/libc/sys/getfsstat.2,v
 retrieving revision 1.17
 diff -u -p -r1.17 getfsstat.2
 --- getfsstat.2   5 Jun 2009 23:31:34 -   1.17
 +++ getfsstat.2   16 Oct 2010 14:42:58 -
 @@ -55,24 +55,34 @@ typedef struct { int32_t val[2]; } fsid_
  #define MNAMELEN 90  /* length of buffer for returned name */
  
  struct statfs {
 -u_int32_t  f_flags;   /* copy of mount flags */
 -int32_tf_bsize;   /* fundamental file system block size */
 -u_int32_t  f_iosize;  /* optimal transfer block size */
 -u_int32_t  f_blocks;  /* total data blocks in file system */
 -u_int32_t  f_bfree;   /* free blocks in fs */
 -int32_tf_bavail;  /* free blocks avail to non-superuser */
 -u_int32_t  f_files;   /* total file nodes in file system */
 -u_int32_t  f_ffree;   /* free file nodes in fs */
 -fsid_t f_fsid;/* file system id */
 -uid_t  f_owner;   /* user that mounted the file system */
 -u_int32_t  f_syncwrites;  /* count of sync writes since mount */
 -u_int32_t  f_asyncwrites; /* count of async writes since mount */
 -u_int32_t  f_ctime;   /* last mount [-u] time */
 -u_int32_t  f_spare[3];/* spare for later */
 -char   f_fstypename[MFSNAMELEN]; /* fs type name */
 -char   f_mntonname[MNAMELEN];/* directory on which mounted */
 -char   f_mntfromname[MNAMELEN];  /* mounted file system */
 -union mount_info mount_info; /* per-filesystem mount options */
 +u_int32_tf_flags;/* copy of mount flags */
 +u_int32_tf_bsize;/* file system block size */
 +u_int32_tf_iosize;   /* optimal transfer block size */
 +
 + /* unit is f_bsize */
 +u_int64_tf_blocks;   /* total data blocks in file system */
 +u_int64_tf_bfree;/* free blocks in fs */
 +int64_t  f_bavail;   /* free blocks avail to non-superuser */
 +
 +u_int64_tf_files;/* total file nodes in file system */
 +u_int64_tf_ffree;/* free file nodes in fs */
 +int64_t  f_favail;   /* free file nodes avail to non-root */
 +
 +u_int64_tf_syncwrites;  /* count of sync writes since mount */
 +u_int64_tf_syncreads;   /* count of sync reads since mount */
 +u_int64_tf_asyncwrites; /* count of async writes since mount */
 +u_int64_tf_asyncreads;  /* count of async reads since mount */
 +
 +fsid_t   f_fsid; /* file system id */
 +u_int32_tf_namemax;  /* maximum filename length */
 +uid_tf_owner;/* user that mounted the file system */
 +u_int32_tf_ctime;/* last mount [-u] time */
 +u_int32_tf_spare[3]; /* spare for later */
 +
 +char f_fstypename[MFSNAMELEN]; /* fs type name */
 +char f_mntonname[MNAMELEN];/* directory on which mounted */
 +char f_mntfromname[MNAMELEN];  /* mounted file system */
 +union mount_info mount_info;   /* per-filesystem mount options */
  };
  .Ed
  .Pp



Re: mandoc(1) grows tbl(1) support, and groff(1) moves to ports

2010-10-16 Thread Jason McIntyre
On Sat, Oct 16, 2010 at 06:34:25PM +0200, Ingo Schwarze wrote:
 
  (3) tomorrow: send patches to switch tbl | nroff
  over to mandoc in the base build system
  (4) tomorrow: send patches to unlink the last me(7) and ms(7)
  documents form the base build
 
 That's what this message is about, see below.
 
 I have already tested the relevant parts of the base build with it,
 and I'm starting a full base build (i386) with it right now.
 In case mobody else wants to do that, i will try a xenocara build
 after that.
 

i've run this through a build of base, amd64 machine, with MANPS set. no
problems building. the man pages look fine on the terminal, but tables
do not work at all for postscript pages - don;t know if you know that or
not.

note i do not have xenocara source, so did not build X.

i can;t see any other problems.

one question (not just for ingo) - what are we doing with the me/ms
pages? we have sufficiently removed enough of them that i think
it's just not worth keeping the rest. especially if we don;t
anticipate a means to view them in base (or do we?). perhaps we
could just distribute them as ascii text files?

jmc



Re: mandoc(1) grows tbl(1) support, and groff(1) moves to ports

2010-10-16 Thread Ingo Schwarze
Hi Jason,

Jason McIntyre wrote on Sat, Oct 16, 2010 at 07:23:47PM +0059:
 On Sat, Oct 16, 2010 at 06:34:25PM +0200, Ingo Schwarze wrote:

 (3) tomorrow: send patches to switch tbl | nroff
 over to mandoc in the base build system
 (4) tomorrow: send patches to unlink the last me(7) and ms(7)
 documents form the base build

 That's what this message is about, see below.
 
 I have already tested the relevant parts of the base build with it,
 and I'm starting a full base build (i386) with it right now.
 In case mobody else wants to do that, i will try a xenocara build
 after that.

 i've run this through a build of base, amd64 machine, with MANPS set.
 no problems building.  the man pages look fine on the terminal,

Thanks a lot for checking!

 but tables do not work at all for postscript pages -
 don;t know if you know that or not.

Frankly, i feared as much; but as MANPS is off by default and it
affects merely 16 pages, and it was rather unlikely to kill the build,
i didn't want to waste any time on that particular problem right now.
I think tbl -Tps can be fixed later.

 note i do not have xenocara source, so did not build X.
 
 i can;t see any other problems.
 
 one question (not just for ingo) -
 what are we doing with the me/ms pages?

The patch i just sent simply unlinks them from the build,
such that they no longer get installed.

 we have sufficiently removed enough of them that i think
 it's just not worth keeping the rest. especially if we don;t
 anticipate a means to view them in base (or do we?). perhaps we
 could just distribute them as ascii text files?

I do not hold strong opinions on these questions.

Yours,
  Ingo



Re: mandoc(1) grows tbl(1) support, and groff(1) moves to ports

2010-10-16 Thread Theo de Raadt
one question (not just for ingo) - what are we doing with the me/ms
pages? we have sufficiently removed enough of them that i think
it's just not worth keeping the rest. especially if we don;t
anticipate a means to view them in base (or do we?). perhaps we
could just distribute them as ascii text files?

I think the me/ms pages serve no purpose.

they are unmaintained relative to the code they apparently document
and as a result are dangerously full of lies.

i think we should unlink them.  older versions can be found in millions
of places on the net.

we are not tasked with being historians.



Re: requests for perl XS code

2010-10-16 Thread Philip Guenther
On 10/16/10, Marc Espie es...@nerim.net wrote:
 I could use bundled code to do the following:
 1/ direct interface to mkstemp
 so that we don't have to use the atrocious File::Temp big monstrosity.

I've sent Marc a tiny mkdtemp/mkstemp/mkstemps-via-XS module, so
unless he barfs all over it this one is done.


 2/ file descriptor passing over sockets
 means redoing the stuff described in socket/recv/CMSG_DATA
 so that we could have a simple interface to grab stuff in perl.

Marc, do you have an API in mind that someone working on this should aim for?


Philip Guenther



vfprintf.c: use ssize_t for ssizearg

2010-10-16 Thread Claus Assmann
Should the type of ssizearg be ssize_t?

Index: vfprintf.c
===
RCS file: cvs/src/lib/libc/stdio/vfprintf.c,v
retrieving revision 1.58
diff -u -r1.58 vfprintf.c
--- vfprintf.c  9 Nov 2009 00:18:27 -   1.58
+++ vfprintf.c  17 Oct 2010 01:34:24 -
@@ -62,7 +62,7 @@
unsigned long long  ulonglongarg;
ptrdiff_t   ptrdiffarg;
size_t  sizearg;
-   size_t  ssizearg;
+   ssize_t ssizearg;
intmax_tintmaxarg;
uintmax_t   uintmaxarg;
void*pvoidarg;