/src/mongo/db/mongod.cpp

https://github.com/mongodb/mongo · C++ · 49 lines · 13 code · 3 blank · 33 comment · 0 complexity · e8226792caae031726bdf56c119eb2d8 MD5 · raw file

  1. /**
  2. * Copyright (C) 2020-present MongoDB, Inc.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the Server Side Public License, version 1,
  6. * as published by MongoDB, Inc.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * Server Side Public License for more details.
  12. *
  13. * You should have received a copy of the Server Side Public License
  14. * along with this program. If not, see
  15. * <http://www.mongodb.com/licensing/server-side-public-license>.
  16. *
  17. * As a special exception, the copyright holders give permission to link the
  18. * code of portions of this program with the OpenSSL library under certain
  19. * conditions as described in each individual source file and distribute
  20. * linked combinations including the program with the OpenSSL library. You
  21. * must comply with the Server Side Public License in all respects for
  22. * all of the code used other than as permitted herein. If you modify file(s)
  23. * with this exception, you may extend this exception to your version of the
  24. * file(s), but you are not obligated to do so. If you do not wish to do so,
  25. * delete this exception statement from your version. If you delete this
  26. * exception statement from all source files in the program, then also delete
  27. * it in the license file.
  28. */
  29. #include "mongo/platform/basic.h"
  30. #include "mongo/db/mongod_main.h"
  31. #include "mongo/util/quick_exit.h"
  32. #include "mongo/util/text.h"
  33. #if defined(_WIN32)
  34. // In Windows, wmain() is an alternate entry point for main(), and receives the same parameters
  35. // as main() but encoded in Windows Unicode (UTF-16); "wide" 16-bit wchar_t characters. The
  36. // WindowsCommandLine object converts these wide character strings to a UTF-8 coded equivalent
  37. // and makes them available through the argv() and envp() members. This enables mongoDbMain()
  38. // to process UTF-8 encoded arguments and environment variables without regard to platform.
  39. int wmain(int argc, wchar_t* argvW[]) {
  40. mongo::quickExit(mongo::mongod_main(argc, mongo::WindowsCommandLine(argc, argvW).argv()));
  41. }
  42. #else
  43. int main(int argc, char* argv[]) {
  44. mongo::quickExit(mongo::mongod_main(argc, argv));
  45. }
  46. #endif