From: Git Backport Process Date: Wed, 5 Aug 2020 07:59:49 +0000 (+0200) Subject: BEE Backport bacula/src/win32/compat/compat.h X-Git-Tag: Release-11.3.2~1350 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ca49227c868fcbf74f5bba78712c7cbae0f474c;p=thirdparty%2Fbacula.git BEE Backport bacula/src/win32/compat/compat.h This commit is the result of the squash of the following main commits: Author: Henrique Date: Tue Apr 30 20:07:27 2019 -0300 win32: added flock implementation Author: Radosław Korzeniewski Date: Mon Jul 16 14:33:42 2018 +0200 Fix bsock compilation on windows based on Eric's patch. Author: Eric Bollengier Date: Wed Jul 4 10:50:46 2018 +0200 win32: Fix director compilation Author: Alain Spineux Date: Mon Mar 26 18:23:06 2018 +0200 win32: update compat.cpp "file" functions to use new path functions - statDir - stat 2 - GetApplicationName - win32_chmod win32_chdir win32_mkdir - win32_getcwd file_open utime - symlink - stat - breaddir - opendir --- diff --git a/bacula/src/win32/compat/compat.h b/bacula/src/win32/compat/compat.h index 53b0c54d07..d5ae60cafb 100644 --- a/bacula/src/win32/compat/compat.h +++ b/bacula/src/win32/compat/compat.h @@ -47,6 +47,10 @@ #define __STDC__ 1 #endif +#ifndef POOLMEM +typedef char POOLMEM; +#endif + #include #ifdef HAVE_MINGW_W64 @@ -212,6 +216,9 @@ struct stat uint64_t st_blocks; uint32_t st_fattrs; /* Windows file attributes */ }; +#ifndef SHUT_RDWR +#define SHUT_RDWR SD_BOTH +#endif #ifndef SOCK_CLOEXEC #define SOCK_CLOEXEC 0x00000000 @@ -291,6 +298,15 @@ int chmod(const char *, mode_t mode); int fcntl(int fd, int cmd, long arg); int fstat(intptr_t fd, struct stat *sb); + +/* Operations for the `flock' call. */ +#define LOCK_SH 1 /* Shared lock. */ +#define LOCK_EX 2 /* Exclusive lock. */ +#define LOCK_UN 8 /* Unlock. */ +/* Can be OR'd in to one of the above. */ +#define LOCK_NB 4 /* Don't block when locking. */ +int flock (int fd, int operation); + int inet_aton(const char *cp, struct in_addr *inp); int binet_pton(int af, const char *src, void *dst); int kill(pid_t pid, int signo); @@ -336,15 +352,20 @@ DIR *opendir(const char *name); int closedir(DIR *dir); struct passwd { - char *foo; + char *foo; + uid_t pw_uid; }; struct group { - char *foo; + char *foo; + gid_t gr_gid; }; struct passwd *getpwuid(uid_t); struct group *getgrgid(uid_t); +#define getgrnam(x) NULL +#define getpwnam(x) NULL + #ifdef xxx_needed struct sigaction { @@ -457,6 +478,7 @@ int mkstemp(char *t); void malloc_trim(int); uint64_t get_memory_info(char *buf, int buflen); +void win32_normalize_fileset_path(POOLMEM *&fname); #undef ftruncate #define ftruncate win32_ftruncate