-static int one_and_only(void)
-{
- char string[50];
- int lock_file;
-
- lock_file = open(UDEVD_LOCK, O_RDWR | O_CREAT, 0x640);
- if (lock_file < 0)
- return -1;
-
- /* see if we can lock */
- if (lockf(lock_file, F_TLOCK, 0) < 0) {
- dbg("file is already locked, exit");
- close(lock_file);
- return -1;
- }
-
- snprintf(string, sizeof(string), "%d\n", getpid());
- write(lock_file, string, strlen(string));
-
- return 0;
-}
-