mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Sync imsg from OpenBSD.
This commit is contained in:
		@@ -1,4 +1,4 @@
 | 
				
			|||||||
/*	$OpenBSD: imsg-buffer.c,v 1.10 2017/04/11 09:57:19 reyk Exp $	*/
 | 
					/*	$OpenBSD: imsg-buffer.c,v 1.11 2017/12/14 09:27:44 kettenis Exp $	*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
 | 
					 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
 | 
				
			||||||
@@ -29,9 +29,9 @@
 | 
				
			|||||||
#include "compat.h"
 | 
					#include "compat.h"
 | 
				
			||||||
#include "imsg.h"
 | 
					#include "imsg.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	ibuf_realloc(struct ibuf *, size_t);
 | 
					static int	ibuf_realloc(struct ibuf *, size_t);
 | 
				
			||||||
void	ibuf_enqueue(struct msgbuf *, struct ibuf *);
 | 
					static void	ibuf_enqueue(struct msgbuf *, struct ibuf *);
 | 
				
			||||||
void	ibuf_dequeue(struct msgbuf *, struct ibuf *);
 | 
					static void	ibuf_dequeue(struct msgbuf *, struct ibuf *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct ibuf *
 | 
					struct ibuf *
 | 
				
			||||||
ibuf_open(size_t len)
 | 
					ibuf_open(size_t len)
 | 
				
			||||||
@@ -67,7 +67,7 @@ ibuf_dynamic(size_t len, size_t max)
 | 
				
			|||||||
	return (buf);
 | 
						return (buf);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					static int
 | 
				
			||||||
ibuf_realloc(struct ibuf *buf, size_t len)
 | 
					ibuf_realloc(struct ibuf *buf, size_t len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	u_char	*b;
 | 
						u_char	*b;
 | 
				
			||||||
@@ -289,14 +289,14 @@ again:
 | 
				
			|||||||
	return (1);
 | 
						return (1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
 | 
					ibuf_enqueue(struct msgbuf *msgbuf, struct ibuf *buf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry);
 | 
						TAILQ_INSERT_TAIL(&msgbuf->bufs, buf, entry);
 | 
				
			||||||
	msgbuf->queued++;
 | 
						msgbuf->queued++;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					static void
 | 
				
			||||||
ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf)
 | 
					ibuf_dequeue(struct msgbuf *msgbuf, struct ibuf *buf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
 | 
						TAILQ_REMOVE(&msgbuf->bufs, buf, entry);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,4 @@
 | 
				
			|||||||
/*	$OpenBSD: imsg.c,v 1.15 2017/04/11 09:57:19 reyk Exp $	*/
 | 
					/*	$OpenBSD: imsg.c,v 1.16 2017/12/14 09:27:44 kettenis Exp $	*/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
 | 
					 * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
 | 
				
			||||||
@@ -30,7 +30,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
int	 imsg_fd_overhead = 0;
 | 
					int	 imsg_fd_overhead = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int	 imsg_get_fd(struct imsgbuf *);
 | 
					static int	 imsg_get_fd(struct imsgbuf *);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void
 | 
					void
 | 
				
			||||||
imsg_init(struct imsgbuf *ibuf, int fd)
 | 
					imsg_init(struct imsgbuf *ibuf, int fd)
 | 
				
			||||||
@@ -266,7 +266,7 @@ imsg_free(struct imsg *imsg)
 | 
				
			|||||||
	freezero(imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE);
 | 
						freezero(imsg->data, imsg->hdr.len - IMSG_HEADER_SIZE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int
 | 
					static int
 | 
				
			||||||
imsg_get_fd(struct imsgbuf *ibuf)
 | 
					imsg_get_fd(struct imsgbuf *ibuf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int		 fd;
 | 
						int		 fd;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user