X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=para.h;h=46efebdebf22e7e2677ef4d48f066a642ebf4c8c;hp=0a14b99a51f0096e979983c9954f9617ea669097;hb=277ed4a605f68118aff9e671f16c0ac6edb1d55a;hpb=c059f39305eb3629e06a89aa44816e98d29d78a8 diff --git a/para.h b/para.h index 0a14b99a..46efebde 100644 --- a/para.h +++ b/para.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1997-2012 Andre Noll + * Copyright (C) 1997-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -82,14 +82,6 @@ extern __printf_2_3 void (*para_log)(int, const char*, ...); /** Sent by para_client to initiate the authentication procedure. */ #define AUTH_REQUEST_MSG "auth rsa " -/** Sent by para_server for commands that expect a data file. */ -#define AWAITING_DATA_MSG "\nAwaiting Data." -/** Sent by para_server if authentication was successful. */ -#define PROCEED_MSG "Proceed." -/** Length of the \p PROCEED_MSG string. */ -#define PROCEED_MSG_LEN strlen(PROCEED_MSG) -/** Sent by para_client to indicate the end of the command line. */ -#define EOC_MSG "\nEnd of Command." /* exec */ int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds); @@ -131,6 +123,18 @@ _static_inline_ long int para_random(unsigned max) return ((max + 0.0) * (random() / (RAND_MAX + 1.0))); } +/** + * Simple sanity check for I/O vectors. + * + * \param iov Pointer to the I/O vector to check. + * + * \return True if \a iov points to a non-empty buffer. + */ +_static_inline_ bool iov_valid(const struct iovec *iov) +{ + return iov && iov->iov_len > 0 && iov->iov_base; +} + /** Round up x to next multiple of y. */ #define ROUND_UP(x, y) ({ \ const typeof(y) _divisor = y; \