main: Fix BMC system stuck when doing enumerate state after host shutdown

Root cause:
According original postd design, the postFd open without any file descriptor flag option.
This cause I/O operation on the postFd will waiting process on wait_event_interruptible() in LPC BPC driver.
To avoid this stuck symptom when Host shutdown, postd daemon need to use nonblocking read.

Solution:
Change open fd flag to O_NONBLOCK avoid this kind of system stuck symptom.

Tested:
Using RunBMC-Olympus platform to verify it. BTW, this issue is 100% repo.
1. Power ON Host by WebUI.
2. Shutdown Host by WebUI.
3. Execute enumerate curl or busctl command as below to query state.
   curl -b cjar -k https://${POLEG_IP}/xyz/openbmc_project/state/enumerate
   busctl get-property xyz.openbmc_project.State.Boot.Raw /xyz/openbmc_project/state/boot/raw xyz.openbmc_project.State.Boot.Raw Value
4. BMC system get enumerate state normally without stuck symptom when Host shutdown.

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: Ibcaee07443d773c25f8d127f927a307bb0cb78e4
1 file changed