The branch, master has been updated via 3c9b32b replace: Avoid DEBUG(), which is not available in libreplace. via 49eca29 libreplace: Add usleep implementation. via c9fb336 use usleep rather than sys_usleep in various places, in anticipation of usleep moving to libreplace. from c0288e0 lib/util: Remove obsolete sys_getpid() and sys_fork().
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 3c9b32b5eb1220b8521f768bab8dc07a40de93f5 Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Mar 24 21:18:55 2012 +0100 replace: Avoid DEBUG(), which is not available in libreplace. Autobuild-User: Jelmer Vernooij <jel...@samba.org> Autobuild-Date: Sun Mar 25 00:13:59 CET 2012 on sn-devel-104 commit 49eca290d37ad7564a3be3332ee76020ddb5a03f Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Mar 24 21:17:56 2012 +0100 libreplace: Add usleep implementation. commit c9fb33697db1bdc1967a0cca557ad323ebe4ea22 Author: Jelmer Vernooij <jel...@samba.org> Date: Sat Mar 24 20:43:07 2012 +0100 use usleep rather than sys_usleep in various places, in anticipation of usleep moving to libreplace. ----------------------------------------------------------------------- Summary of changes: lib/replace/replace.c | 16 ++++++++++++- lib/replace/replace.h | 6 ++++ source3/include/proto.h | 1 - source3/lib/system.c | 34 --------------------------- source3/passdb/pdb_smbpasswd.c | 2 +- source3/rpc_server/spoolss/srv_spoolss_nt.c | 2 +- source3/utils/net_rpc_service.c | 2 +- source3/utils/status_profile.c | 2 +- 8 files changed, 25 insertions(+), 40 deletions(-) Changeset truncated at 500 lines: diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 03fae90..c076ba1 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -851,7 +851,7 @@ void *rep_memalign( size_t align, size_t size ) size_t pagesize = (size_t)-1; #endif if (pagesize == (size_t)-1) { - DEBUG(0,("memalign functionality not available on this platform!\n")); + errno = ENOSYS; return NULL; } if (size < pagesize) { @@ -890,3 +890,17 @@ int rep_getpeereid(int s, uid_t *uid, gid_t *gid) #endif } #endif + +#ifndef HAVE_USLEEP +int rep_usleep(useconds_t sec) +{ + struct timeval tval; + /* + * Fake it with select... + */ + tval.tv_sec = 0; + tval.tv_usec = usecs/1000; + select(0,NULL,NULL,NULL,&tval); + return 0; +} +#endif /* HAVE_USLEEP */ diff --git a/lib/replace/replace.h b/lib/replace/replace.h index f2b1952..776da8a 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -835,4 +835,10 @@ char *rep_getpass(const char *prompt); int rep_getpeereid(int s, uid_t *uid, gid_t *gid); #endif +#ifndef HAVE_USLEEP +#define usleep rep_usleep +typedef long useconds_t; +int usleep(useconds_t); +#endif + #endif /* _LIBREPLACE_REPLACE_H */ diff --git a/source3/include/proto.h b/source3/include/proto.h index a4fb496..779745a 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -318,7 +318,6 @@ int sys_set_nfs_quota(const char *path, const char *bdev, /* The following definitions come from lib/system.c */ -int sys_usleep(long usecs); ssize_t sys_read(int fd, void *buf, size_t count); ssize_t sys_write(int fd, const void *buf, size_t count); ssize_t sys_writev(int fd, const struct iovec *iov, int iovcnt); diff --git a/source3/lib/system.c b/source3/lib/system.c index 92e244f..238f84b 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -52,40 +52,6 @@ /******************************************************************* - A wrapper for usleep in case we don't have one. -********************************************************************/ - -int sys_usleep(long usecs) -{ -#ifndef HAVE_USLEEP - struct timeval tval; -#endif - - /* - * We need this braindamage as the glibc usleep - * is not SPEC1170 complient... grumble... JRA. - */ - - if(usecs < 0 || usecs > 999999) { - errno = EINVAL; - return -1; - } - -#if HAVE_USLEEP - usleep(usecs); - return 0; -#else /* HAVE_USLEEP */ - /* - * Fake it with select... - */ - tval.tv_sec = 0; - tval.tv_usec = usecs/1000; - select(0,NULL,NULL,NULL,&tval); - return 0; -#endif /* HAVE_USLEEP */ -} - -/******************************************************************* A read wrapper that will deal with EINTR. ********************************************************************/ diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 4d5bed4..c1dabc4 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -217,7 +217,7 @@ static FILE *startsmbfilepwent(const char *pfile, enum pwf_access_type type, int if((fd = sys_open(pfile, O_CREAT|O_TRUNC|O_EXCL|O_RDWR, 0600))!=-1) { break; } - sys_usleep(200); /* Spin, spin... */ + usleep(200); /* Spin, spin... */ } if(fd == -1) { DEBUG(0,("startsmbfilepwent_internal: too many race conditions \ diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index ef987e5..c4e7e50 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1957,7 +1957,7 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, && (RA_WIN2K == get_remote_arch()) ) { DEBUG(10,("_spoolss_OpenPrinterEx: Enabling LAN/WAN hack for Win2k clients.\n")); - sys_usleep( 500000 ); + usleep( 500000 ); } #endif diff --git a/source3/utils/net_rpc_service.c b/source3/utils/net_rpc_service.c index d1208e2..523eafd 100644 --- a/source3/utils/net_rpc_service.c +++ b/source3/utils/net_rpc_service.c @@ -200,7 +200,7 @@ static WERROR watch_service_state(struct rpc_pipe_client *pipe_hnd, d_printf("."); i++; - sys_usleep( 100 ); + usleep( 100 ); } d_printf("\n"); diff --git a/source3/utils/status_profile.c b/source3/utils/status_profile.c index c0eeb7a..e01b165 100644 --- a/source3/utils/status_profile.c +++ b/source3/utils/status_profile.c @@ -563,7 +563,7 @@ bool status_profile_rates(bool verbose) (unsigned long )usec_to_msec(remain_usec)); } - sys_usleep(remain_usec); + usleep(remain_usec); } } -- Samba Shared Repository