Skip to content
This repository was archived by the owner on Dec 20, 2018. It is now read-only.

Comments

add logic for master to write a pidfile#40

Open
bahamas10 wants to merge 4 commits intoindutny:masterfrom
bahamas10:dave-pidfile
Open

add logic for master to write a pidfile#40
bahamas10 wants to merge 4 commits intoindutny:masterfrom
bahamas10:dave-pidfile

Conversation

@bahamas10
Copy link
Contributor

notes

I tried to place the logic in bud.c right above the call to uv_run but the ended up confused as to why there are 2 calls to uv_run... either way i've tested this and it seems to work as expected.

src/bud.c Outdated
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlink().

@indutny
Copy link
Owner

indutny commented Jun 15, 2014

Thank you very much for your contribution! Could you please fix some nits?

@bahamas10
Copy link
Contributor Author

definitely... i'll make the changes!

one question though: I was originally going to use open/write/close instead of fopen/fprintf/fclose, but I see based on the source code bud supports Windows. I thought the f* functions were meant to create a higher level abstraction for open/write/close on non-unixy systems? I could be wrong, as I've never done any Windows programming, but will open/write/close work as expected for Windows?

either way, I much prefer just using the syscalls directly... it's easier and simpler.

@indutny
Copy link
Owner

indutny commented Jun 15, 2014

Hm... I just thought that we could try using synchronous libuv API for this purpose :) Would you mind investigating this?

Also, is it happening in a right place right now? From what I see it seems that the worker's could overwrite master's pid file...

@bahamas10
Copy link
Contributor Author

I agree, the libuv API is probably the safest bet for cross-platfrom compatibility... i can figure that out... it's time i dug into libuv anyway :)

As far as I can tell, only the master will write the pid because of this check

if (!config->is_worker && config->pidfile != NULL) {
  // make pid file
}

@indutny
Copy link
Owner

indutny commented Jun 15, 2014

Ah, I see... Why not move this code to master.c then?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants