Skip to content

Commit

Permalink
lib-sieve: sieve - Add sieve_record_resource_usage().
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanbosch committed Jan 22, 2021
1 parent bcff0f7 commit 0c84d61
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/lib-sieve/sieve.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,12 @@ int sieve_save(struct sieve_binary *sbin, bool update,
return sieve_script_binary_save(script, sbin, update, error_r);
}

bool sieve_record_resource_usage(struct sieve_binary *sbin,
const struct sieve_resource_usage *rusage)
{
return sieve_binary_record_resource_usage(sbin, rusage);
}

void sieve_close(struct sieve_binary **_sbin)
{
sieve_binary_close(_sbin);
Expand Down
8 changes: 8 additions & 0 deletions src/lib-sieve/sieve.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ sieve_open(struct sieve_instance *svinst, const char *script_location,
const char *script_name, struct sieve_error_handler *ehandler,
enum sieve_compile_flags flags, enum sieve_error *error_r);

/* Record resource usage in the binary cumulatively. The binary is disabled when
resource limits are exceeded within a configured timeout. Returns FALSE when
resource limits are exceeded. */
bool ATTR_NOWARN_UNUSED_RESULT
sieve_record_resource_usage(struct sieve_binary *sbin,
const struct sieve_resource_usage *rusage)
ATTR_NULL(1);

/* Saves the binary as the file indicated by the path parameter. This function
will not write the binary to disk when the provided binary object was loaded
earlier from the indicated bin_path, unless update is TRUE.
Expand Down

0 comments on commit 0c84d61

Please sign in to comment.