28
28
#include "system/filesys.h"
29
29
#include "system/time.h"
30
#include "system/network.h"
30
31
#include "system/passwd.h"
31
32
#include "system/syslog.h"
32
33
#include "system/locale.h"
213
214
#endif /* HAVE_INITGROUPS */
216
#if (defined(SecureWare) && defined(SCO))
217
/* This is needed due to needing the nap() function but we don't want
218
to include the Xenix libraries since that will break other things...
219
BTW: system call # 0x0c28 is the same as calling nap() */
220
long nap(long milliseconds) {
221
return syscall(0x0c28, milliseconds);
226
217
#ifndef HAVE_MEMMOVE
227
218
/*******************************************************************
228
219
safely copies memory, ensuring no overlap problems.
412
403
/* have a reasonable go at emulating it. Hope that
413
404
the system mktemp() isn't completely hopeless */
414
char *p = mktemp(template);
406
if (template[0] == 0)
417
408
return open(p, O_CREAT|O_EXCL|O_RDWR, 0600);
823
#ifndef HAVE_MEMALIGN
824
void *rep_memalign( size_t align, size_t size )
826
#if defined(HAVE_POSIX_MEMALIGN)
828
int ret = posix_memalign( &p, align, size );
834
/* On *BSD systems memaligns doesn't exist, but memory will
835
* be aligned on allocations of > pagesize. */
836
#if defined(SYSCONF_SC_PAGESIZE)
837
size_t pagesize = (size_t)sysconf(_SC_PAGESIZE);
838
#elif defined(HAVE_GETPAGESIZE)
839
size_t pagesize = (size_t)getpagesize();
841
size_t pagesize = (size_t)-1;
843
if (pagesize == (size_t)-1) {
847
if (size < pagesize) {
855
#ifndef HAVE_GETPEEREID
856
int rep_getpeereid(int s, uid_t *uid, gid_t *gid)
858
#if defined(HAVE_PEERCRED)
860
socklen_t cred_len = sizeof(struct ucred);
864
ret = getsockopt(s, SOL_SOCKET, SO_PEERCRED, (void *)&cred, &cred_len);
869
if (cred_len != sizeof(struct ucred)) {
885
int rep_usleep(useconds_t sec)
889
* Fake it with select...
892
tval.tv_usec = usecs/1000;
893
select(0,NULL,NULL,NULL,&tval);
896
#endif /* HAVE_USLEEP */
898
#ifndef HAVE_SETPROCTITLE
899
void rep_setproctitle(const char *fmt, ...)