aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-07-18 00:44:39 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-18 00:44:39 +0200
commit7f4ddbcab8598e3d5e29c23ce883cdfa664408f1 (patch)
tree5f1b18463f641f24fad519e0aefb60b97d707b52 /src/util
parent28ab2c446fba4980a8295d59fdf203a028a35dd6 (diff)
downloadgnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.tar.gz
gnunet-7f4ddbcab8598e3d5e29c23ce883cdfa664408f1.zip
merge flags into enum for GNUNET_DISK_pipe() API, fixing #6188
Diffstat (limited to 'src/util')
-rw-r--r--src/util/bio.c41
-rw-r--r--src/util/configuration.c7
-rw-r--r--src/util/crypto_ecc.c10
-rw-r--r--src/util/crypto_hash.c4
-rw-r--r--src/util/crypto_mpi.c4
-rw-r--r--src/util/disk.c44
-rw-r--r--src/util/gnunet-qr.c7
-rw-r--r--src/util/gnunet-uri.c2
-rw-r--r--src/util/helper.c7
-rw-r--r--src/util/os_priority.c4
-rw-r--r--src/util/perf_malloc.c4
-rw-r--r--src/util/perf_scheduler.c4
-rw-r--r--src/util/scheduler.c5
-rw-r--r--src/util/service.c4
-rw-r--r--src/util/strings.c2
-rw-r--r--src/util/test_bio.c14
-rw-r--r--src/util/test_common_logging_runtime_loglevels.c5
-rw-r--r--src/util/test_container_multihashmap.c2
-rw-r--r--src/util/test_container_multipeermap.c2
-rw-r--r--src/util/test_scheduler.c2
20 files changed, 79 insertions, 95 deletions
diff --git a/src/util/bio.c b/src/util/bio.c
index b27230240..39050bb87 100644
--- a/src/util/bio.c
+++ b/src/util/bio.c
@@ -260,7 +260,7 @@ read_from_buffer (struct GNUNET_BIO_ReadHandle *h,
260 char *result, 260 char *result,
261 size_t len) 261 size_t len)
262{ 262{
263 if (h->size < len || h->size - h->pos < len) 263 if ((h->size < len) || (h->size - h->pos < len))
264 { 264 {
265 GNUNET_asprintf (&h->emsg, 265 GNUNET_asprintf (&h->emsg,
266 _ ("Error while reading `%s' from buffer: %s"), 266 _ ("Error while reading `%s' from buffer: %s"),
@@ -431,6 +431,7 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
431 return GNUNET_OK; 431 return GNUNET_OK;
432} 432}
433 433
434
434/** 435/**
435 * Read a float. 436 * Read a float.
436 * 437 *
@@ -439,9 +440,9 @@ GNUNET_BIO_read_meta_data (struct GNUNET_BIO_ReadHandle *h,
439 * @param f address of float to read 440 * @param f address of float to read
440 */ 441 */
441int 442int
442GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h, 443GNUNET_BIO_read_float (struct GNUNET_BIO_ReadHandle *h,
443 const char *what, 444 const char *what,
444 float *f) 445 float *f)
445{ 446{
446 int32_t *i = (int32_t *) f; 447 int32_t *i = (int32_t *) f;
447 return GNUNET_BIO_read_int32 (h, what, i); 448 return GNUNET_BIO_read_int32 (h, what, i);
@@ -456,9 +457,9 @@ GNUNET_BIO_read_float(struct GNUNET_BIO_ReadHandle *h,
456 * @param f address of double to read 457 * @param f address of double to read
457 */ 458 */
458int 459int
459GNUNET_BIO_read_double(struct GNUNET_BIO_ReadHandle *h, 460GNUNET_BIO_read_double (struct GNUNET_BIO_ReadHandle *h,
460 const char *what, 461 const char *what,
461 double *f) 462 double *f)
462{ 463{
463 int64_t *i = (int64_t *) f; 464 int64_t *i = (int64_t *) f;
464 return GNUNET_BIO_read_int64 (h, what, i); 465 return GNUNET_BIO_read_int64 (h, what, i);
@@ -692,7 +693,7 @@ GNUNET_BIO_get_buffer_contents (struct GNUNET_BIO_WriteHandle *h,
692{ 693{
693 if (IO_BUFFER != h->type) 694 if (IO_BUFFER != h->type)
694 return GNUNET_SYSERR; 695 return GNUNET_SYSERR;
695 if (NULL == contents || NULL == size) 696 if ((NULL == contents) || (NULL == size))
696 return GNUNET_SYSERR; 697 return GNUNET_SYSERR;
697 int ret = (NULL != h->emsg) ? GNUNET_SYSERR : GNUNET_OK; 698 int ret = (NULL != h->emsg) ? GNUNET_SYSERR : GNUNET_OK;
698 if (NULL != emsg) 699 if (NULL != emsg)
@@ -897,9 +898,9 @@ GNUNET_BIO_write_meta_data (struct GNUNET_BIO_WriteHandle *h,
897 * @param f float to write 898 * @param f float to write
898 */ 899 */
899int 900int
900GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h, 901GNUNET_BIO_write_float (struct GNUNET_BIO_WriteHandle *h,
901 const char *what, 902 const char *what,
902 float f) 903 float f)
903{ 904{
904 int32_t i = f; 905 int32_t i = f;
905 return GNUNET_BIO_write_int32 (h, what, i); 906 return GNUNET_BIO_write_int32 (h, what, i);
@@ -914,9 +915,9 @@ GNUNET_BIO_write_float(struct GNUNET_BIO_WriteHandle *h,
914 * @param f double to write 915 * @param f double to write
915 */ 916 */
916int 917int
917GNUNET_BIO_write_double(struct GNUNET_BIO_WriteHandle *h, 918GNUNET_BIO_write_double (struct GNUNET_BIO_WriteHandle *h,
918 const char *what, 919 const char *what,
919 double f) 920 double f)
920{ 921{
921 int64_t i = f; 922 int64_t i = f;
922 return GNUNET_BIO_write_int64 (h, what, i); 923 return GNUNET_BIO_write_int64 (h, what, i);
@@ -1196,7 +1197,7 @@ GNUNET_BIO_read_spec_int64 (const char *what,
1196 * @param f address of float to read 1197 * @param f address of float to read
1197 */ 1198 */
1198struct GNUNET_BIO_ReadSpec 1199struct GNUNET_BIO_ReadSpec
1199GNUNET_BIO_read_spec_float(const char *what, float *f) 1200GNUNET_BIO_read_spec_float (const char *what, float *f)
1200{ 1201{
1201 struct GNUNET_BIO_ReadSpec rs = { 1202 struct GNUNET_BIO_ReadSpec rs = {
1202 .rh = &read_spec_handler_int32, 1203 .rh = &read_spec_handler_int32,
@@ -1216,7 +1217,7 @@ GNUNET_BIO_read_spec_float(const char *what, float *f)
1216 * @param f address of double to read 1217 * @param f address of double to read
1217 */ 1218 */
1218struct GNUNET_BIO_ReadSpec 1219struct GNUNET_BIO_ReadSpec
1219GNUNET_BIO_read_spec_double(const char *what, double *f) 1220GNUNET_BIO_read_spec_double (const char *what, double *f)
1220{ 1221{
1221 struct GNUNET_BIO_ReadSpec rs = { 1222 struct GNUNET_BIO_ReadSpec rs = {
1222 .rh = &read_spec_handler_int64, 1223 .rh = &read_spec_handler_int64,
@@ -1243,7 +1244,7 @@ GNUNET_BIO_read_spec_commit (struct GNUNET_BIO_ReadHandle *h,
1243{ 1244{
1244 int ret = GNUNET_OK; 1245 int ret = GNUNET_OK;
1245 1246
1246 for (size_t i=0; NULL!=rs[i].rh; ++i) 1247 for (size_t i = 0; NULL!=rs[i].rh; ++i)
1247 { 1248 {
1248 ret = rs[i].rh (rs[i].cls, h, rs[i].what, rs[i].target, rs[i].size); 1249 ret = rs[i].rh (rs[i].cls, h, rs[i].what, rs[i].target, rs[i].size);
1249 if (GNUNET_OK != ret) 1250 if (GNUNET_OK != ret)
@@ -1490,7 +1491,7 @@ GNUNET_BIO_write_spec_int64 (const char *what,
1490 * @return the write spec 1491 * @return the write spec
1491 */ 1492 */
1492struct GNUNET_BIO_WriteSpec 1493struct GNUNET_BIO_WriteSpec
1493GNUNET_BIO_write_spec_float(const char *what, float *f) 1494GNUNET_BIO_write_spec_float (const char *what, float *f)
1494{ 1495{
1495 struct GNUNET_BIO_WriteSpec ws = { 1496 struct GNUNET_BIO_WriteSpec ws = {
1496 .wh = &write_spec_handler_int32, 1497 .wh = &write_spec_handler_int32,
@@ -1512,7 +1513,7 @@ GNUNET_BIO_write_spec_float(const char *what, float *f)
1512 * @return the write spec 1513 * @return the write spec
1513 */ 1514 */
1514struct GNUNET_BIO_WriteSpec 1515struct GNUNET_BIO_WriteSpec
1515GNUNET_BIO_write_spec_double(const char *what, double *f) 1516GNUNET_BIO_write_spec_double (const char *what, double *f)
1516{ 1517{
1517 struct GNUNET_BIO_WriteSpec ws = { 1518 struct GNUNET_BIO_WriteSpec ws = {
1518 .wh = &write_spec_handler_int64, 1519 .wh = &write_spec_handler_int64,
@@ -1540,7 +1541,7 @@ GNUNET_BIO_write_spec_commit (struct GNUNET_BIO_WriteHandle *h,
1540{ 1541{
1541 int ret = GNUNET_OK; 1542 int ret = GNUNET_OK;
1542 1543
1543 for (size_t i=0; NULL!=ws[i].wh; ++i) 1544 for (size_t i = 0; NULL!=ws[i].wh; ++i)
1544 { 1545 {
1545 ret = ws[i].wh (ws[i].cls, h, ws[i].what, ws[i].source, ws[i].source_size); 1546 ret = ws[i].wh (ws[i].cls, h, ws[i].what, ws[i].source, ws[i].source_size);
1546 if (GNUNET_OK != ret) 1547 if (GNUNET_OK != ret)
diff --git a/src/util/configuration.c b/src/util/configuration.c
index faee9e3bf..26beacaff 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -1819,12 +1819,12 @@ GNUNET_CONFIGURATION_load_from (struct GNUNET_CONFIGURATION_Handle *cfg,
1819 * @return a freshly allocated configuration 1819 * @return a freshly allocated configuration
1820 */ 1820 */
1821struct GNUNET_CONFIGURATION_Handle * 1821struct GNUNET_CONFIGURATION_Handle *
1822GNUNET_CONFIGURATION_default(void) 1822GNUNET_CONFIGURATION_default (void)
1823{ 1823{
1824 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); 1824 const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get ();
1825 const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); 1825 const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default ();
1826 1826
1827 GNUNET_OS_init(dpd); 1827 GNUNET_OS_init (dpd);
1828 1828
1829 struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); 1829 struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create ();
1830 const char *xdg = getenv ("XDG_CONFIG_HOME"); 1830 const char *xdg = getenv ("XDG_CONFIG_HOME");
@@ -1835,7 +1835,8 @@ GNUNET_CONFIGURATION_default(void)
1835 else 1835 else
1836 cfgname = GNUNET_strdup (pd->user_config_file); 1836 cfgname = GNUNET_strdup (pd->user_config_file);
1837 1837
1838 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgname)) { 1838 if (GNUNET_OK != GNUNET_CONFIGURATION_load (cfg, cfgname))
1839 {
1839 GNUNET_OS_init (pd); 1840 GNUNET_OS_init (pd);
1840 GNUNET_CONFIGURATION_destroy (cfg); 1841 GNUNET_CONFIGURATION_destroy (cfg);
1841 GNUNET_free (cfgname); 1842 GNUNET_free (cfgname);
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c
index e1608ae55..019dbe94e 100644
--- a/src/util/crypto_ecc.c
+++ b/src/util/crypto_ecc.c
@@ -141,7 +141,7 @@ decode_private_ecdsa_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv)
141 int rc; 141 int rc;
142 uint8_t d[32]; 142 uint8_t d[32];
143 143
144 for (size_t i=0; i<32; i++) 144 for (size_t i = 0; i<32; i++)
145 d[i] = priv->d[31 - i]; 145 d[i] = priv->d[31 - i];
146 146
147 rc = gcry_sexp_build (&result, 147 rc = gcry_sexp_build (&result,
@@ -195,7 +195,7 @@ GNUNET_CRYPTO_eddsa_key_get_public (
195 struct GNUNET_CRYPTO_EddsaPublicKey *pub) 195 struct GNUNET_CRYPTO_EddsaPublicKey *pub)
196{ 196{
197 unsigned char pk[crypto_sign_PUBLICKEYBYTES]; 197 unsigned char pk[crypto_sign_PUBLICKEYBYTES];
198 unsigned char sk[crypto_sign_SECRETKEYBYTES]; 198 unsigned char sk[crypto_sign_SECRETKEYBYTES];
199 199
200 BENCHMARK_START (eddsa_key_get_public); 200 BENCHMARK_START (eddsa_key_get_public);
201 GNUNET_assert (0 == crypto_sign_seed_keypair (pk, sk, priv->d)); 201 GNUNET_assert (0 == crypto_sign_seed_keypair (pk, sk, priv->d));
@@ -929,7 +929,7 @@ GNUNET_CRYPTO_ecdsa_private_key_derive (
929 929
930 h = derive_h (&pub, label, context); 930 h = derive_h (&pub, label, context);
931 /* Convert to big endian for libgcrypt */ 931 /* Convert to big endian for libgcrypt */
932 for (size_t i=0; i < 32; i++) 932 for (size_t i = 0; i < 32; i++)
933 dc[i] = priv->d[31 - i]; 933 dc[i] = priv->d[31 - i];
934 GNUNET_CRYPTO_mpi_scan_unsigned (&x, dc, sizeof(dc)); 934 GNUNET_CRYPTO_mpi_scan_unsigned (&x, dc, sizeof(dc));
935 d = gcry_mpi_new (256); 935 d = gcry_mpi_new (256);
@@ -941,9 +941,9 @@ GNUNET_CRYPTO_ecdsa_private_key_derive (
941 ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); 941 ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
942 GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d); 942 GNUNET_CRYPTO_mpi_print_unsigned (dc, sizeof(dc), d);
943 /* Convert to big endian for libgcrypt */ 943 /* Convert to big endian for libgcrypt */
944 for (size_t i=0; i < 32; i++) 944 for (size_t i = 0; i < 32; i++)
945 ret->d[i] = dc[31 - i]; 945 ret->d[i] = dc[31 - i];
946 sodium_memzero(dc, sizeof(dc)); 946 sodium_memzero (dc, sizeof(dc));
947 gcry_mpi_release (d); 947 gcry_mpi_release (d);
948 return ret; 948 return ret;
949} 949}
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 622953476..0dbe9dbe8 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -250,12 +250,13 @@ GNUNET_CRYPTO_hash_to_aes_key (const struct GNUNET_HashCode *hc,
250 */ 250 */
251int 251int
252GNUNET_CRYPTO_hash_get_bit_ltr (const struct GNUNET_HashCode *code, 252GNUNET_CRYPTO_hash_get_bit_ltr (const struct GNUNET_HashCode *code,
253 unsigned int bit) 253 unsigned int bit)
254{ 254{
255 GNUNET_assert (bit < 8 * sizeof(struct GNUNET_HashCode)); 255 GNUNET_assert (bit < 8 * sizeof(struct GNUNET_HashCode));
256 return (((unsigned char *) code)[bit >> 3] & (128 >> (bit & 7))) > 0; 256 return (((unsigned char *) code)[bit >> 3] & (128 >> (bit & 7))) > 0;
257} 257}
258 258
259
259/** 260/**
260 * Obtain a bit from a hashcode. 261 * Obtain a bit from a hashcode.
261 * @param code the GNUNET_CRYPTO_hash to index bit-wise 262 * @param code the GNUNET_CRYPTO_hash to index bit-wise
@@ -272,7 +273,6 @@ GNUNET_CRYPTO_hash_get_bit_rtl (const struct GNUNET_HashCode *code,
272} 273}
273 274
274 275
275
276/** 276/**
277 * Determine how many low order bits match in two 277 * Determine how many low order bits match in two
278 * `struct GNUNET_HashCode`s. i.e. - 010011 and 011111 share 278 * `struct GNUNET_HashCode`s. i.e. - 010011 and 011111 share
diff --git a/src/util/crypto_mpi.c b/src/util/crypto_mpi.c
index 099921611..6df47c7e1 100644
--- a/src/util/crypto_mpi.c
+++ b/src/util/crypto_mpi.c
@@ -157,8 +157,8 @@ GNUNET_CRYPTO_mpi_scan_unsigned (gcry_mpi_t *result,
157 */ 157 */
158void 158void
159GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result, 159GNUNET_CRYPTO_mpi_scan_unsigned_le (gcry_mpi_t *result,
160 const void *data, 160 const void *data,
161 size_t size) 161 size_t size)
162{ 162{
163 int rc; 163 int rc;
164 164
diff --git a/src/util/disk.c b/src/util/disk.c
index cdead59d2..6560726ea 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1451,33 +1451,23 @@ GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h)
1451/** 1451/**
1452 * Creates an interprocess channel 1452 * Creates an interprocess channel
1453 * 1453 *
1454 * @param blocking_read creates an asynchronous pipe for reading if set to GNUNET_NO 1454 * @param pf how to configure the pipe
1455 * @param blocking_write creates an asynchronous pipe for writing if set to GNUNET_NO
1456 * @param inherit_read inherit the parent processes stdin (only for windows)
1457 * @param inherit_write inherit the parent processes stdout (only for windows)
1458 * @return handle to the new pipe, NULL on error 1455 * @return handle to the new pipe, NULL on error
1459 */ 1456 */
1460struct GNUNET_DISK_PipeHandle * 1457struct GNUNET_DISK_PipeHandle *
1461GNUNET_DISK_pipe (int blocking_read, 1458GNUNET_DISK_pipe (enum GNUNET_DISK_PipeFlags pf)
1462 int blocking_write,
1463 int inherit_read,
1464 int inherit_write)
1465{ 1459{
1466 int fd[2]; 1460 int fd[2];
1467 int ret;
1468 int eno;
1469 1461
1470 (void) inherit_read; 1462 if (-1 == pipe (fd))
1471 (void) inherit_write;
1472 ret = pipe (fd);
1473 if (ret == -1)
1474 { 1463 {
1475 eno = errno; 1464 int eno = errno;
1465
1476 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe"); 1466 LOG_STRERROR (GNUNET_ERROR_TYPE_ERROR, "pipe");
1477 errno = eno; 1467 errno = eno;
1478 return NULL; 1468 return NULL;
1479 } 1469 }
1480 return GNUNET_DISK_pipe_from_fd (blocking_read, blocking_write, fd); 1470 return GNUNET_DISK_pipe_from_fd (pf, fd);
1481} 1471}
1482 1472
1483 1473
@@ -1485,29 +1475,26 @@ GNUNET_DISK_pipe (int blocking_read,
1485 * Creates a pipe object from a couple of file descriptors. 1475 * Creates a pipe object from a couple of file descriptors.
1486 * Useful for wrapping existing pipe FDs. 1476 * Useful for wrapping existing pipe FDs.
1487 * 1477 *
1488 * @param blocking_read creates an asynchronous pipe for reading if set to GNUNET_NO 1478 * @param pf how to configure the pipe
1489 * @param blocking_write creates an asynchronous pipe for writing if set to GNUNET_NO
1490 * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes 1479 * @param fd an array of two fd values. One of them may be -1 for read-only or write-only pipes
1491 * 1480 *
1492 * @return handle to the new pipe, NULL on error 1481 * @return handle to the new pipe, NULL on error
1493 */ 1482 */
1494struct GNUNET_DISK_PipeHandle * 1483struct GNUNET_DISK_PipeHandle *
1495GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]) 1484GNUNET_DISK_pipe_from_fd (enum GNUNET_DISK_PipeFlags pf,
1485 int fd[2])
1496{ 1486{
1497 struct GNUNET_DISK_PipeHandle *p; 1487 struct GNUNET_DISK_PipeHandle *p;
1498 1488 int ret = 0;
1499 p = GNUNET_new (struct GNUNET_DISK_PipeHandle);
1500
1501 int ret;
1502 int flags; 1489 int flags;
1503 int eno = 0; /* make gcc happy */ 1490 int eno = 0; /* make gcc happy */
1504 1491
1505 ret = 0; 1492 p = GNUNET_new (struct GNUNET_DISK_PipeHandle);
1506 if (fd[0] >= 0) 1493 if (fd[0] >= 0)
1507 { 1494 {
1508 p->fd[0] = GNUNET_new (struct GNUNET_DISK_FileHandle); 1495 p->fd[0] = GNUNET_new (struct GNUNET_DISK_FileHandle);
1509 p->fd[0]->fd = fd[0]; 1496 p->fd[0]->fd = fd[0];
1510 if (! blocking_read) 1497 if (0 == (GNUNET_DISK_PF_BLOCKING_READ & pf))
1511 { 1498 {
1512 flags = fcntl (fd[0], F_GETFL); 1499 flags = fcntl (fd[0], F_GETFL);
1513 flags |= O_NONBLOCK; 1500 flags |= O_NONBLOCK;
@@ -1530,7 +1517,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2])
1530 { 1517 {
1531 p->fd[1] = GNUNET_new (struct GNUNET_DISK_FileHandle); 1518 p->fd[1] = GNUNET_new (struct GNUNET_DISK_FileHandle);
1532 p->fd[1]->fd = fd[1]; 1519 p->fd[1]->fd = fd[1];
1533 if (! blocking_write) 1520 if (0 == (GNUNET_DISK_PF_BLOCKING_WRITE & pf))
1534 { 1521 {
1535 flags = fcntl (fd[1], F_GETFL); 1522 flags = fcntl (fd[1], F_GETFL);
1536 flags |= O_NONBLOCK; 1523 flags |= O_NONBLOCK;
@@ -1562,7 +1549,6 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2])
1562 errno = eno; 1549 errno = eno;
1563 return NULL; 1550 return NULL;
1564 } 1551 }
1565
1566 return p; 1552 return p;
1567} 1553}
1568 1554
@@ -1572,7 +1558,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2])
1572 * 1558 *
1573 * @param p pipe to close 1559 * @param p pipe to close
1574 * @param end which end of the pipe to close 1560 * @param end which end of the pipe to close
1575 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1561 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
1576 */ 1562 */
1577int 1563int
1578GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, 1564GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p,
@@ -1644,7 +1630,7 @@ GNUNET_DISK_pipe_detach_end (struct GNUNET_DISK_PipeHandle *p,
1644 * Closes an interprocess channel 1630 * Closes an interprocess channel
1645 * 1631 *
1646 * @param p pipe to close 1632 * @param p pipe to close
1647 * @return GNUNET_OK on success, GNUNET_SYSERR otherwise 1633 * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise
1648 */ 1634 */
1649int 1635int
1650GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p) 1636GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p)
diff --git a/src/util/gnunet-qr.c b/src/util/gnunet-qr.c
index 84a3184bc..83b2af2fc 100644
--- a/src/util/gnunet-qr.c
+++ b/src/util/gnunet-qr.c
@@ -31,7 +31,7 @@
31 31
32#define LOG(fmt, ...) \ 32#define LOG(fmt, ...) \
33 if (verbose) \ 33 if (verbose) \
34 printf (fmt, ## __VA_ARGS__) 34 printf (fmt, ## __VA_ARGS__)
35 35
36/** 36/**
37 * Video device to capture from. Sane default for GNU/Linux systems. 37 * Video device to capture from. Sane default for GNU/Linux systems.
@@ -161,10 +161,7 @@ gnunet_uri (void *cls,
161 return; 161 return;
162 } 162 }
163 GNUNET_free (subsystem); 163 GNUNET_free (subsystem);
164 sigpipe = GNUNET_DISK_pipe (GNUNET_NO, 164 sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
165 GNUNET_NO,
166 GNUNET_NO,
167 GNUNET_NO);
168 GNUNET_assert (NULL != sigpipe); 165 GNUNET_assert (NULL != sigpipe);
169 rt = GNUNET_SCHEDULER_add_read_file ( 166 rt = GNUNET_SCHEDULER_add_read_file (
170 GNUNET_TIME_UNIT_FOREVER_REL, 167 GNUNET_TIME_UNIT_FOREVER_REL,
diff --git a/src/util/gnunet-uri.c b/src/util/gnunet-uri.c
index f8754a6d1..9443c9120 100644
--- a/src/util/gnunet-uri.c
+++ b/src/util/gnunet-uri.c
@@ -167,7 +167,7 @@ main (int argc, char *const *argv)
167 167
168 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) 168 if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv))
169 return 2; 169 return 2;
170 sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); 170 sigpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
171 GNUNET_assert (sigpipe != NULL); 171 GNUNET_assert (sigpipe != NULL);
172 shc_chld = 172 shc_chld =
173 GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); 173 GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death);
diff --git a/src/util/helper.c b/src/util/helper.c
index 7985f2eca..7360b7d4b 100644
--- a/src/util/helper.c
+++ b/src/util/helper.c
@@ -401,9 +401,9 @@ static void
401start_helper (struct GNUNET_HELPER_Handle *h) 401start_helper (struct GNUNET_HELPER_Handle *h)
402{ 402{
403 h->helper_in = 403 h->helper_in =
404 GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_YES, GNUNET_NO); 404 GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
405 h->helper_out = 405 h->helper_out =
406 GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); 406 GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
407 if ((h->helper_in == NULL) || (h->helper_out == NULL)) 407 if ((h->helper_in == NULL) || (h->helper_out == NULL))
408 { 408 {
409 /* out of file descriptors? try again later... */ 409 /* out of file descriptors? try again later... */
@@ -423,7 +423,8 @@ start_helper (struct GNUNET_HELPER_Handle *h)
423 h->fh_to_helper = 423 h->fh_to_helper =
424 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE); 424 GNUNET_DISK_pipe_handle (h->helper_in, GNUNET_DISK_PIPE_END_WRITE);
425 h->helper_proc = GNUNET_OS_start_process_vap (h->with_control_pipe 425 h->helper_proc = GNUNET_OS_start_process_vap (h->with_control_pipe
426 ? GNUNET_OS_INHERIT_STD_ERR | GNUNET_OS_USE_PIPE_CONTROL 426 ? GNUNET_OS_INHERIT_STD_ERR
427 | GNUNET_OS_USE_PIPE_CONTROL
427 : GNUNET_OS_INHERIT_STD_ERR, 428 : GNUNET_OS_INHERIT_STD_ERR,
428 h->helper_in, 429 h->helper_in,
429 h->helper_out, 430 h->helper_out,
diff --git a/src/util/os_priority.c b/src/util/os_priority.c
index 2f86f792f..8d045c72b 100644
--- a/src/util/os_priority.c
+++ b/src/util/os_priority.c
@@ -376,7 +376,7 @@ start_process (enum GNUNET_OS_InheritStdioFlags std_inheritance,
376 struct GNUNET_DISK_PipeHandle *childpipe; 376 struct GNUNET_DISK_PipeHandle *childpipe;
377 int dup_childpipe_read_fd = -1; 377 int dup_childpipe_read_fd = -1;
378 378
379 childpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_YES, GNUNET_NO); 379 childpipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
380 if (NULL == childpipe) 380 if (NULL == childpipe)
381 return NULL; 381 return NULL;
382 childpipe_read = 382 childpipe_read =
@@ -1152,7 +1152,7 @@ GNUNET_OS_command_run (GNUNET_OS_LineProcessor proc,
1152 struct GNUNET_DISK_PipeHandle *opipe; 1152 struct GNUNET_DISK_PipeHandle *opipe;
1153 va_list ap; 1153 va_list ap;
1154 1154
1155 opipe = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, GNUNET_YES); 1155 opipe = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
1156 if (NULL == opipe) 1156 if (NULL == opipe)
1157 return NULL; 1157 return NULL;
1158 va_start (ap, binary); 1158 va_start (ap, binary);
diff --git a/src/util/perf_malloc.c b/src/util/perf_malloc.c
index 6582505c8..1c91402da 100644
--- a/src/util/perf_malloc.c
+++ b/src/util/perf_malloc.c
@@ -56,11 +56,11 @@ perf_realloc ()
56 ptr = GNUNET_malloc (i); 56 ptr = GNUNET_malloc (i);
57 memset (ptr, 1, i); 57 memset (ptr, 1, i);
58 ptr = GNUNET_realloc (ptr, i + 5); 58 ptr = GNUNET_realloc (ptr, i + 5);
59 for (size_t j=0;j<i;j++) 59 for (size_t j = 0; j<i; j++)
60 GNUNET_assert (1 == ptr[j]); 60 GNUNET_assert (1 == ptr[j]);
61 memset (ptr, 6, i + 5); 61 memset (ptr, 6, i + 5);
62 ptr = GNUNET_realloc (ptr, i - 5); 62 ptr = GNUNET_realloc (ptr, i - 5);
63 for (size_t j=0;j<i-5;j++) 63 for (size_t j = 0; j<i - 5; j++)
64 GNUNET_assert (6 == ptr[j]); 64 GNUNET_assert (6 == ptr[j]);
65 GNUNET_free (ptr); 65 GNUNET_free (ptr);
66 } 66 }
diff --git a/src/util/perf_scheduler.c b/src/util/perf_scheduler.c
index 3ea76e24c..4d4d0a228 100644
--- a/src/util/perf_scheduler.c
+++ b/src/util/perf_scheduler.c
@@ -94,8 +94,8 @@ main (int argc, char *argv[])
94 GNUNET_YES)); 94 GNUNET_YES));
95 GAUGER ("UTIL", "Scheduler", 95 GAUGER ("UTIL", "Scheduler",
96 tasks / 1024 / (1 96 tasks / 1024 / (1
97 + GNUNET_TIME_absolute_get_duration 97 + GNUNET_TIME_absolute_get_duration
98 (start).rel_value_us / 1000LL), "tasks/ms"); 98 (start).rel_value_us / 1000LL), "tasks/ms");
99 return 0; 99 return 0;
100} 100}
101 101
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 93393bd7c..b5ce20254 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -2214,10 +2214,7 @@ GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
2214 GNUNET_assert (NULL == shutdown_pipe_handle); 2214 GNUNET_assert (NULL == shutdown_pipe_handle);
2215 /* general set-up */ 2215 /* general set-up */
2216 sh = GNUNET_new (struct GNUNET_SCHEDULER_Handle); 2216 sh = GNUNET_new (struct GNUNET_SCHEDULER_Handle);
2217 shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO, 2217 shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
2218 GNUNET_NO,
2219 GNUNET_NO,
2220 GNUNET_NO);
2221 GNUNET_assert (NULL != shutdown_pipe_handle); 2218 GNUNET_assert (NULL != shutdown_pipe_handle);
2222 pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle, 2219 pr = GNUNET_DISK_pipe_handle (shutdown_pipe_handle,
2223 GNUNET_DISK_PIPE_END_READ); 2220 GNUNET_DISK_PIPE_END_READ);
diff --git a/src/util/service.c b/src/util/service.c
index 1b80c8d13..e6bbe855f 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -2021,8 +2021,8 @@ GNUNET_SERVICE_run_ (int argc,
2021 sh.disconnect_cb = disconnect_cb; 2021 sh.disconnect_cb = disconnect_cb;
2022 sh.cb_cls = cls; 2022 sh.cb_cls = cls;
2023 sh.handlers = (NULL == pd->agpl_url) 2023 sh.handlers = (NULL == pd->agpl_url)
2024 ? GNUNET_MQ_copy_handlers (handlers) 2024 ? GNUNET_MQ_copy_handlers (handlers)
2025 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL); 2025 : GNUNET_MQ_copy_handlers2 (handlers, &return_agpl, NULL);
2026 sh.service_name = service_name; 2026 sh.service_name = service_name;
2027 sh.ret = 0; 2027 sh.ret = 0;
2028 /* setup subsystems */ 2028 /* setup subsystems */
diff --git a/src/util/strings.c b/src/util/strings.c
index 5148d0368..41180dd71 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -1985,7 +1985,7 @@ GNUNET_STRINGS_base64_decode (const char *data, size_t len, void **out)
1985 "ignoring CR/LF\n"); \ 1985 "ignoring CR/LF\n"); \
1986 i++; \ 1986 i++; \
1987 if (i >= len) \ 1987 if (i >= len) \
1988 goto END; \ 1988 goto END; \
1989 } 1989 }
1990 1990
1991 GNUNET_assert (len / 3 < SIZE_MAX); 1991 GNUNET_assert (len / 3 < SIZE_MAX);
diff --git a/src/util/test_bio.c b/src/util/test_bio.c
index 0c8453121..f18014719 100644
--- a/src/util/test_bio.c
+++ b/src/util/test_bio.c
@@ -52,14 +52,14 @@ test_normal_rw (void)
52 GNUNET_BIO_write_spec_string ("test-normal-rw-string", TESTSTRING), 52 GNUNET_BIO_write_spec_string ("test-normal-rw-string", TESTSTRING),
53 GNUNET_BIO_write_spec_meta_data ("test-normal-rw-metadata", mdW), 53 GNUNET_BIO_write_spec_meta_data ("test-normal-rw-metadata", mdW),
54 GNUNET_BIO_write_spec_int64 ("test-normal-rw-int64", &wNum), 54 GNUNET_BIO_write_spec_int64 ("test-normal-rw-int64", &wNum),
55 GNUNET_BIO_write_spec_end(), 55 GNUNET_BIO_write_spec_end (),
56 }; 56 };
57 57
58 struct GNUNET_BIO_ReadSpec rs[] = { 58 struct GNUNET_BIO_ReadSpec rs[] = {
59 GNUNET_BIO_read_spec_string ("test-normal-rw-string", &rString, 200), 59 GNUNET_BIO_read_spec_string ("test-normal-rw-string", &rString, 200),
60 GNUNET_BIO_read_spec_meta_data ("test-normal-rw-metadata", &mdR), 60 GNUNET_BIO_read_spec_meta_data ("test-normal-rw-metadata", &mdR),
61 GNUNET_BIO_read_spec_int64 ("test-normal-rw-int64", &rNum), 61 GNUNET_BIO_read_spec_int64 ("test-normal-rw-int64", &rNum),
62 GNUNET_BIO_read_spec_end(), 62 GNUNET_BIO_read_spec_end (),
63 }; 63 };
64 64
65 /* I/O on file */ 65 /* I/O on file */
@@ -73,12 +73,13 @@ test_normal_rw (void)
73 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs)); 73 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs));
74 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); 74 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL));
75 GNUNET_assert (0 == strcmp (TESTSTRING, rString)); 75 GNUNET_assert (0 == strcmp (TESTSTRING, rString));
76 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, mdW)); 76 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR,
77 mdW));
77 GNUNET_assert (wNum == rNum); 78 GNUNET_assert (wNum == rNum);
78 79
79 GNUNET_CONTAINER_meta_data_destroy (mdR); 80 GNUNET_CONTAINER_meta_data_destroy (mdR);
80 GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename)); 81 GNUNET_assert (GNUNET_OK == GNUNET_DISK_directory_remove (filename));
81 GNUNET_free(filename); 82 GNUNET_free (filename);
82 83
83 /* I/O on buffer */ 84 /* I/O on buffer */
84 wh = GNUNET_BIO_write_open_buffer (); 85 wh = GNUNET_BIO_write_open_buffer ();
@@ -96,7 +97,8 @@ test_normal_rw (void)
96 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs)); 97 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_spec_commit (rh, rs));
97 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL)); 98 GNUNET_assert (GNUNET_OK == GNUNET_BIO_read_close (rh, NULL));
98 GNUNET_assert (0 == strcmp (TESTSTRING, rString)); 99 GNUNET_assert (0 == strcmp (TESTSTRING, rString));
99 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR, mdW)); 100 GNUNET_assert (GNUNET_YES == GNUNET_CONTAINER_meta_data_test_equal (mdR,
101 mdW));
100 GNUNET_assert (wNum == rNum); 102 GNUNET_assert (wNum == rNum);
101 103
102 GNUNET_free (buffer); 104 GNUNET_free (buffer);
@@ -314,7 +316,7 @@ test_fullfile_rw (void)
314 200), 316 200),
315 GNUNET_BIO_read_spec_meta_data ("test-fullfile-rw-metadata", 317 GNUNET_BIO_read_spec_meta_data ("test-fullfile-rw-metadata",
316 &mdR), 318 &mdR),
317 GNUNET_BIO_read_spec_end(), 319 GNUNET_BIO_read_spec_end (),
318 }; 320 };
319 321
320 wh = GNUNET_BIO_write_open_file ("/dev/full"); 322 wh = GNUNET_BIO_write_open_file ("/dev/full");
diff --git a/src/util/test_common_logging_runtime_loglevels.c b/src/util/test_common_logging_runtime_loglevels.c
index ce1cdadd6..79cf9d53a 100644
--- a/src/util/test_common_logging_runtime_loglevels.c
+++ b/src/util/test_common_logging_runtime_loglevels.c
@@ -207,7 +207,7 @@ read_output_line (int phase_from1, int phase_to1, int phase_from2,
207 */ 207 */
208#define LOG_MAX_LINE_LENGTH (17) 208#define LOG_MAX_LINE_LENGTH (17)
209 209
210#define LOG_BUFFER_SIZE LOG_MAX_NUM_LINES * LOG_MAX_LINE_LENGTH 210#define LOG_BUFFER_SIZE LOG_MAX_NUM_LINES *LOG_MAX_LINE_LENGTH
211 211
212static char buf[LOG_BUFFER_SIZE]; 212static char buf[LOG_BUFFER_SIZE];
213 213
@@ -347,8 +347,7 @@ runone ()
347{ 347{
348 const struct GNUNET_DISK_FileHandle *stdout_read_handle; 348 const struct GNUNET_DISK_FileHandle *stdout_read_handle;
349 349
350 pipe_stdout = GNUNET_DISK_pipe (GNUNET_YES, GNUNET_YES, GNUNET_NO, 350 pipe_stdout = GNUNET_DISK_pipe (GNUNET_DISK_PF_BLOCKING_RW);
351 GNUNET_YES);
352 351
353 if (pipe_stdout == NULL) 352 if (pipe_stdout == NULL)
354 { 353 {
diff --git a/src/util/test_container_multihashmap.c b/src/util/test_container_multihashmap.c
index bd9e7af31..f46b9f56e 100644
--- a/src/util/test_container_multihashmap.c
+++ b/src/util/test_container_multihashmap.c
@@ -31,7 +31,7 @@
31 if (m != NULL) GNUNET_CONTAINER_multihashmap_destroy (m); \ 31 if (m != NULL) GNUNET_CONTAINER_multihashmap_destroy (m); \
32 if (NULL != \ 32 if (NULL != \
33 iter) \ 33 iter) \
34 GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); \ 34 GNUNET_CONTAINER_multihashmap_iterator_destroy (iter); \
35 return 1; } 35 return 1; }
36#define CHECK(c) { if (! (c)) ABORT (); } 36#define CHECK(c) { if (! (c)) ABORT (); }
37 37
diff --git a/src/util/test_container_multipeermap.c b/src/util/test_container_multipeermap.c
index 9aeead56c..cb6fc30d2 100644
--- a/src/util/test_container_multipeermap.c
+++ b/src/util/test_container_multipeermap.c
@@ -31,7 +31,7 @@
31 if (NULL != m) GNUNET_CONTAINER_multipeermap_destroy (m); \ 31 if (NULL != m) GNUNET_CONTAINER_multipeermap_destroy (m); \
32 if (NULL != \ 32 if (NULL != \
33 iter) \ 33 iter) \
34 GNUNET_CONTAINER_multipeermap_iterator_destroy (iter); \ 34 GNUNET_CONTAINER_multipeermap_iterator_destroy (iter); \
35 return 1; } 35 return 1; }
36#define CHECK(c) { if (! (c)) ABORT (); } 36#define CHECK(c) { if (! (c)) ABORT (); }
37 37
diff --git a/src/util/test_scheduler.c b/src/util/test_scheduler.c
index 471ca64e5..0e2e7f760 100644
--- a/src/util/test_scheduler.c
+++ b/src/util/test_scheduler.c
@@ -133,7 +133,7 @@ task4 (void *cls)
133 133
134 GNUNET_assert (4 == *ok); 134 GNUNET_assert (4 == *ok);
135 (*ok) = 6; 135 (*ok) = 6;
136 p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); 136 p = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE);
137 GNUNET_assert (NULL != p); 137 GNUNET_assert (NULL != p);
138 fds[0] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_READ); 138 fds[0] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_READ);
139 fds[1] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_WRITE); 139 fds[1] = GNUNET_DISK_pipe_handle (p, GNUNET_DISK_PIPE_END_WRITE);