summaryrefslogtreecommitdiff
path: root/job.h
diff options
context:
space:
mode:
Diffstat (limited to 'job.h')
-rw-r--r--job.h47
1 files changed, 46 insertions, 1 deletions
diff --git a/job.h b/job.h
index 0e4e118..df74270 100644
--- a/job.h
+++ b/job.h
@@ -26,7 +26,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* How to set close-on-exec for a file descriptor. */
#if !defined F_SETFD
-# define CLOSE_ON_EXEC(_d)
+# ifdef WINDOWS32
+# define CLOSE_ON_EXEC(_d) process_noinherit(_d)
+# else
+# define CLOSE_ON_EXEC(_d)
+# endif
#else
# ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
@@ -34,6 +38,47 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# define CLOSE_ON_EXEC(_d) (void) fcntl ((_d), F_SETFD, FD_CLOEXEC)
#endif
+#ifdef OUTPUT_SYNC
+# ifdef WINDOWS32
+/* For emulations in w32/compat/posixfcn.c. */
+# define F_GETFD 1
+# define F_SETLKW 2
+/* Implementation note: None of the values of l_type below can be zero
+ -- they are compared with a static instance of the struct, so zero
+ means unknown/invalid, see w32/compat/posixfcn.c. */
+# define F_WRLCK 1
+# define F_UNLCK 2
+
+struct flock {
+ short l_type;
+ short l_whence;
+ off_t l_start;
+ off_t l_len;
+ pid_t l_pid;
+};
+
+/* This type is actually a HANDLE, but we want to avoid including
+ windows.h as much as possible. */
+typedef intptr_t sync_handle_t;
+
+/* Public functions emulated/provided in posixfcn.c. */
+int fcntl (intptr_t fd, int cmd, ...);
+intptr_t create_mutex (void);
+int same_stream (FILE *f1, FILE *f2);
+
+# define RECORD_SYNC_MUTEX(m) record_sync_mutex(m)
+void record_sync_mutex (const char *str);
+void prepare_mutex_handle_string (intptr_t hdl);
+
+# else /* !WINDOWS32 */
+
+typedef int sync_handle_t; /* file descriptor */
+
+# define RECORD_SYNC_MUTEX(m) (void)(m)
+
+# endif
+#endif /* OUTPUT_SYNC */
+
/* Structure describing a running or dead child process. */
struct child