filemon_dev.c (bmake-20201101) | : | filemon_dev.c (bmake-20201117) | ||
---|---|---|---|---|
/* $NetBSD: filemon_dev.c,v 1.3 2020/07/10 15:53:30 sjg Exp $ */ | /* $NetBSD: filemon_dev.c,v 1.4 2020/11/05 17:27:16 rillig Exp $ */ | |||
/*- | /*- | |||
* Copyright (c) 2020 The NetBSD Foundation, Inc. | * Copyright (c) 2020 The NetBSD Foundation, Inc. | |||
* All rights reserved. | * All rights reserved. | |||
* | * | |||
* This code is derived from software contributed to The NetBSD Foundation | * This code is derived from software contributed to The NetBSD Foundation | |||
* by Taylor R. Campbell. | * by Taylor R. Campbell. | |||
* | * | |||
* Redistribution and use in source and binary forms, with or without | * Redistribution and use in source and binary forms, with or without | |||
* modification, are permitted provided that the following conditions | * modification, are permitted provided that the following conditions | |||
skipping to change at line 68 | skipping to change at line 68 | |||
} | } | |||
struct filemon * | struct filemon * | |||
filemon_open(void) | filemon_open(void) | |||
{ | { | |||
struct filemon *F; | struct filemon *F; | |||
unsigned i; | unsigned i; | |||
int error; | int error; | |||
/* Allocate and zero a struct filemon object. */ | /* Allocate and zero a struct filemon object. */ | |||
F = calloc(1, sizeof(*F)); | F = calloc(1, sizeof *F); | |||
if (F == NULL) | if (F == NULL) | |||
return NULL; | return NULL; | |||
/* Try opening /dev/filemon, up to six times (cargo cult!). */ | /* Try opening /dev/filemon, up to six times (cargo cult!). */ | |||
for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) { | for (i = 0; (F->fd = open(_PATH_FILEMON, O_RDWR|O_CLOEXEC)) == -1; i++) { | |||
if (i == 5) { | if (i == 5) { | |||
error = errno; | error = errno; | |||
goto fail0; | goto fail0; | |||
} | } | |||
} | } | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added |