Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial freebsd support #607

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

initial freebsd support #607

wants to merge 2 commits into from

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Dec 11, 2018

related to #606. This is initial support without packaging or documentation.
With this change it is possible build and run omiserver and use cli.

I'm able to run all tests.

./regress
 
##===================##
##                                            ##
## ALL TESTS PASSED!        ##
##                                            ##
##===================##
 

and this on my Azure machine

root@toweinfu-fbsd:/opt/omi-1.6.0 # sudo /opt/omi/bin/omicli ei root/omi OMI_Identify
instance of OMI_Identify
{
    [Key] InstanceID=2FDB5542-5896-45D5-9BE9-DC04430AAABE
    SystemName=toweinfu-fbsd
    ProductName=OMI
    ProductVendor=Microsoft
    ProductVersionMajor=1
    ProductVersionMinor=6
    ProductVersionRevision=0
    ProductVersionString=1.6.0-121
    Platform=FREEBSD_X86_64_GNU
    OperatingSystem=FREEBSD
    Architecture=X86_64
    Compiler=GNU
    ConfigPrefix=GNU
    ConfigLibDir=/opt/omi-1.6.0/lib
    ConfigBinDir=/opt/omi-1.6.0/bin
    ConfigIncludeDir=/opt/omi-1.6.0/include
    ConfigDataDir=/opt/omi-1.6.0/share
    ConfigLocalStateDir=/opt/omi-1.6.0/var
    ConfigSysConfDir=/opt/omi-1.6.0/etc
    ConfigProviderDir=/opt/omi-1.6.0/etc
    ConfigLogFile=/opt/omi-1.6.0/var/log/omiserver.log
    ConfigPIDFile=/opt/omi-1.6.0/var/run/omiserver.pid
    ConfigRegisterDir=/opt/omi-1.6.0/etc/omiregister
    ConfigSchemaDir=/opt/omi-1.6.0/share/omischema
    ConfigNameSpaces={interop, root-cimv2, root-omi, root-check}
}

@palladia
Copy link
Contributor

Please do not merge until given ok by Saroj or Ashok.

@wfurt
Copy link
Member Author

wfurt commented Dec 12, 2018

no, I won't @palladia. I don't have permissions. Who would be good person to talk to make this more polished? e.g. fix packaging and documentation. I tried to look around but I want to make sure it would meet expectation.

struct tm gmt;
struct tm local;

time_t now = time(NULL);
Copy link
Contributor

Choose a reason for hiding this comment

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

where is now use?

Copy link
Member Author

Choose a reason for hiding this comment

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

look at CPU_GetLocalTimestampz() @JumpingYang001. On Linux, timezone is extern long with offset to GMT. BSD does not have that. (or OSX/MacOS) Since I failed to figure out what we do for Mac, I simply calculate once difference between GMT and local.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, I found there is a char* timezone() function in FreeBSD.

I think OSX should use exist logic, I don't know much about how BSD dealt with it.
I just surprise the now variable here isn't used?
:)

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch. there were two lines missing - I probably somehow nuke them in final cleanup. I also add more comments. I hope the code makes more sense now.

Copy link
Contributor

Choose a reason for hiding this comment

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

In fact, we don't have verification for u.timestamp.utc in https://github.com/Microsoft/omi/blob/eb689db8a63de6e466f149cd80136de26c53b40c/Unix/tests/pal/test_pal.cpp#L1021 , if you can add one that would be nice, e.g. TEST_ASSERT(now.u.timestamp.utc>= "2018/12/12 00:00AM UTC"'s utc);, just an example that means it will be greater than a recent past utc time.

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if my condition is good, just a thought. :)

@JumpingYang001
Copy link
Contributor

@wfurt Saroj seems be in vacation today and tomorrow, he might be back next week, let's wait his comments, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants