profile.c 980 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. * END COPYRIGHT BLOCK **/
  6. #include "slapi-plugin.h"
  7. #include "repl.h"
  8. /* module: provide an interface to the profile file */
  9. static FILE *profile_fd=NULL;
  10. /* JCMREPL - Could build up in an AVL tree and dump out to disk at the end... */
  11. void profile_log(char *file,int line)
  12. {
  13. if (profile_fd==NULL)
  14. slapi_log_error(,"profile_log: profile file not open.");
  15. else
  16. {
  17. /* JCMREPL - Probably need a lock around here */
  18. fprintf(profile_fd,"%s %d\n",file,line);
  19. }
  20. }
  21. void profile_open()
  22. {
  23. char filename[MAX_FILENAME];
  24. PR_snprintf(filename, MAX_FILENAME, "%s%s", CFG_rootpath, CFG_profilefile);
  25. profile_fd= textfile_open(filename,"a");
  26. }
  27. void profile_close()
  28. {
  29. if (profile_fd==NULL)
  30. slapi_log_error(SLAPI_LOG_ERROR, "repl_profile" ,"profile_close: profile file not open.");
  31. else
  32. textfile_close(profile_fd);
  33. }