This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
int | pidfile_acquire (char *pidfile) |
void | pidfile_write_release (int pid_fd) |
void | pidfile_delete (char *pidfile) |
int pidfile_acquire | ( | char * | pidfile | ) |
Definition at line 32 of file pidfile.c.
Referenced by udhcp().
00033 { 00034 int pid_fd; 00035 if (pidfile == NULL) return -1; 00036 00037 pid_fd = open(pidfile, O_CREAT | O_WRONLY, 0644); 00038 if (pid_fd < 0) { 00039 LOG(LOG_ERR, "Unable to open pidfile %s: %s\n", 00040 pidfile, strerror(errno)); 00041 } else { 00042 lockf(pid_fd, F_LOCK, 0); 00043 } 00044 00045 return pid_fd; 00046 }
void pidfile_delete | ( | char * | pidfile | ) |
void pidfile_write_release | ( | int | pid_fd | ) |
Definition at line 49 of file pidfile.c.
Referenced by udhcp().
00050 { 00051 FILE *out; 00052 00053 if (pid_fd < 0) return; 00054 00055 if ((out = fdopen(pid_fd, "w")) != NULL) { 00056 fprintf(out, "%d\n", getpid()); 00057 fclose(out); 00058 } 00059 lockf(pid_fd, F_UNLCK, 0); 00060 close(pid_fd); 00061 }