PERFORCE change 122592 for review

Alfred Perlstein alfred at freebsd.org
Mon Jul 9 20:48:37 UTC 2007


* Alfred Perlstein <alfred at freebsd.org> [070709 12:39] wrote:
> Peter, why not have libc obtain this at startup and cache it?
> 
> Otherwise these syscalls will incur an additional sysctl per
> call, right?

duh, saw your later changes... I'm assuming those pretty much
address that concern.

thanks,
-Alfred

> 
> -Alfred
> 
> * Peter Wemm <peter at FreeBSD.org> [070630 15:26] wrote:
> > http://perforce.freebsd.org/chv.cgi?CH=122592
> > 
> > Change 122592 by peter at peter_overcee on 2007/06/30 22:25:38
> > 
> > 	Use getosreldate() to test for __new_* syscalls.
> > 
> > Affected files ...
> > 
> > .. //depot/projects/hammer/lib/libc/sys/ftruncate.c#3 edit
> > .. //depot/projects/hammer/lib/libc/sys/lseek.c#3 edit
> > .. //depot/projects/hammer/lib/libc/sys/mmap.c#4 edit
> > .. //depot/projects/hammer/lib/libc/sys/pread.c#3 edit
> > .. //depot/projects/hammer/lib/libc/sys/pwrite.c#3 edit
> > .. //depot/projects/hammer/lib/libc/sys/truncate.c#3 edit
> > 
> > Differences ...
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/ftruncate.c#3 (text+ko) ====
> > 
> > @@ -36,6 +36,7 @@
> >  #include <sys/types.h>
> >  #include <sys/syscall.h>
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -47,5 +48,8 @@
> >  	off_t	length;
> >  {
> >  
> > -	return(__syscall((quad_t)SYS_ftruncate, fd, 0, length));
> > +	if (getosreldate() >= 700049)
> > +		return(__new_ftruncate(fd, length));
> > +	else
> > +		return(__syscall((quad_t)SYS_ftruncate, fd, 0, length));
> >  }
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/lseek.c#3 (text+ko) ====
> > 
> > @@ -36,6 +36,7 @@
> >  #include <sys/types.h>
> >  #include <sys/syscall.h>
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -47,5 +48,9 @@
> >  	off_t	offset;
> >  	int	whence;
> >  {
> > -	return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence));
> > +
> > +	if (getosreldate() >= 700049)
> > +		return(__new_lseek(fd, offset, whence));
> > +	else
> > +		return(__syscall((quad_t)SYS_lseek, fd, 0, offset, whence));
> >  }
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/mmap.c#4 (text+ko) ====
> > 
> > @@ -37,6 +37,7 @@
> >  #include <sys/mman.h>
> >  #include <sys/syscall.h>
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -52,6 +53,10 @@
> >  	off_t	offset;
> >  {
> >  
> > -	return ((void *)(intptr_t)__syscall((quad_t)SYS_mmap, addr, len, prot,
> > -	    flags, fd, 0, offset));
> > +	if (getosreldate() >= 700049)
> > +		return (__new_mmap(addr, len, prot, flags, fd, offset));
> > +	else
> > +
> > +		return ((void *)(intptr_t)__syscall((quad_t)SYS_mmap, addr, len, prot,
> > +		    flags, fd, 0, offset));
> >  }
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/pread.c#3 (text+ko) ====
> > 
> > @@ -36,6 +36,7 @@
> >  #include <sys/types.h>
> >  #include <sys/syscall.h>
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -48,5 +49,9 @@
> >  	size_t	nbyte;
> >  	off_t	offset;
> >  {
> > -	return ((ssize_t)__syscall((quad_t)SYS_pread, fd, buf, nbyte, 0, offset));
> > +
> > +	if (getosreldate() >= 700049)
> > +		return (__new_pread(fd, buf, nbyte, offset));
> > +	else
> > +		return ((ssize_t)__syscall((quad_t)SYS_pread, fd, buf, nbyte, 0, offset));
> >  }
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/pwrite.c#3 (text+ko) ====
> > 
> > @@ -36,6 +36,7 @@
> >  #include <sys/types.h>
> >  #include <sys/syscall.h>
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -48,5 +49,8 @@
> >  	size_t	nbyte;
> >  	off_t	offset;
> >  {
> > -	return ((ssize_t)__syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset));
> > +	if (getosreldate() >= 700049)
> > +		return (__new_pwrite(fd, buf, nbyte, offset));
> > +	else
> > +		return ((ssize_t)__syscall((quad_t)SYS_pwrite, fd, buf, nbyte, 0, offset));
> >  }
> > 
> > ==== //depot/projects/hammer/lib/libc/sys/truncate.c#3 (text+ko) ====
> > 
> > @@ -35,8 +35,8 @@
> >  
> >  #include <sys/types.h>
> >  #include <sys/syscall.h>
> > -
> >  #include <unistd.h>
> > +#include <osreldate.h>
> >  
> >  /*
> >   * This function provides 64-bit offset padding that
> > @@ -48,5 +48,8 @@
> >  	off_t	length;
> >  {
> >  
> > -	return(__syscall((quad_t)SYS_truncate, path, 0, length));
> > +	if (getosreldate() >= 700049)
> > +		return(__new_truncate(path, length));
> > +	else
> > +		return(__syscall((quad_t)SYS_truncate, path, 0, length));
> >  }
> 
> -- 
> - Alfred Perlstein

-- 
- Alfred Perlstein


More information about the p4-projects mailing list