diff --git a/misc/nacl/README b/misc/nacl/README deleted file mode 100644 index 179e526d89..0000000000 --- a/misc/nacl/README +++ /dev/null @@ -1,121 +0,0 @@ -Native Client -============= - -This document outlines the basics of building and developing the Go runtime and -programs in the Native Client (NaCl) environment. - -Go 1.3 supports three architectures - - * nacl/386 which is standard 386. - * nacl/amd64p32 which is a 64 bit architecture, where the address space is - limited to a 4gb window. - * nacl/arm which is 32-bit ARMv7A architecture with 1GB address space. - -For background it is recommended that you read https://golang.org/s/go13nacl. - -Prerequisites -------------- - -Native Client programs are executed inside a sandbox, the NaCl runtime. This -runtime must be installed before you can use NaCl programs. - -The NaCl distribution comes with an installer which ensures you have access to -the latest version of the runtime. The version tracks the Chrome numbering -scheme. - -# Download NaCl - -Download nacl_sdk.zip file from - https://developer.chrome.com/native-client/sdk/download -and unpack it. I chose /opt/nacl_sdk. - -# Update - -The zip file contains a small skeleton that can be used to download the correct -sdk. These are released every 6-8 weeks, in line with Chrome releases. - - % cd /opt/nacl_sdk - % ./naclsdk update - -At this time pepper_49 is the stable version. The NaCl port needs at least pepper_39 -to work. If naclsdk downloads a later version, please adjust accordingly. - -The cmd/go helper scripts expect that the loaders sel_ldr_{x86_{32,64},arm} and -nacl_helper_bootstrap_arm are in your path. I find it easiest to make a symlink -from the NaCl distribution to my $GOPATH/bin directory. - - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_x86_32 $GOPATH/bin/sel_ldr_x86_32 - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_x86_64 $GOPATH/bin/sel_ldr_x86_64 - % ln -nfs /opt/nacl_sdk/pepper_39/tools/sel_ldr_arm $GOPATH/bin/sel_ldr_arm - -Additionally, for NaCl/ARM only: - - % ln -nfs /opt/nacl_sdk/pepper_39/tools/nacl_helper_bootstrap_arm $GOPATH/bin/nacl_helper_bootstrap_arm - -Support scripts ---------------- - -Symlink the two scripts in this directory into your $PATH, just as you did with -NaCl sdk above. - - % ln -nfs $GOROOT/misc/nacl/go_nacl_amd64p32_exec $GOPATH/bin/go_nacl_amd64p32_exec - % ln -nfs $GOROOT/misc/nacl/go_nacl_386_exec $GOPATH/bin/go_nacl_386_exec - % ln -nfs $GOROOT/misc/nacl/go_nacl_arm_exec $GOPATH/bin/go_nacl_arm_exec - -Building and testing --------------------- - -Building for NaCl is similar to cross compiling for other platforms. However, -as it is not possible to ever build in a `native` NaCl environment, the cmd/go -tool has been enhanced to allow the full build, all.bash, to be executed, -rather than just the compile stage, make.bash. - -The cmd/go tool knows that if GOOS is set to `nacl` it should not try to -execute any binaries itself. Instead it passes their execution to a support -script which sets up a Native Client environment and invokes the NaCl sandbox. - -The script's name has a special format, go_$GOOS_$GOARCH_exec, so cmd/go can -find it. - -In short, if the support scripts are in place, the cmd/go tool can be used as -per normal. - -# Build and test Go for NaCl - -NaCl does not permit direct file system access. Instead, package syscall -provides a simulated file system served by in-memory data. The script -nacltest.bash is the NaCl equivalent of all.bash. It builds NaCl with an -in-memory file system containing files needed for tests, and then it runs the -tests. - - % cd go/src - % env GOARCH=amd64p32 ./nacltest.bash - -Debugging ---------- - -Assuming that you have built nacl/amd64p32 binary ./mybin and can run as: - - % sel_ldr_x86_64 -l /dev/null -S -e ./mybin - -Create the nacl manifest file mybin.manifest with the following contents: - - { "program": { "x86-64": { "url": "mybin" } } } - -url is the path to the binary relative to the manifest file. -Then, run the program as: - - % sel_ldr_x86_64 -g -l /dev/null -S -e ./mybin - -The -g flag instructs the loader to stop at startup. Then, in another console: - - % /opt/nacl_sdk/pepper_39/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb - % nacl-manifest mybin.manifest - % target remote :4014 - -If you see that the program is stopped in _rt0_amd64p32_nacl, then symbols are -loaded successfully and you can type 'c' to start the program. -Next time you can automate it as: - - % /opt/nacl_sdk/pepper_39/toolchain/linux_x86_glibc/bin/x86_64-nacl-gdb \ - -ex 'nacl-manifest mybin.manifest' -ex 'target remote :4014' diff --git a/misc/nacl/go_nacl_386_exec b/misc/nacl/go_nacl_386_exec deleted file mode 100755 index 9cff635565..0000000000 --- a/misc/nacl/go_nacl_386_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec sel_ldr_x86_32 -l /dev/null -S -e "$@" diff --git a/misc/nacl/go_nacl_amd64p32_exec b/misc/nacl/go_nacl_amd64p32_exec deleted file mode 100755 index 0a5ed651f1..0000000000 --- a/misc/nacl/go_nacl_amd64p32_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec sel_ldr_x86_64 -l /dev/null -S -e "$@" diff --git a/misc/nacl/go_nacl_arm_exec b/misc/nacl/go_nacl_arm_exec deleted file mode 100755 index 4275cb1111..0000000000 --- a/misc/nacl/go_nacl_arm_exec +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -eval $(go env) - -export NACLENV_GOARCH=$GOARCH -export NACLENV_GOOS=$GOOS -export NACLENV_GOROOT=/go -export NACLENV_NACLPWD=$(pwd | sed "s;$GOROOT;/go;") - -exec nacl_helper_bootstrap_arm $(which sel_ldr_arm) --reserved_at_zero=0xXXXXXXXXXXXXXXXX -l /dev/null -S -e "$@" diff --git a/misc/nacl/mkzip.go b/misc/nacl/mkzip.go deleted file mode 100644 index 5ec241e35a..0000000000 --- a/misc/nacl/mkzip.go +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Mkzip creates a zip file from a 'proto' file describing the contents. -// -// The proto file is inspired by the Plan 9 mkfs prototype file format. -// It describes a file tree, one directory per line, with leading tab -// indentation marking the tree structure. Each line contains a leading -// name field giving the name of the file to copy into the zip file, -// and then a sequence of optional key=value attributes to control -// the copy. The only known attribute is src=foo, meaning copy the -// actual data for the file (or directory) from an alternate location. -package main - -import ( - "archive/zip" - "bufio" - "flag" - "fmt" - "io" - "io/ioutil" - "log" - "os" - "path" - "path/filepath" - "strings" -) - -func usage() { - fmt.Fprintf(os.Stderr, "usage: mkzip [-r root] src.proto out.zip\n") - os.Exit(2) -} - -func sysfatal(format string, args ...interface{}) { - fmt.Fprintf(os.Stderr, "mkzip: %s\n", fmt.Sprintf(format, args...)) - os.Exit(2) -} - -var ( - root = flag.String("r", ".", "interpret source paths relative to this directory") - gopackage = flag.String("p", "", "write Go source file in this package") -) - -type stack struct { - name string - src string - depth int -} - -func main() { - log.SetFlags(0) - flag.Usage = usage - flag.Parse() - - args := flag.Args() - if len(args) != 2 { - usage() - } - - rf, err := os.Open(args[0]) - if err != nil { - sysfatal("%v", err) - } - r := bufio.NewScanner(rf) - - zf, err := os.Create(args[1]) - if err != nil { - sysfatal("%v", err) - } - - var w io.Writer = zf - if *gopackage != "" { - fmt.Fprintf(zf, `package %s -import "sync" -func init() { - var once sync.Once - fsinit = func() { - once.Do(func() { - unzip("`, *gopackage) - gw := &goWriter{b: bufio.NewWriter(w)} - defer func() { - if err := gw.Close(); err != nil { - sysfatal("finishing Go output: %v", err) - } - }() - w = gw - } - z := zip.NewWriter(w) - - lineno := 0 - - addfile := func(info os.FileInfo, dst string, src string) { - zh, err := zip.FileInfoHeader(info) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - zh.Name = dst - zh.Method = zip.Deflate - if info.IsDir() && !strings.HasSuffix(dst, "/") { - zh.Name += "/" - } - w, err := z.CreateHeader(zh) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - if info.IsDir() { - return - } - r, err := os.Open(src) - if err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - defer r.Close() - if _, err := io.Copy(w, r); err != nil { - sysfatal("%s:%d: %s: %v", args[0], lineno, src, err) - } - } - - var stk []stack - - for r.Scan() { - line := r.Text() - lineno++ - s := strings.TrimLeft(line, "\t") - prefix, line := line[:len(line)-len(s)], s - if i := strings.Index(line, "#"); i >= 0 { - line = line[:i] - } - f := strings.Fields(line) - if len(f) == 0 { - continue - } - if strings.HasPrefix(line, " ") { - sysfatal("%s:%d: must use tabs for indentation", args[0], lineno) - } - depth := len(prefix) - for len(stk) > 0 && depth <= stk[len(stk)-1].depth { - stk = stk[:len(stk)-1] - } - parent := "" - psrc := *root - if len(stk) > 0 { - parent = stk[len(stk)-1].name - psrc = stk[len(stk)-1].src - } - if strings.Contains(f[0], "/") { - sysfatal("%s:%d: destination name cannot contain slash", args[0], lineno) - } - name := path.Join(parent, f[0]) - src := filepath.Join(psrc, f[0]) - for _, attr := range f[1:] { - i := strings.Index(attr, "=") - if i < 0 { - sysfatal("%s:%d: malformed attribute %q", args[0], lineno, attr) - } - key, val := attr[:i], attr[i+1:] - switch key { - case "src": - src = val - default: - sysfatal("%s:%d: unknown attribute %q", args[0], lineno, attr) - } - } - - stk = append(stk, stack{name: name, src: src, depth: depth}) - - if f[0] == "*" || f[0] == "+" { - if f[0] == "*" { - dir, err := ioutil.ReadDir(psrc) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - for _, d := range dir { - addfile(d, path.Join(parent, d.Name()), filepath.Join(psrc, d.Name())) - } - } else { - err := filepath.Walk(psrc, func(src string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if src == psrc { - return nil - } - if psrc == "." { - psrc = "" - } - name := path.Join(parent, filepath.ToSlash(src[len(psrc):])) - addfile(info, name, src) - return nil - }) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - } - continue - } - - fi, err := os.Stat(src) - if err != nil { - sysfatal("%s:%d: %v", args[0], lineno, err) - } - addfile(fi, name, src) - } - - if err := z.Close(); err != nil { - sysfatal("finishing zip file: %v", err) - } -} - -type goWriter struct { - b *bufio.Writer -} - -func (w *goWriter) Write(b []byte) (int, error) { - for _, c := range b { - fmt.Fprintf(w.b, "\\x%02x", c) - } - return len(b), nil -} - -func (w *goWriter) Close() error { - fmt.Fprintf(w.b, "\")\n\t\t})\n\t}\n}") - w.b.Flush() - return nil -} diff --git a/misc/nacl/testdata/bin/placeholder b/misc/nacl/testdata/bin/placeholder deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/misc/nacl/testdata/empty b/misc/nacl/testdata/empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/misc/nacl/testdata/group b/misc/nacl/testdata/group deleted file mode 100644 index eb7f9a3072..0000000000 --- a/misc/nacl/testdata/group +++ /dev/null @@ -1,8 +0,0 @@ -nobody:*:-2: -nogroup:*:-1: -wheel:*:0:root -daemon:*:1:root -kmem:*:2:root -sys:*:3:root -tty:*:4:root -operator:*:5:root diff --git a/misc/nacl/testdata/hosts b/misc/nacl/testdata/hosts deleted file mode 100644 index 75721cd5af..0000000000 --- a/misc/nacl/testdata/hosts +++ /dev/null @@ -1 +0,0 @@ -127.0.0.1 localhost diff --git a/misc/nacl/testdata/mime.types b/misc/nacl/testdata/mime.types deleted file mode 100644 index ba678d5a4e..0000000000 --- a/misc/nacl/testdata/mime.types +++ /dev/null @@ -1,1596 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redistribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/calendar+xml -# application/cals-1840 -# application/ccmp+xml -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -application/docbook+xml dbk -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -application/gml+xml gml -application/gpx+xml gpx -application/gxf gxf -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -application/inkml+xml ink inkml -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -application/jsonml+json jsonml -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink+xml metalink -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lrf mar so dist distz pkg bpk dump elc deploy mobipocket-ebook -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/omdoc+xml omdoc -application/onenote onetoc onetoc2 onetmp onepkg -application/oxps oxps -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rpki-ghostbusters gbr -application/rpki-manifest mft -application/rpki-roa roa -# application/rpki-updown -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssdl+xml ssdl -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vcard+xml -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.formscentral.fcdt fcdt -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.astraea-software.iota iota -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.collection+json -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -# application/vnd.curl -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.dart dart -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.dece.zip uvz uvvz -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.ds-keypoint kpxx -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -# application/vnd.eprints.data+xml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -# application/vnd.hal+json -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -# application/vnd.hzn-3d-crossword -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -# application/vnd.innopath.wamp.notification -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.newsmessage+xml -# application/vnd.iptc.g2.packageitem+xml -# application/vnd.iptc.g2.planningitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -# application/vnd.ms-color.iccprofile -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -# application/vnd.ms-opentype -# application/vnd.ms-package.obfuscated-opentype -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -# application/vnd.ms-printing.printticket+xml -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -application/vnd.mynfc taglet -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.nitf ntf nitf -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oftn.l10n+json -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-feature-handler+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.cab-user-prefs+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.pal+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -application/vnd.osgi.subsystem esa -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.rn-realmedia-vbr rmvb -application/vnd.route66.link66+xml link66 -# application/vnd.rs-274x -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.package smzip -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tcpdump.pcap pcap cap dmp -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.through-ngn -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -# application/x-amf -application/x-apple-diskimage dmg -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-blorb blb blorb -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cbr cbr cba cbt cbz cb7 -application/x-cdlink vcd -application/x-cfs-compressed cfs -application/x-chat chat -application/x-chess-pgn pgn -application/x-conference nsc -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-dgc-compressed dgc -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-envoy evy -application/x-eva eva -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/x-font-woff woff -# application/x-font-vfont -application/x-freearc arc -application/x-futuresplash spl -application/x-gca-compressed gca -application/x-glulx ulx -application/x-gnumeric gnumeric -application/x-gramps-xml gramps -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-install-instructions install -application/x-iso9660-image iso -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-lzh-compressed lzh lha -application/x-mie mie -application/x-mobipocket-ebook prc mobi -application/x-mpegurl m3u8 -application/x-ms-application application -application/x-ms-shortcut lnk -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf wmz emf emz -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-nzb nzb -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-research-info-systems ris -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-sql sql -application/x-stuffit sit -application/x-stuffitx sitx -application/x-subrip srt -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-t3vm-image t3 -application/x-tads gam -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-tgif obj -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xliff+xml xlf -application/x-xpinstall xpi -application/x-xz xz -application/x-zmachine z1 z2 z3 z4 z5 z6 z7 z8 -# application/x400-bp -application/xaml+xml xaml -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xproc+xml xpl -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dv -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/fwdred -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/ip-mr_v2.5 -# audio/isac -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -audio/mp4a-latm m4a m4p -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -# audio/musepack -audio/ogg oga ogg spx -# audio/opus -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -audio/s3m s3m -audio/silk sil -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.dvb.file -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-caf caf -audio/x-flac flac -audio/x-matroska mka -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -# audio/x-tta -audio/x-wav wav -audio/xm xm -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jp2 jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/pict pict pic pct -image/png png -image/prs.btif btif -# image/prs.pti -image/sgi sgi -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.ms-photo wdp -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-3ds 3ds -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-macpaint pntg pnt mac -image/x-mrsid-image sid -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-quicktime qtif qti -image/x-rgb rgb -image/x-tga tga -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -model/x3d+binary x3db x3dbz -model/x3d+vrml x3dv x3dvz -model/x3d+xml x3d x3dz -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -text/cache-manifest manifest -# text/1d-interleaved-parityfec -text/cache-manifest appcache -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -# text/fwdred -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -text/vcard vcard -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -text/vnd.dvb.subtitle sub -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-java-source java -text/x-opml opml -text/x-pascal p pas -text/x-nfo nfo -text/x-setext etx -text/x-sfv sfv -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp4v-es -video/mp2t ts -video/mp4 mp4 mp4v mpg4 m4v -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.dvb.file dvb -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/x-dv dv dif -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-matroska mkv mk3d mks -video/x-mng mng -video/x-ms-asf asf asx -video/x-ms-vob vob -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -video/x-smv smv -x-conference/x-cooltalk ice diff --git a/misc/nacl/testzip.proto b/misc/nacl/testzip.proto deleted file mode 100644 index 5a9804b36d..0000000000 --- a/misc/nacl/testzip.proto +++ /dev/null @@ -1,190 +0,0 @@ -etc src=/etc - mime.types src=../misc/nacl/testdata/mime.types - resolv.conf src=../misc/nacl/testdata/empty - group src=../misc/nacl/testdata/group - passwd src=../misc/nacl/testdata/empty - hosts src=../misc/nacl/testdata/hosts - services -usr src=../misc/nacl/testdata - bin -go src=.. - src - cmd - api - testdata - + - asm - internal - asm - testdata - + - compile - internal - syntax - parser.go - cover - testdata - + - doc - main.go - pkg.go - doc_test.go - testdata - + - internal - objfile - objfile.go - buildid - testdata - + - gofmt - gofmt.go - gofmt_test.go - testdata - + - vendor - github.com - google - pprof - internal - binutils - + - driver - + - graph - + - report - + - profile - + - ianlancetaylor - demangle - + - golang.org - x - arch - arm - armasm - + - arm64 - arm64asm - + - x86 - x86asm - + - ppc64 - ppc64asm - + - archive - tar - testdata - + - zip - testdata - + - compress - bzip2 - testdata - + - flate - testdata - + - gzip - testdata - + - lzw - testdata - + - zlib - crypto - ed25519 - testdata - + - rsa - testdata - + - tls - testdata - + - debug - dwarf - testdata - + - elf - testdata - + - macho - testdata - + - pe - testdata - + - plan9obj - testdata - + - go - build - + - doc - testdata - + - format - + - parser - + - printer - + - image - testdata - + - draw - gif - jpeg - png - testdata - + - internal - trace - testdata - + - xcoff - testdata - + - io - + - mime - testdata - + - multipart - testdata - + - net - http - + - testdata - + - os - + - path - filepath - + - regexp - testdata - + - runtime - textflag.h - strconv - testdata - + - testdata - + - text - template - testdata - + - lib - time - zoneinfo.zip - - test - + diff --git a/src/buildall.bash b/src/buildall.bash index 5762a332de..18d0b0db19 100755 --- a/src/buildall.bash +++ b/src/buildall.bash @@ -45,17 +45,17 @@ selectedtargets() { gettargets | egrep -v 'android-arm|darwin-arm' | egrep "$pattern" } -# put linux, nacl first in the target list to get all the architectures up front. -linux_nacl_targets() { - selectedtargets | egrep 'linux|nacl' | sort +# put linux first in the target list to get all the architectures up front. +linux_targets() { + selectedtargets | grep 'linux' | sort } -non_linux_nacl_targets() { - selectedtargets | egrep -v 'linux|nacl' | sort +non_linux_targets() { + selectedtargets | grep -v 'linux' | sort } # Note words in $targets are separated by both newlines and spaces. -targets="$(linux_nacl_targets) $(non_linux_nacl_targets)" +targets="$(linux_targets) $(non_linux_targets)" failed=false for target in $targets diff --git a/src/cmd/compile/internal/gc/inl_test.go b/src/cmd/compile/internal/gc/inl_test.go index 77c398af82..5446b13b8b 100644 --- a/src/cmd/compile/internal/gc/inl_test.go +++ b/src/cmd/compile/internal/gc/inl_test.go @@ -174,7 +174,7 @@ func TestIntendedInlining(t *testing.T) { } switch runtime.GOARCH { - case "nacl", "386", "wasm", "arm": + case "386", "wasm", "arm": default: // TODO(mvdan): As explained in /test/inline_sync.go, some // architectures don't have atomic intrinsics, so these go over diff --git a/src/cmd/compile/internal/gc/sizeof_test.go b/src/cmd/compile/internal/gc/sizeof_test.go index b1184ffbb9..f4725c0eb2 100644 --- a/src/cmd/compile/internal/gc/sizeof_test.go +++ b/src/cmd/compile/internal/gc/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package gc import ( diff --git a/src/cmd/compile/internal/ssa/sizeof_test.go b/src/cmd/compile/internal/ssa/sizeof_test.go index a17db87e8b..60ada011e3 100644 --- a/src/cmd/compile/internal/ssa/sizeof_test.go +++ b/src/cmd/compile/internal/ssa/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package ssa import ( diff --git a/src/cmd/compile/internal/types/sizeof_test.go b/src/cmd/compile/internal/types/sizeof_test.go index 09b852f343..ea947d8f41 100644 --- a/src/cmd/compile/internal/types/sizeof_test.go +++ b/src/cmd/compile/internal/types/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package types import ( diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index 9e503117ae..8f2f57dc22 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -86,7 +86,6 @@ var okgoos = []string{ "android", "solaris", "freebsd", - "nacl", "netbsd", "openbsd", "plan9", @@ -1505,9 +1504,6 @@ var cgoEnabled = map[string]bool{ "android/arm": true, "android/arm64": true, "js/wasm": false, - "nacl/386": false, - "nacl/amd64p32": false, - "nacl/arm": false, "netbsd/386": true, "netbsd/amd64": true, "netbsd/arm": true, diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go index 3be9754e67..273ef2e19a 100644 --- a/src/cmd/dist/test.go +++ b/src/cmd/dist/test.go @@ -703,7 +703,7 @@ func (t *tester) registerTests() { // Doc tests only run on builders. // They find problems approximately never. - if t.hasBash() && goos != "nacl" && goos != "js" && goos != "android" && !t.iOS() && os.Getenv("GO_BUILDER_NAME") != "" { + if t.hasBash() && goos != "js" && goos != "android" && !t.iOS() && os.Getenv("GO_BUILDER_NAME") != "" { t.registerTest("doc_progs", "../doc/progs", "time", "go", "run", "run.go") t.registerTest("wiki", "../doc/articles/wiki", "./test.bash") t.registerTest("codewalk", "../doc/codewalk", "time", "./run") @@ -735,7 +735,7 @@ func (t *tester) registerTests() { }) } } - if goos != "nacl" && goos != "android" && !t.iOS() && goos != "js" { + if goos != "android" && !t.iOS() && goos != "js" { t.tests = append(t.tests, distTest{ name: "api", heading: "API check", diff --git a/src/cmd/dist/util.go b/src/cmd/dist/util.go index e6a3887a72..b9e8a513d9 100644 --- a/src/cmd/dist/util.go +++ b/src/cmd/dist/util.go @@ -383,10 +383,6 @@ func xsamefile(f1, f2 string) bool { } func xgetgoarm() string { - if goos == "nacl" { - // NaCl guarantees VFPv3 and is always cross-compiled. - return "7" - } if goos == "darwin" || goos == "android" { // Assume all darwin/arm and android devices have VFPv3. // These ports are also mostly cross-compiled, so it makes little diff --git a/src/cmd/doc/doc_test.go b/src/cmd/doc/doc_test.go index 7bc5842cc6..ef8152b036 100644 --- a/src/cmd/doc/doc_test.go +++ b/src/cmd/doc/doc_test.go @@ -33,9 +33,6 @@ func TestMain(m *testing.M) { } func maybeSkip(t *testing.T) { - if strings.HasPrefix(runtime.GOOS, "nacl") { - t.Skip("nacl does not have a full file tree") - } if runtime.GOOS == "darwin" && strings.HasPrefix(runtime.GOARCH, "arm") { t.Skip("darwin/arm does not have a full file tree") } diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index bf00e1f4c9..2561f5b2f8 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1238,7 +1238,7 @@ // If the -exec flag is not given, GOOS or GOARCH is different from the system // default, and a program named go_$GOOS_$GOARCH_exec can be found // on the current search path, 'go run' invokes the binary using that program, -// for example 'go_nacl_386_exec a.out arguments...'. This allows execution of +// for example 'go_js_wasm_exec a.out arguments...'. This allows execution of // cross-compiled programs when a simulator or other execution method is // available. // diff --git a/src/cmd/go/go_test.go b/src/cmd/go/go_test.go index 71a2e01fa3..e4cf953b9e 100644 --- a/src/cmd/go/go_test.go +++ b/src/cmd/go/go_test.go @@ -56,7 +56,7 @@ func tooSlow(t *testing.T) { func init() { switch runtime.GOOS { - case "android", "js", "nacl": + case "android", "js": canRun = false case "darwin": switch runtime.GOARCH { @@ -5604,7 +5604,7 @@ func TestTestCacheInputs(t *testing.T) { tg.grepStdout(`\(cached\)`, "did not cache") switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": // no shell scripts default: tg.run("test", "testcache", "-run=Exec") diff --git a/src/cmd/go/help_test.go b/src/cmd/go/help_test.go index 9c0fa8411e..9bcab820ce 100644 --- a/src/cmd/go/help_test.go +++ b/src/cmd/go/help_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package main_test import ( diff --git a/src/cmd/go/internal/base/signal_unix.go b/src/cmd/go/internal/base/signal_unix.go index c109eecadb..342775a118 100644 --- a/src/cmd/go/internal/base/signal_unix.go +++ b/src/cmd/go/internal/base/signal_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js linux netbsd openbsd solaris package base diff --git a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go index 581a978ef8..faf73446f7 100644 --- a/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go +++ b/src/cmd/go/internal/lockedfile/internal/filelock/filelock_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9 +// +build !js,!plan9 package filelock_test diff --git a/src/cmd/go/internal/lockedfile/lockedfile_test.go b/src/cmd/go/internal/lockedfile/lockedfile_test.go index 6d5819efdb..ff8796fff4 100644 --- a/src/cmd/go/internal/lockedfile/lockedfile_test.go +++ b/src/cmd/go/internal/lockedfile/lockedfile_test.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // js and nacl do not support inter-process file locking. -// +build !js,!nacl +// +build !js package lockedfile_test diff --git a/src/cmd/go/internal/renameio/umask_test.go b/src/cmd/go/internal/renameio/umask_test.go index 1d5e594e7e..d75d67c9a9 100644 --- a/src/cmd/go/internal/renameio/umask_test.go +++ b/src/cmd/go/internal/renameio/umask_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!plan9,!windows,!js +// +build !plan9,!windows,!js package renameio diff --git a/src/cmd/go/internal/run/run.go b/src/cmd/go/internal/run/run.go index 648a87f665..2edae38cca 100644 --- a/src/cmd/go/internal/run/run.go +++ b/src/cmd/go/internal/run/run.go @@ -33,7 +33,7 @@ If the -exec flag is given, 'go run' invokes the binary using xprog: If the -exec flag is not given, GOOS or GOARCH is different from the system default, and a program named go_$GOOS_$GOARCH_exec can be found on the current search path, 'go run' invokes the binary using that program, -for example 'go_nacl_386_exec a.out arguments...'. This allows execution of +for example 'go_js_wasm_exec a.out arguments...'. This allows execution of cross-compiled programs when a simulator or other execution method is available. diff --git a/src/cmd/go/internal/work/build_test.go b/src/cmd/go/internal/work/build_test.go index 55e1eea25b..b60f4e27c0 100644 --- a/src/cmd/go/internal/work/build_test.go +++ b/src/cmd/go/internal/work/build_test.go @@ -221,8 +221,6 @@ func pkgImportPath(pkgpath string) *load.Package { // See https://golang.org/issue/18878. func TestRespectSetgidDir(t *testing.T) { switch runtime.GOOS { - case "nacl": - t.Skip("can't set SetGID bit with chmod on nacl") case "darwin": if runtime.GOARCH == "arm" || runtime.GOARCH == "arm64" { t.Skip("can't set SetGID bit with chmod on iOS") diff --git a/src/cmd/go/testdata/src/testcache/testcache_test.go b/src/cmd/go/testdata/src/testcache/testcache_test.go index 9b2d1ea782..3de7c42fae 100644 --- a/src/cmd/go/testdata/src/testcache/testcache_test.go +++ b/src/cmd/go/testdata/src/testcache/testcache_test.go @@ -72,7 +72,7 @@ func TestDirList(t *testing.T) { } func TestExec(t *testing.T) { - if runtime.GOOS == "plan9" || runtime.GOOS == "windows" || runtime.GOOS == "nacl" { + if runtime.GOOS == "plan9" || runtime.GOOS == "windows" { t.Skip("non-unix") } diff --git a/src/cmd/internal/obj/sizeof_test.go b/src/cmd/internal/obj/sizeof_test.go index e70d174637..05da9cc1e6 100644 --- a/src/cmd/internal/obj/sizeof_test.go +++ b/src/cmd/internal/obj/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package obj import ( diff --git a/src/cmd/link/internal/sym/sizeof_test.go b/src/cmd/link/internal/sym/sizeof_test.go index da4602a161..e6e3916dad 100644 --- a/src/cmd/link/internal/sym/sizeof_test.go +++ b/src/cmd/link/internal/sym/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package sym import ( diff --git a/src/crypto/rand/eagain.go b/src/crypto/rand/eagain.go index 045d037d20..f251ba28fc 100644 --- a/src/crypto/rand/eagain.go +++ b/src/crypto/rand/eagain.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package rand diff --git a/src/crypto/rand/rand_unix.go b/src/crypto/rand/rand_unix.go index f3091f51c5..0610f691b0 100644 --- a/src/crypto/rand/rand_unix.go +++ b/src/crypto/rand/rand_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd plan9 solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd plan9 solaris // Unix cryptographically secure pseudorandom number // generator. diff --git a/src/crypto/x509/root_nacl.go b/src/crypto/x509/root_nacl.go deleted file mode 100644 index 4413f64738..0000000000 --- a/src/crypto/x509/root_nacl.go +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package x509 - -// Possible certificate files; stop after finding one. -var certFiles = []string{} diff --git a/src/crypto/x509/root_unix.go b/src/crypto/x509/root_unix.go index 48de50b4ea..f1e174c894 100644 --- a/src/crypto/x509/root_unix.go +++ b/src/crypto/x509/root_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package x509 diff --git a/src/debug/elf/file_test.go b/src/debug/elf/file_test.go index b826a0ff05..42e575e182 100644 --- a/src/debug/elf/file_test.go +++ b/src/debug/elf/file_test.go @@ -784,7 +784,7 @@ func TestCompressedSection(t *testing.T) { func TestNoSectionOverlaps(t *testing.T) { // Ensure cmd/link outputs sections without overlaps. switch runtime.GOOS { - case "aix", "android", "darwin", "js", "nacl", "plan9", "windows": + case "aix", "android", "darwin", "js", "plan9", "windows": t.Skipf("cmd/link doesn't produce ELF binaries on %s", runtime.GOOS) } _ = net.ResolveIPAddr // force dynamic linkage diff --git a/src/go/build/deps_test.go b/src/go/build/deps_test.go index cbb0c59127..6443094515 100644 --- a/src/go/build/deps_test.go +++ b/src/go/build/deps_test.go @@ -514,7 +514,7 @@ func listStdPkgs(goroot string) ([]string, error) { func TestDependencies(t *testing.T) { iOS := runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") - if runtime.GOOS == "nacl" || iOS { + if iOS { // Tests run in a limited file system and we do not // provide access to every source file. t.Skipf("skipping on %s/%s, missing full GOROOT", runtime.GOOS, runtime.GOARCH) diff --git a/src/go/internal/gccgoimporter/importer_test.go b/src/go/internal/gccgoimporter/importer_test.go index 37250fde41..a74a456868 100644 --- a/src/go/internal/gccgoimporter/importer_test.go +++ b/src/go/internal/gccgoimporter/importer_test.go @@ -100,7 +100,7 @@ var importerTests = [...]importerTest{ } func TestGoxImporter(t *testing.T) { - testenv.MustHaveExec(t) // this is to skip nacl, js + testenv.MustHaveExec(t) initmap := make(map[*types.Package]InitData) imp := GetImporter([]string{"testdata"}, initmap) diff --git a/src/go/internal/gcimporter/gcimporter_test.go b/src/go/internal/gcimporter/gcimporter_test.go index 3b7636806e..df93f3f062 100644 --- a/src/go/internal/gcimporter/gcimporter_test.go +++ b/src/go/internal/gcimporter/gcimporter_test.go @@ -26,10 +26,7 @@ import ( // import. func skipSpecialPlatforms(t *testing.T) { switch platform := runtime.GOOS + "-" + runtime.GOARCH; platform { - case "nacl-amd64p32", - "nacl-386", - "nacl-arm", - "darwin-arm", + case "darwin-arm", "darwin-arm64": t.Skipf("no compiled packages available for import on %s", platform) } @@ -140,7 +137,7 @@ func TestImportTestdata(t *testing.T) { } func TestVersionHandling(t *testing.T) { - skipSpecialPlatforms(t) // we really only need to exclude nacl platforms, but this is fine + skipSpecialPlatforms(t) // This package only handles gc export data. if runtime.Compiler != "gc" { diff --git a/src/go/types/example_test.go b/src/go/types/example_test.go index 492127bbab..b8fba7312a 100644 --- a/src/go/types/example_test.go +++ b/src/go/types/example_test.go @@ -5,7 +5,7 @@ // Only run where builders (build.golang.org) have // access to compiled packages for import. // -// +build !arm,!arm64,!nacl +// +build !arm,!arm64 package types_test diff --git a/src/internal/cpu/cpu_x86.s b/src/internal/cpu/cpu_x86.s index 228fbcf6d6..564e1133ed 100644 --- a/src/internal/cpu/cpu_x86.s +++ b/src/internal/cpu/cpu_x86.s @@ -19,14 +19,8 @@ TEXT ·cpuid(SB), NOSPLIT, $0-24 // func xgetbv() (eax, edx uint32) TEXT ·xgetbv(SB),NOSPLIT,$0-8 -#ifdef GOOS_nacl - // nacl does not support XGETBV. - MOVL $0, eax+0(FP) - MOVL $0, edx+4(FP) -#else MOVL $0, CX XGETBV MOVL AX, eax+0(FP) MOVL DX, edx+4(FP) -#endif RET diff --git a/src/internal/poll/export_posix_test.go b/src/internal/poll/export_posix_test.go index 6b9bb8b7d0..abadf50930 100644 --- a/src/internal/poll/export_posix_test.go +++ b/src/internal/poll/export_posix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows // Export guts for testing on posix. // Since testing imports os and os imports internal/poll, diff --git a/src/internal/poll/fd_fsync_posix.go b/src/internal/poll/fd_fsync_posix.go index 6705a3e524..0886d749d3 100644 --- a/src/internal/poll/fd_fsync_posix.go +++ b/src/internal/poll/fd_fsync_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/fd_poll_nacljs.go b/src/internal/poll/fd_poll_js.go similarity index 99% rename from src/internal/poll/fd_poll_nacljs.go rename to src/internal/poll/fd_poll_js.go index 0871f342d4..2bfeb0a0b7 100644 --- a/src/internal/poll/fd_poll_nacljs.go +++ b/src/internal/poll/fd_poll_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package poll diff --git a/src/internal/poll/fd_posix.go b/src/internal/poll/fd_posix.go index b43ad51799..d0bacdd473 100644 --- a/src/internal/poll/fd_posix.go +++ b/src/internal/poll/fd_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package poll diff --git a/src/internal/poll/fd_posix_test.go b/src/internal/poll/fd_posix_test.go index 246d4989e1..4449eb3a15 100644 --- a/src/internal/poll/fd_posix_test.go +++ b/src/internal/poll/fd_posix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package poll_test diff --git a/src/internal/poll/fd_unix.go b/src/internal/poll/fd_unix.go index 8185269c53..41d6ef593d 100644 --- a/src/internal/poll/fd_unix.go +++ b/src/internal/poll/fd_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/hook_unix.go b/src/internal/poll/hook_unix.go index a7512b1255..11f90e9696 100644 --- a/src/internal/poll/hook_unix.go +++ b/src/internal/poll/hook_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package poll diff --git a/src/internal/poll/sys_cloexec.go b/src/internal/poll/sys_cloexec.go index 64e46127d4..7b87f136df 100644 --- a/src/internal/poll/sys_cloexec.go +++ b/src/internal/poll/sys_cloexec.go @@ -5,7 +5,7 @@ // This file implements sysSocket and accept for platforms that do not // provide a fast path for setting SetNonblock and CloseOnExec. -// +build aix darwin js,wasm nacl solaris +// +build aix darwin js,wasm solaris package poll diff --git a/src/internal/syscall/unix/nonblocking_nacl.go b/src/internal/syscall/unix/nonblocking_nacl.go deleted file mode 100644 index ff67c75e81..0000000000 --- a/src/internal/syscall/unix/nonblocking_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package unix - -func IsNonblock(fd int) (nonblocking bool, err error) { - return false, nil -} diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go index f7a9730ca6..b036aa6ebc 100644 --- a/src/internal/testenv/testenv.go +++ b/src/internal/testenv/testenv.go @@ -43,7 +43,7 @@ func HasGoBuild() bool { return false } switch runtime.GOOS { - case "android", "nacl", "js": + case "android", "js": return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { @@ -122,7 +122,7 @@ func GoTool() (string, error) { // using os.StartProcess or (more commonly) exec.Command. func HasExec() bool { switch runtime.GOOS { - case "nacl", "js": + case "js": return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { @@ -135,8 +135,6 @@ func HasExec() bool { // HasSrc reports whether the entire source tree is available under GOROOT. func HasSrc() bool { switch runtime.GOOS { - case "nacl": - return false case "darwin": if strings.HasPrefix(runtime.GOARCH, "arm") { return false @@ -175,14 +173,14 @@ func MustHaveExecPath(t testing.TB, path string) { // HasExternalNetwork reports whether the current system can use // external (non-localhost) networks. func HasExternalNetwork() bool { - return !testing.Short() && runtime.GOOS != "nacl" && runtime.GOOS != "js" + return !testing.Short() && runtime.GOOS != "js" } // MustHaveExternalNetwork checks that the current system can use // external (non-localhost) networks. // If not, MustHaveExternalNetwork calls t.Skip with an explanation. func MustHaveExternalNetwork(t testing.TB) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("skipping test: no external network on %s", runtime.GOOS) } if testing.Short() { diff --git a/src/internal/testenv/testenv_notwin.go b/src/internal/testenv/testenv_notwin.go index d8ce6cd385..ccb5d5585f 100644 --- a/src/internal/testenv/testenv_notwin.go +++ b/src/internal/testenv/testenv_notwin.go @@ -12,7 +12,7 @@ import ( func hasSymlink() (ok bool, reason string) { switch runtime.GOOS { - case "android", "nacl", "plan9": + case "android", "plan9": return false, "" } diff --git a/src/log/syslog/doc.go b/src/log/syslog/doc.go index 5458523249..bd12bea581 100644 --- a/src/log/syslog/doc.go +++ b/src/log/syslog/doc.go @@ -22,5 +22,3 @@ package syslog // see https://golang.org/issue/1108. // BUG(akumar): This package is not implemented on Plan 9. - -// BUG(minux): This package is not implemented on NaCl (Native Client). diff --git a/src/log/syslog/example_test.go b/src/log/syslog/example_test.go index 3d5b76d219..4288d37dee 100644 --- a/src/log/syslog/example_test.go +++ b/src/log/syslog/example_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog_test diff --git a/src/log/syslog/syslog.go b/src/log/syslog/syslog.go index dfd0028e5c..82dd4e7dd6 100644 --- a/src/log/syslog/syslog.go +++ b/src/log/syslog/syslog.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog diff --git a/src/log/syslog/syslog_test.go b/src/log/syslog/syslog_test.go index 8a28d67c98..dd1a1c4988 100644 --- a/src/log/syslog/syslog_test.go +++ b/src/log/syslog/syslog_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9,!js +// +build !windows,!plan9,!js package syslog diff --git a/src/log/syslog/syslog_unix.go b/src/log/syslog/syslog_unix.go index 6c17e1f260..a64eed29f1 100644 --- a/src/log/syslog/syslog_unix.go +++ b/src/log/syslog/syslog_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!nacl,!plan9 +// +build !windows,!plan9 package syslog diff --git a/src/mime/type_unix.go b/src/mime/type_unix.go index dfc1f88b2a..0b247b623a 100644 --- a/src/mime/type_unix.go +++ b/src/mime/type_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package mime diff --git a/src/naclmake.bash b/src/naclmake.bash deleted file mode 100755 index 5e6c3ce05e..0000000000 --- a/src/naclmake.bash +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2016 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# naclmake.bash builds runs make.bash for nacl, but not does run any -# tests. This is used by the continuous build. - -# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH; -# see ../misc/nacl/README. - -set -e -ulimit -c 0 - -# guess GOARCH if not set -naclGOARCH=$GOARCH -if [ -z "$naclGOARCH" ]; then - case "$(uname -m)" in - x86_64) - naclGOARCH=amd64p32 - ;; - armv7l) # NativeClient on ARM only supports ARMv7A. - naclGOARCH=arm - ;; - i?86) - naclGOARCH=386 - ;; - esac -fi - -unset GOOS GOARCH -if [ ! -f make.bash ]; then - echo 'nacltest.bash must be run from $GOROOT/src' 1>&2 - exit 1 -fi - -# the builder might have set GOROOT_FINAL. -export GOROOT=$(pwd)/.. - -# Build zip file embedded in package syscall. -echo "##### Building fake file system zip for nacl" -rm -f syscall/fstest_nacl.go -GOROOT_BOOTSTRAP=${GOROOT_BOOTSTRAP:-$HOME/go1.4} -gobin=$GOROOT_BOOTSTRAP/bin -GOROOT=$GOROOT_BOOTSTRAP $gobin/go run ../misc/nacl/mkzip.go -p syscall -r .. ../misc/nacl/testzip.proto syscall/fstest_nacl.go - -# Run standard build and tests. -GOOS=nacl GOARCH=$naclGOARCH ./make.bash "$@" diff --git a/src/nacltest.bash b/src/nacltest.bash deleted file mode 100755 index dc245b484c..0000000000 --- a/src/nacltest.bash +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2014 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -# For testing Native Client on builders or locally. -# Builds a test file system and embeds it into package syscall -# in every generated binary. -# -# Assumes that sel_ldr binaries and go_nacl_$GOARCH_exec scripts are in $PATH; -# see ../misc/nacl/README. - -set -e -ulimit -c 0 - -. ./naclmake.bash "$@" - -# Check GOARCH. -case "$naclGOARCH" in -amd64p32) - if ! which sel_ldr_x86_64 >/dev/null; then - echo 'cannot find sel_ldr_x86_64' 1>&2 - exit 1 - fi - ;; -386) - if ! which sel_ldr_x86_32 >/dev/null; then - echo 'cannot find sel_ldr_x86_32' 1>&2 - exit 1 - fi - ;; -arm) - if ! which sel_ldr_arm >/dev/null; then - echo 'cannot find sel_ldr_arm' 1>&2 - exit 1 - fi - ;; -*) - echo 'unsupported $GOARCH for nacl: '"$naclGOARCH" 1>&2 - exit 1 -esac - -if ! which go_nacl_${naclGOARCH}_exec >/dev/null; then - echo "cannot find go_nacl_${naclGOARCH}_exec, see ../misc/nacl/README." 1>&2 - exit 1 -fi - -export PATH=$(pwd)/../bin:$(pwd)/../misc/nacl:$PATH -GOROOT=$(../bin/go env GOROOT) -GOOS=nacl GOARCH=$naclGOARCH go tool dist test --no-rebuild - -rm -f syscall/fstest_nacl.go diff --git a/src/net/dial_test.go b/src/net/dial_test.go index 1bf96fd3ce..5a8d0e09ca 100644 --- a/src/net/dial_test.go +++ b/src/net/dial_test.go @@ -763,11 +763,6 @@ func TestDialCancel(t *testing.T) { } mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - // nacl doesn't have external network access. - t.Skipf("skipping on %s", runtime.GOOS) - } - blackholeIPPort := JoinHostPort(slowDst4, "1234") if !supportsIPv4() { blackholeIPPort = JoinHostPort(slowDst6, "1234") @@ -923,7 +918,7 @@ func TestDialListenerAddr(t *testing.T) { func TestDialerControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/error_nacl.go b/src/net/error_nacl.go deleted file mode 100644 index caad133b77..0000000000 --- a/src/net/error_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2018 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package net - -func isConnError(err error) bool { - return false -} diff --git a/src/net/error_posix.go b/src/net/error_posix.go index 70efa4c66f..d709a273b7 100644 --- a/src/net/error_posix.go +++ b/src/net/error_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/error_test.go b/src/net/error_test.go index c4fee5aa5e..89dcc2e6e6 100644 --- a/src/net/error_test.go +++ b/src/net/error_test.go @@ -185,7 +185,7 @@ func TestDialError(t *testing.T) { func TestProtocolDialError(t *testing.T) { switch runtime.GOOS { - case "nacl", "solaris", "illumos": + case "solaris", "illumos": t.Skipf("not supported on %s", runtime.GOOS) } @@ -214,7 +214,7 @@ func TestProtocolDialError(t *testing.T) { func TestDialAddrError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -376,7 +376,7 @@ func TestListenPacketError(t *testing.T) { func TestProtocolListenError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/fd_unix.go b/src/net/fd_unix.go index 4f59871f49..a6d6453810 100644 --- a/src/net/fd_unix.go +++ b/src/net/fd_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package net diff --git a/src/net/file.go b/src/net/file.go index 81a44e1f3f..c13332c188 100644 --- a/src/net/file.go +++ b/src/net/file.go @@ -6,7 +6,7 @@ package net import "os" -// BUG(mikio): On JS, NaCl and Windows, the FileConn, FileListener and +// BUG(mikio): On JS and Windows, the FileConn, FileListener and // FilePacketConn functions are not implemented. type fileAddr string diff --git a/src/net/file_stub.go b/src/net/file_stub.go index 2256608365..bfb8100f53 100644 --- a/src/net/file_stub.go +++ b/src/net/file_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/file_test.go b/src/net/file_test.go index cd717747af..8c09c0da1b 100644 --- a/src/net/file_test.go +++ b/src/net/file_test.go @@ -31,7 +31,7 @@ var fileConnTests = []struct { func TestFileConn(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -138,7 +138,7 @@ var fileListenerTests = []struct { func TestFileListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -230,7 +230,7 @@ var filePacketConnTests = []struct { func TestFilePacketConn(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } @@ -297,7 +297,7 @@ func TestFilePacketConn(t *testing.T) { // Issue 24483. func TestFileCloseRace(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": t.Skipf("not supported on %s", runtime.GOOS) } if !testableNetwork("tcp") { diff --git a/src/net/hook_unix.go b/src/net/hook_unix.go index a1568319f3..a28f1e066d 100644 --- a/src/net/hook_unix.go +++ b/src/net/hook_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package net diff --git a/src/net/interface.go b/src/net/interface.go index 58248560a2..914aaa010f 100644 --- a/src/net/interface.go +++ b/src/net/interface.go @@ -10,7 +10,7 @@ import ( "time" ) -// BUG(mikio): On JS and NaCl, methods and functions related to +// BUG(mikio): On JS, methods and functions related to // Interface are not implemented. // BUG(mikio): On AIX, DragonFly BSD, NetBSD, OpenBSD, Plan 9 and diff --git a/src/net/interface_stub.go b/src/net/interface_stub.go index 0afaa80d63..ec58665e19 100644 --- a/src/net/interface_stub.go +++ b/src/net/interface_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/interface_test.go b/src/net/interface_test.go index 6cdfb6265f..c34cd7432f 100644 --- a/src/net/interface_test.go +++ b/src/net/interface_test.go @@ -290,7 +290,7 @@ func checkUnicastStats(ifStats *ifStats, uniStats *routeStats) error { func checkMulticastStats(ifStats *ifStats, uniStats, multiStats *routeStats) error { switch runtime.GOOS { - case "aix", "dragonfly", "nacl", "netbsd", "openbsd", "plan9", "solaris", "illumos": + case "aix", "dragonfly", "netbsd", "openbsd", "plan9", "solaris", "illumos": default: // Test the existence of connected multicast route // clones for IPv4. Unlike IPv6, IPv4 multicast diff --git a/src/net/internal/socktest/switch_unix.go b/src/net/internal/socktest/switch_unix.go index 0626aa06c0..7dc3518410 100644 --- a/src/net/internal/socktest/switch_unix.go +++ b/src/net/internal/socktest/switch_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package socktest diff --git a/src/net/internal/socktest/sys_unix.go b/src/net/internal/socktest/sys_unix.go index b96075bfe4..0525512bff 100644 --- a/src/net/internal/socktest/sys_unix.go +++ b/src/net/internal/socktest/sys_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package socktest diff --git a/src/net/iprawsock.go b/src/net/iprawsock.go index 8a9c26559b..f18331a1fd 100644 --- a/src/net/iprawsock.go +++ b/src/net/iprawsock.go @@ -21,7 +21,7 @@ import ( // change the behavior of these methods; use Read or ReadMsgIP // instead. -// BUG(mikio): On JS, NaCl and Plan 9, methods and functions related +// BUG(mikio): On JS and Plan 9, methods and functions related // to IPConn are not implemented. // BUG(mikio): On Windows, the File method of IPConn is not diff --git a/src/net/iprawsock_posix.go b/src/net/iprawsock_posix.go index 2a5d49f490..e653f6ae17 100644 --- a/src/net/iprawsock_posix.go +++ b/src/net/iprawsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/ipsock_posix.go b/src/net/ipsock_posix.go index 947f4ef614..5570ed118d 100644 --- a/src/net/ipsock_posix.go +++ b/src/net/ipsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net @@ -134,7 +134,7 @@ func favoriteAddrFamily(network string, laddr, raddr sockaddr, mode string) (fam } func internetSocket(ctx context.Context, net string, laddr, raddr sockaddr, sotype, proto int, mode string, ctrlFn func(string, string, syscall.RawConn) error) (fd *netFD, err error) { - if (runtime.GOOS == "aix" || runtime.GOOS == "windows" || runtime.GOOS == "openbsd" || runtime.GOOS == "nacl") && mode == "dial" && raddr.isWildcard() { + if (runtime.GOOS == "aix" || runtime.GOOS == "windows" || runtime.GOOS == "openbsd") && mode == "dial" && raddr.isWildcard() { raddr = raddr.toLocal(net) } family, ipv6only := favoriteAddrFamily(net, laddr, raddr, mode) diff --git a/src/net/listen_test.go b/src/net/listen_test.go index fef2b6405f..d8c72096ed 100644 --- a/src/net/listen_test.go +++ b/src/net/listen_test.go @@ -224,7 +224,7 @@ var dualStackTCPListenerTests = []struct { // to be greater than or equal to 4.4. func TestDualStackTCPListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -314,7 +314,7 @@ var dualStackUDPListenerTests = []struct { // to be greater than or equal to 4.4. func TestDualStackUDPListener(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } if !supportsIPv4() || !supportsIPv6() { @@ -532,7 +532,7 @@ func TestIPv4MulticastListener(t *testing.T) { testenv.MustHaveExternalNetwork(t) switch runtime.GOOS { - case "android", "nacl", "plan9": + case "android", "plan9": t.Skipf("not supported on %s", runtime.GOOS) case "solaris", "illumos": t.Skipf("not supported on solaris or illumos, see golang.org/issue/7399") @@ -733,7 +733,7 @@ func TestClosingListener(t *testing.T) { func TestListenConfigControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/lookup.go b/src/net/lookup.go index 24d0d25c3a..9cebd10c87 100644 --- a/src/net/lookup.go +++ b/src/net/lookup.go @@ -27,8 +27,7 @@ var protocols = map[string]int{ } // services contains minimal mappings between services names and port -// numbers for platforms that don't have a complete list of port numbers -// (some Solaris distros, nacl, etc). +// numbers for platforms that don't have a complete list of port numbers. // // See https://www.iana.org/assignments/service-names-port-numbers // diff --git a/src/net/lookup_fake.go b/src/net/lookup_fake.go index 6c8a151bca..3b3c39bc7d 100644 --- a/src/net/lookup_fake.go +++ b/src/net/lookup_fake.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/lookup_test.go b/src/net/lookup_test.go index e85605fa2f..b933291cea 100644 --- a/src/net/lookup_test.go +++ b/src/net/lookup_test.go @@ -858,10 +858,6 @@ func TestLookupProtocol_Minimal(t *testing.T) { } func TestLookupNonLDH(t *testing.T) { - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - defer dnsWaitGroup.Wait() if fixup := forceGoDNS(); fixup != nil { @@ -886,10 +882,6 @@ func TestLookupNonLDH(t *testing.T) { func TestLookupContextCancel(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - defer dnsWaitGroup.Wait() ctx, ctxCancel := context.WithCancel(context.Background()) @@ -911,9 +903,6 @@ func TestLookupContextCancel(t *testing.T) { // crashes if nil is used. func TestNilResolverLookup(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } var r *Resolver = nil ctx := context.Background() @@ -933,10 +922,6 @@ func TestNilResolverLookup(t *testing.T) { // canceled lookups (see golang.org/issue/24178 for details). func TestLookupHostCancel(t *testing.T) { mustHaveExternalNetwork(t) - if runtime.GOOS == "nacl" { - t.Skip("skip on nacl") - } - const ( google = "www.google.com" invalidDomain = "invalid.invalid" // RFC 2606 reserves .invalid diff --git a/src/net/main_conf_test.go b/src/net/main_conf_test.go index b535046bda..a92dff56c2 100644 --- a/src/net/main_conf_test.go +++ b/src/net/main_conf_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9,!windows +// +build !js,!plan9,!windows package net diff --git a/src/net/main_noconf_test.go b/src/net/main_noconf_test.go index 55e3770835..bac84aa300 100644 --- a/src/net/main_noconf_test.go +++ b/src/net/main_noconf_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl plan9 windows +// +build js,wasm plan9 windows package net diff --git a/src/net/main_unix_test.go b/src/net/main_unix_test.go index 34a8a104e8..8b9897699c 100644 --- a/src/net/main_unix_test.go +++ b/src/net/main_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package net diff --git a/src/net/net_test.go b/src/net/net_test.go index 463ae8856d..a7406740f5 100644 --- a/src/net/net_test.go +++ b/src/net/net_test.go @@ -72,7 +72,7 @@ func TestCloseRead(t *testing.T) { func TestCloseWrite(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -285,7 +285,6 @@ func TestPacketConnClose(t *testing.T) { } } -// nacl was previous failing to reuse an address. func TestListenCloseListen(t *testing.T) { const maxTries = 10 for tries := 0; tries < maxTries; tries++ { @@ -302,7 +301,7 @@ func TestListenCloseListen(t *testing.T) { } ln, err = Listen("tcp", addr) if err == nil { - // Success. nacl couldn't do this before. + // Success. (This test didn't always make it here earlier.) ln.Close() return } @@ -541,7 +540,7 @@ func TestNotTemporaryRead(t *testing.T) { if err == nil { return errors.New("Read succeeded unexpectedly") } else if err == io.EOF { - // This happens on NaCl and Plan 9. + // This happens on Plan 9. return nil } else if ne, ok := err.(Error); !ok { return fmt.Errorf("unexpected error %v", err) diff --git a/src/net/platform_test.go b/src/net/platform_test.go index 10f55c971d..d35dfaade3 100644 --- a/src/net/platform_test.go +++ b/src/net/platform_test.go @@ -37,13 +37,9 @@ func testableNetwork(network string) bool { ss := strings.Split(network, ":") switch ss[0] { case "ip+nopriv": - switch runtime.GOOS { - case "nacl": - return false - } case "ip", "ip4", "ip6": switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": return false default: if os.Getuid() != 0 { @@ -52,7 +48,7 @@ func testableNetwork(network string) bool { } case "unix", "unixgram": switch runtime.GOOS { - case "android", "nacl", "plan9", "windows": + case "android", "plan9", "windows": return false case "aix": return unixEnabledOnAIX @@ -63,7 +59,7 @@ func testableNetwork(network string) bool { } case "unixpacket": switch runtime.GOOS { - case "aix", "android", "darwin", "nacl", "plan9", "windows": + case "aix", "android", "darwin", "plan9", "windows": return false case "netbsd": // It passes on amd64 at least. 386 fails (Issue 22927). arm is unknown. diff --git a/src/net/port_unix.go b/src/net/port_unix.go index a6153c0c20..4fdd9a37bc 100644 --- a/src/net/port_unix.go +++ b/src/net/port_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris nacl +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris // Read system port mappings from /etc/services diff --git a/src/net/rawconn.go b/src/net/rawconn.go index c40ea4a2e1..c786354582 100644 --- a/src/net/rawconn.go +++ b/src/net/rawconn.go @@ -15,7 +15,7 @@ import ( // deadlines. If the user-provided callback returns false, the Write // method will fail immediately. -// BUG(mikio): On JS, NaCl and Plan 9, the Control, Read and Write +// BUG(mikio): On JS and Plan 9, the Control, Read and Write // methods of syscall.RawConn are not implemented. type rawConn struct { diff --git a/src/net/rawconn_stub_test.go b/src/net/rawconn_stub_test.go index 0a033c12fc..cec977f75d 100644 --- a/src/net/rawconn_stub_test.go +++ b/src/net/rawconn_stub_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl plan9 +// +build js,wasm plan9 package net diff --git a/src/net/rawconn_test.go b/src/net/rawconn_test.go index 11900dff8d..9a82f8f78e 100644 --- a/src/net/rawconn_test.go +++ b/src/net/rawconn_test.go @@ -15,7 +15,7 @@ import ( func TestRawConnReadWrite(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -175,7 +175,7 @@ func TestRawConnReadWrite(t *testing.T) { func TestRawConnControl(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/sendfile_stub.go b/src/net/sendfile_stub.go index 6d338da454..53bc53af43 100644 --- a/src/net/sendfile_stub.go +++ b/src/net/sendfile_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin js,wasm nacl netbsd openbsd +// +build aix darwin js,wasm netbsd openbsd package net diff --git a/src/net/sendfile_test.go b/src/net/sendfile_test.go index 911e6139c5..13842a1261 100644 --- a/src/net/sendfile_test.go +++ b/src/net/sendfile_test.go @@ -218,7 +218,7 @@ func TestSendfileSeeked(t *testing.T) { // Test that sendfile doesn't put a pipe into blocking mode. func TestSendfilePipe(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9", "windows": + case "plan9", "windows": // These systems don't support deadlines on pipes. t.Skipf("skipping on %s", runtime.GOOS) } diff --git a/src/net/sock_posix.go b/src/net/sock_posix.go index 00ee61883c..80b4169ec6 100644 --- a/src/net/sock_posix.go +++ b/src/net/sock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows package net diff --git a/src/net/sock_stub.go b/src/net/sock_stub.go index bbce61b687..c9f86af4e7 100644 --- a/src/net/sock_stub.go +++ b/src/net/sock_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix nacl js,wasm solaris +// +build aix js,wasm solaris package net diff --git a/src/net/sockaddr_posix.go b/src/net/sockaddr_posix.go index ae83b5ab19..a3710dd3f7 100644 --- a/src/net/sockaddr_posix.go +++ b/src/net/sockaddr_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/sockopt_stub.go b/src/net/sockopt_stub.go index bc0667504a..52624a35d8 100644 --- a/src/net/sockopt_stub.go +++ b/src/net/sockopt_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/sockoptip_stub.go b/src/net/sockoptip_stub.go index 3297969314..57cd289040 100644 --- a/src/net/sockoptip_stub.go +++ b/src/net/sockoptip_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/sys_cloexec.go b/src/net/sys_cloexec.go index e97fb21a1f..89aad7066a 100644 --- a/src/net/sys_cloexec.go +++ b/src/net/sys_cloexec.go @@ -5,7 +5,7 @@ // This file implements sysSocket and accept for platforms that do not // provide a fast path for setting SetNonblock and CloseOnExec. -// +build aix darwin nacl solaris +// +build aix darwin solaris package net diff --git a/src/net/tcpsock.go b/src/net/tcpsock.go index b7b73d0d81..9a9b03a1e8 100644 --- a/src/net/tcpsock.go +++ b/src/net/tcpsock.go @@ -12,7 +12,7 @@ import ( "time" ) -// BUG(mikio): On JS, NaCl and Windows, the File method of TCPConn and +// BUG(mikio): On JS and Windows, the File method of TCPConn and // TCPListener is not implemented. // TCPAddr represents the address of a TCP end point. diff --git a/src/net/tcpsock_posix.go b/src/net/tcpsock_posix.go index e32d5d7ee3..257c11976f 100644 --- a/src/net/tcpsock_posix.go +++ b/src/net/tcpsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/tcpsock_test.go b/src/net/tcpsock_test.go index f78675b185..8a70496693 100644 --- a/src/net/tcpsock_test.go +++ b/src/net/tcpsock_test.go @@ -476,10 +476,6 @@ func TestTCPReadWriteAllocs(t *testing.T) { // I/O on Plan 9 allocates memory. // See net/fd_io_plan9.go. t.Skipf("not supported on %s", runtime.GOOS) - case "nacl": - // NaCl needs to allocate pseudo file descriptor - // stuff. See syscall/fd_nacl.go. - t.Skipf("not supported on %s", runtime.GOOS) } ln, err := Listen("tcp", "127.0.0.1:0") diff --git a/src/net/tcpsockopt_stub.go b/src/net/tcpsockopt_stub.go index fd7f57923b..d043da123d 100644 --- a/src/net/tcpsockopt_stub.go +++ b/src/net/tcpsockopt_stub.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package net diff --git a/src/net/timeout_test.go b/src/net/timeout_test.go index b4fc2c0198..e90c16f34b 100644 --- a/src/net/timeout_test.go +++ b/src/net/timeout_test.go @@ -411,9 +411,6 @@ func TestReadTimeoutMustNotReturn(t *testing.T) { if perr := parseReadError(err); perr != nil { t.Error(perr) } - if err == io.EOF && runtime.GOOS == "nacl" { // see golang.org/issue/8044 - return - } if nerr, ok := err.(Error); !ok || nerr.Timeout() || nerr.Temporary() { t.Fatal(err) } @@ -432,11 +429,6 @@ var readFromTimeoutTests = []struct { } func TestReadFromTimeout(t *testing.T) { - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) // see golang.org/issue/8916 - } - ch := make(chan Addr) defer close(ch) handler := func(ls *localPacketServer, c PacketConn) { @@ -621,11 +613,6 @@ var writeToTimeoutTests = []struct { func TestWriteToTimeout(t *testing.T) { t.Parallel() - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) - } - c1, err := newLocalPacketListener("udp") if err != nil { t.Fatal(err) @@ -991,11 +978,6 @@ func TestReadWriteProlongedTimeout(t *testing.T) { func TestReadWriteDeadlineRace(t *testing.T) { t.Parallel() - switch runtime.GOOS { - case "nacl": - t.Skipf("not supported on %s", runtime.GOOS) - } - N := 1000 if testing.Short() { N = 50 diff --git a/src/net/udpsock.go b/src/net/udpsock.go index b234ed89ab..ec2bcfa607 100644 --- a/src/net/udpsock.go +++ b/src/net/udpsock.go @@ -9,15 +9,12 @@ import ( "syscall" ) -// BUG(mikio): On NaCl and Plan 9, the ReadMsgUDP and +// BUG(mikio): On Plan 9, the ReadMsgUDP and // WriteMsgUDP methods of UDPConn are not implemented. // BUG(mikio): On Windows, the File method of UDPConn is not // implemented. -// BUG(mikio): On NaCl, the ListenMulticastUDP function is not -// implemented. - // BUG(mikio): On JS, methods and functions related to UDPConn are not // implemented. diff --git a/src/net/udpsock_posix.go b/src/net/udpsock_posix.go index 611fe51df9..bbfa4ed9c7 100644 --- a/src/net/udpsock_posix.go +++ b/src/net/udpsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/udpsock_test.go b/src/net/udpsock_test.go index 397b6649cd..947381a57b 100644 --- a/src/net/udpsock_test.go +++ b/src/net/udpsock_test.go @@ -162,13 +162,8 @@ func testWriteToConn(t *testing.T, raddr string) { t.Fatalf("should fail as ErrWriteToConnected: %v", err) } _, _, err = c.(*UDPConn).WriteMsgUDP(b, nil, nil) - switch runtime.GOOS { - case "nacl": // see golang.org/issue/9252 - t.Skipf("not implemented yet on %s", runtime.GOOS) - default: - if err != nil { - t.Fatal(err) - } + if err != nil { + t.Fatal(err) } } @@ -205,13 +200,8 @@ func testWriteToPacketConn(t *testing.T, raddr string) { t.Fatalf("should fail as errMissingAddress: %v", err) } _, _, err = c.(*UDPConn).WriteMsgUDP(b, nil, ra) - switch runtime.GOOS { - case "nacl": // see golang.org/issue/9252 - t.Skipf("not implemented yet on %s", runtime.GOOS) - default: - if err != nil { - t.Fatal(err) - } + if err != nil { + t.Fatal(err) } } @@ -335,7 +325,7 @@ func TestIPv6LinkLocalUnicastUDP(t *testing.T) { func TestUDPZeroBytePayload(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) case "darwin": testenv.SkipFlaky(t, 29225) @@ -373,7 +363,7 @@ func TestUDPZeroBytePayload(t *testing.T) { func TestUDPZeroByteBuffer(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } @@ -410,7 +400,7 @@ func TestUDPZeroByteBuffer(t *testing.T) { func TestUDPReadSizeError(t *testing.T) { switch runtime.GOOS { - case "nacl", "plan9": + case "plan9": t.Skipf("not supported on %s", runtime.GOOS) } diff --git a/src/net/unixsock.go b/src/net/unixsock.go index ae912a46dd..b38438c11a 100644 --- a/src/net/unixsock.go +++ b/src/net/unixsock.go @@ -12,7 +12,7 @@ import ( "time" ) -// BUG(mikio): On JS, NaCl and Plan 9, methods and functions related +// BUG(mikio): On JS and Plan 9, methods and functions related // to UnixConn and UnixListener are not implemented. // BUG(mikio): On Windows, methods and functions related to UnixConn diff --git a/src/net/unixsock_posix.go b/src/net/unixsock_posix.go index 74f5cc231c..275c7c936d 100644 --- a/src/net/unixsock_posix.go +++ b/src/net/unixsock_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package net diff --git a/src/net/unixsock_test.go b/src/net/unixsock_test.go index 4828990310..80cccf21e3 100644 --- a/src/net/unixsock_test.go +++ b/src/net/unixsock_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !js,!nacl,!plan9,!windows +// +build !js,!plan9,!windows package net diff --git a/src/os/dir_unix.go b/src/os/dir_unix.go index b2c8fe6f15..e0c4989756 100644 --- a/src/os/dir_unix.go +++ b/src/os/dir_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/error_posix.go b/src/os/error_posix.go index 0478ba676a..2aeca82304 100644 --- a/src/os/error_posix.go +++ b/src/os/error_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/error_unix_test.go b/src/os/error_unix_test.go index c47af56332..bfc83c9867 100644 --- a/src/os/error_unix_test.go +++ b/src/os/error_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os_test diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go index 799e0b4eeb..93793e0eee 100644 --- a/src/os/exec/lp_unix.go +++ b/src/os/exec/lp_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package exec diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go index 505931b488..f6c7a49c1b 100644 --- a/src/os/exec_posix.go +++ b/src/os/exec_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/exec_unix.go b/src/os/exec_unix.go index abae5a2feb..6e4ffe82d2 100644 --- a/src/os/exec_unix.go +++ b/src/os/exec_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/executable.go b/src/os/executable.go index 17eed10bc9..cc3134af1c 100644 --- a/src/os/executable.go +++ b/src/os/executable.go @@ -15,8 +15,6 @@ package os // // The main use case is finding resources located relative to an // executable. -// -// Executable is not supported on nacl. func Executable() (string, error) { return executable() } diff --git a/src/os/executable_procfs.go b/src/os/executable_procfs.go index 5bb63b9bdc..2628223b8d 100644 --- a/src/os/executable_procfs.go +++ b/src/os/executable_procfs.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build linux netbsd dragonfly nacl js,wasm +// +build linux netbsd dragonfly js,wasm package os diff --git a/src/os/executable_test.go b/src/os/executable_test.go index d513c8760e..f25ee0c95a 100644 --- a/src/os/executable_test.go +++ b/src/os/executable_test.go @@ -17,7 +17,7 @@ import ( const executable_EnvVar = "OSTEST_OUTPUT_EXECPATH" func TestExecutable(t *testing.T) { - testenv.MustHaveExec(t) // will also exclude nacl, which doesn't support Executable anyway + testenv.MustHaveExec(t) ep, err := os.Executable() if err != nil { t.Fatalf("Executable failed: %v", err) diff --git a/src/os/export_unix_test.go b/src/os/export_unix_test.go index 032b1a9dbf..39866a68de 100644 --- a/src/os/export_unix_test.go +++ b/src/os/export_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/file.go b/src/os/file.go index 9afc0ba360..51e0993f36 100644 --- a/src/os/file.go +++ b/src/os/file.go @@ -475,8 +475,6 @@ func UserHomeDir() (string, error) { } // On some geese the home directory is not always defined. switch runtime.GOOS { - case "nacl": - return "/", nil case "android": return "/sdcard", nil case "darwin": diff --git a/src/os/file_posix.go b/src/os/file_posix.go index 2343079219..c3635ddd28 100644 --- a/src/os/file_posix.go +++ b/src/os/file_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package os diff --git a/src/os/file_unix.go b/src/os/file_unix.go index 754e859645..042c2997db 100644 --- a/src/os/file_unix.go +++ b/src/os/file_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/os_test.go b/src/os/os_test.go index b94ab0d232..ae6bad1fee 100644 --- a/src/os/os_test.go +++ b/src/os/os_test.go @@ -1159,9 +1159,7 @@ func testChtimes(t *testing.T, name string) { pmt := postStat.ModTime() if !pat.Before(at) { switch runtime.GOOS { - case "plan9", "nacl": - // Ignore. - // Plan 9, NaCl: + case "plan9": // Mtime is the time of the last change of // content. Similarly, atime is set whenever // the contents are accessed; also, it is set @@ -1351,10 +1349,6 @@ func TestSeek(t *testing.T) { {0, io.SeekCurrent, 2<<32 - 1}, } for i, tt := range tests { - if runtime.GOOS == "nacl" && tt.out > 1<<30 { - t.Logf("skipping test case #%d on nacl; https://golang.org/issue/21728", i) - continue - } off, err := f.Seek(tt.in, tt.whence) if off != tt.out || err != nil { if e, ok := err.(*PathError); ok && e.Err == syscall.EINVAL && tt.out > 1<<32 && runtime.GOOS == "linux" { @@ -1371,7 +1365,7 @@ func TestSeek(t *testing.T) { func TestSeekError(t *testing.T) { switch runtime.GOOS { - case "js", "nacl", "plan9": + case "js", "plan9": t.Skipf("skipping test on %v", runtime.GOOS) } diff --git a/src/os/path_unix.go b/src/os/path_unix.go index df423d2c9d..c99a8240c5 100644 --- a/src/os/path_unix.go +++ b/src/os/path_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/pipe_bsd.go b/src/os/pipe_bsd.go index dc4c951a28..0d2d82feb9 100644 --- a/src/os/pipe_bsd.go +++ b/src/os/pipe_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly js,wasm nacl solaris +// +build aix darwin dragonfly js,wasm solaris package os diff --git a/src/os/pipe_test.go b/src/os/pipe_test.go index 4c53bc985d..114c181c4a 100644 --- a/src/os/pipe_test.go +++ b/src/os/pipe_test.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Test broken pipes on Unix systems. -// +build !plan9,!nacl,!js +// +build !plan9,!js package os_test diff --git a/src/os/rawconn_test.go b/src/os/rawconn_test.go index 820150d959..2554f5b087 100644 --- a/src/os/rawconn_test.go +++ b/src/os/rawconn_test.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // Test use of raw connections. -// +build !plan9,!nacl,!js +// +build !plan9,!js package os_test diff --git a/src/os/removeall_test.go b/src/os/removeall_test.go index 4d556f977e..8700b6af17 100644 --- a/src/os/removeall_test.go +++ b/src/os/removeall_test.go @@ -289,7 +289,7 @@ func TestRemoveReadOnlyDir(t *testing.T) { // Issue #29983. func TestRemoveAllButReadOnlyAndPathError(t *testing.T) { switch runtime.GOOS { - case "nacl", "js", "windows": + case "js", "windows": t.Skipf("skipping test on %s", runtime.GOOS) } @@ -379,7 +379,7 @@ func TestRemoveAllButReadOnlyAndPathError(t *testing.T) { func TestRemoveUnreadableDir(t *testing.T) { switch runtime.GOOS { - case "nacl", "js", "windows": + case "js", "windows": t.Skipf("skipping test on %s", runtime.GOOS) } diff --git a/src/os/signal/signal_unix.go b/src/os/signal/signal_unix.go index 0bbf41bfde..89ee2d9e18 100644 --- a/src/os/signal/signal_unix.go +++ b/src/os/signal/signal_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package signal diff --git a/src/os/stat_nacljs.go b/src/os/stat_js.go similarity index 98% rename from src/os/stat_nacljs.go rename to src/os/stat_js.go index f14add8674..8d20ccddfc 100644 --- a/src/os/stat_nacljs.go +++ b/src/os/stat_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build js,wasm nacl +// +build js,wasm package os diff --git a/src/os/stat_unix.go b/src/os/stat_unix.go index 4f85dcea07..0a7e6029ac 100644 --- a/src/os/stat_unix.go +++ b/src/os/stat_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package os diff --git a/src/os/sys_bsd.go b/src/os/sys_bsd.go index d820be2ab6..b1698f5d4c 100644 --- a/src/os/sys_bsd.go +++ b/src/os/sys_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd js,wasm nacl netbsd openbsd +// +build darwin dragonfly freebsd js,wasm netbsd openbsd package os diff --git a/src/os/sys_nacl.go b/src/os/sys_nacl.go deleted file mode 100644 index 07907c8477..0000000000 --- a/src/os/sys_nacl.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package os - -// supportsCloseOnExec reports whether the platform supports the -// O_CLOEXEC flag. -const supportsCloseOnExec = false diff --git a/src/os/timeout_test.go b/src/os/timeout_test.go index 5d7ea7ea29..0fe03fa517 100644 --- a/src/os/timeout_test.go +++ b/src/os/timeout_test.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl // +build !js // +build !plan9 // +build !windows diff --git a/src/os/user/lookup_stubs.go b/src/os/user/lookup_stubs.go index 7164514828..178d814dda 100644 --- a/src/os/user/lookup_stubs.go +++ b/src/os/user/lookup_stubs.go @@ -35,15 +35,8 @@ func current() (*User, error) { Name: "", // ignored HomeDir: homeDir, } - // On NaCL and Android, return a dummy user instead of failing. + // On Android, return a dummy user instead of failing. switch runtime.GOOS { - case "nacl": - if u.Uid == "" { - u.Uid = "1" - } - if u.Username == "" { - u.Username = "nacl" - } case "android": if u.Uid == "" { u.Uid = "1" diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go index be62f4d0c3..0890cd8f2b 100644 --- a/src/os/user/lookup_unix.go +++ b/src/os/user/lookup_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm !android,linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm !android,linux netbsd openbsd solaris // +build !cgo osusergo package user diff --git a/src/os/user/lookup_unix_test.go b/src/os/user/lookup_unix_test.go index 65fe0656de..72d3b47534 100644 --- a/src/os/user/lookup_unix_test.go +++ b/src/os/user/lookup_unix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd !android,linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris // +build !cgo package user diff --git a/src/os/wait_unimp.go b/src/os/wait_unimp.go index 469abf7640..0f4cdc4533 100644 --- a/src/os/wait_unimp.go +++ b/src/os/wait_unimp.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly js,wasm nacl netbsd openbsd solaris +// +build aix darwin dragonfly js,wasm netbsd openbsd solaris package os diff --git a/src/path/filepath/path_unix.go b/src/path/filepath/path_unix.go index c10b3288a1..ec497d9e26 100644 --- a/src/path/filepath/path_unix.go +++ b/src/path/filepath/path_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package filepath diff --git a/src/plugin/plugin_test.go b/src/plugin/plugin_test.go index b334c5cf0e..30b79edaad 100644 --- a/src/plugin/plugin_test.go +++ b/src/plugin/plugin_test.go @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl // +build !linux linux,!arm64 package plugin_test diff --git a/src/reflect/all_test.go b/src/reflect/all_test.go index 7c5dd59aa7..1fbc8dd61c 100644 --- a/src/reflect/all_test.go +++ b/src/reflect/all_test.go @@ -6416,7 +6416,7 @@ func TestGCBits(t *testing.T) { join(hdr, rep(8, lit(0, 1)), rep(8, lit(1)), lit(1))) verifyMapBucket(t, Tint64, Tptr, map[int64]Xptr(nil), - join(hdr, rep(8, rep(8/PtrSize, lit(0))), rep(8, lit(1)), naclpad(), lit(1))) + join(hdr, rep(8, rep(8/PtrSize, lit(0))), rep(8, lit(1)), lit(1))) verifyMapBucket(t, Tscalar, Tscalar, map[Xscalar]Xscalar(nil), @@ -6443,13 +6443,6 @@ func TestGCBits(t *testing.T) { join(hdr, rep(8, lit(1)), rep(8, lit(1)), lit(1))) } -func naclpad() []byte { - if runtime.GOARCH == "amd64p32" { - return lit(0) - } - return nil -} - func rep(n int, b []byte) []byte { return bytes.Repeat(b, n) } func join(b ...[]byte) []byte { return bytes.Join(b, nil) } func lit(x ...byte) []byte { return x } diff --git a/src/runtime/alg.go b/src/runtime/alg.go index 935d45d503..56a8212981 100644 --- a/src/runtime/alg.go +++ b/src/runtime/alg.go @@ -321,7 +321,6 @@ var hashkey [4]uintptr func alginit() { // Install AES hash algorithms if the instructions needed are present. if (GOARCH == "386" || GOARCH == "amd64") && - GOOS != "nacl" && cpu.X86.HasAES && // AESENC cpu.X86.HasSSSE3 && // PSHUFB cpu.X86.HasSSE41 { // PINSR{D,Q} diff --git a/src/runtime/asm_386.s b/src/runtime/asm_386.s index b31ea41ad4..8f0ec08f80 100644 --- a/src/runtime/asm_386.s +++ b/src/runtime/asm_386.s @@ -109,9 +109,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 MOVL SP, (g_stack+stack_hi)(BP) // find out information about the processor we're on -#ifdef GOOS_nacl // NaCl doesn't like PUSHFL/POPFL - JMP has_cpuid -#else // first see if CPUID instruction is supported. PUSHFL PUSHFL @@ -123,7 +120,6 @@ TEXT runtime·rt0_go(SB),NOSPLIT|NOFRAME,$0 POPFL // restore EFLAGS TESTL $(1<<21), AX JNE has_cpuid -#endif bad_proc: // show that the program requires MMX. MOVL $2, 0(SP) diff --git a/src/runtime/asm_arm.s b/src/runtime/asm_arm.s index ade39dfed8..51a50c604c 100644 --- a/src/runtime/asm_arm.s +++ b/src/runtime/asm_arm.s @@ -185,14 +185,10 @@ GLOBL runtime·mainPC(SB),RODATA,$4 TEXT runtime·breakpoint(SB),NOSPLIT,$0-0 // gdb won't skip this breakpoint instruction automatically, // so you must manually "set $pc+=4" to skip it and continue. -#ifdef GOOS_nacl - WORD $0xe125be7f // BKPT 0x5bef, NACL_INSTR_ARM_BREAKPOINT -#else #ifdef GOOS_plan9 WORD $0xD1200070 // undefined instruction used as armv5 breakpoint in Plan 9 #else WORD $0xe7f001f0 // undefined instruction that gdb understands is a software breakpoint -#endif #endif RET @@ -327,9 +323,6 @@ switch: // save our state in g->sched. Pretend to // be systemstack_switch if the G stack is scanned. MOVW $runtime·systemstack_switch(SB), R3 -#ifdef GOOS_nacl - ADD $4, R3, R3 // get past nacl-insert bic instruction -#endif ADD $4, R3, R3 // get past push {lr} MOVW R3, (g_sched+gobuf_pc)(g) MOVW R13, (g_sched+gobuf_sp)(g) @@ -887,7 +880,6 @@ TEXT runtime·usplitR0(SB),NOSPLIT,$0 SUB R1, R3, R1 RET -#ifndef GOOS_nacl // This is called from .init_array and follows the platform, not Go, ABI. TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW R9, saver9-4(SP) // The access to global variables below implicitly uses R9, which is callee-save @@ -898,7 +890,6 @@ TEXT runtime·addmoduledata(SB),NOSPLIT,$0-0 MOVW saver11-8(SP), R11 MOVW saver9-4(SP), R9 RET -#endif TEXT ·checkASM(SB),NOSPLIT,$0-1 MOVW $1, R3 @@ -935,8 +926,6 @@ ret: MOVM.IA.W (R13), [R0,R1] // Do the write. MOVW R3, (R2) - // Normally RET on nacl clobbers R12, but because this - // function has no frame it doesn't have to usual epilogue. RET flush: diff --git a/src/runtime/crash_nonunix_test.go b/src/runtime/crash_nonunix_test.go index bf349a5d89..06c197ec2b 100644 --- a/src/runtime/crash_nonunix_test.go +++ b/src/runtime/crash_nonunix_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build windows plan9 nacl js,wasm +// +build windows plan9 js,wasm package runtime_test diff --git a/src/runtime/debug/heapdump_test.go b/src/runtime/debug/heapdump_test.go index c986efcb32..de1ec27d21 100644 --- a/src/runtime/debug/heapdump_test.go +++ b/src/runtime/debug/heapdump_test.go @@ -13,7 +13,7 @@ import ( ) func TestWriteHeapDumpNonempty(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") @@ -42,7 +42,7 @@ func objfin(x *Obj) { } func TestWriteHeapDumpFinalizers(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skipf("WriteHeapDump is not available on %s.", runtime.GOOS) } f, err := ioutil.TempFile("", "heapdumptest") diff --git a/src/runtime/defs_nacl_386.go b/src/runtime/defs_nacl_386.go deleted file mode 100644 index 70dfcf2c51..0000000000 --- a/src/runtime/defs_nacl_386.go +++ /dev/null @@ -1,49 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregs386 struct { - eax uint32 - ecx uint32 - edx uint32 - ebx uint32 - esp uint32 - ebp uint32 - esi uint32 - edi uint32 - eip uint32 - eflags uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregs386 -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/defs_nacl_arm.go b/src/runtime/defs_nacl_arm.go deleted file mode 100644 index 89e539ea7b..0000000000 --- a/src/runtime/defs_nacl_arm.go +++ /dev/null @@ -1,56 +0,0 @@ -package runtime - -const ( - // These values are referred to in the source code - // but really don't matter. Even so, use the standard numbers. - _SIGQUIT = 3 - _SIGTRAP = 5 - _SIGSEGV = 11 - _SIGPROF = 27 -) - -type timespec struct { - tv_sec int64 - tv_nsec int32 -} - -//go:nosplit -func (ts *timespec) setNsec(ns int64) { - ts.tv_sec = int64(timediv(ns, 1e9, &ts.tv_nsec)) -} - -type excregsarm struct { - r0 uint32 - r1 uint32 - r2 uint32 - r3 uint32 - r4 uint32 - r5 uint32 - r6 uint32 - r7 uint32 - r8 uint32 - r9 uint32 // the value reported here is undefined. - r10 uint32 - r11 uint32 - r12 uint32 - sp uint32 /* r13 */ - lr uint32 /* r14 */ - pc uint32 /* r15 */ - cpsr uint32 -} - -type exccontext struct { - size uint32 - portable_context_offset uint32 - portable_context_size uint32 - arch uint32 - regs_size uint32 - reserved [11]uint32 - regs excregsarm -} - -type excportablecontext struct { - pc uint32 - sp uint32 - fp uint32 -} diff --git a/src/runtime/env_posix.go b/src/runtime/env_posix.go index 03208c7c10..f95ff68545 100644 --- a/src/runtime/env_posix.go +++ b/src/runtime/env_posix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/export_mmap_test.go b/src/runtime/export_mmap_test.go index 6c4a4466de..aeaf37f64b 100644 --- a/src/runtime/export_mmap_test.go +++ b/src/runtime/export_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris // Export guts for testing. diff --git a/src/runtime/internal/sys/arch_386.go b/src/runtime/internal/sys/arch_386.go index 3426fd1702..b51f70a512 100644 --- a/src/runtime/internal/sys/arch_386.go +++ b/src/runtime/internal/sys/arch_386.go @@ -7,7 +7,7 @@ package sys const ( ArchFamily = I386 BigEndian = false - DefaultPhysPageSize = GoosNacl*65536 + (1-GoosNacl)*4096 // 4k normally; 64k on NaCl + DefaultPhysPageSize = 4096 PCQuantum = 1 Int64Align = 4 MinFrameSize = 0 diff --git a/src/runtime/internal/sys/zgoos_nacl.go b/src/runtime/internal/sys/zgoos_nacl.go deleted file mode 100644 index 9e65b6f185..0000000000 --- a/src/runtime/internal/sys/zgoos_nacl.go +++ /dev/null @@ -1,24 +0,0 @@ -// Code generated by gengoos.go using 'go generate'. DO NOT EDIT. - -// +build nacl - -package sys - -const GOOS = `nacl` - -const GoosAix = 0 -const GoosAndroid = 0 -const GoosDarwin = 0 -const GoosDragonfly = 0 -const GoosFreebsd = 0 -const GoosHurd = 0 -const GoosIllumos = 0 -const GoosJs = 0 -const GoosLinux = 0 -const GoosNacl = 1 -const GoosNetbsd = 0 -const GoosOpenbsd = 0 -const GoosPlan9 = 0 -const GoosSolaris = 0 -const GoosWindows = 0 -const GoosZos = 0 diff --git a/src/runtime/lfstack_32bit.go b/src/runtime/lfstack_32bit.go index d36ca50971..f07ff1c06b 100644 --- a/src/runtime/lfstack_32bit.go +++ b/src/runtime/lfstack_32bit.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build 386 arm nacl mips mipsle +// +build 386 arm mips mipsle package runtime diff --git a/src/runtime/lock_sema.go b/src/runtime/lock_sema.go index b36c97f71e..9507d46f41 100644 --- a/src/runtime/lock_sema.go +++ b/src/runtime/lock_sema.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin nacl netbsd openbsd plan9 solaris windows +// +build aix darwin netbsd openbsd plan9 solaris windows package runtime diff --git a/src/runtime/mem_bsd.go b/src/runtime/mem_bsd.go index 08a2391610..ad23539523 100644 --- a/src/runtime/mem_bsd.go +++ b/src/runtime/mem_bsd.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build dragonfly freebsd nacl netbsd openbsd solaris +// +build dragonfly freebsd netbsd openbsd solaris package runtime diff --git a/src/runtime/mknacl.sh b/src/runtime/mknacl.sh deleted file mode 100644 index 306ae3d9c1..0000000000 --- a/src/runtime/mknacl.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash -# Copyright 2013 The Go Authors. All rights reserved. -# Use of this source code is governed by a BSD-style -# license that can be found in the LICENSE file. - -cat /Users/rsc/pub/native_client/src/trusted/service_runtime/include/bits/nacl_syscalls.h | - awk ' - BEGIN { - printf("// Code generated by mknacl.sh; DO NOT EDIT.\n") - } - NF==3 && $1=="#define" && $2~/^NACL_sys_/ { - name=$2 - sub(/^NACL_sys_/, "SYS_", name) - printf("#define %s %s\n", name, $3) - }' >syscall_nacl.h diff --git a/src/runtime/mmap.go b/src/runtime/mmap.go index 2868f3fd4e..9fe31cb416 100644 --- a/src/runtime/mmap.go +++ b/src/runtime/mmap.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !linux !amd64 // +build !linux !arm64 // +build !js diff --git a/src/runtime/netpoll.go b/src/runtime/netpoll.go index 73bbc5e3c7..adb072db38 100644 --- a/src/runtime/netpoll.go +++ b/src/runtime/netpoll.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris windows package runtime diff --git a/src/runtime/netpoll_fake.go b/src/runtime/netpoll_fake.go index 5b1a63a878..214538e281 100644 --- a/src/runtime/netpoll_fake.go +++ b/src/runtime/netpoll_fake.go @@ -2,10 +2,10 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// Fake network poller for NaCl and wasm/js. +// Fake network poller for wasm/js. // Should never be used, because NaCl and wasm/js network connections do not honor "SetNonblock". -// +build nacl js,wasm +// +build js,wasm package runtime diff --git a/src/runtime/os2_nacl.go b/src/runtime/os2_nacl.go deleted file mode 100644 index b84cb18bb2..0000000000 --- a/src/runtime/os2_nacl.go +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -const ( - _NSIG = 32 - _SI_USER = 1 - - // native_client/src/trusted/service_runtime/include/sys/errno.h - // The errors are mainly copied from Linux. - _EPERM = 1 /* Operation not permitted */ - _ENOENT = 2 /* No such file or directory */ - _ESRCH = 3 /* No such process */ - _EINTR = 4 /* Interrupted system call */ - _EIO = 5 /* I/O error */ - _ENXIO = 6 /* No such device or address */ - _E2BIG = 7 /* Argument list too long */ - _ENOEXEC = 8 /* Exec format error */ - _EBADF = 9 /* Bad file number */ - _ECHILD = 10 /* No child processes */ - _EAGAIN = 11 /* Try again */ - // _ENOMEM is defined in mem_bsd.go for nacl. - // _ENOMEM = 12 /* Out of memory */ - _EACCES = 13 /* Permission denied */ - _EFAULT = 14 /* Bad address */ - _EBUSY = 16 /* Device or resource busy */ - _EEXIST = 17 /* File exists */ - _EXDEV = 18 /* Cross-device link */ - _ENODEV = 19 /* No such device */ - _ENOTDIR = 20 /* Not a directory */ - _EISDIR = 21 /* Is a directory */ - _EINVAL = 22 /* Invalid argument */ - _ENFILE = 23 /* File table overflow */ - _EMFILE = 24 /* Too many open files */ - _ENOTTY = 25 /* Not a typewriter */ - _EFBIG = 27 /* File too large */ - _ENOSPC = 28 /* No space left on device */ - _ESPIPE = 29 /* Illegal seek */ - _EROFS = 30 /* Read-only file system */ - _EMLINK = 31 /* Too many links */ - _EPIPE = 32 /* Broken pipe */ - _ENAMETOOLONG = 36 /* File name too long */ - _ENOSYS = 38 /* Function not implemented */ - _EDQUOT = 122 /* Quota exceeded */ - _EDOM = 33 /* Math arg out of domain of func */ - _ERANGE = 34 /* Math result not representable */ - _EDEADLK = 35 /* Deadlock condition */ - _ENOLCK = 37 /* No record locks available */ - _ENOTEMPTY = 39 /* Directory not empty */ - _ELOOP = 40 /* Too many symbolic links */ - _ENOMSG = 42 /* No message of desired type */ - _EIDRM = 43 /* Identifier removed */ - _ECHRNG = 44 /* Channel number out of range */ - _EL2NSYNC = 45 /* Level 2 not synchronized */ - _EL3HLT = 46 /* Level 3 halted */ - _EL3RST = 47 /* Level 3 reset */ - _ELNRNG = 48 /* Link number out of range */ - _EUNATCH = 49 /* Protocol driver not attached */ - _ENOCSI = 50 /* No CSI structure available */ - _EL2HLT = 51 /* Level 2 halted */ - _EBADE = 52 /* Invalid exchange */ - _EBADR = 53 /* Invalid request descriptor */ - _EXFULL = 54 /* Exchange full */ - _ENOANO = 55 /* No anode */ - _EBADRQC = 56 /* Invalid request code */ - _EBADSLT = 57 /* Invalid slot */ - _EDEADLOCK = _EDEADLK /* File locking deadlock error */ - _EBFONT = 59 /* Bad font file fmt */ - _ENOSTR = 60 /* Device not a stream */ - _ENODATA = 61 /* No data (for no delay io) */ - _ETIME = 62 /* Timer expired */ - _ENOSR = 63 /* Out of streams resources */ - _ENONET = 64 /* Machine is not on the network */ - _ENOPKG = 65 /* Package not installed */ - _EREMOTE = 66 /* The object is remote */ - _ENOLINK = 67 /* The link has been severed */ - _EADV = 68 /* Advertise error */ - _ESRMNT = 69 /* Srmount error */ - _ECOMM = 70 /* Communication error on send */ - _EPROTO = 71 /* Protocol error */ - _EMULTIHOP = 72 /* Multihop attempted */ - _EDOTDOT = 73 /* Cross mount point (not really error) */ - _EBADMSG = 74 /* Trying to read unreadable message */ - _EOVERFLOW = 75 /* Value too large for defined data type */ - _ENOTUNIQ = 76 /* Given log. name not unique */ - _EBADFD = 77 /* f.d. invalid for this operation */ - _EREMCHG = 78 /* Remote address changed */ - _ELIBACC = 79 /* Can't access a needed shared lib */ - _ELIBBAD = 80 /* Accessing a corrupted shared lib */ - _ELIBSCN = 81 /* .lib section in a.out corrupted */ - _ELIBMAX = 82 /* Attempting to link in too many libs */ - _ELIBEXEC = 83 /* Attempting to exec a shared library */ - _EILSEQ = 84 - _EUSERS = 87 - _ENOTSOCK = 88 /* Socket operation on non-socket */ - _EDESTADDRREQ = 89 /* Destination address required */ - _EMSGSIZE = 90 /* Message too long */ - _EPROTOTYPE = 91 /* Protocol wrong type for socket */ - _ENOPROTOOPT = 92 /* Protocol not available */ - _EPROTONOSUPPORT = 93 /* Unknown protocol */ - _ESOCKTNOSUPPORT = 94 /* Socket type not supported */ - _EOPNOTSUPP = 95 /* Operation not supported on transport endpoint */ - _EPFNOSUPPORT = 96 /* Protocol family not supported */ - _EAFNOSUPPORT = 97 /* Address family not supported by protocol family */ - _EADDRINUSE = 98 /* Address already in use */ - _EADDRNOTAVAIL = 99 /* Address not available */ - _ENETDOWN = 100 /* Network interface is not configured */ - _ENETUNREACH = 101 /* Network is unreachable */ - _ENETRESET = 102 - _ECONNABORTED = 103 /* Connection aborted */ - _ECONNRESET = 104 /* Connection reset by peer */ - _ENOBUFS = 105 /* No buffer space available */ - _EISCONN = 106 /* Socket is already connected */ - _ENOTCONN = 107 /* Socket is not connected */ - _ESHUTDOWN = 108 /* Can't send after socket shutdown */ - _ETOOMANYREFS = 109 - _ETIMEDOUT = 110 /* Connection timed out */ - _ECONNREFUSED = 111 /* Connection refused */ - _EHOSTDOWN = 112 /* Host is down */ - _EHOSTUNREACH = 113 /* Host is unreachable */ - _EALREADY = 114 /* Socket already connected */ - _EINPROGRESS = 115 /* Connection already in progress */ - _ESTALE = 116 - _ENOTSUP = _EOPNOTSUPP /* Not supported */ - _ENOMEDIUM = 123 /* No medium (in tape drive) */ - _ECANCELED = 125 /* Operation canceled. */ - _ELBIN = 2048 /* Inode is remote (not really error) */ - _EFTYPE = 2049 /* Inappropriate file type or format */ - _ENMFILE = 2050 /* No more files */ - _EPROCLIM = 2051 - _ENOSHARE = 2052 /* No such host or network path */ - _ECASECLASH = 2053 /* Filename exists with different case */ - _EWOULDBLOCK = _EAGAIN /* Operation would block */ - - // native_client/src/trusted/service_runtime/include/bits/mman.h. - // NOTE: DO NOT USE native_client/src/shared/imc/nacl_imc_c.h. - // Those MAP_*values are different from these. - _PROT_NONE = 0x0 - _PROT_READ = 0x1 - _PROT_WRITE = 0x2 - _PROT_EXEC = 0x4 - - _MAP_SHARED = 0x1 - _MAP_PRIVATE = 0x2 - _MAP_FIXED = 0x10 - _MAP_ANON = 0x20 - - _MADV_FREE = 0 - _SIGFPE = 8 - _FPE_INTDIV = 0 -) - -type siginfo struct{} diff --git a/src/runtime/os_nacl.go b/src/runtime/os_nacl.go deleted file mode 100644 index 8cda597ca5..0000000000 --- a/src/runtime/os_nacl.go +++ /dev/null @@ -1,333 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type mOS struct { - waitsema int32 // semaphore for parking on locks - waitsemacount int32 - waitsemalock int32 -} - -func nacl_exception_stack(p uintptr, size int32) int32 -func nacl_exception_handler(fn uintptr, arg unsafe.Pointer) int32 -func nacl_sem_create(flag int32) int32 -func nacl_sem_wait(sem int32) int32 -func nacl_sem_post(sem int32) int32 -func nacl_mutex_create(flag int32) int32 -func nacl_mutex_lock(mutex int32) int32 -func nacl_mutex_trylock(mutex int32) int32 -func nacl_mutex_unlock(mutex int32) int32 -func nacl_cond_create(flag int32) int32 -func nacl_cond_wait(cond, n int32) int32 -func nacl_cond_signal(cond int32) int32 -func nacl_cond_broadcast(cond int32) int32 - -//go:noescape -func nacl_cond_timed_wait_abs(cond, lock int32, ts *timespec) int32 -func nacl_thread_create(fn uintptr, stk, tls, xx unsafe.Pointer) int32 - -//go:noescape -func nacl_nanosleep(ts, extra *timespec) int32 -func nanotime() int64 -func mmap(addr unsafe.Pointer, n uintptr, prot, flags, fd int32, off uint32) (p unsafe.Pointer, err int) -func exit(code int32) -func osyield() - -//go:noescape -func write(fd uintptr, p unsafe.Pointer, n int32) int32 - -//go:linkname os_sigpipe os.sigpipe -func os_sigpipe() { - throw("too many writes on closed pipe") -} - -func dieFromSignal(sig uint32) { - exit(2) -} - -func sigpanic() { - g := getg() - if !canpanic(g) { - throw("unexpected signal during runtime execution") - } - - // Native Client only invokes the exception handler for memory faults. - g.sig = _SIGSEGV - panicmem() -} - -func raiseproc(sig uint32) { -} - -// Stubs so tests can link correctly. These should never be called. -func open(name *byte, mode, perm int32) int32 -func closefd(fd int32) int32 -func read(fd int32, p unsafe.Pointer, n int32) int32 - -type sigset struct{} - -// Called to initialize a new m (including the bootstrap m). -// Called on the parent thread (main thread in case of bootstrap), can allocate memory. -func mpreinit(mp *m) { - mp.gsignal = malg(32 * 1024) - mp.gsignal.m = mp -} - -func sigtramp(ctxt byte) - -//go:nosplit -func msigsave(mp *m) { -} - -//go:nosplit -func msigrestore(sigmask sigset) { -} - -//go:nosplit -//go:nowritebarrierrec -func clearSignalHandlers() { -} - -//go:nosplit -func sigblock() { -} - -// Called to initialize a new m (including the bootstrap m). -// Called on the new thread, cannot allocate memory. -func minit() { - _g_ := getg() - - // Initialize signal handling - ret := nacl_exception_stack(_g_.m.gsignal.stack.lo, 32*1024) - if ret < 0 { - print("runtime: nacl_exception_stack: error ", -ret, "\n") - } - - ret = nacl_exception_handler(funcPC(sigtramp), nil) - if ret < 0 { - print("runtime: nacl_exception_handler: error ", -ret, "\n") - } -} - -// Called from dropm to undo the effect of an minit. -func unminit() { -} - -func osinit() { - ncpu = 1 - getg().m.procid = 2 - //nacl_exception_handler(funcPC(sigtramp), nil); - physPageSize = 65536 -} - -func signame(sig uint32) string { - if sig >= uint32(len(sigtable)) { - return "" - } - return sigtable[sig].name -} - -//go:nosplit -func crash() { - *(*int32)(nil) = 0 -} - -//go:noescape -func getRandomData([]byte) - -func goenvs() { - goenvs_unix() -} - -func initsig(preinit bool) { -} - -//go:nosplit -func usleep(us uint32) { - var ts timespec - - ts.tv_sec = int64(us / 1e6) - ts.tv_nsec = int32(us%1e6) * 1e3 - nacl_nanosleep(&ts, nil) -} - -func mstart_nacl() - -// May run with m.p==nil, so write barriers are not allowed. -//go:nowritebarrier -func newosproc(mp *m) { - stk := unsafe.Pointer(mp.g0.stack.hi) - mp.tls[0] = uintptr(unsafe.Pointer(mp.g0)) - mp.tls[1] = uintptr(unsafe.Pointer(mp)) - ret := nacl_thread_create(funcPC(mstart_nacl), stk, unsafe.Pointer(&mp.tls[2]), nil) - if ret < 0 { - print("nacl_thread_create: error ", -ret, "\n") - throw("newosproc") - } -} - -//go:noescape -func exitThread(wait *uint32) - -//go:nosplit -func semacreate(mp *m) { - if mp.waitsema != 0 { - return - } - systemstack(func() { - mu := nacl_mutex_create(0) - if mu < 0 { - print("nacl_mutex_create: error ", -mu, "\n") - throw("semacreate") - } - c := nacl_cond_create(0) - if c < 0 { - print("nacl_cond_create: error ", -c, "\n") - throw("semacreate") - } - mp.waitsema = c - mp.waitsemalock = mu - }) -} - -//go:nosplit -func semasleep(ns int64) int32 { - var ret int32 - systemstack(func() { - _g_ := getg() - if nacl_mutex_lock(_g_.m.waitsemalock) < 0 { - throw("semasleep") - } - var ts timespec - if ns >= 0 { - end := ns + nanotime() - ts.tv_sec = end / 1e9 - ts.tv_nsec = int32(end % 1e9) - } - for _g_.m.waitsemacount == 0 { - if ns < 0 { - if nacl_cond_wait(_g_.m.waitsema, _g_.m.waitsemalock) < 0 { - throw("semasleep") - } - } else { - r := nacl_cond_timed_wait_abs(_g_.m.waitsema, _g_.m.waitsemalock, &ts) - if r == -_ETIMEDOUT { - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = -1 - return - } - if r < 0 { - throw("semasleep") - } - } - } - - _g_.m.waitsemacount = 0 - nacl_mutex_unlock(_g_.m.waitsemalock) - ret = 0 - }) - return ret -} - -//go:nosplit -func semawakeup(mp *m) { - systemstack(func() { - if nacl_mutex_lock(mp.waitsemalock) < 0 { - throw("semawakeup") - } - if mp.waitsemacount != 0 { - throw("semawakeup") - } - mp.waitsemacount = 1 - nacl_cond_signal(mp.waitsema) - nacl_mutex_unlock(mp.waitsemalock) - }) -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -//go:norace -//go:nowritebarrierrec -func badsignal(sig uintptr) { - cgocallback(unsafe.Pointer(funcPC(badsignalgo)), noescape(unsafe.Pointer(&sig)), unsafe.Sizeof(sig), 0) -} - -func badsignalgo(sig uintptr) { - if !sigsend(uint32(sig)) { - // A foreign thread received the signal sig, and the - // Go code does not want to handle it. - raisebadsignal(uint32(sig)) - } -} - -// This runs on a foreign stack, without an m or a g. No stack split. -//go:nosplit -func badsignal2() { - write(2, unsafe.Pointer(&badsignal1[0]), int32(len(badsignal1))) - exit(2) -} - -var badsignal1 = []byte("runtime: signal received on thread not created by Go.\n") - -func raisebadsignal(sig uint32) { - badsignal2() -} - -func madvise(addr unsafe.Pointer, n uintptr, flags int32) {} -func munmap(addr unsafe.Pointer, n uintptr) {} -func setProcessCPUProfiler(hz int32) {} -func setThreadCPUProfiler(hz int32) {} -func sigdisable(uint32) {} -func sigenable(uint32) {} -func sigignore(uint32) {} -func closeonexec(int32) {} - -// gsignalStack is unused on nacl. -type gsignalStack struct{} - -// nacl fake time support - time in nanoseconds since 1970 -var faketime int64 - -var writelock uint32 // test-and-set spin lock for write - -// lastfaketime stores the last faketime value written to fd 1 or 2. -var lastfaketime int64 - -// lastfaketimefd stores the fd to which lastfaketime was written. -// -// Subsequent writes to the same fd may use the same timestamp, -// but the timestamp must increase if the fd changes. -var lastfaketimefd int32 - -func walltime() (sec int64, nsec int32) - -/* -An attempt at IRT. Doesn't work. See end of sys_nacl_amd64.s. - -void (*nacl_irt_query)(void); - -int8 nacl_irt_basic_v0_1_str[] = "nacl-irt-basic-0.1"; -void *nacl_irt_basic_v0_1[6]; // exit, gettod, clock, nanosleep, sched_yield, sysconf -int32 nacl_irt_basic_v0_1_size = sizeof(nacl_irt_basic_v0_1); - -int8 nacl_irt_memory_v0_3_str[] = "nacl-irt-memory-0.3"; -void *nacl_irt_memory_v0_3[3]; // mmap, munmap, mprotect -int32 nacl_irt_memory_v0_3_size = sizeof(nacl_irt_memory_v0_3); - -int8 nacl_irt_thread_v0_1_str[] = "nacl-irt-thread-0.1"; -void *nacl_irt_thread_v0_1[3]; // thread_create, thread_exit, thread_nice -int32 nacl_irt_thread_v0_1_size = sizeof(nacl_irt_thread_v0_1); -*/ - -// The following functions are implemented in runtime assembly. -// Provide a Go declaration to go with its assembly definitions. - -//go:linkname syscall_naclWrite syscall.naclWrite -func syscall_naclWrite(fd int, b []byte) int - -//go:linkname syscall_now syscall.now -func syscall_now() (sec int64, nsec int32) diff --git a/src/runtime/os_nacl_arm.go b/src/runtime/os_nacl_arm.go deleted file mode 100644 index 8669ee75b4..0000000000 --- a/src/runtime/os_nacl_arm.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -func checkgoarm() { - // TODO(minux): FP checks like in os_linux_arm.go. - - // NaCl/ARM only supports ARMv7 - if goarm != 7 { - print("runtime: NaCl requires ARMv7. Recompile using GOARM=7.\n") - exit(1) - } -} - -//go:nosplit -func cputicks() int64 { - // Currently cputicks() is used in blocking profiler and to seed runtime·fastrand(). - // runtime·nanotime() is a poor approximation of CPU ticks that is enough for the profiler. - // TODO: need more entropy to better seed fastrand. - return nanotime() -} diff --git a/src/runtime/pprof/pprof_test.go b/src/runtime/pprof/pprof_test.go index 53496371a0..ed04fe06ac 100644 --- a/src/runtime/pprof/pprof_test.go +++ b/src/runtime/pprof/pprof_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!js +// +build !js package pprof diff --git a/src/runtime/rt0_nacl_386.s b/src/runtime/rt0_nacl_386.s deleted file mode 100644 index 4c990022f1..0000000000 --- a/src/runtime/rt0_nacl_386.s +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - arg block == SP+8 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_386_nacl(SB),NOSPLIT,$8 - MOVL argc+12(FP), AX - LEAL argv+16(FP), BX - MOVL AX, 0(SP) - MOVL BX, 4(SP) - JMP runtime·rt0_go(SB) - -TEXT main(SB),NOSPLIT,$0 - // Remove the return address from the stack. - // rt0_go doesn't expect it to be there. - ADDL $4, SP - JMP runtime·rt0_go(SB) diff --git a/src/runtime/rt0_nacl_arm.s b/src/runtime/rt0_nacl_arm.s deleted file mode 100644 index a52c0d8619..0000000000 --- a/src/runtime/rt0_nacl_arm.s +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -// NaCl entry has: -// 0(FP) - 0 -// 4(FP) - cleanup function pointer, always 0 -// 8(FP) - envc -// 12(FP) - argc -// 16(FP) - argv, then 0, then envv, then 0, then auxv -TEXT _rt0_arm_nacl(SB),NOSPLIT|NOFRAME,$0 - MOVW 8(R13), R0 - MOVW $12(R13), R1 - B runtime·rt0_go(SB) diff --git a/src/runtime/runtime_mmap_test.go b/src/runtime/runtime_mmap_test.go index 6741e1da8d..bb0b747606 100644 --- a/src/runtime/runtime_mmap_test.go +++ b/src/runtime/runtime_mmap_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package runtime_test diff --git a/src/runtime/runtime_test.go b/src/runtime/runtime_test.go index 37eacfea64..ab7a03b2d1 100644 --- a/src/runtime/runtime_test.go +++ b/src/runtime/runtime_test.go @@ -193,9 +193,6 @@ func TestSetPanicOnFault(t *testing.T) { } func testSetPanicOnFault(t *testing.T, addr uintptr, nfault *int) { - if GOOS == "nacl" { - t.Skip("nacl doesn't seem to fault on high addresses") - } if GOOS == "js" { t.Skip("js does not support catching faults") } @@ -294,7 +291,7 @@ func TestTrailingZero(t *testing.T) { } func TestBadOpen(t *testing.T) { - if GOOS == "windows" || GOOS == "nacl" || GOOS == "js" { + if GOOS == "windows" || GOOS == "js" { t.Skip("skipping OS that doesn't have open/read/write/close") } // make sure we get the correct error code if open fails. Same for diff --git a/src/runtime/semasleep_test.go b/src/runtime/semasleep_test.go index 3eb7c6a6d1..9b371b0732 100644 --- a/src/runtime/semasleep_test.go +++ b/src/runtime/semasleep_test.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl,!plan9,!windows,!js +// +build !plan9,!windows,!js package runtime_test diff --git a/src/runtime/signal_386.go b/src/runtime/signal_386.go index 143deb9de7..ef97979796 100644 --- a/src/runtime/signal_386.go +++ b/src/runtime/signal_386.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_amd64x.go b/src/runtime/signal_amd64x.go index 9d59e262de..459499e973 100644 --- a/src/runtime/signal_amd64x.go +++ b/src/runtime/signal_amd64x.go @@ -3,7 +3,7 @@ // license that can be found in the LICENSE file. // +build amd64 amd64p32 -// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build darwin dragonfly freebsd linux netbsd openbsd solaris package runtime diff --git a/src/runtime/signal_arm.go b/src/runtime/signal_arm.go index bb597c5608..97742206c7 100644 --- a/src/runtime/signal_arm.go +++ b/src/runtime/signal_arm.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build darwin dragonfly freebsd linux nacl netbsd openbsd +// +build darwin dragonfly freebsd linux netbsd openbsd package runtime diff --git a/src/runtime/signal_nacl.go b/src/runtime/signal_nacl.go deleted file mode 100644 index ad321d8b75..0000000000 --- a/src/runtime/signal_nacl.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -type sigTabT struct { - flags int32 - name string -} - -var sigtable = [...]sigTabT{ - /* 0 */ {0, "SIGNONE: no trap"}, - /* 1 */ {_SigNotify + _SigKill, "SIGHUP: terminal line hangup"}, - /* 2 */ {_SigNotify + _SigKill, "SIGINT: interrupt"}, - /* 3 */ {_SigNotify + _SigThrow, "SIGQUIT: quit"}, - /* 4 */ {_SigThrow, "SIGILL: illegal instruction"}, - /* 5 */ {_SigThrow, "SIGTRAP: trace trap"}, - /* 6 */ {_SigNotify + _SigThrow, "SIGABRT: abort"}, - /* 7 */ {_SigThrow, "SIGEMT: emulate instruction executed"}, - /* 8 */ {_SigPanic, "SIGFPE: floating-point exception"}, - /* 9 */ {0, "SIGKILL: kill"}, - /* 10 */ {_SigPanic, "SIGBUS: bus error"}, - /* 11 */ {_SigPanic, "SIGSEGV: segmentation violation"}, - /* 12 */ {_SigThrow, "SIGSYS: bad system call"}, - /* 13 */ {_SigNotify, "SIGPIPE: write to broken pipe"}, - /* 14 */ {_SigNotify, "SIGALRM: alarm clock"}, - /* 15 */ {_SigNotify + _SigKill, "SIGTERM: termination"}, - /* 16 */ {_SigNotify + _SigIgn, "SIGURG: urgent condition on socket"}, - /* 17 */ {0, "SIGSTOP: stop"}, - /* 18 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTSTP: keyboard stop"}, - /* 19 */ {_SigNotify + _SigDefault + _SigIgn, "SIGCONT: continue after stop"}, - /* 20 */ {_SigNotify + _SigIgn, "SIGCHLD: child status has changed"}, - /* 21 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTIN: background read from tty"}, - /* 22 */ {_SigNotify + _SigDefault + _SigIgn, "SIGTTOU: background write to tty"}, - /* 23 */ {_SigNotify, "SIGIO: i/o now possible"}, - /* 24 */ {_SigNotify, "SIGXCPU: cpu limit exceeded"}, - /* 25 */ {_SigNotify, "SIGXFSZ: file size limit exceeded"}, - /* 26 */ {_SigNotify, "SIGVTALRM: virtual alarm clock"}, - /* 27 */ {_SigNotify, "SIGPROF: profiling alarm clock"}, - /* 28 */ {_SigNotify, "SIGWINCH: window size change"}, - /* 29 */ {_SigNotify, "SIGINFO: status request from keyboard"}, - /* 30 */ {_SigNotify, "SIGUSR1: user-defined signal 1"}, - /* 31 */ {_SigNotify, "SIGUSR2: user-defined signal 2"}, -} diff --git a/src/runtime/signal_nacl_386.go b/src/runtime/signal_nacl_386.go deleted file mode 100644 index 1a30a89c76..0000000000 --- a/src/runtime/signal_nacl_386.go +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregs386 { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) eax() uint32 { return c.regs().eax } -func (c *sigctxt) ebx() uint32 { return c.regs().ebx } -func (c *sigctxt) ecx() uint32 { return c.regs().ecx } -func (c *sigctxt) edx() uint32 { return c.regs().edx } -func (c *sigctxt) edi() uint32 { return c.regs().edi } -func (c *sigctxt) esi() uint32 { return c.regs().esi } -func (c *sigctxt) ebp() uint32 { return c.regs().ebp } -func (c *sigctxt) esp() uint32 { return c.regs().esp } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) eip() uint32 { return c.regs().eip } - -func (c *sigctxt) eflags() uint32 { return c.regs().eflags } -func (c *sigctxt) cs() uint32 { return ^uint32(0) } -func (c *sigctxt) fs() uint32 { return ^uint32(0) } -func (c *sigctxt) gs() uint32 { return ^uint32(0) } -func (c *sigctxt) sigcode() uint32 { return ^uint32(0) } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_eip(x uint32) { c.regs().eip = x } -func (c *sigctxt) set_esp(x uint32) { c.regs().esp = x } -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_nacl_arm.go b/src/runtime/signal_nacl_arm.go deleted file mode 100644 index b8312324ac..0000000000 --- a/src/runtime/signal_nacl_arm.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package runtime - -import "unsafe" - -type sigctxt struct { - info *siginfo - ctxt unsafe.Pointer -} - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) regs() *excregsarm { return &(*exccontext)(c.ctxt).regs } - -func (c *sigctxt) r0() uint32 { return c.regs().r0 } -func (c *sigctxt) r1() uint32 { return c.regs().r1 } -func (c *sigctxt) r2() uint32 { return c.regs().r2 } -func (c *sigctxt) r3() uint32 { return c.regs().r3 } -func (c *sigctxt) r4() uint32 { return c.regs().r4 } -func (c *sigctxt) r5() uint32 { return c.regs().r5 } -func (c *sigctxt) r6() uint32 { return c.regs().r6 } -func (c *sigctxt) r7() uint32 { return c.regs().r7 } -func (c *sigctxt) r8() uint32 { return c.regs().r8 } -func (c *sigctxt) r9() uint32 { return c.regs().r9 } -func (c *sigctxt) r10() uint32 { return c.regs().r10 } -func (c *sigctxt) fp() uint32 { return c.regs().r11 } -func (c *sigctxt) ip() uint32 { return c.regs().r12 } -func (c *sigctxt) sp() uint32 { return c.regs().sp } -func (c *sigctxt) lr() uint32 { return c.regs().lr } - -//go:nosplit -//go:nowritebarrierrec -func (c *sigctxt) pc() uint32 { return c.regs().pc } - -func (c *sigctxt) cpsr() uint32 { return c.regs().cpsr } -func (c *sigctxt) fault() uintptr { return ^uintptr(0) } -func (c *sigctxt) trap() uint32 { return ^uint32(0) } -func (c *sigctxt) error() uint32 { return ^uint32(0) } -func (c *sigctxt) oldmask() uint32 { return ^uint32(0) } - -func (c *sigctxt) sigcode() uint32 { return 0 } -func (c *sigctxt) sigaddr() uint32 { return 0 } - -func (c *sigctxt) set_pc(x uint32) { c.regs().pc = x } -func (c *sigctxt) set_sp(x uint32) { c.regs().sp = x } -func (c *sigctxt) set_lr(x uint32) { c.regs().lr = x } -func (c *sigctxt) set_r10(x uint32) { c.regs().r10 = x } - -func (c *sigctxt) set_sigcode(x uint32) {} -func (c *sigctxt) set_sigaddr(x uint32) {} diff --git a/src/runtime/signal_sighandler.go b/src/runtime/signal_sighandler.go index bec4653218..b81957ef02 100644 --- a/src/runtime/signal_sighandler.go +++ b/src/runtime/signal_sighandler.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris package runtime diff --git a/src/runtime/sizeof_test.go b/src/runtime/sizeof_test.go index 830055e2aa..852244d425 100644 --- a/src/runtime/sizeof_test.go +++ b/src/runtime/sizeof_test.go @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !nacl - package runtime_test import ( diff --git a/src/runtime/stubs2.go b/src/runtime/stubs2.go index 77513386b7..cf2b124812 100644 --- a/src/runtime/stubs2.go +++ b/src/runtime/stubs2.go @@ -5,7 +5,6 @@ // +build !plan9 // +build !solaris // +build !windows -// +build !nacl // +build !js // +build !darwin // +build !aix diff --git a/src/runtime/stubs3.go b/src/runtime/stubs3.go index f81372805e..95eecc7eca 100644 --- a/src/runtime/stubs3.go +++ b/src/runtime/stubs3.go @@ -4,7 +4,6 @@ // +build !plan9 // +build !solaris -// +build !nacl // +build !freebsd // +build !darwin // +build !aix diff --git a/src/runtime/sys_nacl_386.s b/src/runtime/sys_nacl_386.s deleted file mode 100644 index 8460aabce3..0000000000 --- a/src/runtime/sys_nacl_386.s +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -TEXT runtime·exit(SB),NOSPLIT,$4 - MOVL code+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_exit) - JMP 0(PC) - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVL wait+0(FP), AX - // SYS_thread_exit will clear *wait when the stack is free. - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$12 - MOVL name+0(FP), AX - MOVL AX, 0(SP) - MOVL mode+4(FP), AX - MOVL AX, 4(SP) - MOVL perm+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_open) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$4 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_close) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_read) - MOVL AX, ret+12(FP) - RET - -TEXT syscall·naclWrite(SB), NOSPLIT, $16-16 - MOVL arg1+0(FP), DI - MOVL arg2+4(FP), SI - MOVL arg3+8(FP), DX - MOVL DI, 0(SP) - MOVL SI, 4(SP) - MOVL DX, 8(SP) - CALL runtime·write(SB) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$12 - MOVL fd+0(FP), AX - MOVL AX, 0(SP) - MOVL p+4(FP), AX - MOVL AX, 4(SP) - MOVL n+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_write) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$8 - MOVL p+0(FP), AX - MOVL AX, 0(SP) - MOVL size+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_stack) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$8 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL arg+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_exception_handler) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_wait) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$4 - MOVL sem+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_sem_post) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_lock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_trylock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$4 - MOVL mutex+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_mutex_unlock) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$4 - MOVL flag+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_create) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$8 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_cond_wait) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_signal) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$4 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - NACL_SYSCALL(SYS_cond_broadcast) - MOVL AX, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$12 - MOVL cond+0(FP), AX - MOVL AX, 0(SP) - MOVL lock+4(FP), AX - MOVL AX, 4(SP) - MOVL ts+8(FP), AX - MOVL AX, 8(SP) - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVL AX, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$16 - MOVL fn+0(FP), AX - MOVL AX, 0(SP) - MOVL stk+4(FP), AX - MOVL AX, 4(SP) - MOVL tls+8(FP), AX - MOVL AX, 8(SP) - MOVL xx+12(FP), AX - MOVL AX, 12(SP) - NACL_SYSCALL(SYS_thread_create) - MOVL AX, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - JMP runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$8 - MOVL ts+0(FP), AX - MOVL AX, 0(SP) - MOVL extra+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_nanosleep) - MOVL AX, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$32 - MOVL addr+0(FP), AX - MOVL AX, 0(SP) - MOVL n+4(FP), AX - MOVL AX, 4(SP) - MOVL prot+8(FP), AX - MOVL AX, 8(SP) - MOVL flags+12(FP), AX - MOVL AX, 12(SP) - MOVL fd+16(FP), AX - MOVL AX, 16(SP) - MOVL off+20(FP), AX - MOVL AX, 24(SP) - MOVL $0, 28(SP) - LEAL 24(SP), AX - MOVL AX, 20(SP) - NACL_SYSCALL(SYS_mmap) - CMPL AX, $-4095 - JNA ok - NEGL AX - MOVL $0, p+24(FP) - MOVL AX, err+28(FP) - RET -ok: - MOVL AX, p+24(FP) - MOVL $0, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 12(SP), CX // high 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - MOVL AX, sec_lo+0(FP) - MOVL CX, sec_hi+4(FP) - MOVL BX, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - JMP runtime·walltime(SB) - -TEXT runtime·nanotime(SB),NOSPLIT,$20 - MOVL $0, 0(SP) // real time clock - LEAL 8(SP), AX - MOVL AX, 4(SP) // timespec - NACL_SYSCALL(SYS_clock_gettime) - MOVL 8(SP), AX // low 32 sec - MOVL 16(SP), BX // nsec - - // sec is in AX, nsec in BX - // convert to DX:AX nsec - MOVL $1000000000, CX - MULL CX - ADDL BX, AX - ADCL $0, DX - - MOVL AX, ret_lo+0(FP) - MOVL DX, ret_hi+4(FP) - RET - -TEXT runtime·setldt(SB),NOSPLIT,$8 - MOVL base+4(FP), BX - ADDL $0x8, BX - MOVL BX, 0(SP) - NACL_SYSCALL(SYS_tls_init) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$0 - get_tls(CX) - - // check that g exists - MOVL g(CX), DI - CMPL DI, $0 - JNE 6(PC) - MOVL $11, BX - MOVL $0, 0(SP) - MOVL $runtime·badsignal(SB), AX - CALL AX - JMP ret - - // save g - NOP SP // tell vet SP changed - stop checking offsets - MOVL DI, 20(SP) - - // g = m->gsignal - MOVL g_m(DI), BX - MOVL m_gsignal(BX), BX - MOVL BX, g(CX) - - // copy arguments for sighandler - MOVL $11, 0(SP) // signal - MOVL $0, 4(SP) // siginfo - LEAL 8(SP), AX - MOVL AX, 8(SP) // context - MOVL DI, 12(SP) // g - - CALL runtime·sighandler(SB) - - // restore g - get_tls(CX) - MOVL 20(SP), BX - MOVL BX, g(CX) - -ret: - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // NaCl has abdicated its traditional operating system responsibility - // and declined to implement 'sigreturn'. Instead the only way to return - // to the execution of our program is to restore the registers ourselves. - // Unfortunately, that is impossible to do with strict fidelity, because - // there is no way to do the final update of PC that ends the sequence - // without either (1) jumping to a register, in which case the register ends - // holding the PC value instead of its intended value or (2) storing the PC - // on the stack and using RET, which imposes the requirement that SP is - // valid and that is okay to smash the word below it. The second would - // normally be the lesser of the two evils, except that on NaCl, the linker - // must rewrite RET into "POP reg; AND $~31, reg; JMP reg", so either way - // we are going to lose a register as a result of the incoming signal. - // Similarly, there is no way to restore EFLAGS; the usual way is to use - // POPFL, but NaCl rejects that instruction. We could inspect the bits and - // execute a sequence of instructions designed to recreate those flag - // settings, but that's a lot of work. - // - // Thankfully, Go's signal handlers never try to return directly to the - // executing code, so all the registers and EFLAGS are dead and can be - // smashed. The only registers that matter are the ones that are setting - // up for the simulated call that the signal handler has created. - // Today those registers are just PC and SP, but in case additional registers - // are relevant in the future (for example DX is the Go func context register) - // we restore as many registers as possible. - // - // We smash BP, because that's what the linker smashes during RET. - // - LEAL 72(SP), BP - MOVL 0(BP), AX - MOVL 4(BP), CX - MOVL 8(BP), DX - MOVL 12(BP), BX - MOVL 16(BP), SP - // 20(BP) is saved BP, never to be seen again - MOVL 24(BP), SI - MOVL 28(BP), DI - // 36(BP) is saved EFLAGS, never to be seen again - MOVL 32(BP), BP // saved PC - JMP BP - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$8-12 - MOVL arg_base+0(FP), AX - MOVL AX, 0(SP) - MOVL arg_len+4(FP), AX - MOVL AX, 4(SP) - NACL_SYSCALL(SYS_get_random_bytes) - RET diff --git a/src/runtime/sys_nacl_arm.s b/src/runtime/sys_nacl_arm.s deleted file mode 100644 index 90201683b7..0000000000 --- a/src/runtime/sys_nacl_arm.s +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "go_asm.h" -#include "go_tls.h" -#include "textflag.h" -#include "syscall_nacl.h" - -#define NACL_SYSCALL(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; BL (R8) - -TEXT runtime·exit(SB),NOSPLIT,$0 - MOVW code+0(FP), R0 - NACL_SYSCALL(SYS_exit) - RET - -// func exitThread(wait *uint32) -TEXT runtime·exitThread(SB),NOSPLIT,$4-4 - MOVW wait+0(FP), R0 - // SYS_thread_exit will clear *wait when the stack is free. - NACL_SYSCALL(SYS_thread_exit) - JMP 0(PC) - -TEXT runtime·open(SB),NOSPLIT,$0 - MOVW name+0(FP), R0 - MOVW name+0(FP), R1 - MOVW name+0(FP), R2 - NACL_SYSCALL(SYS_open) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·closefd(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - NACL_SYSCALL(SYS_close) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·read(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_read) - MOVW R0, ret+12(FP) - RET - -// func naclWrite(fd int, b []byte) int -TEXT syscall·naclWrite(SB),NOSPLIT,$0 - MOVW arg1+0(FP), R0 - MOVW arg2+4(FP), R1 - MOVW arg3+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·write(SB),NOSPLIT,$0 - MOVW fd+0(FP), R0 - MOVW p+4(FP), R1 - MOVW n+8(FP), R2 - NACL_SYSCALL(SYS_write) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_exception_stack(SB),NOSPLIT,$0 - MOVW p+0(FP), R0 - MOVW size+4(FP), R1 - NACL_SYSCALL(SYS_exception_stack) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_exception_handler(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW arg+4(FP), R1 - NACL_SYSCALL(SYS_exception_handler) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_sem_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_sem_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_wait(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_wait) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_sem_post(SB),NOSPLIT,$0 - MOVW sem+0(FP), R0 - NACL_SYSCALL(SYS_sem_post) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_mutex_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_lock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_lock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_trylock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_trylock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_mutex_unlock(SB),NOSPLIT,$0 - MOVW mutex+0(FP), R0 - NACL_SYSCALL(SYS_mutex_unlock) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_create(SB),NOSPLIT,$0 - MOVW flag+0(FP), R0 - NACL_SYSCALL(SYS_cond_create) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_wait(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW n+4(FP), R1 - NACL_SYSCALL(SYS_cond_wait) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·nacl_cond_signal(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_signal) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_broadcast(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - NACL_SYSCALL(SYS_cond_broadcast) - MOVW R0, ret+4(FP) - RET - -TEXT runtime·nacl_cond_timed_wait_abs(SB),NOSPLIT,$0 - MOVW cond+0(FP), R0 - MOVW lock+4(FP), R1 - MOVW ts+8(FP), R2 - NACL_SYSCALL(SYS_cond_timed_wait_abs) - MOVW R0, ret+12(FP) - RET - -TEXT runtime·nacl_thread_create(SB),NOSPLIT,$0 - MOVW fn+0(FP), R0 - MOVW stk+4(FP), R1 - MOVW tls+8(FP), R2 - MOVW xx+12(FP), R3 - NACL_SYSCALL(SYS_thread_create) - MOVW R0, ret+16(FP) - RET - -TEXT runtime·mstart_nacl(SB),NOSPLIT,$0 - MOVW 0(R9), R0 // TLS - MOVW -8(R0), R1 // g - MOVW -4(R0), R2 // m - MOVW R2, g_m(R1) - MOVW R1, g - B runtime·mstart(SB) - -TEXT runtime·nacl_nanosleep(SB),NOSPLIT,$0 - MOVW ts+0(FP), R0 - MOVW extra+4(FP), R1 - NACL_SYSCALL(SYS_nanosleep) - MOVW R0, ret+8(FP) - RET - -TEXT runtime·osyield(SB),NOSPLIT,$0 - NACL_SYSCALL(SYS_sched_yield) - RET - -TEXT runtime·mmap(SB),NOSPLIT,$8 - MOVW addr+0(FP), R0 - MOVW n+4(FP), R1 - MOVW prot+8(FP), R2 - MOVW flags+12(FP), R3 - MOVW fd+16(FP), R4 - // arg6:offset should be passed as a pointer (to int64) - MOVW off+20(FP), R5 - MOVW R5, 4(R13) - MOVW $0, R6 - MOVW R6, 8(R13) - MOVW $4(R13), R5 - MOVM.DB.W [R4,R5], (R13) // arg5 and arg6 are passed on stack - NACL_SYSCALL(SYS_mmap) - MOVM.IA.W (R13), [R4, R5] - CMP $-4095, R0 - MOVW $0, R1 - RSB.HI $0, R0 - MOVW.HI R0, R1 // if error, put in R1 - MOVW.HI $0, R0 - MOVW R0, p+24(FP) - MOVW R1, err+28(FP) - RET - -TEXT runtime·walltime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec - MOVW 12(R13), R2 // nsec - MOVW R0, sec_lo+0(FP) - MOVW R1, sec_hi+4(FP) - MOVW R2, nsec+8(FP) - RET - -TEXT syscall·now(SB),NOSPLIT,$0 - B runtime·walltime(SB) - -// int64 nanotime(void) so really -// void nanotime(int64 *nsec) -TEXT runtime·nanotime(SB),NOSPLIT,$16 - MOVW $0, R0 // real time clock - MOVW $4(R13), R1 - NACL_SYSCALL(SYS_clock_gettime) - MOVW 4(R13), R0 // low 32-bit sec - MOVW 8(R13), R1 // high 32-bit sec (ignored for now) - MOVW 12(R13), R2 // nsec - MOVW $1000000000, R3 - MULLU R0, R3, (R1, R0) - MOVW $0, R4 - ADD.S R2, R0 - ADC R4, R1 - MOVW R0, ret_lo+0(FP) - MOVW R1, ret_hi+4(FP) - RET - -TEXT runtime·sigtramp(SB),NOSPLIT,$80 - // load g from thread context - MOVW $ctxt+-4(FP), R0 - MOVW (16*4+10*4)(R0), g - - // check that g exists - CMP $0, g - BNE 4(PC) - MOVW $runtime·badsignal2(SB), R11 - BL (R11) - RET - - // save g - MOVW g, R3 - MOVW g, 20(R13) - - // g = m->gsignal - MOVW g_m(g), R8 - MOVW m_gsignal(R8), g - - // copy arguments for call to sighandler - MOVW $11, R0 - MOVW R0, 4(R13) // signal - MOVW $0, R0 - MOVW R0, 8(R13) // siginfo - MOVW $ctxt+-4(FP), R0 - MOVW R0, 12(R13) // context - MOVW R3, 16(R13) // g - - BL runtime·sighandler(SB) - - // restore g - MOVW 20(R13), g - - // Enable exceptions again. - NACL_SYSCALL(SYS_exception_clear_flag) - - // Restore registers as best we can. Impossible to do perfectly. - // See comment in sys_nacl_386.s for extended rationale. - MOVW $ctxt+-4(FP), R1 - ADD $64, R1 - MOVW (0*4)(R1), R0 - MOVW (2*4)(R1), R2 - MOVW (3*4)(R1), R3 - MOVW (4*4)(R1), R4 - MOVW (5*4)(R1), R5 - MOVW (6*4)(R1), R6 - MOVW (7*4)(R1), R7 - MOVW (8*4)(R1), R8 - // cannot write to R9 - MOVW (10*4)(R1), g - MOVW (11*4)(R1), R11 - MOVW (12*4)(R1), R12 - MOVW (13*4)(R1), R13 - MOVW (14*4)(R1), R14 - MOVW (15*4)(R1), R1 - B (R1) - -nog: - MOVW $0, R0 - RET - -// func getRandomData([]byte) -TEXT runtime·getRandomData(SB),NOSPLIT,$0-12 - MOVW arg_base+0(FP), R0 - MOVW arg_len+4(FP), R1 - NACL_SYSCALL(SYS_get_random_bytes) - RET - -// Likewise, this is only valid for ARMv7+, but that's okay. -TEXT ·publicationBarrier(SB),NOSPLIT|NOFRAME,$0-0 - B runtime·armPublicationBarrier(SB) - -TEXT runtime·read_tls_fallback(SB),NOSPLIT|NOFRAME,$0 - WORD $0xe7fedef0 // NACL_INSTR_ARM_ABORT_NOW (UDF #0xEDE0) diff --git a/src/runtime/syscall_nacl.h b/src/runtime/syscall_nacl.h deleted file mode 100644 index 5ee75abdd6..0000000000 --- a/src/runtime/syscall_nacl.h +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by mknacl.sh; DO NOT EDIT. -#define SYS_null 1 -#define SYS_nameservice 2 -#define SYS_dup 8 -#define SYS_dup2 9 -#define SYS_open 10 -#define SYS_close 11 -#define SYS_read 12 -#define SYS_write 13 -#define SYS_lseek 14 -#define SYS_stat 16 -#define SYS_fstat 17 -#define SYS_chmod 18 -#define SYS_isatty 19 -#define SYS_brk 20 -#define SYS_mmap 21 -#define SYS_munmap 22 -#define SYS_getdents 23 -#define SYS_mprotect 24 -#define SYS_list_mappings 25 -#define SYS_exit 30 -#define SYS_getpid 31 -#define SYS_sched_yield 32 -#define SYS_sysconf 33 -#define SYS_gettimeofday 40 -#define SYS_clock 41 -#define SYS_nanosleep 42 -#define SYS_clock_getres 43 -#define SYS_clock_gettime 44 -#define SYS_mkdir 45 -#define SYS_rmdir 46 -#define SYS_chdir 47 -#define SYS_getcwd 48 -#define SYS_unlink 49 -#define SYS_imc_makeboundsock 60 -#define SYS_imc_accept 61 -#define SYS_imc_connect 62 -#define SYS_imc_sendmsg 63 -#define SYS_imc_recvmsg 64 -#define SYS_imc_mem_obj_create 65 -#define SYS_imc_socketpair 66 -#define SYS_mutex_create 70 -#define SYS_mutex_lock 71 -#define SYS_mutex_trylock 72 -#define SYS_mutex_unlock 73 -#define SYS_cond_create 74 -#define SYS_cond_wait 75 -#define SYS_cond_signal 76 -#define SYS_cond_broadcast 77 -#define SYS_cond_timed_wait_abs 79 -#define SYS_thread_create 80 -#define SYS_thread_exit 81 -#define SYS_tls_init 82 -#define SYS_thread_nice 83 -#define SYS_tls_get 84 -#define SYS_second_tls_set 85 -#define SYS_second_tls_get 86 -#define SYS_exception_handler 87 -#define SYS_exception_stack 88 -#define SYS_exception_clear_flag 89 -#define SYS_sem_create 100 -#define SYS_sem_wait 101 -#define SYS_sem_post 102 -#define SYS_sem_get_value 103 -#define SYS_dyncode_create 104 -#define SYS_dyncode_modify 105 -#define SYS_dyncode_delete 106 -#define SYS_test_infoleak 109 -#define SYS_test_crash 110 -#define SYS_test_syscall_1 111 -#define SYS_test_syscall_2 112 -#define SYS_futex_wait_abs 120 -#define SYS_futex_wake 121 -#define SYS_pread 130 -#define SYS_pwrite 131 -#define SYS_truncate 140 -#define SYS_lstat 141 -#define SYS_link 142 -#define SYS_rename 143 -#define SYS_symlink 144 -#define SYS_access 145 -#define SYS_readlink 146 -#define SYS_utimes 147 -#define SYS_get_random_bytes 150 diff --git a/src/runtime/testdata/testprog/signal.go b/src/runtime/testdata/testprog/signal.go index 2ccbada57b..417e105c68 100644 --- a/src/runtime/testdata/testprog/signal.go +++ b/src/runtime/testdata/testprog/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 package main diff --git a/src/runtime/testdata/testprognet/signal.go b/src/runtime/testdata/testprognet/signal.go index a1559fe616..4d2de79d97 100644 --- a/src/runtime/testdata/testprognet/signal.go +++ b/src/runtime/testdata/testprognet/signal.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build !windows,!plan9,!nacl +// +build !windows,!plan9 // This is in testprognet instead of testprog because testprog // must not import anything (like net, but also like os/signal) diff --git a/src/runtime/time.go b/src/runtime/time.go index ac2a9aae8f..d667d11244 100644 --- a/src/runtime/time.go +++ b/src/runtime/time.go @@ -13,8 +13,6 @@ import ( // Package time knows the layout of this structure. // If this struct changes, adjust ../time/sleep.go:/runtimeTimer. -// For GOOS=nacl, package syscall knows the layout of this structure. -// If this struct changes, adjust ../syscall/net_nacl.go:/runtimeTimer. type timer struct { tb *timersBucket // the bucket the timer lives in i int // heap index diff --git a/src/runtime/time_fake.go b/src/runtime/time_fake.go index bef3a65873..c64d2994a9 100644 --- a/src/runtime/time_fake.go +++ b/src/runtime/time_fake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build faketime -// +build !nacl // +build !windows // Faketime isn't currently supported on Windows. This would require: diff --git a/src/runtime/time_nofake.go b/src/runtime/time_nofake.go index 0b153b9583..1912a94e87 100644 --- a/src/runtime/time_nofake.go +++ b/src/runtime/time_nofake.go @@ -3,7 +3,6 @@ // license that can be found in the LICENSE file. // +build !faketime -// +build !nacl package runtime diff --git a/src/runtime/tls_arm.s b/src/runtime/tls_arm.s index 350089abc6..bed7891368 100644 --- a/src/runtime/tls_arm.s +++ b/src/runtime/tls_arm.s @@ -33,11 +33,6 @@ // runtime.mcall assumes this function only clobbers R0 and R11. // Returns with g in R0. TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - MOVW g, R0 // preserve R0 across call to setg<> - RET -#else // If the host does not support MRC the linker will replace it with // a call to runtime.read_tls_fallback which jumps to __kuser_get_tls. // The replacement function saves LR in R11 over the call to read_tls_fallback. @@ -48,16 +43,11 @@ TEXT runtime·save_g(SB),NOSPLIT|NOFRAME,$0 MOVW g, 0(R0) MOVW g, R0 // preserve R0 across call to setg<> RET -#endif // load_g loads the g register from pthread-provided // thread-local memory, for use after calling externally compiled // ARM code that overwrote those registers. TEXT runtime·load_g(SB),NOSPLIT,$0 -#ifdef GOOS_nacl - // nothing to do as nacl/arm does not use TLS at all. - RET -#else // See save_g MRC 15, 0, R0, C13, C0, 3 // fetch TLS base pointer BIC $3, R0 // Darwin/ARM might return unaligned pointer @@ -65,7 +55,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 ADD R11, R0 MOVW 0(R0), g RET -#endif // This is called from rt0_go, which runs on the system stack // using the initial stack allocated by the OS. @@ -78,7 +67,6 @@ TEXT runtime·load_g(SB),NOSPLIT,$0 // Declare a dummy word ($4, not $0) to make sure the // frame is 8 bytes and stays 8-byte-aligned. TEXT runtime·_initcgo(SB),NOSPLIT,$4 -#ifndef GOOS_nacl // if there is an _cgo_init, call it. MOVW _cgo_init(SB), R4 CMP $0, R4 @@ -93,7 +81,6 @@ TEXT runtime·_initcgo(SB),NOSPLIT,$4 MOVW $setg_gcc<>(SB), R1 // arg 1: setg MOVW g, R0 // arg 0: G BL (R4) // will clobber R0-R3 -#endif nocgo: RET diff --git a/src/runtime/vlop_arm.s b/src/runtime/vlop_arm.s index 41d285874d..3f28f03c48 100644 --- a/src/runtime/vlop_arm.s +++ b/src/runtime/vlop_arm.s @@ -40,9 +40,7 @@ #define Ra R11 // Be careful: Ra == R11 will be used by the linker for synthesized instructions. -// Note: this function does not have a frame. If it ever needs a frame, -// the RET instruction will clobber R12 on nacl, and the compiler's register -// allocator needs to know. +// Note: this function does not have a frame. TEXT runtime·udiv(SB),NOSPLIT|NOFRAME,$0 MOVBU internal∕cpu·ARM+const_offsetARMHasIDIVA(SB), Ra CMP $0, Ra diff --git a/src/syscall/asm_nacl_386.s b/src/syscall/asm_nacl_386.s deleted file mode 100644 index b989171120..0000000000 --- a/src/syscall/asm_nacl_386.s +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" -#include "funcdata.h" -#include "../runtime/syscall_nacl.h" - -// -// System call support for 386, Native Client -// - -#define NACL_SYSCALL(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; CALL AX - -#define NACL_SYSJMP(code) \ - MOVL $(0x10000 + ((code)<<5)), AX; JMP AX - -TEXT ·Syscall(SB),NOSPLIT,$12-28 - NO_LOCAL_POINTERS - CALL runtime·entersyscall(SB) - MOVL trap+0(FP), AX - MOVL a1+4(FP), BX - MOVL BX, 0(SP) - MOVL a2+8(FP), BX - MOVL BX, 4(SP) - MOVL a3+12(FP), BX - MOVL BX, 8(SP) - SHLL $5, AX - ADDL $0x10000, AX - CALL AX - CMPL AX, $0 - JGE ok - MOVL $-1, r1+16(FP) - MOVL $-1, r2+20(FP) - NEGL AX - MOVL AX, err+24(FP) - CALL runtime·exitsyscall(SB) - RET -ok: - MOVL AX, r1+16(FP) - MOVL DX, r2+20(FP) - MOVL $0, err+24(FP) - CALL runtime·exitsyscall(SB) - RET diff --git a/src/syscall/asm_nacl_arm.s b/src/syscall/asm_nacl_arm.s deleted file mode 100644 index 6092afd9e6..0000000000 --- a/src/syscall/asm_nacl_arm.s +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" -#include "funcdata.h" -#include "../runtime/syscall_nacl.h" - -// -// System call support for ARM, Native Client -// - -#define NACL_SYSCALL(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; BL (R8) - -#define NACL_SYSJMP(code) \ - MOVW $(0x10000 + ((code)<<5)), R8; B (R8) - -TEXT ·Syscall(SB),NOSPLIT,$0-28 - BL runtime·entersyscall(SB) - MOVW trap+0(FP), R8 - MOVW a1+4(FP), R0 - MOVW a2+8(FP), R1 - MOVW a3+12(FP), R2 - // more args would use R3, and then stack. - MOVW $0x10000, R7 - ADD R8<<5, R7 - BL (R7) - CMP $0, R0 - BGE ok - MOVW $-1, R1 - MOVW R1, r1+16(FP) - MOVW R1, r2+20(FP) - RSB $0, R0 - MOVW R0, err+24(FP) - BL runtime·exitsyscall(SB) - RET -ok: - MOVW R0, r1+16(FP) - MOVW R1, r2+20(FP) - MOVW $0, R2 - MOVW R2, err+24(FP) - BL runtime·exitsyscall(SB) - RET diff --git a/src/syscall/dirent.go b/src/syscall/dirent.go index 5c7af42b0c..fab123d4a7 100644 --- a/src/syscall/dirent.go +++ b/src/syscall/dirent.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package syscall diff --git a/src/syscall/env_unix.go b/src/syscall/env_unix.go index 0b6b711a8f..e80a3ff1c9 100644 --- a/src/syscall/env_unix.go +++ b/src/syscall/env_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris // Unix environment variables. diff --git a/src/syscall/fd_nacl.go b/src/syscall/fd_nacl.go deleted file mode 100644 index b31aa58c49..0000000000 --- a/src/syscall/fd_nacl.go +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// File descriptor support for Native Client. -// We want to provide access to a broader range of (simulated) files than -// Native Client allows, so we maintain our own file descriptor table exposed -// to higher-level packages. - -package syscall - -import ( - "io" - "sync" -) - -// files is the table indexed by a file descriptor. -var files struct { - sync.RWMutex - tab []*file -} - -// A file is an open file, something with a file descriptor. -// A particular *file may appear in files multiple times, due to use of Dup or Dup2. -type file struct { - fdref int // uses in files.tab - impl fileImpl // underlying implementation -} - -// A fileImpl is the implementation of something that can be a file. -type fileImpl interface { - // Standard operations. - // These can be called concurrently from multiple goroutines. - stat(*Stat_t) error - read([]byte) (int, error) - write([]byte) (int, error) - seek(int64, int) (int64, error) - pread([]byte, int64) (int, error) - pwrite([]byte, int64) (int, error) - - // Close is called when the last reference to a *file is removed - // from the file descriptor table. It may be called concurrently - // with active operations such as blocked read or write calls. - close() error -} - -// newFD adds impl to the file descriptor table, -// returning the new file descriptor. -// Like Unix, it uses the lowest available descriptor. -func newFD(impl fileImpl) int { - files.Lock() - defer files.Unlock() - f := &file{impl: impl, fdref: 1} - for fd, oldf := range files.tab { - if oldf == nil { - files.tab[fd] = f - return fd - } - } - fd := len(files.tab) - files.tab = append(files.tab, f) - return fd -} - -// Install Native Client stdin, stdout, stderr. -func init() { - newFD(&naclFile{naclFD: 0}) - newFD(&naclFile{naclFD: 1}) - newFD(&naclFile{naclFD: 2}) -} - -// fdToFile retrieves the *file corresponding to a file descriptor. -func fdToFile(fd int) (*file, error) { - files.Lock() - defer files.Unlock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - return nil, EBADF - } - return files.tab[fd], nil -} - -func Close(fd int) error { - files.Lock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - files.Unlock() - return EBADF - } - f := files.tab[fd] - files.tab[fd] = nil - f.fdref-- - fdref := f.fdref - files.Unlock() - if fdref > 0 { - return nil - } - return f.impl.close() -} - -func CloseOnExec(fd int) { - // nothing to do - no exec -} - -func Dup(fd int) (int, error) { - files.Lock() - defer files.Unlock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil { - return -1, EBADF - } - f := files.tab[fd] - f.fdref++ - for newfd, oldf := range files.tab { - if oldf == nil { - files.tab[newfd] = f - return newfd, nil - } - } - newfd := len(files.tab) - files.tab = append(files.tab, f) - return newfd, nil -} - -func Dup2(fd, newfd int) error { - files.Lock() - if fd < 0 || fd >= len(files.tab) || files.tab[fd] == nil || newfd < 0 || newfd >= len(files.tab)+100 { - files.Unlock() - return EBADF - } - f := files.tab[fd] - f.fdref++ - for cap(files.tab) <= newfd { - files.tab = append(files.tab[:cap(files.tab)], nil) - } - oldf := files.tab[newfd] - var oldfdref int - if oldf != nil { - oldf.fdref-- - oldfdref = oldf.fdref - } - files.tab[newfd] = f - files.Unlock() - if oldf != nil { - if oldfdref == 0 { - oldf.impl.close() - } - } - return nil -} - -func Fstat(fd int, st *Stat_t) error { - f, err := fdToFile(fd) - if err != nil { - return err - } - return f.impl.stat(st) -} - -func Read(fd int, b []byte) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.read(b) -} - -var zerobuf [0]byte - -func Write(fd int, b []byte) (int, error) { - if b == nil { - // avoid nil in syscalls; nacl doesn't like that. - b = zerobuf[:] - } - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.write(b) -} - -func Pread(fd int, b []byte, offset int64) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.pread(b, offset) -} - -func Pwrite(fd int, b []byte, offset int64) (int, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.pwrite(b, offset) -} - -func Seek(fd int, offset int64, whence int) (int64, error) { - f, err := fdToFile(fd) - if err != nil { - return 0, err - } - return f.impl.seek(offset, whence) -} - -// defaulFileImpl implements fileImpl. -// It can be embedded to complete a partial fileImpl implementation. -type defaultFileImpl struct{} - -func (*defaultFileImpl) close() error { return nil } -func (*defaultFileImpl) stat(*Stat_t) error { return ENOSYS } -func (*defaultFileImpl) read([]byte) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) write([]byte) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) seek(int64, int) (int64, error) { return 0, ENOSYS } -func (*defaultFileImpl) pread([]byte, int64) (int, error) { return 0, ENOSYS } -func (*defaultFileImpl) pwrite([]byte, int64) (int, error) { return 0, ENOSYS } - -// naclFile is the fileImpl implementation for a Native Client file descriptor. -type naclFile struct { - defaultFileImpl - naclFD int -} - -func (f *naclFile) stat(st *Stat_t) error { - return naclFstat(f.naclFD, st) -} - -func (f *naclFile) read(b []byte) (int, error) { - n, err := naclRead(f.naclFD, b) - if err != nil { - n = 0 - } - return n, err -} - -// implemented in package runtime, to add time header on playground -func naclWrite(fd int, b []byte) int - -func (f *naclFile) write(b []byte) (int, error) { - n := naclWrite(f.naclFD, b) - if n < 0 { - return 0, Errno(-n) - } - return n, nil -} - -func (f *naclFile) seek(off int64, whence int) (int64, error) { - old := off - err := naclSeek(f.naclFD, &off, whence) - if err != nil { - return old, err - } - return off, nil -} - -func (f *naclFile) prw(b []byte, offset int64, rw func([]byte) (int, error)) (int, error) { - // NaCl has no pread; simulate with seek and hope for no races. - old, err := f.seek(0, io.SeekCurrent) - if err != nil { - return 0, err - } - if _, err := f.seek(offset, io.SeekStart); err != nil { - return 0, err - } - n, err := rw(b) - f.seek(old, io.SeekStart) - return n, err -} - -func (f *naclFile) pread(b []byte, offset int64) (int, error) { - return f.prw(b, offset, f.read) -} - -func (f *naclFile) pwrite(b []byte, offset int64) (int, error) { - return f.prw(b, offset, f.write) -} - -func (f *naclFile) close() error { - err := naclClose(f.naclFD) - f.naclFD = -1 - return err -} - -// A pipeFile is an in-memory implementation of a pipe. -// The byteq implementation is in net_nacl.go. -type pipeFile struct { - defaultFileImpl - rd *byteq - wr *byteq -} - -func (f *pipeFile) close() error { - if f.rd != nil { - f.rd.close() - } - if f.wr != nil { - f.wr.close() - } - return nil -} - -func (f *pipeFile) read(b []byte) (int, error) { - if f.rd == nil { - return 0, EINVAL - } - n, err := f.rd.read(b, 0) - if err == EAGAIN { - err = nil - } - return n, err -} - -func (f *pipeFile) write(b []byte) (int, error) { - if f.wr == nil { - return 0, EINVAL - } - n, err := f.wr.write(b, 0) - if err == EAGAIN { - err = EPIPE - } - return n, err -} - -func Pipe(fd []int) error { - q := newByteq() - fd[0] = newFD(&pipeFile{rd: q}) - fd[1] = newFD(&pipeFile{wr: q}) - return nil -} diff --git a/src/syscall/fs_nacl.go b/src/syscall/fs_nacl.go deleted file mode 100644 index dfe13d92a1..0000000000 --- a/src/syscall/fs_nacl.go +++ /dev/null @@ -1,846 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// A simulated Unix-like file system for use within NaCl. -// -// The simulation is not particularly tied to NaCl other than the reuse -// of NaCl's definition for the Stat_t structure. -// -// The file system need never be written to disk, so it is represented as -// in-memory Go data structures, never in a serialized form. -// -// TODO: Perhaps support symlinks, although they muck everything up. - -package syscall - -import ( - "io" - "sync" - "unsafe" -) - -// Provided by package runtime. -func now() (sec int64, nsec int32) - -// An fsys is a file system. -// Since there is no I/O (everything is in memory), -// the global lock mu protects the whole file system state, -// and that's okay. -type fsys struct { - mu sync.Mutex - root *inode // root directory - cwd *inode // process current directory - inum uint64 // number of inodes created - dev []func() (devFile, error) // table for opening devices -} - -// A devFile is the implementation required of device files -// like /dev/null or /dev/random. -type devFile interface { - pread([]byte, int64) (int, error) - pwrite([]byte, int64) (int, error) -} - -// An inode is a (possibly special) file in the file system. -type inode struct { - Stat_t - data []byte - dir []dirent -} - -// A dirent describes a single directory entry. -type dirent struct { - name string - inode *inode -} - -// An fsysFile is the fileImpl implementation backed by the file system. -type fsysFile struct { - defaultFileImpl - fsys *fsys - inode *inode - openmode int - offset int64 - dev devFile -} - -// newFsys creates a new file system. -func newFsys() *fsys { - fs := &fsys{} - fs.mu.Lock() - defer fs.mu.Unlock() - ip := fs.newInode() - ip.Mode = 0555 | S_IFDIR - fs.dirlink(ip, ".", ip) - fs.dirlink(ip, "..", ip) - fs.cwd = ip - fs.root = ip - return fs -} - -var fs = newFsys() -var fsinit = func() {} - -func init() { - // do not trigger loading of zipped file system here - oldFsinit := fsinit - defer func() { fsinit = oldFsinit }() - fsinit = func() {} - Mkdir("/dev", 0555) - Mkdir("/tmp", 0777) - mkdev("/dev/null", 0666, openNull) - mkdev("/dev/random", 0444, openRandom) - mkdev("/dev/urandom", 0444, openRandom) - mkdev("/dev/zero", 0666, openZero) - chdirEnv() -} - -func chdirEnv() { - pwd, ok := Getenv("NACLPWD") - if ok { - chdir(pwd) - } -} - -// Except where indicated otherwise, unexported methods on fsys -// expect fs.mu to have been locked by the caller. - -// newInode creates a new inode. -func (fs *fsys) newInode() *inode { - fs.inum++ - ip := &inode{ - Stat_t: Stat_t{ - Ino: fs.inum, - Blksize: 512, - }, - } - return ip -} - -// atime sets ip.Atime to the current time. -func (fs *fsys) atime(ip *inode) { - sec, nsec := now() - ip.Atime, ip.AtimeNsec = sec, int64(nsec) -} - -// mtime sets ip.Mtime to the current time. -func (fs *fsys) mtime(ip *inode) { - sec, nsec := now() - ip.Mtime, ip.MtimeNsec = sec, int64(nsec) -} - -// dirlookup looks for an entry in the directory dp with the given name. -// It returns the directory entry and its index within the directory. -func (fs *fsys) dirlookup(dp *inode, name string) (de *dirent, index int, err error) { - fs.atime(dp) - for i := range dp.dir { - de := &dp.dir[i] - if de.name == name { - fs.atime(de.inode) - return de, i, nil - } - } - return nil, 0, ENOENT -} - -// dirlink adds to the directory dp an entry for name pointing at the inode ip. -// If dp already contains an entry for name, that entry is overwritten. -func (fs *fsys) dirlink(dp *inode, name string, ip *inode) { - fs.mtime(dp) - fs.atime(ip) - ip.Nlink++ - for i := range dp.dir { - if dp.dir[i].name == name { - dp.dir[i] = dirent{name, ip} - return - } - } - dp.dir = append(dp.dir, dirent{name, ip}) - dp.dirSize() -} - -func (dp *inode) dirSize() { - dp.Size = int64(len(dp.dir)) * (8 + 8 + 2 + 256) // Dirent -} - -// skipelem splits path into the first element and the remainder. -// the returned first element contains no slashes, and the returned -// remainder does not begin with a slash. -func skipelem(path string) (elem, rest string) { - for len(path) > 0 && path[0] == '/' { - path = path[1:] - } - if len(path) == 0 { - return "", "" - } - i := 0 - for i < len(path) && path[i] != '/' { - i++ - } - elem, path = path[:i], path[i:] - for len(path) > 0 && path[0] == '/' { - path = path[1:] - } - return elem, path -} - -// namei translates a file system path name into an inode. -// If parent is false, the returned ip corresponds to the given name, and elem is the empty string. -// If parent is true, the walk stops at the next-to-last element in the name, -// so that ip is the parent directory and elem is the final element in the path. -func (fs *fsys) namei(path string, parent bool) (ip *inode, elem string, err error) { - // Reject NUL in name. - for i := 0; i < len(path); i++ { - if path[i] == '\x00' { - return nil, "", EINVAL - } - } - - // Reject empty name. - if path == "" { - return nil, "", EINVAL - } - - if path[0] == '/' { - ip = fs.root - } else { - ip = fs.cwd - } - - for len(path) > 0 && path[len(path)-1] == '/' { - path = path[:len(path)-1] - } - - for { - elem, rest := skipelem(path) - if elem == "" { - if parent && ip.Mode&S_IFMT == S_IFDIR { - return ip, ".", nil - } - break - } - if ip.Mode&S_IFMT != S_IFDIR { - return nil, "", ENOTDIR - } - if len(elem) >= 256 { - return nil, "", ENAMETOOLONG - } - if parent && rest == "" { - // Stop one level early. - return ip, elem, nil - } - de, _, err := fs.dirlookup(ip, elem) - if err != nil { - return nil, "", err - } - ip = de.inode - path = rest - } - if parent { - return nil, "", ENOTDIR - } - return ip, "", nil -} - -// open opens or creates a file with the given name, open mode, -// and permission mode bits. -func (fs *fsys) open(name string, openmode int, mode uint32) (fileImpl, error) { - dp, elem, err := fs.namei(name, true) - if err != nil { - return nil, err - } - var ( - ip *inode - dev devFile - ) - de, _, err := fs.dirlookup(dp, elem) - if err != nil { - if openmode&O_CREATE == 0 { - return nil, err - } - ip = fs.newInode() - ip.Mode = mode - fs.dirlink(dp, elem, ip) - if ip.Mode&S_IFMT == S_IFDIR { - fs.dirlink(ip, ".", ip) - fs.dirlink(ip, "..", dp) - } - } else { - ip = de.inode - if openmode&(O_CREATE|O_EXCL) == O_CREATE|O_EXCL { - return nil, EEXIST - } - if openmode&O_TRUNC != 0 { - if ip.Mode&S_IFMT == S_IFDIR { - return nil, EISDIR - } - ip.data = nil - } - if ip.Mode&S_IFMT == S_IFCHR { - if ip.Rdev < 0 || ip.Rdev >= int64(len(fs.dev)) || fs.dev[ip.Rdev] == nil { - return nil, ENODEV - } - dev, err = fs.dev[ip.Rdev]() - if err != nil { - return nil, err - } - } - } - - switch openmode & O_ACCMODE { - case O_WRONLY, O_RDWR: - if ip.Mode&S_IFMT == S_IFDIR { - return nil, EISDIR - } - } - - switch ip.Mode & S_IFMT { - case S_IFDIR: - if openmode&O_ACCMODE != O_RDONLY { - return nil, EISDIR - } - - case S_IFREG: - // ok - - case S_IFCHR: - // handled above - - default: - // TODO: some kind of special file - return nil, EPERM - } - - f := &fsysFile{ - fsys: fs, - inode: ip, - openmode: openmode, - dev: dev, - } - if openmode&O_APPEND != 0 { - f.offset = ip.Size - } - return f, nil -} - -// fsysFile methods to implement fileImpl. - -func (f *fsysFile) stat(st *Stat_t) error { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - *st = f.inode.Stat_t - return nil -} - -func (f *fsysFile) read(b []byte) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - n, err := f.preadLocked(b, f.offset) - f.offset += int64(n) - return n, err -} - -func ReadDirent(fd int, buf []byte) (int, error) { - f, err := fdToFsysFile(fd) - if err != nil { - return 0, err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - if f.inode.Mode&S_IFMT != S_IFDIR { - return 0, EINVAL - } - n, err := f.preadLocked(buf, f.offset) - f.offset += int64(n) - return n, err -} - -func (f *fsysFile) write(b []byte) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - n, err := f.pwriteLocked(b, f.offset) - f.offset += int64(n) - return n, err -} - -func (f *fsysFile) seek(offset int64, whence int) (int64, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - switch whence { - case io.SeekCurrent: - offset += f.offset - case io.SeekEnd: - offset += f.inode.Size - } - if offset < 0 { - return 0, EINVAL - } - if offset > f.inode.Size { - return 0, EINVAL - } - f.offset = offset - return offset, nil -} - -func (f *fsysFile) pread(b []byte, offset int64) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.preadLocked(b, offset) -} - -func (f *fsysFile) pwrite(b []byte, offset int64) (int, error) { - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.pwriteLocked(b, offset) -} - -func (f *fsysFile) preadLocked(b []byte, offset int64) (int, error) { - if f.openmode&O_ACCMODE == O_WRONLY { - return 0, EINVAL - } - if offset < 0 { - return 0, EINVAL - } - if f.dev != nil { - f.fsys.atime(f.inode) - f.fsys.mu.Unlock() - defer f.fsys.mu.Lock() - return f.dev.pread(b, offset) - } - if offset > f.inode.Size { - return 0, nil - } - if int64(len(b)) > f.inode.Size-offset { - b = b[:f.inode.Size-offset] - } - - if f.inode.Mode&S_IFMT == S_IFDIR { - if offset%direntSize != 0 || len(b) != 0 && len(b) < direntSize { - return 0, EINVAL - } - fs.atime(f.inode) - n := 0 - for len(b) >= direntSize { - src := f.inode.dir[int(offset/direntSize)] - dst := (*Dirent)(unsafe.Pointer(&b[0])) - dst.Ino = int64(src.inode.Ino) - dst.Off = offset - dst.Reclen = direntSize - for i := range dst.Name { - dst.Name[i] = 0 - } - copy(dst.Name[:], src.name) - n += direntSize - offset += direntSize - b = b[direntSize:] - } - return n, nil - } - - fs.atime(f.inode) - n := copy(b, f.inode.data[offset:]) - return n, nil -} - -func (f *fsysFile) pwriteLocked(b []byte, offset int64) (int, error) { - if f.openmode&O_ACCMODE == O_RDONLY { - return 0, EINVAL - } - if offset < 0 { - return 0, EINVAL - } - if f.dev != nil { - f.fsys.atime(f.inode) - f.fsys.mu.Unlock() - defer f.fsys.mu.Lock() - return f.dev.pwrite(b, offset) - } - if offset > f.inode.Size { - return 0, EINVAL - } - f.fsys.mtime(f.inode) - n := copy(f.inode.data[offset:], b) - if n < len(b) { - f.inode.data = append(f.inode.data, b[n:]...) - f.inode.Size = int64(len(f.inode.data)) - } - return len(b), nil -} - -// Standard Unix system calls. - -func Open(path string, openmode int, perm uint32) (fd int, err error) { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fs.open(path, openmode, perm&0777|S_IFREG) - if err != nil { - return -1, err - } - return newFD(f), nil -} - -func Mkdir(path string, perm uint32) error { - fs.mu.Lock() - defer fs.mu.Unlock() - _, err := fs.open(path, O_CREATE|O_EXCL, perm&0777|S_IFDIR) - return err -} - -func Getcwd(buf []byte) (n int, err error) { - // Force package os to default to the old algorithm using .. and directory reads. - return 0, ENOSYS -} - -func Stat(path string, st *Stat_t) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - *st = ip.Stat_t - return nil -} - -func Lstat(path string, st *Stat_t) error { - return Stat(path, st) -} - -func unlink(path string, isdir bool) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - dp, elem, err := fs.namei(path, true) - if err != nil { - return err - } - if elem == "." || elem == ".." { - return EINVAL - } - de, _, err := fs.dirlookup(dp, elem) - if err != nil { - return err - } - if isdir { - if de.inode.Mode&S_IFMT != S_IFDIR { - return ENOTDIR - } - if len(de.inode.dir) != 2 { - return ENOTEMPTY - } - } else { - if de.inode.Mode&S_IFMT == S_IFDIR { - return EISDIR - } - } - de.inode.Nlink-- - *de = dp.dir[len(dp.dir)-1] - dp.dir = dp.dir[:len(dp.dir)-1] - dp.dirSize() - return nil -} - -func Unlink(path string) error { - return unlink(path, false) -} - -func Rmdir(path string) error { - return unlink(path, true) -} - -func Chmod(path string, mode uint32) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - ip.Mode = ip.Mode&^0777 | mode&0777 - return nil -} - -func Fchmod(fd int, mode uint32) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - f.inode.Mode = f.inode.Mode&^0777 | mode&0777 - return nil -} - -func Chown(path string, uid, gid int) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - if uid != -1 { - ip.Uid = uint32(uid) - } - if gid != -1 { - ip.Gid = uint32(gid) - } - return nil -} - -func Fchown(fd int, uid, gid int) error { - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - f.inode.Uid = uint32(uid) - f.inode.Gid = uint32(gid) - return nil -} - -func Lchown(path string, uid, gid int) error { - return Chown(path, uid, gid) -} - -func UtimesNano(path string, ts []Timespec) error { - if len(ts) != 2 { - return EINVAL - } - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - ip.Atime = ts[0].Sec - ip.AtimeNsec = int64(ts[0].Nsec) - ip.Mtime = ts[1].Sec - ip.MtimeNsec = int64(ts[1].Nsec) - return nil -} - -func Link(path, link string) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - dp, elem, err := fs.namei(link, true) - if err != nil { - return err - } - if ip.Mode&S_IFMT == S_IFDIR { - return EPERM - } - _, _, err = fs.dirlookup(dp, elem) - if err == nil { - return EEXIST - } - fs.dirlink(dp, elem, ip) - return nil -} - -func Rename(from, to string) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - fdp, felem, err := fs.namei(from, true) - if err != nil { - return err - } - fde, _, err := fs.dirlookup(fdp, felem) - if err != nil { - return err - } - tdp, telem, err := fs.namei(to, true) - if err != nil { - return err - } - fs.dirlink(tdp, telem, fde.inode) - fde.inode.Nlink-- - *fde = fdp.dir[len(fdp.dir)-1] - fdp.dir = fdp.dir[:len(fdp.dir)-1] - fdp.dirSize() - return nil -} - -func (fs *fsys) truncate(ip *inode, length int64) error { - if length > 1e9 || ip.Mode&S_IFMT != S_IFREG { - return EINVAL - } - if length < int64(len(ip.data)) { - ip.data = ip.data[:length] - } else { - data := make([]byte, length) - copy(data, ip.data) - ip.data = data - } - ip.Size = int64(len(ip.data)) - return nil -} - -func Truncate(path string, length int64) error { - fsinit() - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - return fs.truncate(ip, length) -} - -func Ftruncate(fd int, length int64) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - return f.fsys.truncate(f.inode, length) -} - -func Chdir(path string) error { - fsinit() - return chdir(path) -} - -func chdir(path string) error { - fs.mu.Lock() - defer fs.mu.Unlock() - ip, _, err := fs.namei(path, false) - if err != nil { - return err - } - fs.cwd = ip - return nil -} - -func Fchdir(fd int) error { - f, err := fdToFsysFile(fd) - if err != nil { - return err - } - f.fsys.mu.Lock() - defer f.fsys.mu.Unlock() - if f.inode.Mode&S_IFMT != S_IFDIR { - return ENOTDIR - } - fs.cwd = f.inode - return nil -} - -func Readlink(path string, buf []byte) (n int, err error) { - return 0, ENOSYS -} - -func Symlink(path, link string) error { - return ENOSYS -} - -func Fsync(fd int) error { - return nil -} - -// Special devices. - -func mkdev(path string, mode uint32, open func() (devFile, error)) error { - f, err := fs.open(path, O_CREATE|O_RDONLY|O_EXCL, S_IFCHR|mode) - if err != nil { - return err - } - ip := f.(*fsysFile).inode - ip.Rdev = int64(len(fs.dev)) - fs.dev = append(fs.dev, open) - return nil -} - -type nullFile struct{} - -func openNull() (devFile, error) { return &nullFile{}, nil } -func (f *nullFile) close() error { return nil } -func (f *nullFile) pread(b []byte, offset int64) (int, error) { return 0, nil } -func (f *nullFile) pwrite(b []byte, offset int64) (int, error) { return len(b), nil } - -type zeroFile struct{} - -func openZero() (devFile, error) { return &zeroFile{}, nil } -func (f *zeroFile) close() error { return nil } -func (f *zeroFile) pwrite(b []byte, offset int64) (int, error) { return len(b), nil } - -func (f *zeroFile) pread(b []byte, offset int64) (int, error) { - for i := range b { - b[i] = 0 - } - return len(b), nil -} - -type randomFile struct{} - -func openRandom() (devFile, error) { - return randomFile{}, nil -} - -func (f randomFile) close() error { - return nil -} - -func (f randomFile) pread(b []byte, offset int64) (int, error) { - if err := naclGetRandomBytes(b); err != nil { - return 0, err - } - return len(b), nil -} - -func (f randomFile) pwrite(b []byte, offset int64) (int, error) { - return 0, EPERM -} - -func fdToFsysFile(fd int) (*fsysFile, error) { - f, err := fdToFile(fd) - if err != nil { - return nil, err - } - impl := f.impl - fsysf, ok := impl.(*fsysFile) - if !ok { - return nil, EINVAL - } - return fsysf, nil -} - -// create creates a file in the file system with the given name, mode, time, and data. -// It is meant to be called when initializing the file system image. -func create(name string, mode uint32, sec int64, data []byte) error { - fs.mu.Lock() - defer fs.mu.Unlock() - f, err := fs.open(name, O_CREATE|O_EXCL, mode) - if err != nil { - if mode&S_IFMT == S_IFDIR { - ip, _, err := fs.namei(name, false) - if err == nil && (ip.Mode&S_IFMT) == S_IFDIR { - return nil // directory already exists - } - } - return err - } - ip := f.(*fsysFile).inode - ip.Atime = sec - ip.Mtime = sec - ip.Ctime = sec - if len(data) > 0 { - ip.Size = int64(len(data)) - ip.data = data - } - return nil -} diff --git a/src/syscall/mkall.sh b/src/syscall/mkall.sh index 6239967664..74bce4a627 100755 --- a/src/syscall/mkall.sh +++ b/src/syscall/mkall.sh @@ -265,12 +265,6 @@ linux_s390x) mksysnum="./mksysnum_linux.pl $unistd_h" mktypes="GOARCH=$GOARCH go tool cgo -godefs" ;; -nacl_386) - mkerrors="" - mksyscall="./mksyscall.pl -l32 -nacl" - mksysnum="" - mktypes="" - ;; nacl_amd64p32) mkerrors="" mksyscall="./mksyscall.pl -nacl" diff --git a/src/syscall/net_js.go b/src/syscall/net_js.go index d5bf1f4f99..25f171bda8 100644 --- a/src/syscall/net_js.go +++ b/src/syscall/net_js.go @@ -42,7 +42,7 @@ const ( const ( _ = iota F_DUPFD_CLOEXEC - SYS_FCNTL = 500 // unsupported; same value as net_nacl.go + SYS_FCNTL = 500 // unsupported ) type Sockaddr interface { diff --git a/src/syscall/net_nacl.go b/src/syscall/net_nacl.go deleted file mode 100644 index 409a7a4e27..0000000000 --- a/src/syscall/net_nacl.go +++ /dev/null @@ -1,973 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// A simulated network for use within NaCl. -// The simulation is not particularly tied to NaCl, -// but other systems have real networks. - -// All int64 times are UnixNanos. - -package syscall - -import ( - "sync" - "sync/atomic" -) - -// Interface to timers implemented in package runtime. -// Must be in sync with ../runtime/time.go:/^type timer -// Really for use by package time, but we cannot import time here. - -type runtimeTimer struct { - tb uintptr - i int - - when int64 - period int64 - f func(interface{}, uintptr) // NOTE: must not be closure - arg interface{} - seq uintptr -} - -func startTimer(*runtimeTimer) -func stopTimer(*runtimeTimer) bool - -type timer struct { - expired bool - q *queue - r runtimeTimer -} - -func (t *timer) start(q *queue, deadline int64) { - if deadline == 0 { - return - } - t.q = q - t.r.when = deadline - t.r.f = timerExpired - t.r.arg = t - startTimer(&t.r) -} - -func (t *timer) stop() { - if t.r.f == nil { - return - } - stopTimer(&t.r) -} - -func (t *timer) reset(q *queue, deadline int64) { - t.stop() - if deadline == 0 { - return - } - if t.r.f == nil { - t.q = q - t.r.f = timerExpired - t.r.arg = t - } - t.r.when = deadline - startTimer(&t.r) -} - -func timerExpired(i interface{}, seq uintptr) { - t := i.(*timer) - go func() { - t.q.Lock() - defer t.q.Unlock() - t.expired = true - t.q.canRead.Broadcast() - t.q.canWrite.Broadcast() - }() -} - -// Network constants and data structures. These match the traditional values. - -const ( - AF_UNSPEC = iota - AF_UNIX - AF_INET - AF_INET6 -) - -const ( - SHUT_RD = iota - SHUT_WR - SHUT_RDWR -) - -const ( - SOCK_STREAM = 1 + iota - SOCK_DGRAM - SOCK_RAW - SOCK_SEQPACKET -) - -const ( - IPPROTO_IP = 0 - IPPROTO_IPV4 = 4 - IPPROTO_IPV6 = 0x29 - IPPROTO_TCP = 6 - IPPROTO_UDP = 0x11 -) - -// Misc constants expected by package net but not supported. -const ( - _ = iota - SOL_SOCKET - SO_TYPE - NET_RT_IFLIST - IFNAMSIZ - IFF_UP - IFF_BROADCAST - IFF_LOOPBACK - IFF_POINTOPOINT - IFF_MULTICAST - IPV6_V6ONLY - SOMAXCONN - F_DUPFD_CLOEXEC - SO_BROADCAST - SO_REUSEADDR - SO_REUSEPORT - SO_RCVBUF - SO_SNDBUF - SO_KEEPALIVE - SO_LINGER - SO_ERROR - IP_PORTRANGE - IP_PORTRANGE_DEFAULT - IP_PORTRANGE_LOW - IP_PORTRANGE_HIGH - IP_MULTICAST_IF - IP_MULTICAST_LOOP - IP_ADD_MEMBERSHIP - IPV6_PORTRANGE - IPV6_PORTRANGE_DEFAULT - IPV6_PORTRANGE_LOW - IPV6_PORTRANGE_HIGH - IPV6_MULTICAST_IF - IPV6_MULTICAST_LOOP - IPV6_JOIN_GROUP - TCP_NODELAY - TCP_KEEPINTVL - TCP_KEEPIDLE - - SYS_FCNTL = 500 // unsupported -) - -var SocketDisableIPv6 bool - -// A Sockaddr is one of the SockaddrXxx structs. -type Sockaddr interface { - // copy returns a copy of the underlying data. - copy() Sockaddr - - // key returns the value of the underlying data, - // for comparison as a map key. - key() interface{} -} - -type SockaddrInet4 struct { - Port int - Addr [4]byte -} - -func (sa *SockaddrInet4) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrInet4) key() interface{} { return *sa } - -func isIPv4Localhost(sa Sockaddr) bool { - sa4, ok := sa.(*SockaddrInet4) - return ok && sa4.Addr == [4]byte{127, 0, 0, 1} -} - -type SockaddrInet6 struct { - Port int - ZoneId uint32 - Addr [16]byte -} - -func (sa *SockaddrInet6) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrInet6) key() interface{} { return *sa } - -type SockaddrUnix struct { - Name string -} - -func (sa *SockaddrUnix) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrUnix) key() interface{} { return *sa } - -type SockaddrDatalink struct { - Len uint8 - Family uint8 - Index uint16 - Type uint8 - Nlen uint8 - Alen uint8 - Slen uint8 - Data [12]int8 -} - -func (sa *SockaddrDatalink) copy() Sockaddr { - sa1 := *sa - return &sa1 -} - -func (sa *SockaddrDatalink) key() interface{} { return *sa } - -// RoutingMessage represents a routing message. -type RoutingMessage interface { - unimplemented() -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -type Linger struct { - Onoff int32 - Linger int32 -} - -type ICMPv6Filter struct { - Filt [8]uint32 -} - -// A queue is the bookkeeping for a synchronized buffered queue. -// We do not use channels because we need to be able to handle -// writes after and during close, and because a chan byte would -// require too many send and receive operations in real use. -type queue struct { - sync.Mutex - canRead sync.Cond - canWrite sync.Cond - rtimer *timer // non-nil if in read - wtimer *timer // non-nil if in write - r int // total read index - w int // total write index - m int // index mask - closed bool -} - -func (q *queue) init(size int) { - if size&(size-1) != 0 { - panic("invalid queue size - must be power of two") - } - q.canRead.L = &q.Mutex - q.canWrite.L = &q.Mutex - q.m = size - 1 -} - -func past(deadline int64) bool { - sec, nsec := now() - return deadline > 0 && deadline < sec*1e9+int64(nsec) -} - -func (q *queue) waitRead(n int, deadline int64) (int, error) { - if past(deadline) { - return 0, EAGAIN - } - var t timer - t.start(q, deadline) - q.rtimer = &t - for q.w-q.r == 0 && !q.closed && !t.expired { - q.canRead.Wait() - } - q.rtimer = nil - t.stop() - m := q.w - q.r - if m == 0 && t.expired { - return 0, EAGAIN - } - if m > n { - m = n - q.canRead.Signal() // wake up next reader too - } - q.canWrite.Signal() - return m, nil -} - -func (q *queue) waitWrite(n int, deadline int64) (int, error) { - if past(deadline) { - return 0, EAGAIN - } - var t timer - t.start(q, deadline) - q.wtimer = &t - for q.w-q.r > q.m && !q.closed && !t.expired { - q.canWrite.Wait() - } - q.wtimer = nil - t.stop() - m := q.m + 1 - (q.w - q.r) - if m == 0 && t.expired { - return 0, EAGAIN - } - if m == 0 { - return 0, EAGAIN - } - if m > n { - m = n - q.canWrite.Signal() // wake up next writer too - } - q.canRead.Signal() - return m, nil -} - -func (q *queue) close() { - q.Lock() - defer q.Unlock() - q.closed = true - q.canRead.Broadcast() - q.canWrite.Broadcast() -} - -// A byteq is a byte queue. -type byteq struct { - queue - data []byte -} - -func newByteq() *byteq { - q := &byteq{ - data: make([]byte, 4096), - } - q.init(len(q.data)) - return q -} - -func (q *byteq) read(b []byte, deadline int64) (int, error) { - q.Lock() - defer q.Unlock() - n, err := q.waitRead(len(b), deadline) - if err != nil { - return 0, err - } - b = b[:n] - for len(b) > 0 { - m := copy(b, q.data[q.r&q.m:]) - q.r += m - b = b[m:] - } - return n, nil -} - -func (q *byteq) write(b []byte, deadline int64) (n int, err error) { - q.Lock() - defer q.Unlock() - for n < len(b) { - nn, err := q.waitWrite(len(b[n:]), deadline) - if err != nil { - return n, err - } - bb := b[n : n+nn] - n += nn - for len(bb) > 0 { - m := copy(q.data[q.w&q.m:], bb) - q.w += m - bb = bb[m:] - } - } - return n, nil -} - -// A msgq is a queue of messages. -type msgq struct { - queue - data []interface{} -} - -func newMsgq() *msgq { - q := &msgq{ - data: make([]interface{}, 32), - } - q.init(len(q.data)) - return q -} - -func (q *msgq) read(deadline int64) (interface{}, error) { - q.Lock() - defer q.Unlock() - n, err := q.waitRead(1, deadline) - if err != nil { - return nil, err - } - if n == 0 { - return nil, nil - } - m := q.data[q.r&q.m] - q.r++ - return m, nil -} - -func (q *msgq) write(m interface{}, deadline int64) error { - q.Lock() - defer q.Unlock() - _, err := q.waitWrite(1, deadline) - if err != nil { - return err - } - q.data[q.w&q.m] = m - q.w++ - return nil -} - -// An addr is a sequence of bytes uniquely identifying a network address. -// It is not human-readable. -type addr string - -// A conn is one side of a stream-based network connection. -// That is, a stream-based network connection is a pair of cross-connected conns. -type conn struct { - rd *byteq - wr *byteq - local addr - remote addr -} - -// A pktconn is one side of a packet-based network connection. -// That is, a packet-based network connection is a pair of cross-connected pktconns. -type pktconn struct { - rd *msgq - wr *msgq - local addr - remote addr -} - -// A listener accepts incoming stream-based network connections. -type listener struct { - rd *msgq - local addr -} - -// A netFile is an open network file. -type netFile struct { - defaultFileImpl - proto *netproto - sotype int - listener *msgq - packet *msgq - rd *byteq - wr *byteq - rddeadline int64 - wrdeadline int64 - addr Sockaddr - raddr Sockaddr -} - -// A netAddr is a network address in the global listener map. -// All the fields must have defined == operations. -type netAddr struct { - proto *netproto - sotype int - addr interface{} -} - -// net records the state of the network. -// It maps a network address to the listener on that address. -var net = struct { - sync.Mutex - listener map[netAddr]*netFile -}{ - listener: make(map[netAddr]*netFile), -} - -// TODO(rsc): Some day, do a better job with port allocation. -// For playground programs, incrementing is fine. -var nextport = 2 - -// A netproto contains protocol-specific functionality -// (one for AF_INET, one for AF_INET6 and so on). -// It is a struct instead of an interface because the -// implementation needs no state, and I expect to -// add some data fields at some point. -type netproto struct { - bind func(*netFile, Sockaddr) error -} - -var netprotoAF_INET = &netproto{ - bind: func(f *netFile, sa Sockaddr) error { - if sa == nil { - f.addr = &SockaddrInet4{ - Port: nextport, - Addr: [4]byte{127, 0, 0, 1}, - } - nextport++ - return nil - } - addr, ok := sa.(*SockaddrInet4) - if !ok { - return EINVAL - } - addr = addr.copy().(*SockaddrInet4) - if addr.Port == 0 { - addr.Port = nextport - nextport++ - } - f.addr = addr - return nil - }, -} - -var netprotos = map[int]*netproto{ - AF_INET: netprotoAF_INET, -} - -// These functions implement the usual BSD socket operations. - -func (f *netFile) bind(sa Sockaddr) error { - if f.addr != nil { - return EISCONN - } - if err := f.proto.bind(f, sa); err != nil { - return err - } - if f.sotype == SOCK_DGRAM { - _, ok := net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] - if ok { - f.addr = nil - return EADDRINUSE - } - net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] = f - f.packet = newMsgq() - } - return nil -} - -func (f *netFile) listen(backlog int) error { - net.Lock() - defer net.Unlock() - if f.listener != nil { - return EINVAL - } - old, ok := net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] - if ok && !old.listenerClosed() { - return EADDRINUSE - } - net.listener[netAddr{f.proto, f.sotype, f.addr.key()}] = f - f.listener = newMsgq() - return nil -} - -func (f *netFile) accept() (fd int, sa Sockaddr, err error) { - msg, err := f.listener.read(f.readDeadline()) - if err != nil { - return -1, nil, err - } - newf, ok := msg.(*netFile) - if !ok { - // must be eof - return -1, nil, EAGAIN - } - return newFD(newf), newf.raddr.copy(), nil -} - -func (f *netFile) connect(sa Sockaddr) error { - if past(f.writeDeadline()) { - return EAGAIN - } - if f.addr == nil { - if err := f.bind(nil); err != nil { - return err - } - } - net.Lock() - if sa == nil { - net.Unlock() - return EINVAL - } - sa = sa.copy() - if f.raddr != nil { - net.Unlock() - return EISCONN - } - if f.sotype == SOCK_DGRAM { - net.Unlock() - f.raddr = sa - return nil - } - if f.listener != nil { - net.Unlock() - return EISCONN - } - l, ok := net.listener[netAddr{f.proto, f.sotype, sa.key()}] - if !ok { - // If we're dialing 127.0.0.1 but found nothing, try - // 0.0.0.0 also. (Issue 20611) - if isIPv4Localhost(sa) { - sa = &SockaddrInet4{Port: sa.(*SockaddrInet4).Port} - l, ok = net.listener[netAddr{f.proto, f.sotype, sa.key()}] - } - } - if !ok || l.listenerClosed() { - net.Unlock() - return ECONNREFUSED - } - f.raddr = sa - f.rd = newByteq() - f.wr = newByteq() - newf := &netFile{ - proto: f.proto, - sotype: f.sotype, - addr: f.raddr, - raddr: f.addr, - rd: f.wr, - wr: f.rd, - } - net.Unlock() - l.listener.write(newf, f.writeDeadline()) - return nil -} - -func (f *netFile) read(b []byte) (int, error) { - if f.rd == nil { - if f.raddr != nil { - n, _, err := f.recvfrom(b, 0) - return n, err - } - return 0, ENOTCONN - } - return f.rd.read(b, f.readDeadline()) -} - -func (f *netFile) write(b []byte) (int, error) { - if f.wr == nil { - if f.raddr != nil { - err := f.sendto(b, 0, f.raddr) - var n int - if err == nil { - n = len(b) - } - return n, err - } - return 0, ENOTCONN - } - return f.wr.write(b, f.writeDeadline()) -} - -type pktmsg struct { - buf []byte - addr Sockaddr -} - -func (f *netFile) recvfrom(p []byte, flags int) (n int, from Sockaddr, err error) { - if f.sotype != SOCK_DGRAM { - return 0, nil, EINVAL - } - if f.packet == nil { - return 0, nil, ENOTCONN - } - msg1, err := f.packet.read(f.readDeadline()) - if err != nil { - return 0, nil, err - } - msg, ok := msg1.(*pktmsg) - if !ok { - return 0, nil, EAGAIN - } - return copy(p, msg.buf), msg.addr, nil -} - -func (f *netFile) sendto(p []byte, flags int, to Sockaddr) error { - if f.sotype != SOCK_DGRAM { - return EINVAL - } - if f.packet == nil { - if err := f.bind(nil); err != nil { - return err - } - } - net.Lock() - if to == nil { - net.Unlock() - return EINVAL - } - to = to.copy() - l, ok := net.listener[netAddr{f.proto, f.sotype, to.key()}] - if !ok || l.packet == nil { - net.Unlock() - return ECONNREFUSED - } - net.Unlock() - msg := &pktmsg{ - buf: make([]byte, len(p)), - addr: f.addr, - } - copy(msg.buf, p) - l.packet.write(msg, f.writeDeadline()) - return nil -} - -func (f *netFile) listenerClosed() bool { - f.listener.Lock() - defer f.listener.Unlock() - return f.listener.closed -} - -func (f *netFile) close() error { - if f.listener != nil { - f.listener.close() - } - if f.packet != nil { - f.packet.close() - } - if f.rd != nil { - f.rd.close() - } - if f.wr != nil { - f.wr.close() - } - return nil -} - -func fdToNetFile(fd int) (*netFile, error) { - f, err := fdToFile(fd) - if err != nil { - return nil, err - } - impl := f.impl - netf, ok := impl.(*netFile) - if !ok { - return nil, EINVAL - } - return netf, nil -} - -func Socket(proto, sotype, unused int) (fd int, err error) { - p := netprotos[proto] - if p == nil { - return -1, EPROTONOSUPPORT - } - if sotype != SOCK_STREAM && sotype != SOCK_DGRAM { - return -1, ESOCKTNOSUPPORT - } - f := &netFile{ - proto: p, - sotype: sotype, - } - return newFD(f), nil -} - -func Bind(fd int, sa Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.bind(sa) -} - -func StopIO(fd int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - f.close() - return nil -} - -func Listen(fd int, backlog int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.listen(backlog) -} - -func Accept(fd int) (newfd int, sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, nil, err - } - return f.accept() -} - -func Getsockname(fd int) (sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return nil, err - } - if f.addr == nil { - return nil, ENOTCONN - } - return f.addr.copy(), nil -} - -func Getpeername(fd int) (sa Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return nil, err - } - if f.raddr == nil { - return nil, ENOTCONN - } - return f.raddr.copy(), nil -} - -func Connect(fd int, sa Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.connect(sa) -} - -func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, nil, err - } - return f.recvfrom(p, flags) -} - -func Sendto(fd int, p []byte, flags int, to Sockaddr) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - return f.sendto(p, flags, to) -} - -func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn, recvflags int, from Sockaddr, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return - } - n, from, err = f.recvfrom(p, flags) - return -} - -func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) error { - _, err := SendmsgN(fd, p, oob, to, flags) - return err -} - -func SendmsgN(fd int, p, oob []byte, to Sockaddr, flags int) (n int, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, err - } - switch f.sotype { - case SOCK_STREAM: - n, err = f.write(p) - case SOCK_DGRAM: - n = len(p) - err = f.sendto(p, flags, to) - } - if err != nil { - return 0, err - } - return n, nil -} - -func GetsockoptInt(fd, level, opt int) (value int, err error) { - f, err := fdToNetFile(fd) - if err != nil { - return 0, err - } - switch { - case level == SOL_SOCKET && opt == SO_TYPE: - return f.sotype, nil - } - return 0, ENOTSUP -} - -func SetsockoptInt(fd, level, opt int, value int) error { - return nil -} - -func SetsockoptByte(fd, level, opt int, value byte) error { - _, err := fdToNetFile(fd) - if err != nil { - return err - } - return ENOTSUP -} - -func SetsockoptLinger(fd, level, opt int, l *Linger) error { - return nil -} - -func SetReadDeadline(fd int, t int64) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - atomic.StoreInt64(&f.rddeadline, t) - if bq := f.rd; bq != nil { - bq.Lock() - if timer := bq.rtimer; timer != nil { - timer.reset(&bq.queue, t) - } - bq.Unlock() - } - return nil -} - -func (f *netFile) readDeadline() int64 { - return atomic.LoadInt64(&f.rddeadline) -} - -func SetWriteDeadline(fd int, t int64) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - atomic.StoreInt64(&f.wrdeadline, t) - if bq := f.wr; bq != nil { - bq.Lock() - if timer := bq.wtimer; timer != nil { - timer.reset(&bq.queue, t) - } - bq.Unlock() - } - return nil -} - -func (f *netFile) writeDeadline() int64 { - return atomic.LoadInt64(&f.wrdeadline) -} - -func Shutdown(fd int, how int) error { - f, err := fdToNetFile(fd) - if err != nil { - return err - } - switch how { - case SHUT_RD: - f.rd.close() - case SHUT_WR: - f.wr.close() - case SHUT_RDWR: - f.rd.close() - f.wr.close() - } - return nil -} - -func SetsockoptICMPv6Filter(fd, level, opt int, filter *ICMPv6Filter) error { panic("SetsockoptICMPv") } -func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) error { panic("SetsockoptIPMreq") } -func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) error { panic("SetsockoptIPv") } -func SetsockoptInet4Addr(fd, level, opt int, value [4]byte) error { panic("SetsockoptInet") } -func SetsockoptString(fd, level, opt int, s string) error { panic("SetsockoptString") } -func SetsockoptTimeval(fd, level, opt int, tv *Timeval) error { panic("SetsockoptTimeval") } -func Socketpair(domain, typ, proto int) (fd [2]int, err error) { panic("Socketpair") } - -func SetNonblock(fd int, nonblocking bool) error { return nil } diff --git a/src/syscall/syscall_nacl.go b/src/syscall/syscall_nacl.go deleted file mode 100644 index c784d372a1..0000000000 --- a/src/syscall/syscall_nacl.go +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package syscall - -import ( - "internal/oserror" - "sync" - "unsafe" -) - -//sys naclClose(fd int) (err error) = sys_close -//sys naclFstat(fd int, stat *Stat_t) (err error) = sys_fstat -//sys naclRead(fd int, b []byte) (n int, err error) = sys_read -//sys naclSeek(fd int, off *int64, whence int) (err error) = sys_lseek -//sys naclGetRandomBytes(b []byte) (err error) = sys_get_random_bytes - -const direntSize = 8 + 8 + 2 + 256 - -// native_client/src/trusted/service_runtime/include/sys/dirent.h -type Dirent struct { - Ino int64 - Off int64 - Reclen uint16 - Name [256]byte -} - -func direntIno(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Ino), unsafe.Sizeof(Dirent{}.Ino)) -} - -func direntReclen(buf []byte) (uint64, bool) { - return readInt(buf, unsafe.Offsetof(Dirent{}.Reclen), unsafe.Sizeof(Dirent{}.Reclen)) -} - -func direntNamlen(buf []byte) (uint64, bool) { - reclen, ok := direntReclen(buf) - if !ok { - return 0, false - } - return reclen - uint64(unsafe.Offsetof(Dirent{}.Name)), true -} - -const PathMax = 256 - -// An Errno is an unsigned number describing an error condition. -// It implements the error interface. The zero Errno is by convention -// a non-error, so code to convert from Errno to error should use: -// err = nil -// if errno != 0 { -// err = errno -// } -// -// Errno values can be tested against error values from the os package -// using errors.Is. For example: -// -// _, _, err := syscall.Syscall(...) -// if errors.Is(err, os.ErrNotExist) ... -type Errno uintptr - -func (e Errno) Error() string { - if 0 <= int(e) && int(e) < len(errorstr) { - s := errorstr[e] - if s != "" { - return s - } - } - return "errno " + itoa(int(e)) -} - -func (e Errno) Is(target error) bool { - switch target { - case oserror.ErrPermission: - return e == EACCES || e == EPERM - case oserror.ErrExist: - return e == EEXIST || e == ENOTEMPTY - case oserror.ErrNotExist: - return e == ENOENT - } - return false -} - -func (e Errno) Temporary() bool { - return e == EINTR || e == EMFILE || e.Timeout() -} - -func (e Errno) Timeout() bool { - return e == EAGAIN || e == EWOULDBLOCK || e == ETIMEDOUT -} - -// A Signal is a number describing a process signal. -// It implements the os.Signal interface. -type Signal int - -const ( - _ Signal = iota - SIGCHLD - SIGINT - SIGKILL - SIGTRAP - SIGQUIT -) - -func (s Signal) Signal() {} - -func (s Signal) String() string { - if 0 <= s && int(s) < len(signals) { - str := signals[s] - if str != "" { - return str - } - } - return "signal " + itoa(int(s)) -} - -var signals = [...]string{} - -// File system - -const ( - Stdin = 0 - Stdout = 1 - Stderr = 2 -) - -// native_client/src/trusted/service_runtime/include/sys/fcntl.h -const ( - O_RDONLY = 0 - O_WRONLY = 1 - O_RDWR = 2 - O_ACCMODE = 3 - - O_CREAT = 0100 - O_CREATE = O_CREAT // for ken - O_TRUNC = 01000 - O_APPEND = 02000 - O_EXCL = 0200 - O_NONBLOCK = 04000 - O_NDELAY = O_NONBLOCK - O_SYNC = 010000 - O_FSYNC = O_SYNC - O_ASYNC = 020000 - - O_CLOEXEC = 0 - - FD_CLOEXEC = 1 -) - -// native_client/src/trusted/service_runtime/include/sys/fcntl.h -const ( - F_DUPFD = 0 - F_GETFD = 1 - F_SETFD = 2 - F_GETFL = 3 - F_SETFL = 4 - F_GETOWN = 5 - F_SETOWN = 6 - F_GETLK = 7 - F_SETLK = 8 - F_SETLKW = 9 - F_RGETLK = 10 - F_RSETLK = 11 - F_CNVT = 12 - F_RSETLKW = 13 - - F_RDLCK = 1 - F_WRLCK = 2 - F_UNLCK = 3 - F_UNLKSYS = 4 -) - -// native_client/src/trusted/service_runtime/include/bits/stat.h -const ( - S_IFMT = 0000370000 - S_IFSHM_SYSV = 0000300000 - S_IFSEMA = 0000270000 - S_IFCOND = 0000260000 - S_IFMUTEX = 0000250000 - S_IFSHM = 0000240000 - S_IFBOUNDSOCK = 0000230000 - S_IFSOCKADDR = 0000220000 - S_IFDSOCK = 0000210000 - - S_IFSOCK = 0000140000 - S_IFLNK = 0000120000 - S_IFREG = 0000100000 - S_IFBLK = 0000060000 - S_IFDIR = 0000040000 - S_IFCHR = 0000020000 - S_IFIFO = 0000010000 - - S_UNSUP = 0000370000 - - S_ISUID = 0004000 - S_ISGID = 0002000 - S_ISVTX = 0001000 - - S_IREAD = 0400 - S_IWRITE = 0200 - S_IEXEC = 0100 - - S_IRWXU = 0700 - S_IRUSR = 0400 - S_IWUSR = 0200 - S_IXUSR = 0100 - - S_IRWXG = 070 - S_IRGRP = 040 - S_IWGRP = 020 - S_IXGRP = 010 - - S_IRWXO = 07 - S_IROTH = 04 - S_IWOTH = 02 - S_IXOTH = 01 -) - -// native_client/src/trusted/service_runtime/include/sys/stat.h -// native_client/src/trusted/service_runtime/include/machine/_types.h -type Stat_t struct { - Dev int64 - Ino uint64 - Mode uint32 - Nlink uint32 - Uid uint32 - Gid uint32 - Rdev int64 - Size int64 - Blksize int32 - Blocks int32 - Atime int64 - AtimeNsec int64 - Mtime int64 - MtimeNsec int64 - Ctime int64 - CtimeNsec int64 -} - -// Processes -// Not supported on NaCl - just enough for package os. - -var ForkLock sync.RWMutex - -type WaitStatus uint32 - -func (w WaitStatus) Exited() bool { return false } -func (w WaitStatus) ExitStatus() int { return 0 } -func (w WaitStatus) Signaled() bool { return false } -func (w WaitStatus) Signal() Signal { return 0 } -func (w WaitStatus) CoreDump() bool { return false } -func (w WaitStatus) Stopped() bool { return false } -func (w WaitStatus) Continued() bool { return false } -func (w WaitStatus) StopSignal() Signal { return 0 } -func (w WaitStatus) TrapCause() int { return 0 } - -// XXX made up -type Rusage struct { - Utime Timeval - Stime Timeval -} - -// XXX made up -type ProcAttr struct { - Dir string - Env []string - Files []uintptr - Sys *SysProcAttr -} - -type SysProcAttr struct { -} - -// System - -func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) -func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { return 0, 0, ENOSYS } -func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err Errno) { return 0, 0, ENOSYS } -func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) { - return 0, 0, ENOSYS -} - -func Sysctl(key string) (string, error) { - if key == "kern.hostname" { - return "naclbox", nil - } - return "", ENOSYS -} - -// Unimplemented Unix midden heap. - -const ImplementsGetwd = false - -func Getwd() (wd string, err error) { return "", ENOSYS } -func Getegid() int { return 1 } -func Geteuid() int { return 1 } -func Getgid() int { return 1 } -func Getgroups() ([]int, error) { return []int{1}, nil } -func Getppid() int { return 2 } -func Getpid() int { return 3 } -func Gettimeofday(tv *Timeval) error { return ENOSYS } -func Getuid() int { return 1 } -func Kill(pid int, signum Signal) error { return ENOSYS } -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { - return 0, ENOSYS -} -func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid int, handle uintptr, err error) { - return 0, 0, ENOSYS -} -func Wait4(pid int, wstatus *WaitStatus, options int, rusage *Rusage) (wpid int, err error) { - return 0, ENOSYS -} -func RouteRIB(facility, param int) ([]byte, error) { return nil, ENOSYS } -func ParseRoutingMessage(b []byte) ([]RoutingMessage, error) { return nil, ENOSYS } -func ParseRoutingSockaddr(msg RoutingMessage) ([]Sockaddr, error) { return nil, ENOSYS } -func SysctlUint32(name string) (value uint32, err error) { return 0, ENOSYS } - -type Iovec struct{} // dummy diff --git a/src/syscall/syscall_nacl_386.go b/src/syscall/syscall_nacl_386.go deleted file mode 100644 index 39112ebcc3..0000000000 --- a/src/syscall/syscall_nacl_386.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package syscall - -type Timespec struct { - Sec int64 - Nsec int32 -} - -type Timeval struct { - Sec int64 - Usec int32 -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} diff --git a/src/syscall/syscall_nacl_arm.go b/src/syscall/syscall_nacl_arm.go deleted file mode 100644 index dec97b546a..0000000000 --- a/src/syscall/syscall_nacl_arm.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package syscall - -type Timespec struct { - Sec int64 - Nsec int32 -} - -type Timeval struct { - Sec int64 - Usec int32 -} - -func setTimespec(sec, nsec int64) Timespec { - return Timespec{Sec: sec, Nsec: int32(nsec)} -} - -func setTimeval(sec, usec int64) Timeval { - return Timeval{Sec: sec, Usec: int32(usec)} -} diff --git a/src/syscall/syscall_test.go b/src/syscall/syscall_test.go index 2a9d90e64c..5390f8aace 100644 --- a/src/syscall/syscall_test.go +++ b/src/syscall/syscall_test.go @@ -62,7 +62,7 @@ func TestExecErrPermutedFds(t *testing.T) { } func TestGettimeofday(t *testing.T) { - if runtime.GOOS == "nacl" || runtime.GOOS == "js" { + if runtime.GOOS == "js" { t.Skip("not implemented on " + runtime.GOOS) } tv := &syscall.Timeval{} diff --git a/src/syscall/tables_nacljs.go b/src/syscall/tables_js.go similarity index 99% rename from src/syscall/tables_nacljs.go rename to src/syscall/tables_js.go index 1c265f25c7..806fa10415 100644 --- a/src/syscall/tables_nacljs.go +++ b/src/syscall/tables_js.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build nacl js,wasm +// +build js,wasm package syscall diff --git a/src/syscall/time_nacl_386.s b/src/syscall/time_nacl_386.s deleted file mode 100644 index 90cf366bb3..0000000000 --- a/src/syscall/time_nacl_386.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -TEXT ·startTimer(SB),NOSPLIT,$0 - JMP time·startTimer(SB) - -TEXT ·stopTimer(SB),NOSPLIT,$0 - JMP time·stopTimer(SB) diff --git a/src/syscall/time_nacl_arm.s b/src/syscall/time_nacl_arm.s deleted file mode 100644 index 7864ec9d3e..0000000000 --- a/src/syscall/time_nacl_arm.s +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#include "textflag.h" - -TEXT ·startTimer(SB),NOSPLIT,$0 - B time·startTimer(SB) - -TEXT ·stopTimer(SB),NOSPLIT,$0 - B time·stopTimer(SB) diff --git a/src/syscall/timestruct.go b/src/syscall/timestruct.go index 09be22c971..682c68cf9b 100644 --- a/src/syscall/timestruct.go +++ b/src/syscall/timestruct.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package syscall diff --git a/src/syscall/unzip_nacl.go b/src/syscall/unzip_nacl.go deleted file mode 100644 index 14b5bd154f..0000000000 --- a/src/syscall/unzip_nacl.go +++ /dev/null @@ -1,685 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Small in-memory unzip implementation. -// A simplified copy of the pre-Go 1 compress/flate/inflate.go -// and a modified copy of the zip reader in package time. -// (The one in package time does not support decompression; this one does.) - -package syscall - -const ( - maxCodeLen = 16 // max length of Huffman code - maxHist = 32768 // max history required - maxLit = 286 - maxDist = 32 - numCodes = 19 // number of codes in Huffman meta-code -) - -type decompressor struct { - in string // compressed input - out []byte // uncompressed output - b uint32 // input bits, at top of b - nb uint - err bool // invalid input - eof bool // reached EOF - - h1, h2 huffmanDecoder // decoders for literal/length, distance - bits [maxLit + maxDist]int // lengths defining Huffman codes - codebits [numCodes]int -} - -func (f *decompressor) nextBlock() { - for f.nb < 1+2 { - if f.moreBits(); f.err { - return - } - } - f.eof = f.b&1 == 1 - f.b >>= 1 - typ := f.b & 3 - f.b >>= 2 - f.nb -= 1 + 2 - switch typ { - case 0: - f.dataBlock() - case 1: - // compressed, fixed Huffman tables - f.huffmanBlock(&fixedHuffmanDecoder, nil) - case 2: - // compressed, dynamic Huffman tables - if f.readHuffman(); f.err { - break - } - f.huffmanBlock(&f.h1, &f.h2) - default: - // 3 is reserved. - f.err = true - } -} - -// RFC 1951 section 3.2.7. -// Compression with dynamic Huffman codes - -var codeOrder = [...]int{16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15} - -func (f *decompressor) readHuffman() { - // HLIT[5], HDIST[5], HCLEN[4]. - for f.nb < 5+5+4 { - if f.moreBits(); f.err { - return - } - } - nlit := int(f.b&0x1F) + 257 - f.b >>= 5 - ndist := int(f.b&0x1F) + 1 - f.b >>= 5 - nclen := int(f.b&0xF) + 4 - f.b >>= 4 - f.nb -= 5 + 5 + 4 - - // (HCLEN+4)*3 bits: code lengths in the magic codeOrder order. - for i := 0; i < nclen; i++ { - for f.nb < 3 { - if f.moreBits(); f.err { - return - } - } - f.codebits[codeOrder[i]] = int(f.b & 0x7) - f.b >>= 3 - f.nb -= 3 - } - for i := nclen; i < len(codeOrder); i++ { - f.codebits[codeOrder[i]] = 0 - } - if !f.h1.init(f.codebits[0:]) { - f.err = true - return - } - - // HLIT + 257 code lengths, HDIST + 1 code lengths, - // using the code length Huffman code. - for i, n := 0, nlit+ndist; i < n; { - x := f.huffSym(&f.h1) - if f.err { - return - } - if x < 16 { - // Actual length. - f.bits[i] = x - i++ - continue - } - // Repeat previous length or zero. - var rep int - var nb uint - var b int - switch x { - default: - f.err = true - return - case 16: - rep = 3 - nb = 2 - if i == 0 { - f.err = true - return - } - b = f.bits[i-1] - case 17: - rep = 3 - nb = 3 - b = 0 - case 18: - rep = 11 - nb = 7 - b = 0 - } - for f.nb < nb { - if f.moreBits(); f.err { - return - } - } - rep += int(f.b & uint32(1<>= nb - f.nb -= nb - if i+rep > n { - f.err = true - return - } - for j := 0; j < rep; j++ { - f.bits[i] = b - i++ - } - } - - if !f.h1.init(f.bits[0:nlit]) || !f.h2.init(f.bits[nlit:nlit+ndist]) { - f.err = true - return - } -} - -// Decode a single Huffman block from f. -// hl and hd are the Huffman states for the lit/length values -// and the distance values, respectively. If hd == nil, using the -// fixed distance encoding associated with fixed Huffman blocks. -func (f *decompressor) huffmanBlock(hl, hd *huffmanDecoder) { - for { - v := f.huffSym(hl) - if f.err { - return - } - var n uint // number of bits extra - var length int - switch { - case v < 256: - f.out = append(f.out, byte(v)) - continue - case v == 256: - // Done with huffman block; read next block. - return - // otherwise, reference to older data - case v < 265: - length = v - (257 - 3) - n = 0 - case v < 269: - length = v*2 - (265*2 - 11) - n = 1 - case v < 273: - length = v*4 - (269*4 - 19) - n = 2 - case v < 277: - length = v*8 - (273*8 - 35) - n = 3 - case v < 281: - length = v*16 - (277*16 - 67) - n = 4 - case v < 285: - length = v*32 - (281*32 - 131) - n = 5 - default: - length = 258 - n = 0 - } - if n > 0 { - for f.nb < n { - if f.moreBits(); f.err { - return - } - } - length += int(f.b & uint32(1<>= n - f.nb -= n - } - - var dist int - if hd == nil { - for f.nb < 5 { - if f.moreBits(); f.err { - return - } - } - dist = int(reverseByte[(f.b&0x1F)<<3]) - f.b >>= 5 - f.nb -= 5 - } else { - if dist = f.huffSym(hd); f.err { - return - } - } - - switch { - case dist < 4: - dist++ - case dist >= 30: - f.err = true - return - default: - nb := uint(dist-2) >> 1 - // have 1 bit in bottom of dist, need nb more. - extra := (dist & 1) << nb - for f.nb < nb { - if f.moreBits(); f.err { - return - } - } - extra |= int(f.b & uint32(1<>= nb - f.nb -= nb - dist = 1<<(nb+1) + 1 + extra - } - - // Copy [-dist:-dist+length] into output. - // Encoding can be prescient, so no check on length. - if dist > len(f.out) { - f.err = true - return - } - - p := len(f.out) - dist - for i := 0; i < length; i++ { - f.out = append(f.out, f.out[p]) - p++ - } - } -} - -// Copy a single uncompressed data block from input to output. -func (f *decompressor) dataBlock() { - // Uncompressed. - // Discard current half-byte. - f.nb = 0 - f.b = 0 - - if len(f.in) < 4 { - f.err = true - return - } - - buf := f.in[:4] - f.in = f.in[4:] - n := int(buf[0]) | int(buf[1])<<8 - nn := int(buf[2]) | int(buf[3])<<8 - if uint16(nn) != uint16(^n) { - f.err = true - return - } - - if len(f.in) < n { - f.err = true - return - } - f.out = append(f.out, f.in[:n]...) - f.in = f.in[n:] -} - -func (f *decompressor) moreBits() { - if len(f.in) == 0 { - f.err = true - return - } - c := f.in[0] - f.in = f.in[1:] - f.b |= uint32(c) << f.nb - f.nb += 8 -} - -// Read the next Huffman-encoded symbol from f according to h. -func (f *decompressor) huffSym(h *huffmanDecoder) int { - for n := uint(h.min); n <= uint(h.max); n++ { - lim := h.limit[n] - if lim == -1 { - continue - } - for f.nb < n { - if f.moreBits(); f.err { - return 0 - } - } - v := int(f.b & uint32(1<>8]) | int(reverseByte[v&0xFF])<<8 // reverse bits - if v <= lim { - f.b >>= n - f.nb -= n - return h.codes[v-h.base[n]] - } - } - f.err = true - return 0 -} - -var reverseByte = [256]byte{ - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, -} - -// Hard-coded Huffman tables for DEFLATE algorithm. -// See RFC 1951, section 3.2.6. -var fixedHuffmanDecoder = huffmanDecoder{ - 7, 9, - [maxCodeLen + 1]int{7: 23, 199, 511}, - [maxCodeLen + 1]int{7: 0, 24, 224}, - []int{ - // length 7: 256-279 - 256, 257, 258, 259, 260, 261, 262, - 263, 264, 265, 266, 267, 268, 269, - 270, 271, 272, 273, 274, 275, 276, - 277, 278, 279, - - // length 8: 0-143 - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, - 117, 118, 119, 120, 121, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 143, - - // length 8: 280-287 - 280, 281, 282, 283, 284, 285, 286, 287, - - // length 9: 144-255 - 144, 145, 146, 147, 148, 149, 150, 151, - 152, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 204, 205, 206, 207, - 208, 209, 210, 211, 212, 213, 214, 215, - 216, 217, 218, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 243, 244, 245, 246, 247, - 248, 249, 250, 251, 252, 253, 254, 255, - }, -} - -// Huffman decoder is based on -// J. Brian Connell, ``A Huffman-Shannon-Fano Code,'' -// Proceedings of the IEEE, 61(7) (July 1973), pp 1046-1047. -type huffmanDecoder struct { - // min, max code length - min, max int - - // limit[i] = largest code word of length i - // Given code v of length n, - // need more bits if v > limit[n]. - limit [maxCodeLen + 1]int - - // base[i] = smallest code word of length i - seq number - base [maxCodeLen + 1]int - - // codes[seq number] = output code. - // Given code v of length n, value is - // codes[v - base[n]]. - codes []int -} - -// Initialize Huffman decoding tables from array of code lengths. -func (h *huffmanDecoder) init(bits []int) bool { - // Count number of codes of each length, - // compute min and max length. - var count [maxCodeLen + 1]int - var min, max int - for _, n := range bits { - if n == 0 { - continue - } - if min == 0 || n < min { - min = n - } - if n > max { - max = n - } - count[n]++ - } - if max == 0 { - return false - } - - h.min = min - h.max = max - - // For each code range, compute - // nextcode (first code of that length), - // limit (last code of that length), and - // base (offset from first code to sequence number). - code := 0 - seq := 0 - var nextcode [maxCodeLen]int - for i := min; i <= max; i++ { - n := count[i] - nextcode[i] = code - h.base[i] = code - seq - code += n - seq += n - h.limit[i] = code - 1 - code <<= 1 - } - - // Make array mapping sequence numbers to codes. - if len(h.codes) < len(bits) { - h.codes = make([]int, len(bits)) - } - for i, n := range bits { - if n == 0 { - continue - } - code := nextcode[n] - nextcode[n]++ - seq := code - h.base[n] - h.codes[seq] = i - } - return true -} - -func inflate(in string) (out []byte) { - var d decompressor - d.in = in - for !d.err && !d.eof { - d.nextBlock() - } - if len(d.in) != 0 { - println("fs unzip: junk at end of compressed data") - return nil - } - return d.out -} - -// get4 returns the little-endian 32-bit value in b. -func zget4(b string) int { - if len(b) < 4 { - return 0 - } - return int(b[0]) | int(b[1])<<8 | int(b[2])<<16 | int(b[3])<<24 -} - -// get2 returns the little-endian 16-bit value in b. -func zget2(b string) int { - if len(b) < 2 { - return 0 - } - return int(b[0]) | int(b[1])<<8 -} - -func unzip(data string) { - const ( - zecheader = 0x06054b50 - zcheader = 0x02014b50 - ztailsize = 22 - zheadersize = 30 - zheader = 0x04034b50 - ) - - buf := data[len(data)-ztailsize:] - n := zget2(buf[10:]) - size := zget4(buf[12:]) - off := zget4(buf[16:]) - - hdr := data[off : off+size] - for i := 0; i < n; i++ { - // zip entry layout: - // 0 magic[4] - // 4 madevers[1] - // 5 madeos[1] - // 6 extvers[1] - // 7 extos[1] - // 8 flags[2] - // 10 meth[2] - // 12 modtime[2] - // 14 moddate[2] - // 16 crc[4] - // 20 csize[4] - // 24 uncsize[4] - // 28 namelen[2] - // 30 xlen[2] - // 32 fclen[2] - // 34 disknum[2] - // 36 iattr[2] - // 38 eattr[4] - // 42 off[4] - // 46 name[namelen] - // 46+namelen+xlen+fclen - next header - // - if zget4(hdr) != zcheader { - println("fs unzip: bad magic") - break - } - meth := zget2(hdr[10:]) - mtime := zget2(hdr[12:]) - mdate := zget2(hdr[14:]) - csize := zget4(hdr[20:]) - size := zget4(hdr[24:]) - namelen := zget2(hdr[28:]) - xlen := zget2(hdr[30:]) - fclen := zget2(hdr[32:]) - xattr := uint32(zget4(hdr[38:])) >> 16 - off := zget4(hdr[42:]) - name := hdr[46 : 46+namelen] - hdr = hdr[46+namelen+xlen+fclen:] - - // zip per-file header layout: - // 0 magic[4] - // 4 extvers[1] - // 5 extos[1] - // 6 flags[2] - // 8 meth[2] - // 10 modtime[2] - // 12 moddate[2] - // 14 crc[4] - // 18 csize[4] - // 22 uncsize[4] - // 26 namelen[2] - // 28 xlen[2] - // 30 name[namelen] - // 30+namelen+xlen - file data - // - buf := data[off : off+zheadersize+namelen] - if zget4(buf) != zheader || - zget2(buf[8:]) != meth || - zget2(buf[26:]) != namelen || - buf[30:30+namelen] != name { - println("fs unzip: inconsistent zip file") - return - } - xlen = zget2(buf[28:]) - - off += zheadersize + namelen + xlen - - var fdata []byte - switch meth { - case 0: - // buf is uncompressed - buf = data[off : off+size] - fdata = []byte(buf) - case 8: - // buf is deflate-compressed - buf = data[off : off+csize] - fdata = inflate(buf) - if len(fdata) != size { - println("fs unzip: inconsistent size in zip file") - return - } - } - - if xattr&S_IFMT == 0 { - if xattr&0777 == 0 { - xattr |= 0666 - } - if len(name) > 0 && name[len(name)-1] == '/' { - xattr |= S_IFDIR - xattr |= 0111 - } else { - xattr |= S_IFREG - } - } - - if err := create(name, xattr, zipToTime(mdate, mtime), fdata); err != nil { - print("fs unzip: create ", name, ": ", err.Error(), "\n") - } - } - - chdirEnv() -} - -func zipToTime(date, time int) int64 { - dd := date & 0x1f - mm := date >> 5 & 0xf - yy := date >> 9 // since 1980 - - sec := int64(315532800) // jan 1 1980 - sec += int64(yy) * 365 * 86400 - sec += int64(yy) / 4 * 86400 - if yy%4 > 0 || mm >= 3 { - sec += 86400 - } - sec += int64(daysBeforeMonth[mm]) * 86400 - sec += int64(dd-1) * 86400 - - h := time >> 11 - m := time >> 5 & 0x3F - s := time & 0x1f * 2 - sec += int64(h*3600 + m*60 + s) - - return sec -} - -var daysBeforeMonth = [...]int32{ - 0, - 0, - 31, - 31 + 28, - 31 + 28 + 31, - 31 + 28 + 31 + 30, - 31 + 28 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30, - 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + 31, -} diff --git a/src/syscall/zsyscall_nacl_386.go b/src/syscall/zsyscall_nacl_386.go deleted file mode 100644 index fb286ba4d3..0000000000 --- a/src/syscall/zsyscall_nacl_386.go +++ /dev/null @@ -1,71 +0,0 @@ -// mksyscall.pl -l32 -nacl -tags nacl,386 syscall_nacl.go syscall_nacl_386.go -// Code generated by the command above; DO NOT EDIT. - -// +build nacl,386 - -package syscall - -import "unsafe" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclClose(fd int) (err error) { - _, _, e1 := Syscall(sys_close, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclFstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(sys_fstat, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclRead(fd int, b []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(sys_read, uintptr(fd), uintptr(_p0), uintptr(len(b))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclSeek(fd int, off *int64, whence int) (err error) { - _, _, e1 := Syscall(sys_lseek, uintptr(fd), uintptr(unsafe.Pointer(off)), uintptr(whence)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclGetRandomBytes(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(sys_get_random_bytes, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/src/syscall/zsyscall_nacl_arm.go b/src/syscall/zsyscall_nacl_arm.go deleted file mode 100644 index d06d02c297..0000000000 --- a/src/syscall/zsyscall_nacl_arm.go +++ /dev/null @@ -1,71 +0,0 @@ -// mksyscall.pl -l32 -nacl -arm -tags nacl,arm syscall_nacl.go syscall_nacl_arm.go -// Code generated by the command above; DO NOT EDIT. - -// +build nacl,arm - -package syscall - -import "unsafe" - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclClose(fd int) (err error) { - _, _, e1 := Syscall(sys_close, uintptr(fd), 0, 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclFstat(fd int, stat *Stat_t) (err error) { - _, _, e1 := Syscall(sys_fstat, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclRead(fd int, b []byte) (n int, err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - r0, _, e1 := Syscall(sys_read, uintptr(fd), uintptr(_p0), uintptr(len(b))) - n = int(r0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclSeek(fd int, off *int64, whence int) (err error) { - _, _, e1 := Syscall(sys_lseek, uintptr(fd), uintptr(unsafe.Pointer(off)), uintptr(whence)) - if e1 != 0 { - err = errnoErr(e1) - } - return -} - -// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT - -func naclGetRandomBytes(b []byte) (err error) { - var _p0 unsafe.Pointer - if len(b) > 0 { - _p0 = unsafe.Pointer(&b[0]) - } else { - _p0 = unsafe.Pointer(&_zero) - } - _, _, e1 := Syscall(sys_get_random_bytes, uintptr(_p0), uintptr(len(b)), 0) - if e1 != 0 { - err = errnoErr(e1) - } - return -} diff --git a/src/time/sys_unix.go b/src/time/sys_unix.go index f4756b18a6..97b1140bbc 100644 --- a/src/time/sys_unix.go +++ b/src/time/sys_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris +// +build aix darwin dragonfly freebsd js,wasm linux netbsd openbsd solaris package time diff --git a/src/time/zoneinfo_unix.go b/src/time/zoneinfo_unix.go index d6bcabfb80..74aa5212a1 100644 --- a/src/time/zoneinfo_unix.go +++ b/src/time/zoneinfo_unix.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -// +build aix darwin,386 darwin,amd64 dragonfly freebsd linux,!android nacl netbsd openbsd solaris +// +build aix darwin,386 darwin,amd64 dragonfly freebsd linux,!android netbsd openbsd solaris // Parse "zoneinfo" time zone file. // This is a fairly standard file format used on OS X, Linux, BSD, Sun, and others.