From c9fb33697db1bdc1967a0cca557ad323ebe4ea22 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 Mar 2012 20:43:07 +0100 Subject: use usleep rather than sys_usleep in various places, in anticipation of usleep moving to libreplace. --- 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 +- 6 files changed, 4 insertions(+), 39 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index a4fb496ea9..779745a13e 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 92e244fdbe..238f84beea 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -51,40 +51,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 4d5bed4e10..c1dabc4dff 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 ef987e5fc9..c4e7e504ca 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 d1208e2ce2..523eafd653 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 c0eeb7a923..e01b1652ab 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); } } -- cgit