diff options
author | otis <otis@pkgsrc.org> | 2020-11-25 16:55:46 +0000 |
---|---|---|
committer | otis <otis@pkgsrc.org> | 2020-11-25 16:55:46 +0000 |
commit | 5758b165a7e370539d08cda51d484c17c774bfc3 (patch) | |
tree | 9669673f569793d763616830a825f754aef188c1 /net | |
parent | 9fec371b8aa1169e1fcdcc85612fb846b28113ee (diff) | |
download | pkgsrc-5758b165a7e370539d08cda51d484c17c774bfc3.tar.gz |
net: Add nats-server
NATS is a simple, secure and performant communications system for digital
systems, services and devices.
Diffstat (limited to 'net')
-rw-r--r-- | net/Makefile | 3 | ||||
-rw-r--r-- | net/nats-server/DESCR | 4 | ||||
-rw-r--r-- | net/nats-server/Makefile | 63 | ||||
-rw-r--r-- | net/nats-server/PLIST | 3 | ||||
-rw-r--r-- | net/nats-server/distinfo | 171 | ||||
-rw-r--r-- | net/nats-server/files/nats_server.sh | 83 | ||||
-rw-r--r-- | net/nats-server/files/smf/manifest.xml | 35 | ||||
-rw-r--r-- | net/nats-server/files/smf/nats-server.sh | 30 | ||||
-rw-r--r-- | net/nats-server/go-modules.mk | 43 | ||||
-rw-r--r-- | net/nats-server/patches/patch-server_pse_pse__netbsd.go | 95 |
10 files changed, 529 insertions, 1 deletions
diff --git a/net/Makefile b/net/Makefile index 0793293a483..e23fe4093f1 100644 --- a/net/Makefile +++ b/net/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.1362 2020/11/19 20:13:19 schmonz Exp $ +# $NetBSD: Makefile,v 1.1363 2020/11/25 16:55:46 otis Exp $ # COMMENT= Networking tools @@ -412,6 +412,7 @@ SUBDIR+= nanotodon SUBDIR+= nap SUBDIR+= napshare SUBDIR+= nasd +SUBDIR+= nats-server SUBDIR+= nbtscan SUBDIR+= ncdc SUBDIR+= ncftp3 diff --git a/net/nats-server/DESCR b/net/nats-server/DESCR new file mode 100644 index 00000000000..d14634b8358 --- /dev/null +++ b/net/nats-server/DESCR @@ -0,0 +1,4 @@ +NATS.io is a simple, secure and high performance open source messaging system +for cloud native applications, IoT messaging, and microservices architectures. + +WWW: https://nats.io/ diff --git a/net/nats-server/Makefile b/net/nats-server/Makefile new file mode 100644 index 00000000000..a2aaf3b4f85 --- /dev/null +++ b/net/nats-server/Makefile @@ -0,0 +1,63 @@ +# $NetBSD: Makefile,v 1.1 2020/11/25 16:55:46 otis Exp $ +# + +DISTNAME= nats-server-2.1.9 +CATEGORIES= net +MASTER_SITES= ${MASTER_SITE_GITHUB:=nats-io/} +GITHUB_TAG= v${PKGVERSION_NOREV} + +HOMEPAGE= https://nats.io/ +COMMENT= Simple, secure and high performance messaging system +LICENSE= apache-2.0 + +BUILD_DEFS+= VARBASE + +GO_BUILD_PATTERN= . + +NATS_USER= natssrv +NATS_GROUP= natssrv +NATS_HOMEDIR= ${VARBASE}/nats-server +NATS_LOGDIR= ${VARBASE}/log/nats-server +NATS_LOGFILE= ${NATS_LOGDIR}/nats-server.log + +CHECK_SSP_SKIP= bin/* + +.include "go-modules.mk" + +.include "../../mk/bsd.prefs.mk" + +PKG_GROUPS= ${NATS_GROUP} +PKG_USERS= ${NATS_USER}:${NATS_GROUP} + +PKG_HOME.${NATS_USER}= ${NATS_HOMEDIR} +PKG_GECOS.${NATS_USER}= nats.io server +PKG_SHELL.${NATS_USER}= /bin/sh + +RCD_SCRIPTS= nats_server +SMF_NAME= nats-server +SMF_METHODS= nats-server + +FILES_SUBST+= NATS_USER=${NATS_USER} +FILES_SUBST+= NATS_GROUP=${NATS_GROUP} +FILES_SUBST+= NATS_HOMEDIR=${NATS_HOMEDIR} +FILES_SUBST+= NATS_LOGDIR=${NATS_LOGDIR} +FILES_SUBST+= NATS_LOGFILE=${NATS_LOGFILE} +FILES_SUBST+= PKG_SYSCONFDIR=${PKG_SYSCONFDIR} + +EGDIR= ${PREFIX}/share/examples/nats-server +REQD_FILES_PERMS+= ${EGDIR}/nats-server.conf \ + ${PKG_SYSCONFDIR}/nats-server.conf \ + ${NATS_USER} ${NATS_GROUP} 0600 + +INSTALLATION_DIRS= bin ${EGDIR} + +OWN_DIRS_PERMS+= ${NATS_HOMEDIR} ${NATS_USER} ${NATS_GROUP} 0700 +MAKE_DIRS_PERMS+= ${NATS_LOGDIR} ${NATS_USER} ${NATS_GROUP} 0700 + +.include "../../lang/go/go-module.mk" + +post-install: + ${ECHO} "# Example config, see https://docs.nats.io/nats-server/configuration" > \ + ${DESTDIR}/${EGDIR}/nats-server.conf + +.include "../../mk/bsd.pkg.mk" diff --git a/net/nats-server/PLIST b/net/nats-server/PLIST new file mode 100644 index 00000000000..0d61ed3bffc --- /dev/null +++ b/net/nats-server/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2020/11/25 16:55:46 otis Exp $ +bin/nats-server +share/examples/nats-server/nats-server.conf diff --git a/net/nats-server/distinfo b/net/nats-server/distinfo new file mode 100644 index 00000000000..c56e4fee903 --- /dev/null +++ b/net/nats-server/distinfo @@ -0,0 +1,171 @@ +$NetBSD: distinfo,v 1.1 2020/11/25 16:55:46 otis Exp $ + +SHA1 (github.com_golang_protobuf_@v_v1.4.0-rc.1.0.20200221234624-67d41d38c208.mod) = 5851929d01ce9db142de96a2d5ec22c15454444c +RMD160 (github.com_golang_protobuf_@v_v1.4.0-rc.1.0.20200221234624-67d41d38c208.mod) = ccd1cb6926fdb5b8caec1825cf78366bb1d92111 +SHA512 (github.com_golang_protobuf_@v_v1.4.0-rc.1.0.20200221234624-67d41d38c208.mod) = 431b8d4756fe79e43cdc2f8478f3171ac9c90912222e50503301fc83d34c90001fb6ee0fee3bc05f66e47d657977395769e54efa0fb74ba35f34429cc0dac5c3 +Size (github.com_golang_protobuf_@v_v1.4.0-rc.1.0.20200221234624-67d41d38c208.mod) = 151 bytes +SHA1 (github.com_golang_protobuf_@v_v1.4.0-rc.1.mod) = f09a77634ed0e1b872a1300477acc6737187d02e +RMD160 (github.com_golang_protobuf_@v_v1.4.0-rc.1.mod) = b717d5301e18d7c7170cfdd5b15f29e13a672939 +SHA512 (github.com_golang_protobuf_@v_v1.4.0-rc.1.mod) = b6d7911148c590b3ce2a14a158cfbb94dd56dd402b3a4a2399adcd0421604f85d904244ddf5f8dba65326f04a7817d5652b30a306c65f44fd248ed269485a21c +Size (github.com_golang_protobuf_@v_v1.4.0-rc.1.mod) = 151 bytes +SHA1 (github.com_golang_protobuf_@v_v1.4.0-rc.2.mod) = 384ecc5dccf7a35804237fa6cec6f4895a882734 +RMD160 (github.com_golang_protobuf_@v_v1.4.0-rc.2.mod) = ff75f133ec8e08a94d57b819f522cc7ede0a1072 +SHA512 (github.com_golang_protobuf_@v_v1.4.0-rc.2.mod) = 2df7aaf6cb36a18165dc458a7b3f4158e2bce3bf10165418de401dd43e06d44378511dd4fea6530cb668a8ebb17b4c3f294ba35f5018e6aeb1b7b9082aac8a84 +Size (github.com_golang_protobuf_@v_v1.4.0-rc.2.mod) = 151 bytes +SHA1 (github.com_golang_protobuf_@v_v1.4.0-rc.4.0.20200313231945-b860323f09d0.mod) = 38b6d454d01b562129e91a51ed6318e1d4bbf9d3 +RMD160 (github.com_golang_protobuf_@v_v1.4.0-rc.4.0.20200313231945-b860323f09d0.mod) = 1d53aa71338f8367069dbd21dfc456c4459ec29b +SHA512 (github.com_golang_protobuf_@v_v1.4.0-rc.4.0.20200313231945-b860323f09d0.mod) = 4c9416c4777123a39b23b49ecf6265295fc3432de083a04dbefc87264b8c69f0d9e342ebb7e8e488f30c3efdc02951fd7dec23dfd1fef0802c8f0250f96612a8 +Size (github.com_golang_protobuf_@v_v1.4.0-rc.4.0.20200313231945-b860323f09d0.mod) = 154 bytes +SHA1 (github.com_golang_protobuf_@v_v1.4.0.mod) = f48171130b79dcd75608e985a7d0f57f1345b1b9 +RMD160 (github.com_golang_protobuf_@v_v1.4.0.mod) = ab63b86f05f017edbfa3e4e6e585abf4de12483f +SHA512 (github.com_golang_protobuf_@v_v1.4.0.mod) = acbd5afd399b3798d4b24529479b18523ae4009e21acde15a3893d2af75f9a6e65fcbd5a237423849003eb8903718eaa0b1aed9177c390972ab9490f3acc0d1f +Size (github.com_golang_protobuf_@v_v1.4.0.mod) = 124 bytes +SHA1 (github.com_golang_protobuf_@v_v1.4.0.zip) = be0ddf3c4726aafa55d85baef44a7adc56f13dd3 +RMD160 (github.com_golang_protobuf_@v_v1.4.0.zip) = ab25152465a2bac00c7186ef7f7658c9a57191ac +SHA512 (github.com_golang_protobuf_@v_v1.4.0.zip) = 4542c6a57361c255ab89d2330c1af61cd706edf82c02bc48854e6f4407911a1657151ecc286b774e25be93bef29d63d2f031a99e24ecdb212030bcb1dbf7b17d +Size (github.com_golang_protobuf_@v_v1.4.0.zip) = 205991 bytes +SHA1 (github.com_google_go-cmp_@v_v0.3.0.mod) = 2f0268915b7860bf12732e400f3a7f9b40e19595 +RMD160 (github.com_google_go-cmp_@v_v0.3.0.mod) = 09b7e40b474b2f0fc2a2a24dece1952eecb4b1e9 +SHA512 (github.com_google_go-cmp_@v_v0.3.0.mod) = 351dc24af135b9c9d714aadce40fe9fa1ec05a35a4df90af79926d5119c3f33a6510ab9d78243748d7dad10bd2178f47d342ea2389972b88d5e9b4be6dee7daa +Size (github.com_google_go-cmp_@v_v0.3.0.mod) = 40 bytes +SHA1 (github.com_google_go-cmp_@v_v0.3.1.mod) = 2f0268915b7860bf12732e400f3a7f9b40e19595 +RMD160 (github.com_google_go-cmp_@v_v0.3.1.mod) = 09b7e40b474b2f0fc2a2a24dece1952eecb4b1e9 +SHA512 (github.com_google_go-cmp_@v_v0.3.1.mod) = 351dc24af135b9c9d714aadce40fe9fa1ec05a35a4df90af79926d5119c3f33a6510ab9d78243748d7dad10bd2178f47d342ea2389972b88d5e9b4be6dee7daa +Size (github.com_google_go-cmp_@v_v0.3.1.mod) = 40 bytes +SHA1 (github.com_google_go-cmp_@v_v0.4.0.mod) = f9a657256aff69a869e33d0ad1d8ab6a9c3e03c2 +RMD160 (github.com_google_go-cmp_@v_v0.4.0.mod) = f1244a81d70c71d1ba3976f098001f3e3de6a11c +SHA512 (github.com_google_go-cmp_@v_v0.4.0.mod) = cb203760fc6ca9c9d64811cf1342752faa5a95f27934c298407dc865f9561081210dd1b82b15ee2f5337b70d4c55d102d8884b5b9a5f70d9cbf85227a32b9713 +Size (github.com_google_go-cmp_@v_v0.4.0.mod) = 105 bytes +SHA1 (github.com_google_go-cmp_@v_v0.4.0.zip) = c65191ecd07c2d25b3ee53b2c8e6f3bd12391272 +RMD160 (github.com_google_go-cmp_@v_v0.4.0.zip) = 8c6fbc05c880aee4105b83336c6d0b571cc9caa6 +SHA512 (github.com_google_go-cmp_@v_v0.4.0.zip) = bd13e72e46a82b149661a61dfc36dc6e0471dd4161f2291f301e871811e5b2a7976a49cf2af10eee1b7b2f6ad68583c240cba007ec163cea157f24bbe51d3b3a +Size (github.com_google_go-cmp_@v_v0.4.0.zip) = 105396 bytes +SHA1 (github.com_nats-io_jwt_@v_v0.3.2.mod) = 91b5b0783bbbcdb3693779dc9052e93e29dec18d +RMD160 (github.com_nats-io_jwt_@v_v0.3.2.mod) = 76d5bcec99a09828aa9529af2fde8486067317b5 +SHA512 (github.com_nats-io_jwt_@v_v0.3.2.mod) = 8745b75071b79f3dea777d3eec1e0f74cdefe5b202c8075994f7e68ba8e9bb87afb70d494fbf55944b12182d480da1c1f45c9f057c789b82ec2da81eff6079a2 +Size (github.com_nats-io_jwt_@v_v0.3.2.mod) = 71 bytes +SHA1 (github.com_nats-io_jwt_@v_v1.1.0.mod) = d4fff4e4581f0768d380d9cfcbc20356543f2164 +RMD160 (github.com_nats-io_jwt_@v_v1.1.0.mod) = b398ad013fe57f5db9b0688a4e0a430becbbb87e +SHA512 (github.com_nats-io_jwt_@v_v1.1.0.mod) = e6fda24ddc8e521bbecaa9d70a06f34cbb4f726bdbeeab84317b4f2252fcf04c5fc40beb9e46a251c62b291b2802c40e9f3864201f36bd876571dc21df905e2e +Size (github.com_nats-io_jwt_@v_v1.1.0.mod) = 80 bytes +SHA1 (github.com_nats-io_jwt_@v_v1.1.0.zip) = e98ecc218efa93b722633c1bed13de0a2dd36074 +RMD160 (github.com_nats-io_jwt_@v_v1.1.0.zip) = 2415710b06ce048dbbfd255e2c1c5400bc178bf5 +SHA512 (github.com_nats-io_jwt_@v_v1.1.0.zip) = 9e2452c182b1beb3a2ab64439e6449054e35edc7aae4aa9ca2393c7f625daf9fd3fd9c13516db08c90b224ba10be6439a552a7add2b6b165b4618b8fd4a631b9 +Size (github.com_nats-io_jwt_@v_v1.1.0.zip) = 59286 bytes +SHA1 (github.com_nats-io_nats.go_@v_v1.10.0.mod) = e7cf60ff2920c7bc23bed44ba2476a6f586bec10 +RMD160 (github.com_nats-io_nats.go_@v_v1.10.0.mod) = 913dc694e9db5c3e7b502b52473e41a90df0aac4 +SHA512 (github.com_nats-io_nats.go_@v_v1.10.0.mod) = a84f987c3aeff7b18712d2f29582c443e9af6613c94847a6391d75abba5b37671ab52353297ff34fdfcc73b65e8f1ed835ff127191e5f5577e59cd2930e22066 +Size (github.com_nats-io_nats.go_@v_v1.10.0.mod) = 143 bytes +SHA1 (github.com_nats-io_nats.go_@v_v1.10.0.zip) = 694654bcddb613eaf175e6f54f1b90b8a131be44 +RMD160 (github.com_nats-io_nats.go_@v_v1.10.0.zip) = d7fae5f6b1ea46ef727c38f345cd0b723776d444 +SHA512 (github.com_nats-io_nats.go_@v_v1.10.0.zip) = c03b53fb3358e1e0cbc505d0cd0beac510a59bb5cf0b4fb9fa8ce4050804c359e611e8fb4ae2c27ba5d670244264d44f283de862cc9db0438d4216872dff9adb +Size (github.com_nats-io_nats.go_@v_v1.10.0.zip) = 173393 bytes +SHA1 (github.com_nats-io_nkeys_@v_v0.1.3.mod) = 00efa27e8a602f64f625d1746f5543077596f6e2 +RMD160 (github.com_nats-io_nkeys_@v_v0.1.3.mod) = 0962cc2fe8769b114c183f6a98c99ed28888aad8 +SHA512 (github.com_nats-io_nkeys_@v_v0.1.3.mod) = eb91e385e6161b3bc7e3e2e337519c1435a368fd98a26880cb37f3d52bdaaf23d7b07e1c7430592d0c960050a08c3f94e0a18576da214e50fe7047f2324b0ea0 +Size (github.com_nats-io_nkeys_@v_v0.1.3.mod) = 96 bytes +SHA1 (github.com_nats-io_nkeys_@v_v0.1.4.mod) = c87f112335d78a75d4d7d9ca80f0afcf819e15e7 +RMD160 (github.com_nats-io_nkeys_@v_v0.1.4.mod) = 24e965cfbcda74860e2042bc478892b3d9f1eea6 +SHA512 (github.com_nats-io_nkeys_@v_v0.1.4.mod) = 6a4b76d2e2d62805d9a062710992543be0f4a8f00ec7741af392b0b1190aac7a358baf3eaefaa53f422b0bc70be991ffc7a9345a84c4b90f3f3b0f98c781f623 +Size (github.com_nats-io_nkeys_@v_v0.1.4.mod) = 96 bytes +SHA1 (github.com_nats-io_nkeys_@v_v0.1.4.zip) = 82c07b942777e57ef9e333c4259fa3065fe8d99e +RMD160 (github.com_nats-io_nkeys_@v_v0.1.4.zip) = 23ac270d799630e5025e71fcd5619c3e51c0856b +SHA512 (github.com_nats-io_nkeys_@v_v0.1.4.zip) = 46df7a386f010cfcb3f29bcb48c1c890cfa04deabfe475531cb841295c62b86a3e8a0b7f8784342b22470f42680215f746af6af7cbc207b174b3411ae298070f +Size (github.com_nats-io_nkeys_@v_v0.1.4.zip) = 25325 bytes +SHA1 (github.com_nats-io_nuid_@v_v1.0.1.mod) = 0f597e2ac4860dead31ccc759032cdfced744aca +RMD160 (github.com_nats-io_nuid_@v_v1.0.1.mod) = 0b2e605e5d517c72b962486475d0ac583403da98 +SHA512 (github.com_nats-io_nuid_@v_v1.0.1.mod) = 918b829894cfd626c011f7ff13934a2c1c12c3482ed61652ec2c59f5b94a0e8c8510e3bef4f5cbfae977df177f8eb9a123738d7382a6a6e2f8cc582d50eb10c9 +Size (github.com_nats-io_nuid_@v_v1.0.1.mod) = 31 bytes +SHA1 (github.com_nats-io_nuid_@v_v1.0.1.zip) = 5a281f3ae3d008c7484a29538c48107d8cc7595d +RMD160 (github.com_nats-io_nuid_@v_v1.0.1.zip) = f107c228aa1042e14b2da12637befe61f98cc1bb +SHA512 (github.com_nats-io_nuid_@v_v1.0.1.zip) = cc4067a1094494f168b72cc174ded31b29dfa044eac0c86c4993938561d63b7319cf2e47154c7c62afe96efbba6468bb495c0a00990d3ad2a075167e135469c5 +Size (github.com_nats-io_nuid_@v_v1.0.1.zip) = 10281 bytes +SHA1 (golang.org_x_crypto_@v_v0.0.0-20190308221718-c2843e01d9a2.mod) = c3e39c7d2e068f84aa5bea52adee1b947b7172ef +RMD160 (golang.org_x_crypto_@v_v0.0.0-20190308221718-c2843e01d9a2.mod) = 183c918cefe501fad260e58e749108493fd09855 +SHA512 (golang.org_x_crypto_@v_v0.0.0-20190308221718-c2843e01d9a2.mod) = 2df49895053b36fed7ea905aa73f86568fbafd79ff0a7976679d8c77cf15025129435d9dbfd89367b611b1aadbea4f4bd1835eb4efa9ea702466e443638d379e +Size (golang.org_x_crypto_@v_v0.0.0-20190308221718-c2843e01d9a2.mod) = 88 bytes +SHA1 (golang.org_x_crypto_@v_v0.0.0-20190701094942-4def268fd1a4.mod) = bf62c0db434e5f8e36e718adbf545c12a7e5022d +RMD160 (golang.org_x_crypto_@v_v0.0.0-20190701094942-4def268fd1a4.mod) = 710cff58e3b0974d2133ccdc7d91d47fda16b370 +SHA512 (golang.org_x_crypto_@v_v0.0.0-20190701094942-4def268fd1a4.mod) = f40c7b620b28b5bdc6ce92d43768af71b5869e7f0eb7872dd0f2751eed2bd15a17f7af26bf2dc5c6f7e6b816a174d010bfd22b3f8f5dd72f22dc4e4357dea842 +Size (golang.org_x_crypto_@v_v0.0.0-20190701094942-4def268fd1a4.mod) = 146 bytes +SHA1 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.mod) = 7130b95a0c17fc1a34b248ae15d9aaa1471a06a7 +RMD160 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.mod) = ab71ec9e86e79de9b3838603bd85aa6ae86a19df +SHA512 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.mod) = 7c5a755a03063d47d259fda0a6c2faa63c2f30b98dbac583e106aaa817d6cde3e07551e0b5e08f3a25db4c4ca45a23cebe993ae6f3d39c88deeaf2c7d8086a06 +Size (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.mod) = 155 bytes +SHA1 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.zip) = 4627dc5f44859459089cbd25e087b1c595af245c +RMD160 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.zip) = 09a0dbea1ba051670322619e2433f36eed9cc944 +SHA512 (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.zip) = aa3d172a5c0d759ef698bf10ee48c231d3dc981c5f22f5e4755a2dc36596bdd2cd78891bb45c91aecb44380560e11c318d1de2c26e72650947449b335ae4b177 +Size (golang.org_x_crypto_@v_v0.0.0-20200323165209-0ec3e9974c59.zip) = 1872460 bytes +SHA1 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.mod) = 6ef6a99d81892498abd5503dbb2b07c0ae1bc68d +RMD160 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.mod) = afd75680a7f105a82833b8ce7c412fd2c478ff29 +SHA512 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.mod) = 26b6c92eecd2208967336d4d23f8a71f77f9a73643ad1e5cd84dee36b2f626fffc806e4dd33acc284831a0961e2b363d898a747903235945fbfb665c5b4d5ef2 +Size (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.mod) = 119 bytes +SHA1 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.zip) = e11950aa16878d4d151f72e4944540533d629914 +RMD160 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.zip) = 87f82c0cab1b8297d2d57c1e0ed70ad376c81a5c +SHA512 (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.zip) = 0d740cd05300d902cf60f54692cbdf91758457ac21a66738beac133b3a31930b3833b10978750efb59450d75f0b750985e28218d04e1d8e3e68c4c883fadab58 +Size (golang.org_x_net_@v_v0.0.0-20190404232315-eb5bcb51f2a3.zip) = 1277629 bytes +SHA1 (golang.org_x_sys_@v_v0.0.0-20190215142949-d0b11bdaac8a.mod) = 536a84fdba3fc4d815d54fbe7255aa493fbd3ecb +RMD160 (golang.org_x_sys_@v_v0.0.0-20190215142949-d0b11bdaac8a.mod) = d0b39e9f156ac4a72364d57c54e08d92f91000c0 +SHA512 (golang.org_x_sys_@v_v0.0.0-20190215142949-d0b11bdaac8a.mod) = ffe50fccf7f1d200f2ebc805b190e3f10c5a3184458a38f4590e520d7ce115e1520fbabe56651bbdc2e08da4a8db5ac86d0e88728efde3ab26c64ab4e0cd604c +Size (golang.org_x_sys_@v_v0.0.0-20190215142949-d0b11bdaac8a.mod) = 24 bytes +SHA1 (golang.org_x_sys_@v_v0.0.0-20190412213103-97732733099d.mod) = 9c0a67f5f608966214879bdc8263f4927cb8da2f +RMD160 (golang.org_x_sys_@v_v0.0.0-20190412213103-97732733099d.mod) = 470ffe5252fd7913930e210baaa374da49776819 +SHA512 (golang.org_x_sys_@v_v0.0.0-20190412213103-97732733099d.mod) = 0c7b940d567c7685dcb55c76c69aedeaab2170f4f3bde458994c879bf344169f34fb3f3ca899b0f138a8b0b8be5031217b57a6edf5980e6066ff5cb92d1ff9ab +Size (golang.org_x_sys_@v_v0.0.0-20190412213103-97732733099d.mod) = 33 bytes +SHA1 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.mod) = 9c0a67f5f608966214879bdc8263f4927cb8da2f +RMD160 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.mod) = 470ffe5252fd7913930e210baaa374da49776819 +SHA512 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.mod) = 0c7b940d567c7685dcb55c76c69aedeaab2170f4f3bde458994c879bf344169f34fb3f3ca899b0f138a8b0b8be5031217b57a6edf5980e6066ff5cb92d1ff9ab +Size (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.mod) = 33 bytes +SHA1 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.zip) = fed1b18f0903ccc3daa9254115611acf7fcb5250 +RMD160 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.zip) = ec1beb2aa34c0f60379ee67c6828530229c538d0 +SHA512 (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.zip) = 04d07f2b5b2d75e94442b0b80adad5770eff5191b75de8baf0b864c9d03cf6d28f462d190ff9a2df88dea1405cdf88a6f1bf22361efefde0162429da3e344b7c +Size (golang.org_x_sys_@v_v0.0.0-20190726091711-fc99dfbffb4e.zip) = 1817676 bytes +SHA1 (golang.org_x_text_@v_v0.3.0.mod) = f3a33d4b075f49232516e483aeb74d4015994c88 +RMD160 (golang.org_x_text_@v_v0.3.0.mod) = 2954886f81bdca9d743aac213cd223e1ec7f8484 +SHA512 (golang.org_x_text_@v_v0.3.0.mod) = ca081ef7cccd7bbedc6843fbe0c452352661a07e1298cd02ff338ed79d807c6401d613a3cf20011189d2f98a794ffa410547b3e352eb58a6f0a84822285d391d +Size (golang.org_x_text_@v_v0.3.0.mod) = 25 bytes +SHA1 (golang.org_x_text_@v_v0.3.0.zip) = 6d55d1ba31d50719f91c77cd1fe44553f9ce07e0 +RMD160 (golang.org_x_text_@v_v0.3.0.zip) = 6e5ab0fad42b4bac5d765044b4d03aae57aaf7bd +SHA512 (golang.org_x_text_@v_v0.3.0.zip) = 982d78f580a7eac99a0c51e6f1fd2b2c3b91f56cd5e2b96fe960510049f7daf5915264f73f55f05675eee232a52998f9667fa84a9ccba15ed7819e4c93f583a7 +Size (golang.org_x_text_@v_v0.3.0.zip) = 6349244 bytes +SHA1 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.mod) = 8d7e758a07d4abc4637100ab62d3e41c1b87b79d +RMD160 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.mod) = 5199856d86a07427d7c628e06cb792a3f6ab4f08 +SHA512 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.mod) = 659d18a7a3a1be45ff6dc9e7475276b82ee7f11c47d39b0c237d7f872836a1dbdfff0902f21d6cd8093663997865da92e3e5a4acf1ad6129f972dc5e667b4f05 +Size (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.mod) = 37 bytes +SHA1 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.zip) = cc1f425bcc19975e37e63c8ba2e5fc5a65a8ce86 +RMD160 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.zip) = e7275418034649024d09edcc76799b6bcc11657b +SHA512 (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.zip) = c72b8b73f89624889a2874c1b2445cb82f0e545fccf6a7761a278f3f659eb19f5f1c8585641b8f89f2bcfc3817ad2c0e267751cfeeab949e287e43af5df57e28 +Size (golang.org_x_xerrors_@v_v0.0.0-20191204190536-9bdfabe68543.zip) = 22282 bytes +SHA1 (google.golang.org_protobuf_@v_v0.0.0-20200109180630-ec00e32a8dfd.mod) = f84f515934a2a6c0e9d99132dc0f5471e89c3a80 +RMD160 (google.golang.org_protobuf_@v_v0.0.0-20200109180630-ec00e32a8dfd.mod) = e12ee6acf0c2a80b46d98419e6d04380a8442cc5 +SHA512 (google.golang.org_protobuf_@v_v0.0.0-20200109180630-ec00e32a8dfd.mod) = 3cb3393e78f44d9de80074244756d5e309d19adca15e8313a392b925a687edad46e93c612da1539dc09d0c0072a063eede6f04fbd9e5671059e9857da0f7b1e6 +Size (google.golang.org_protobuf_@v_v0.0.0-20200109180630-ec00e32a8dfd.mod) = 83 bytes +SHA1 (google.golang.org_protobuf_@v_v0.0.0-20200221191635-4d8936d0db64.mod) = 04352f5c6df5b8aa6734d52655d3d4754a187dbb +RMD160 (google.golang.org_protobuf_@v_v0.0.0-20200221191635-4d8936d0db64.mod) = 480a110fe45220f85f756820964e9a5453ae5bd3 +SHA512 (google.golang.org_protobuf_@v_v0.0.0-20200221191635-4d8936d0db64.mod) = bf45db2ba4ae10b447c471118551d337125d5432142f5aa4ba964054d09393730c23373e42eb34574ca93f9b1a12364669be13ba7faa7d9908cacb982984d414 +Size (google.golang.org_protobuf_@v_v0.0.0-20200221191635-4d8936d0db64.mod) = 128 bytes +SHA1 (google.golang.org_protobuf_@v_v0.0.0-20200228230310-ab0ca4ff8a60.mod) = af6756f18b010d6e9998ecb2de00ac50254850e5 +RMD160 (google.golang.org_protobuf_@v_v0.0.0-20200228230310-ab0ca4ff8a60.mod) = 7f05fb2d1795c8f9bb240a27086f7e075b795245 +SHA512 (google.golang.org_protobuf_@v_v0.0.0-20200228230310-ab0ca4ff8a60.mod) = 7d00ab108b35ba41ed8c6ad54533bbbd967e0cdf39e62cb8914c0c6e4a531c779a28ea3fb2a4a7f6f4af7f3c922246a8d8ec8eabb779758245cedbebfdd97378 +Size (google.golang.org_protobuf_@v_v0.0.0-20200228230310-ab0ca4ff8a60.mod) = 158 bytes +SHA1 (google.golang.org_protobuf_@v_v1.20.1-0.20200309200217-e05f789c0967.mod) = d634146057aec00c85b5206461ae451ba58dd586 +RMD160 (google.golang.org_protobuf_@v_v1.20.1-0.20200309200217-e05f789c0967.mod) = 2da00d91a335f79a8344aee85559b7c8c3e0aa19 +SHA512 (google.golang.org_protobuf_@v_v1.20.1-0.20200309200217-e05f789c0967.mod) = 802c0df5ed11f0bb2e221c01152c6339d3634068f89aac760654411884e6b936b031cbfabad57c5add340f9d504edfcd683c77cb0ba7d753e06bc604095257ce +Size (google.golang.org_protobuf_@v_v1.20.1-0.20200309200217-e05f789c0967.mod) = 128 bytes +SHA1 (google.golang.org_protobuf_@v_v1.21.0.mod) = 7123863e67368ab67f1ab4f383b1ae93b70a5f65 +RMD160 (google.golang.org_protobuf_@v_v1.21.0.mod) = 80ae41902e42b2ed32d538dd66407cd56b209798 +SHA512 (google.golang.org_protobuf_@v_v1.21.0.mod) = 4797f4305d5b0159aba0825c0432cc5678cb74e55cd95eb5c42e9879a62db5aefa76c6286a436aee9a31b096193e8a3bc2e67175f0296c9d5eca3d03e98ab2d9 +Size (google.golang.org_protobuf_@v_v1.21.0.mod) = 158 bytes +SHA1 (google.golang.org_protobuf_@v_v1.22.0.mod) = 403a8dce3e237f10fd98860055d5d511fae677d8 +RMD160 (google.golang.org_protobuf_@v_v1.22.0.mod) = f935435eac4dcecb0b1671fac4b6ba1bc342edde +SHA512 (google.golang.org_protobuf_@v_v1.22.0.mod) = dab1668079153e90bea3913c9aae022543d17d61e275e3d0e2ba7dfda3dd8f82642bcfd1e4d4add2b8f4fed342efd66ee6c7d7fe1e65e67e4e62f2d0ffd2387c +Size (google.golang.org_protobuf_@v_v1.22.0.mod) = 123 bytes +SHA1 (google.golang.org_protobuf_@v_v1.22.0.zip) = 0911c9c920a55a86d9a380198f52ce7b057bace1 +RMD160 (google.golang.org_protobuf_@v_v1.22.0.zip) = 10881d431a6597637c41580fec8519ae6bc9ee8f +SHA512 (google.golang.org_protobuf_@v_v1.22.0.zip) = b2f953c416fd7a690e3ac21f69ecab9c5edd8cf18fafbb7db4cddf530dd8d0f95d287ee88a4a7c32405db52a8e22d1b2fb6e7a1de03d7f3159a19cb53959dc42 +Size (google.golang.org_protobuf_@v_v1.22.0.zip) = 1489452 bytes +SHA1 (nats-server-2.1.9.tar.gz) = 4f55c75544605ad6abec12ebae8ce39363b4dc6f +RMD160 (nats-server-2.1.9.tar.gz) = 07fefef00925d7be6752260dd00979f38d4804b1 +SHA512 (nats-server-2.1.9.tar.gz) = 41ce9ea00f72630764074b2957b1e8af1937390f87059b4882b4072d7397e5315e3b187e60ee8ea08b8ddb1bdf3d8e7d191b1ca17849d4b981b3a6d71cad0139 +Size (nats-server-2.1.9.tar.gz) = 969583 bytes +SHA1 (patch-server_pse_pse__netbsd.go) = 9f69352a0a6f976e51488d4693bc7701dd551506 diff --git a/net/nats-server/files/nats_server.sh b/net/nats-server/files/nats_server.sh new file mode 100644 index 00000000000..c452acca406 --- /dev/null +++ b/net/nats-server/files/nats_server.sh @@ -0,0 +1,83 @@ +#!@RCD_SCRIPTS_SHELL@ +# +# $NetBSD: nats_server.sh,v 1.1 2020/11/25 16:55:46 otis Exp $ +# +# PROVIDE: nats_server +# REQUIRE: DAEMON LOGIN mountall network +# KEYWORD: shutdown +# +# You will need to set some variables in /etc/rc.conf to start nats-server: +# +# nats_server=YES +# +# The following variables are optional: +# +# nats_server_config="/path/to/nats-server.conf" +# path to nats-server config file +# default: +# @PKG_SYSCONFDIR@/nats-server.conf +# nats_server_pidfile="/path/to/p.pid" path to nats-server PID file +# default: +# @NATS_HOMEDIR@/nats-server.pid +# nats_server_logfile="/path/to/p.log" path to nats-server log file +# default: +# @NATS_LOGFILE@ +# nats_server_user="natssrv" the username for nats-server daemon +# nats_server_group="natssrv" the group for nats-server daemon + +if [ -f /etc/rc.subr ]; then + . /etc/rc.subr +fi + +name="nats_server" +rcvar="nats_server" +command="@PREFIX@/bin/nats-server" +: ${nats_server_config:="@PKG_SYSCONFDIR@/nats-server.conf"} +: ${nats_server_pidfile:="@NATS_HOMEDIR@/nats-server.pid"} +: ${nats_server_logfile:="@NATS_LOGFILE@"} +: ${nats_server_user:="natssrv"} +: ${nats_server_group:="natssrv"} + +start_cmd="natssrv_start" +stop_cmd="natssrv_stop" + +natssrv_start() +{ + @ECHO@ "Starting ${name}." + ulimit -n 10240 + cd @NATS_HOMEDIR@ + /usr/bin/su ${nats_server_user}:${nats_server_group} \ + -c "${command} -P ${nats_server_pidfile} \ + -l ${nats_server_logfile} -c ${nats_server_config} &" +} + +natssrv_stop() +{ + local pidfile + + pidfile="${nats_server_pidfile}" + if [ -r "${pidfile}" ]; then + echo "Stopping ${name}." + kill `/bin/cat ${pidfile}` + /bin/rm "${pidfile}" + fi +} + +if [ -f /etc/rc.subr -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then + load_rc_config $name + pidfile="${nats_server_pidfile}" + run_rc_command "$1" +else + if [ -f /etc/rc.conf ]; then + . /etc/rc.conf + fi + pidfile="${nats_server_pidfile}" + case "$1" in + stop) + natssrv_stop + ;; + *) + eval ${start_cmd} + ;; + esac +fi diff --git a/net/nats-server/files/smf/manifest.xml b/net/nats-server/files/smf/manifest.xml new file mode 100644 index 00000000000..2096f866dae --- /dev/null +++ b/net/nats-server/files/smf/manifest.xml @@ -0,0 +1,35 @@ +<?xml version='1.0'?> +<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'> +<service_bundle type='manifest' name='@SMF_NAME@'> + <service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'> + <create_default_instance enabled='false' /> + <single_instance /> + <dependency name='fs' grouping='require_all' restart_on='none' type='service'> + <service_fmri value='svc:/system/filesystem/local' /> + </dependency> + <dependency name='net' grouping='require_all' restart_on='none' type='service'> + <service_fmri value='svc:/network/loopback' /> + </dependency> + <dependency name='config' grouping='require_all' restart_on='none' type='path'> + <service_fmri value='file://@PKG_SYSCONFDIR@/nats-server.conf' /> + </dependency> + <method_context working_directory='@VARBASE@/nats-server'> + <method_credential user='@NATS_USER@' group='@NATS_GROUP@' /> + <method_environment> + <envvar name='LD_PRELOAD_32' value='/usr/lib/extendedFILE.so.1' /> + </method_environment> + </method_context> + <exec_method name='start' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.nats-server@ start' timeout_seconds='0' /> + <exec_method name='stop' type='method' exec='@PREFIX@/@SMF_METHOD_FILE.nats-server@ stop' timeout_seconds='0' /> + <stability value='Evolving' /> + <template> + <common_name> + <loctext xml:lang='C'>nats.io messaging server</loctext> + </common_name> + <documentation> + <manpage title='NATS' section='1' /> + <doc_link name='nats.io' uri='https://nats.io/' /> + </documentation> + </template> + </service> +</service_bundle> diff --git a/net/nats-server/files/smf/nats-server.sh b/net/nats-server/files/smf/nats-server.sh new file mode 100644 index 00000000000..9df7d50ecae --- /dev/null +++ b/net/nats-server/files/smf/nats-server.sh @@ -0,0 +1,30 @@ +#!@SMF_METHOD_SHELL@ +# +# $NetBSD: nats-server.sh,v 1.1 2020/11/25 16:55:47 otis Exp $ +# +# Init script for nats-server +# + +. /lib/svc/share/smf_include.sh + +PIDFILE="@NATS_HOMEDIR@/nats-server.pid" +LOGFILE="@NATS_LOGFILE@" +CONFIGFILE="@PKG_SYSCONFDIR@/nats-server.conf" + +ulimit -n 10240 + +case "$1" in +start) + @PREFIX@/bin/nats-server -P ${PIDFILE} \ + -l ${LOGFILE} -c ${CONFIGFILE} & + ;; +stop) + [ -f ${PIDFILE} ] && kill `@HEAD@ -1 ${PIDFILE}` + ;; +*) + echo "Usage: $0 {start|stop}" >&2 + exit 1 + ;; +esac + +exit $SMF_EXIT_OK diff --git a/net/nats-server/go-modules.mk b/net/nats-server/go-modules.mk new file mode 100644 index 00000000000..e75172396df --- /dev/null +++ b/net/nats-server/go-modules.mk @@ -0,0 +1,43 @@ +# $NetBSD: go-modules.mk,v 1.1 2020/11/25 16:55:46 otis Exp $ + +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0-rc.1.0.20200221234624-67d41d38c208.mod +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0-rc.1.mod +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0-rc.2.mod +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0-rc.4.0.20200313231945-b860323f09d0.mod +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0.mod +GO_MODULE_FILES+= github.com/golang/protobuf/@v/v1.4.0.zip +GO_MODULE_FILES+= github.com/google/go-cmp/@v/v0.3.0.mod +GO_MODULE_FILES+= github.com/google/go-cmp/@v/v0.3.1.mod +GO_MODULE_FILES+= github.com/google/go-cmp/@v/v0.4.0.mod +GO_MODULE_FILES+= github.com/google/go-cmp/@v/v0.4.0.zip +GO_MODULE_FILES+= github.com/nats-io/jwt/@v/v0.3.2.mod +GO_MODULE_FILES+= github.com/nats-io/jwt/@v/v1.1.0.mod +GO_MODULE_FILES+= github.com/nats-io/jwt/@v/v1.1.0.zip +GO_MODULE_FILES+= github.com/nats-io/nats.go/@v/v1.10.0.mod +GO_MODULE_FILES+= github.com/nats-io/nats.go/@v/v1.10.0.zip +GO_MODULE_FILES+= github.com/nats-io/nkeys/@v/v0.1.3.mod +GO_MODULE_FILES+= github.com/nats-io/nkeys/@v/v0.1.4.mod +GO_MODULE_FILES+= github.com/nats-io/nkeys/@v/v0.1.4.zip +GO_MODULE_FILES+= github.com/nats-io/nuid/@v/v1.0.1.mod +GO_MODULE_FILES+= github.com/nats-io/nuid/@v/v1.0.1.zip +GO_MODULE_FILES+= golang.org/x/crypto/@v/v0.0.0-20190308221718-c2843e01d9a2.mod +GO_MODULE_FILES+= golang.org/x/crypto/@v/v0.0.0-20190701094942-4def268fd1a4.mod +GO_MODULE_FILES+= golang.org/x/crypto/@v/v0.0.0-20200323165209-0ec3e9974c59.mod +GO_MODULE_FILES+= golang.org/x/crypto/@v/v0.0.0-20200323165209-0ec3e9974c59.zip +GO_MODULE_FILES+= golang.org/x/net/@v/v0.0.0-20190404232315-eb5bcb51f2a3.mod +GO_MODULE_FILES+= golang.org/x/net/@v/v0.0.0-20190404232315-eb5bcb51f2a3.zip +GO_MODULE_FILES+= golang.org/x/sys/@v/v0.0.0-20190215142949-d0b11bdaac8a.mod +GO_MODULE_FILES+= golang.org/x/sys/@v/v0.0.0-20190412213103-97732733099d.mod +GO_MODULE_FILES+= golang.org/x/sys/@v/v0.0.0-20190726091711-fc99dfbffb4e.mod +GO_MODULE_FILES+= golang.org/x/sys/@v/v0.0.0-20190726091711-fc99dfbffb4e.zip +GO_MODULE_FILES+= golang.org/x/text/@v/v0.3.0.mod +GO_MODULE_FILES+= golang.org/x/text/@v/v0.3.0.zip +GO_MODULE_FILES+= golang.org/x/xerrors/@v/v0.0.0-20191204190536-9bdfabe68543.mod +GO_MODULE_FILES+= golang.org/x/xerrors/@v/v0.0.0-20191204190536-9bdfabe68543.zip +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v0.0.0-20200109180630-ec00e32a8dfd.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v0.0.0-20200221191635-4d8936d0db64.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v0.0.0-20200228230310-ab0ca4ff8a60.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v1.20.1-0.20200309200217-e05f789c0967.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v1.21.0.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v1.22.0.mod +GO_MODULE_FILES+= google.golang.org/protobuf/@v/v1.22.0.zip diff --git a/net/nats-server/patches/patch-server_pse_pse__netbsd.go b/net/nats-server/patches/patch-server_pse_pse__netbsd.go new file mode 100644 index 00000000000..b476ddb5c5c --- /dev/null +++ b/net/nats-server/patches/patch-server_pse_pse__netbsd.go @@ -0,0 +1,95 @@ +$NetBSD: patch-server_pse_pse__netbsd.go,v 1.1 2020/11/25 16:55:47 otis Exp $ + +Implement NetBSD specific functions. + +--- server/pse/pse_netbsd.go.orig 2020-10-12 21:03:54.012750981 +0000 ++++ server/pse/pse_netbsd.go +@@ -0,0 +1,88 @@ ++// +build netbsd ++// Copyright 2015-2018 The NATS Authors ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++// ++// NetBSD support (c) 2020 Juraj Lutter <otis@NetBSD.org> ++ ++package pse ++ ++/* ++#include <sys/types.h> ++#include <sys/sysctl.h> ++#include <errno.h> ++#include <stddef.h> ++#include <unistd.h> ++ ++long pagetok(long size) ++{ ++ int pageshift, pagesize; ++ ++ pagesize = getpagesize(); ++ pageshift = 0; ++ ++ while (pagesize > 1) { ++ pageshift++; ++ pagesize >>= 1; ++ } ++ ++ return (size << pageshift); ++} ++ ++int getusage(double *pcpu, unsigned int *rss, unsigned int *vss) ++{ ++ int mib[6], ret; ++ size_t len; ++ struct kinfo_proc2 kp; ++ ++ mib[0] = CTL_KERN; ++ mib[1] = KERN_PROC2; ++ mib[2] = KERN_PROC_PID; ++ mib[3] = getpid(); ++ mib[4] = sizeof(kp); ++ mib[5] = 1; ++ ++ len = sizeof(kp); ++ ret = sysctl(mib, 6, &kp, &len, NULL, 0); ++ if (ret != 0) { ++ return (errno); ++ } ++ ++ *rss = pagetok(kp.p_vm_rssize); ++ *vss = kp.p_vm_vsize; ++ *pcpu = kp.p_pctcpu; ++ ++ return 0; ++} ++ ++*/ ++import "C" ++ ++import ( ++ "syscall" ++) ++ ++// This is a placeholder for now. ++func ProcUsage(pcpu *float64, rss, vss *int64) error { ++ var r, v C.uint ++ var c C.double ++ ++ if ret := C.getusage(&c, &r, &v); ret != 0 { ++ return syscall.Errno(ret) ++ } ++ ++ *pcpu = float64(c) ++ *rss = int64(r) ++ *vss = int64(v) ++ ++ return nil ++} |