profile.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /** BEGIN COPYRIGHT BLOCK
  2. * Copyright (C) 2001 Sun Microsystems, Inc. Used by permission.
  3. * Copyright (C) 2005 Red Hat, Inc.
  4. * All rights reserved.
  5. *
  6. * License: GPL (version 3 or any later version).
  7. * See LICENSE for details.
  8. * END COPYRIGHT BLOCK **/
  9. #ifdef HAVE_CONFIG_H
  10. # include <config.h>
  11. #endif
  12. #include "slapi-plugin.h"
  13. #include "repl.h"
  14. /* module: provide an interface to the profile file */
  15. static FILE *profile_fd=NULL;
  16. /* JCMREPL - Could build up in an AVL tree and dump out to disk at the end... */
  17. void profile_log(char *file,int line)
  18. {
  19. if (profile_fd==NULL)
  20. slapi_log_error(,"profile_log: profile file not open.");
  21. else
  22. {
  23. /* JCMREPL - Probably need a lock around here */
  24. fprintf(profile_fd,"%s %d\n",file,line);
  25. }
  26. }
  27. void profile_open()
  28. {
  29. char filename[MAX_FILENAME];
  30. PR_snprintf(filename, MAX_FILENAME, "%s%s", CFG_rootpath, CFG_profilefile);
  31. profile_fd= textfile_open(filename,"a");
  32. }
  33. void profile_close()
  34. {
  35. if (profile_fd==NULL)
  36. slapi_log_error(SLAPI_LOG_ERROR, "repl_profile" ,"profile_close: profile file not open.");
  37. else
  38. textfile_close(profile_fd);
  39. }