text:
package my.interest.lang.util;

/**
 * <p>
 * </p>
 *
 * @author velsubra
 */
public class ProcessUtil {
    private static String ANT_EXEC;
    private static String JAVA_EXEC;
    private static String SHELL_EXTENSION;
    private static String SHELL_EXEC;
    private static String SHELL_EXEC_EXIT_COMMAND;

    public static String getANT_EXEC() {
        return ANT_EXEC;
    }

    public static String getJAVA_EXEC() {
        return JAVA_EXEC;
    }

    public static String getENV_DEFAULT_ANT_HOME() {
        return ENV_DEFAULT_ANT_HOME;
    }

    public static String getENV_DEFAULT_JAVA_HOME() {
        return ENV_DEFAULT_JAVA_HOME;
    }

    public static int getEACH_PROCESS_TIMEOUT_SECS() {
        return EACH_PROCESS_TIMEOUT_SECS;
    }

    public static String getUSER_HOME() {
        return USER_HOME;
    }

    public static boolean isSHELL_SET_SETENV_STYLE() {
        return SHELL_SET_SETENV_STYLE;
    }

    public static boolean isOS_WINDOWS() {
        return OS_WINDOWS;
    }

    public static String getCOPY_COMMAND() {
        return COPY_COMMAND;
    }

    public static String getSHELL_SET_PROP_COMMAND() {
        return SHELL_SET_PROP_COMMAND;
    }

    public static String getSHELL_EXEC_EXIT_COMMAND() {
        return SHELL_EXEC_EXIT_COMMAND;
    }

    public static String getSHELL_EXEC() {
        return SHELL_EXEC;
    }

    public static String getSHELL_EXTENSION() {
        return SHELL_EXTENSION;
    }

    private static String SHELL_SET_PROP_COMMAND;
    private static String COPY_COMMAND;
    private static boolean OS_WINDOWS;
    private static boolean SHELL_SET_SETENV_STYLE = true;
    private static String USER_HOME;

    private static int EACH_PROCESS_TIMEOUT_SECS = 300;

    private static String ENV_DEFAULT_JAVA_HOME = null;
    private static String ENV_DEFAULT_ANT_HOME = null;

    static {
        USER_HOME = System.getProperty("user.home");
        ENV_DEFAULT_JAVA_HOME = System.getProperty("JAVA_HOME", System.getProperty("java.home"));
        ENV_DEFAULT_ANT_HOME =
                System.getProperty("ANT_HOME", System.getProperty("ant.home"));
        String osname = System.getProperty("os.name");
        if (osname != null && osname.toUpperCase().indexOf("WINDOWS") ==
                -1) {
            SHELL_SET_PROP_COMMAND = "setenv";
            ANT_EXEC = "ant";
            SHELL_EXTENSION = ".sh";
            SHELL_EXEC = "csh";
            SHELL_EXEC_EXIT_COMMAND = "exit";
            COPY_COMMAND = "cp";
            JAVA_EXEC = "java";
            //Make it false if  SHELL_SET_PROP_COMMAND
            //uses export style which requires = between var and value otherwise a space. export a=b vs setenv a b
            SHELL_SET_SETENV_STYLE = true;

        } else {
            SHELL_SET_PROP_COMMAND = "set";
            SHELL_EXTENSION = ".bat";
            ANT_EXEC = "ant.bat";
            SHELL_EXEC = "cmd";
            SHELL_EXEC_EXIT_COMMAND = "exit";
            COPY_COMMAND = "copy";
            SHELL_SET_SETENV_STYLE = false;
            JAVA_EXEC = "java.exe";
            OS_WINDOWS = true;
        }

    }
}


text:
    Редактировать
    <form method="post">
        <button class="bottomAction" name="removeArticle" type="submit" th:value="${article.id}">Удалить
        </button>
    </form>

redpajama_set_name: RedPajamaGithub


text:
<?php

$config = [];

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['preload'][] = 'debug';
    $config['modules']['debug'] = 'yii\debug\Module';
    $config['modules']['gii'] = 'yii\gii\Module';
}

return $config;


text:
/**
 * @file framestep filter, inspired on libmpcodecs/vf_framestep.c by
 * Daniele Fornighieri <guru AT digitalfantasy it>.
 */

#include "libavutil/opt.h"
#include "avfilter.h"
#include "internal.h"
#include "video.h"

typedef struct NullContext {
    const AVClass *class;
    int frame_step;
} FrameStepContext;

#define OFFSET(x) offsetof(FrameStepContext, x)
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM

static const AVOption framestep_options[] = {
    { "step", "set frame step",  OFFSET(frame_step), AV_OPT_TYPE_INT, {.i64=1}, 1, INT_MAX, FLAGS},
    { NULL },
};

AVFILTER_DEFINE_CLASS(framestep);

static int config_output_props(AVFilterLink *outlink)
{
    AVFilterContext *ctx = outlink->src;
    FrameStepContext *framestep = ctx->priv;
    AVFilterLink *inlink = ctx->inputs[0];

    outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP;
    outlink->frame_rate =
        av_div_q(inlink->frame_rate, (AVRational){framestep->frame_step, 1});

    av_log(ctx, AV_LOG_VERBOSE, "step:%d frame_rate:%d/%d(%f) -> frame_rate:%d/%d(%f)\n",
           framestep->frame_step,
           inlink->frame_rate.num, inlink->frame_rate.den, av_q2d(inlink->frame_rate),
           outlink->frame_rate.num, outlink->frame_rate.den, av_q2d(outlink->frame_rate));
    return 0;
}

static int filter_frame(AVFilterLink *inlink, AVFrame *ref)
{
    FrameStepContext *framestep = inlink->dst->priv;

    if (!(inlink->frame_count % framestep->frame_step)) {
        return ff_filter_frame(inlink->dst->outputs[0], ref);
    } else {
        av_frame_free(&ref);
        return 0;
    }
}

static const AVFilterPad framestep_inputs[] = {
    {
        .name         = "default",
        .type         = AVMEDIA_TYPE_VIDEO,
        .filter_frame = filter_frame,
    },
    { NULL }
};

static const AVFilterPad framestep_outputs[] = {
    {
        .name         = "default",
        .type         = AVMEDIA_TYPE_VIDEO,
        .config_props = config_output_props,
    },
    { NULL }
};

AVFilter ff_vf_framestep = {
    .name        = "framestep",
    .description = NULL_IF_CONFIG_SMALL("Select one frame every N frames."),
    .priv_size   = sizeof(FrameStepContext),
    .priv_class  = &framestep_class,
    .inputs      = framestep_inputs,
    .outputs     = framestep_outputs,
    .flags       = AVFILTER_FLAG_SUPPORT_TIMELINE_GENERIC,
};


text:
{% extends 'layout.server.view.html' %}

{% block content %}

Page Not Found

  {{url}} is not a valid path.

{% endblock %}


text:
module Merb
  module Test
    module RouteHelper
      include RequestHelper

      # Mimics the url method available to controllers.
      #
      # ==== Parameters
      # name<~to_sym>:: The name of the URL to generate.
      # params<Hash>:: Parameters for the route generation.
      #
      # ==== Returns
      # String:: The generated URL.
      def url(name, params={})
        Merb::Router.generate(name, params)
      end

      # ==== Parameters
      # path<~to_string>:: The URL of the request.
      # method<~to_sym>:: HTTP request method.
      # env<Hash>:: Additional parameters for the request.
      #
      # ==== Returns
      # Hash:: A hash containing the controller and action along with any parameters
      def request_to(path, method = :get, env = {})
        env[:request_method] ||= method.to_s.upcase
        env[:request_uri] = path

        check_request_for_route(fake_request(env))
      end
    end
  end
end


text:
package org.sparkcommerce.profile.web.core.service;

public interface ProductListEntry {

    public Long getId();

    public void setId(Long id);

    public Long getProductId();

    public void setProductId(Long productId);

    public Long getProductListId();

    public void setProductListId(Long productListId);

    public Integer getDisplayOrder();

    public void setDisplayOrder(Integer displayOrder);
}


text:
using Microsoft.WindowsAzure.Storage.Table;

namespace Orleans.Transactions.AzureStorage
{
    internal class KeyEntity : TableEntity
    {
        public const string RK = "k";

        public KeyEntity()
        {
            this.RowKey = RK;
        }

        public long CommittedSequenceId { get; set; }
        public string Metadata { get; set; }
    }
}


text:
import asyncio
import logging
from collections import OrderedDict
from typing import Dict, Union, Any

from applebot.exceptions import EventNotFoundError

log = logging.getLogger(__name__)

class EventManager(object):
    def __init__(self):
        self._events = {}  # type: Dict[str, Event]
        self._event_type = Event

    def __contains__(self, event):
        return str(event) in self._events

    def __getitem__(self, key) -> 'Event':
        return self.get(key)

    def __iter__(self) -> 'Event':
        for event in self._events.values():
            yield event

    def __len__(self):
        return len(self._events)

    def get(self, event, default=None) -> 'Event':
        """Get an event from the manager."""
        return self._events.get(str(event), default)

    def add(self, event, handler=None, call_limit=None) -> Union['Event', 'EventHandler']:
        """Add a new or existing event or handler to the event manager."""
        if handler is not None:
            return self.add_handler(event, handler, call_limit)
        return self.add_event(event)

    async def emit(self, event, *args, **kwargs):
        """Emit an event and call its registered handlers."""
        await self.get(event).emit(*args, **kwargs)

    def add_event(self, event) -> 'Event':
        """Add a new or existing event to the event manager."""
        if not isinstance(event, self._event_type) and not isinstance(event, str):
            raise TypeError('Parameter \'event\' must be of type Event or str')
        if event in self:
            if isinstance(event, self._event_type):
                return self.get(event).combine(event)
            return self.get(event)
        self._events[str(event)] = event if isinstance(event, self._event_type) else self._event_type(event)
        return self.get(event)

    def add_handler(self, event, handler, call_limit=None) -> 'EventHandler':
        """Add a new or existing handler to a new or existing event."""
        if event not in self:
            raise EventNotFoundError('Event \'{0}\' doesn\'t exist or hasn\'t been registered to this EventManager.'.format(event))
        return self.get(event).add(handler, call_limit)

class Event(object):
    def __init__(self, name):
        self.name = name  # type: str
        self.enabled = True  # type: bool
        self._handlers = OrderedDict()  # type: OrderedDict[str, EventHandler]
        self._handler_type = EventHandler
        self._combined_type = CombinedEvent

    def __str__(self):
        return self.name

    def __contains__(self, handler):
        return hash(handler) in self._handlers

    def __getitem__(self, key) -> 'EventHandler':
        return self.get(key)

    def __setitem__(self, key, value):
        return self.set(key, value)

    def __delitem__(self, key):
        return self.remove(key)

    def __iter__(self) -> 'EventHandler':
        for handler in self._handlers.values():
            yield handler

    def __len__(self):
        return len(self._handlers)

    def __hash__(self):
        return hash(self.name)

    async def emit(self, *args, **kwargs):
        """Emit and call the handlers of the event."""
        if self.enabled and len(self):
            log.debug('Emitting event: {}'.format(self.name))
            for handler in self:
                await handler.call(*args, **kwargs)

    def get(self, handler, default=None) -> 'EventHandler':
        """Get a handler from the event."""
        return self._handlers.get(hash(handler), default)

    def set(self, key, handler):
        """Set or remove a handler from the event."""
        if handler is None:
            return self.remove(key)
        if hash(key) != hash(handler):
            raise ValueError('The key must match the assigned handler.')
        return self.add(handler)

    def add(self, handler, call_limit=None) -> 'EventHandler':
        """Add a handler to the event."""
        if not isinstance(handler, self._handler_type) and not callable(handler):
            raise TypeError('Parameter \'handler\' must be callable or of type EventHandler')
        if handler not in self:
            self._handlers[hash(handler)] = handler if isinstance(handler, self._handler_type) else self._handler_type(handler)
        self.get(handler).call_limit = call_limit
        return self.get(handler)

    def remove(self, handler):
        """Remove a handler from the event."""
        self._handlers[handler] = None

    def clear(self):
        """Remove all the handlers from the event."""
        self._handlers.clear()

    def enable(self, enabled=True):
        """Enable or set enabled to value."""
        self.enabled = enabled is True

    def disable(self):
        """Disable the event."""
        self.enabled = False

    def combine(self, other) -> 'Event':
        """Combine with another event and merge handler into a single list."""
        if other is not self:
            self._combined_type(self, other)
        return self

class CombinedEvent(Event):
    def __init__(self, event, *others):
        super().__init__(event)
        self.name = event.name  # type: str
        for event in others:
            self._absorb(event)

    def _absorb(self, event):
        self._handlers.update(event._handlers)
        event._handlers = self

    def items(self, *args, **kwargs):
        return self._handlers.items(*args, **kwargs)

    def keys(self, *args, **kwargs):
        return self._handlers.keys(*args, **kwargs)

    def values(self, *args, **kwargs):
        return self._handlers.values(*args, **kwargs)

    def update(self, *args, **kwargs):
        return self._handlers.update(*args, **kwargs)

    def pop(self, *args, **kwargs):
        return self._handlers.pop(*args, **kwargs)

class EventHandler(object):
    def __init__(self, handler, call_limit=None):
        self._handler = None  # type: asyncio.coroutine
        self._enabled = True  # type: bool
        self.call_limit = call_limit  # type: int
        self.handler = handler  # type: asyncio.coroutine

    def __hash__(self):
        """Get a hash by hashing the handler."""
        return hash(self._handler)

    async def call(self, *args, **kwargs) -> Any:
        """Call the handler."""
        if self.enabled:
            if self.call_limit:
                self.call_limit -= 1
            return await self.handler(*args, **kwargs)
        return None

    def limit(self, limit=1):
        """Set a limit for the amount of times this handler will be called."""
        self.call_limit = int(limit)

    def enable(self, value=True):
        """Enable or set enabled to value."""
        self.enabled = value

    def disable(self):
        """Disable the handler."""
        self.enabled = False

    @property
    def enabled(self) -> bool:
        """Get enabled status."""
        return self._enabled and (self.call_limit is None or self.call_limit > 0)

    @enabled.setter
    def enabled(self, enabled):
        """Set enabled status."""
        self._enabled = bool(enabled)

    @property
    def handler(self) -> asyncio.coroutine:
        """Get handler."""
        return self._handler

    @handler.setter
    def handler(self, handler):
        """Set handler."""
        if not callable(handler):
            raise TypeError('Parameter \'handler\' must be callable')
        self._handler = handler


text:
var app=angular.module('store',[]);

app.controller('StoreController',function(){
    this.products=gems;
});

var gems=[{
    name: 'Dodecahedron',
    price: 2.95,
    description: 'The one and only gem',
    canPurchase: false,
},{
    name: 'Dodecahedron',
    price: 2.95,
    description: 'The one and only gem',
    canPurchase: true,
}];


text:
package main

import (
	"fmt"
	"os"

	log "github.com/Sirupsen/logrus"
	"github.com/coreos/go-systemd/activation"
	"github.com/dcos/3dt/api"
	"net/http"
)

func getVersion() string {
	return (fmt.Sprintf("Version: %s, Revision: %s", api.Version, api.Revision))
}

func runDiag(dt api.Dt) {
	units, err := api.GetUnitsProperties(dt)
	if err != nil {
		log.Fatalf("Error getting units properties: %s", err)
	}

	var fail bool
	for _, unit := range units.Array {
		if unit.UnitHealth != 0 {
			fmt.Printf("[%s]: %s %s\n", unit.UnitID, unit.UnitTitle, unit.UnitOutput)
			fail = true
		}
	}

	if fail {
		log.Fatal("Found unhealthy systemd units")
	}
}

func main() {
	// a message channel to ensure we can start pulling safely
	readyChan := make(chan struct{})

	// load config with default values
	config, err := api.LoadDefaultConfig(os.Args)
	if err != nil {
		log.Fatalf("Could not load default config: %s", err)
	}

	// print version and exit
	if config.FlagVersion {
		fmt.Println(getVersion())
		os.Exit(0)
	}

	DCOSTools := &api.DCOSTools{
		ExhibitorURL: config.FlagExhibitorClusterStatusURL,
		ForceTLS:     config.FlagForceTLS,
	}

	// init requester
	if err := api.Requester.Init(&config, DCOSTools); err != nil {
		log.Fatalf("Could not initialze the HTTP(S) requester: %s", err)
	}

	// Create and init diagnostics job, do not hard fail on error
	diagnosticsJob := &api.DiagnosticsJob{}
	if err := diagnosticsJob.Init(&config, DCOSTools); err != nil {
		log.Errorf("Could not init diagnostics job properly: %s", err)
	}

	// Inject dependencies used for running 3dt.
	dt := api.Dt{
		Cfg:               &config,
		DtDCOSTools:       DCOSTools,
		DtDiagnosticsJob:  diagnosticsJob,
		RunPullerChan:     make(chan bool),
		RunPullerDoneChan: make(chan bool),
		UpdateHealthChan:  make(chan bool),
		UpdateHealthDoneChan: make(chan bool),
	}

	// set verbose (debug) output.
	if config.FlagVerbose {
		log.SetLevel(log.DebugLevel)
	}

	// run local diagnostics, verify all systemd units are healthy.
	if config.FlagDiag {
		runDiag(dt)
		os.Exit(0)
	}

	// start pulling every 60 seconds.
	if config.FlagPull {
		go api.StartPullWithInterval(dt, readyChan)
	}

	// start diagnostic server and expose endpoints.
	log.Info("Start 3DT")
	go api.StartUpdateHealthReport(dt, readyChan, false)
	router := api.NewRouter(dt)

	// try using systemd socket
	listeners, err := activation.Listeners(true)
	if err != nil {
		log.Errorf("Systemd socket not found: %s", err)
	}

	if len(listeners) == 0 || listeners[0] == nil {
		log.Infof("Exposing 3DT API on 0.0.0.0:%d", config.FlagPort)
		log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", config.FlagPort), router))
	}
	log.Infof("Using socket: %s", listeners[0].Addr().String())
	log.Fatal(http.Serve(listeners[0], router))
}


text:
package com.j256.ormlite.android;

import android.database.Cursor;
import com.j256.ormlite.dao.ObjectCache;
import com.j256.ormlite.db.DatabaseType;
import com.j256.ormlite.db.SqliteAndroidDatabaseType;
import com.j256.ormlite.support.DatabaseResults;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class AndroidDatabaseResults
  implements DatabaseResults
{
  private static final int MIN_NUM_COLUMN_NAMES_MAP = 8;
  private static final DatabaseType databaseType = new SqliteAndroidDatabaseType();
  private final Map<String, Integer> columnNameMap;
  private final String[] columnNames;
  private final Cursor cursor;
  private final ObjectCache objectCache;

  public AndroidDatabaseResults(Cursor paramCursor, ObjectCache paramObjectCache)
  {
    this.cursor = paramCursor;
    this.columnNames = paramCursor.getColumnNames();
    if (this.columnNames.length >= 8)
    {
      this.columnNameMap = new HashMap();
      for (int i = 0; i < this.columnNames.length; i++)
        this.columnNameMap.put(this.columnNames[i], Integer.valueOf(i));
    }
    else
    {
      this.columnNameMap = null;
    }
    this.objectCache = paramObjectCache;
  }

  @Deprecated
  public AndroidDatabaseResults(Cursor paramCursor, boolean paramBoolean, ObjectCache paramObjectCache)
  {
    this(paramCursor, paramObjectCache);
  }

  private int lookupColumn(String paramString)
  {
    if (this.columnNameMap == null)
    {
      for (int i = 0; i < this.columnNames.length; i++)
        if (this.columnNames[i].equals(paramString))
          return i;
      return -1;
    }
    Integer localInteger = (Integer)this.columnNameMap.get(paramString);
    if (localInteger == null)
      return -1;
    return localInteger.intValue();
  }

  public void close()
  {
    this.cursor.close();
  }

  public void closeQuietly()
  {
    close();
  }

  public int findColumn(String paramString)
  {
    int i = lookupColumn(paramString);
    if (i >= 0)
      return i;
    StringBuilder localStringBuilder = new StringBuilder(4 + paramString.length());
    databaseType.appendEscapedEntityName(localStringBuilder, paramString);
    int j = lookupColumn(localStringBuilder.toString());
    if (j >= 0)
      return j;
    String[] arrayOfString = this.cursor.getColumnNames();
    throw new SQLException("Unknown field '" + paramString + "' from the Android sqlite cursor, not in:" + Arrays.toString(arrayOfString));
  }

  public boolean first()
  {
    return this.cursor.moveToFirst();
  }

  public BigDecimal getBigDecimal(int paramInt)
  {
    throw new SQLException("Android does not support BigDecimal type.  Use BIG_DECIMAL or BIG_DECIMAL_STRING types");
  }

  public InputStream getBlobStream(int paramInt)
  {
    return new ByteArrayInputStream(this.cursor.getBlob(paramInt));
  }

  public boolean getBoolean(int paramInt)
  {
    return (!this.cursor.isNull(paramInt)) && (this.cursor.getShort(paramInt) != 0);
  }

  public byte getByte(int paramInt)
  {
    return (byte)getShort(paramInt);
  }

  public byte[] getBytes(int paramInt)
  {
    return this.cursor.getBlob(paramInt);
  }

  public char getChar(int paramInt)
  {
    String str = this.cursor.getString(paramInt);
    if ((str == null) || (str.length() == 0))
      return '\000';
    if (str.length() == 1)
      return str.charAt(0);
    throw new SQLException("More than 1 character stored in database column: " + paramInt);
  }

  public int getColumnCount()
  {
    return this.cursor.getColumnCount();
  }

  public String[] getColumnNames()
  {
    int i = getColumnCount();
    String[] arrayOfString = new String[i];
    for (int j = 0; j < i; j++)
      arrayOfString[j] = this.cursor.getColumnName(j);
    return arrayOfString;
  }

  public int getCount()
  {
    return this.cursor.getCount();
  }

  public double getDouble(int paramInt)
  {
    return this.cursor.getDouble(paramInt);
  }

  public float getFloat(int paramInt)
  {
    return this.cursor.getFloat(paramInt);
  }

  public int getInt(int paramInt)
  {
    return this.cursor.getInt(paramInt);
  }

  public long getLong(int paramInt)
  {
    return this.cursor.getLong(paramInt);
  }

  public ObjectCache getObjectCache()
  {
    return this.objectCache;
  }

  public int getPosition()
  {
    return this.cursor.getPosition();
  }

  public Cursor getRawCursor()
  {
    return this.cursor;
  }

  public short getShort(int paramInt)
  {
    return this.cursor.getShort(paramInt);
  }

  public String getString(int paramInt)
  {
    return this.cursor.getString(paramInt);
  }

  public Timestamp getTimestamp(int paramInt)
  {
    throw new SQLException("Android does not support timestamp.  Use JAVA_DATE_LONG or JAVA_DATE_STRING types");
  }

  public boolean last()
  {
    return this.cursor.moveToLast();
  }

  public boolean moveAbsolute(int paramInt)
  {
    return this.cursor.moveToPosition(paramInt);
  }

  public boolean moveRelative(int paramInt)
  {
    return this.cursor.move(paramInt);
  }

  public boolean next()
  {
    return this.cursor.moveToNext();
  }

  public boolean previous()
  {
    return this.cursor.moveToPrevious();
  }

  public String toString()
  {
    return getClass().getSimpleName() + "@" + Integer.toHexString(super.hashCode());
  }

  public boolean wasNull(int paramInt)
  {
    return this.cursor.isNull(paramInt);
  }
}

/* Location:           /Users/vikas/Documents/Mhacks_Real_app/classes-dex2jar.jar
 * Qualified Name:     com.j256.ormlite.android.AndroidDatabaseResults
 * JD-Core Version:    0.6.2
 */


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Symb. bot. upsal. 16(no. 1): 104 (1958)

#### Original name
null

### Remarks
null


text:
const standardErrorMessage = {
  type: 'danger',
  message: 'flash.went-wrong'
};

export default standardErrorMessage;


text:
package autoscaler

import (
	"errors"
	"testing"
	"time"

	v1 "k8s.io/api/core/v1"
	"k8s.io/apimachinery/pkg/util/clock"
	"k8s.io/apimachinery/pkg/util/wait"

	"github.com/kubernetes-sigs/cluster-proportional-autoscaler/pkg/autoscaler/controller/laddercontroller"
	"github.com/kubernetes-sigs/cluster-proportional-autoscaler/pkg/autoscaler/controller/linearcontroller"
	"github.com/kubernetes-sigs/cluster-proportional-autoscaler/pkg/autoscaler/k8sclient"
)

func TestRun(t *testing.T) {
	testConfigMap := v1.ConfigMap{
		Data: make(map[string]string),
	}
	testConfigMap.ObjectMeta.ResourceVersion = `1`
	testConfigMap.Data[laddercontroller.ControllerType] =
		`{
			"coresToReplicas":
			[
				[1, 1],
				[2, 2],
				[3, 3],
				[512, 5],
				[1024, 7],
				[2048, 10],
				[4096, 15],
				[8192, 20],
				[12288, 30],
				[16384, 40],
				[20480, 50],
				[24576, 60],
				[28672, 70],
				[32768, 80],
				[65535, 100]
			],
			"nodesToReplicas":
			[
				[ 1,1 ],
				[ 2,2 ]
			]
		}`
	mockK8s := k8sclient.MockK8sClient{
		NumOfNodes:    0,
		NumOfCores:    0,
		NumOfReplicas: 0,
		ConfigMap:     &testConfigMap,
	}

	fakeClock := clock.NewFakeClock(time.Now())
	fakePollPeriod := 5 * time.Second
	fakeConfigMapName := "fake-cluster-proportional-autoscaler-params"
	autoScaler := &AutoScaler{
		k8sClient:           &mockK8s,
		controller:          laddercontroller.NewLadderController(),
		clock:               fakeClock,
		pollPeriod:          fakePollPeriod,
		configMapName:       fakeConfigMapName,
		stopCh:              make(chan struct{}),
		readyCh:             make(chan<- struct{}, 1),
		lastPollCycleHealth: newHealthInfo(),
		healthServer:        mockHealthServer{},
	}

	go autoScaler.Run()
	defer close(autoScaler.stopCh)

	t.Logf("Scenario: cluster size changing\n")
	t.Logf("Wait for the number of replicas be scaled to 1 even no node and no core)\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 1); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 800
	mockK8s.NumOfNodes = 1
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 5 when there are 800 cores and 1 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 5); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 1
	mockK8s.NumOfNodes = 3
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 2 when there are 1 cores and 3 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 2); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 200000
	mockK8s.NumOfNodes = 50000
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 100 when there are 200000 cores and 50000 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 100); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	t.Logf("Scenario: ConfigMap is changed\n")
	mockK8s.ConfigMap.Data[laddercontroller.ControllerType] =
		`{
			"coresToReplicas":
			[
				[1, 1],
				[2, 2],
				[3, 4],
				[512, 5],
				[1024, 7],
				[2048, 10],
				[4096, 15],
				[8192, 20],
				[12288, 30],
				[16384, 40],
				[20480, 50],
				[24576, 60],
				[28672, 70],
				[32768, 80],
				[65535, 200]
			],
			"nodesToReplicas":
			[
				[ 1,1 ],
				[ 2,2 ]
			]
		}`
	mockK8s.ConfigMap.ObjectMeta.ResourceVersion = `2`

	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 200 with new configuration)\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 200); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 500
	mockK8s.NumOfNodes = 100
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 4 when there are 500 cores and 100 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 4); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	t.Logf("Scenario: ConfigMap is missing and later appears again\n")
	mockK8s.ConfigMap.ObjectMeta.ResourceVersion = ""
	fakeClock.Step(fakePollPeriod)
	t.Logf("And cluster size changed in between\n")
	mockK8s.NumOfCores = 2000
	mockK8s.NumOfNodes = 400
	mockK8s.ConfigMap.ObjectMeta.ResourceVersion = "3"
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 7 when there are 2000 cores and 400 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 7); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	t.Logf("Scenario: Switch control mode on the fly\n")
	delete(mockK8s.ConfigMap.Data, laddercontroller.ControllerType)
	mockK8s.ConfigMap.Data[linearcontroller.ControllerType] =
		`{
			"coresPerReplica": 100,
			"nodesPerReplica": 10,
			"min": 1,
			"max": 100
		}`
	mockK8s.ConfigMap.ObjectMeta.ResourceVersion = `4`

	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 40 with new configuration)\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 40); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 1600
	mockK8s.NumOfNodes = 100
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 16 when there are 1600 cores and 100 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 16); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}

	mockK8s.NumOfCores = 100000
	mockK8s.NumOfNodes = 20000
	fakeClock.Step(fakePollPeriod)
	t.Logf("Wait for the number of replicas be scaled to 100 when there are 100000 cores and 20000 node\n")
	if err := waitForReplicasNumberSatisfy(t, &mockK8s, 100); err != nil {
		t.Fatalf("Timeout waiting for condition: %v", err)
	}
}

func TestRun_MaxRetries(t *testing.T) {
	const maxRetries = 3
	mockK8s := k8sclient.MockK8sClient{
		NumOfNodes:    0,
		NumOfCores:    0,
		NumOfReplicas: 0,
		FetchConfigMapFn: func(namespace, configmap string) (*v1.ConfigMap, error) {
			return nil, errors.New("mocked error")
		},
	}
	var exitFnCalled bool
	fakeClock := clock.NewFakeClock(time.Now())
	fakePollPeriod := 5 * time.Second
	fakeConfigMapName := "fake-cluster-proportional-autoscaler-params"
	readyCh := make(chan struct{})
	stopCh := make(chan struct{})
	autoScaler := &AutoScaler{
		k8sClient:           &mockK8s,
		controller:          laddercontroller.NewLadderController(),
		clock:               fakeClock,
		pollPeriod:          fakePollPeriod,
		configMapName:       fakeConfigMapName,
		stopCh:              stopCh,
		readyCh:             readyCh,
		lastPollCycleHealth: newHealthInfo(),
		maxSyncFailures:     maxRetries,
		exitFn: func() {
			exitFnCalled = true
			// shutdown autoScaler via stopCh to stop
			close(stopCh)
		},
		healthServer: mockHealthServer{},
	}
	go autoScaler.Run()
	<-readyCh
	for i := 0; i < maxRetries; i++ {
		fakeClock.Step(fakePollPeriod)
		wait.Poll(50*time.Millisecond, 3*time.Second, func() (done bool, err error) {
			return true, nil
		})
	}

	if !exitFnCalled {
		t.Fatalf("Did not exit")
	}
	if autoScaler.lastPollCycleHealth.failedCount > autoScaler.maxSyncFailures {
		t.Fatalf("scaler ran more times than allowed")
	}
}

func waitForReplicasNumberSatisfy(t *testing.T, mockK8s *k8sclient.MockK8sClient, replicas int) error {
	return wait.Poll(50*time.Millisecond, 3*time.Second, func() (done bool, err error) {
		if mockK8s.NumOfReplicas != replicas {
			t.Logf("Error number of replicas, expected: %d, got %d\n", replicas, mockK8s.NumOfReplicas)
			return false, nil
		}
		return true, nil
	})
}

type mockHealthServer struct {
}

func (s mockHealthServer) Start() {
}


text:
.class Landroid/widget/Toolbar$SavedState;
.super Landroid/view/View$BaseSavedState;
.source "Toolbar.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/widget/Toolbar;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x8
    name = "SavedState"
.end annotation

# static fields
.field public static final CREATOR:Landroid/os/Parcelable$Creator;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Landroid/os/Parcelable$Creator",
            "<",
            "Landroid/widget/Toolbar$SavedState;",
            ">;"
        }
    .end annotation
.end field

# instance fields
.field public expandedMenuItemId:I

.field public isOverflowOpen:Z

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 1840
    new-instance v0, Landroid/widget/Toolbar$SavedState$1;

    invoke-direct {v0}, Landroid/widget/Toolbar$SavedState$1;-><init>()V

    sput-object v0, Landroid/widget/Toolbar$SavedState;->CREATOR:Landroid/os/Parcelable$Creator;

    return-void
.end method

.method public constructor <init>(Landroid/os/Parcel;)V
    .locals 1
    .param p1, "source"    # Landroid/os/Parcel;

    .prologue
    .line 1824
    invoke-direct {p0, p1}, Landroid/view/View$BaseSavedState;-><init>(Landroid/os/Parcel;)V

    .line 1825
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v0

    iput v0, p0, Landroid/widget/Toolbar$SavedState;->expandedMenuItemId:I

    .line 1826
    invoke-virtual {p1}, Landroid/os/Parcel;->readInt()I

    move-result v0

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    iput-boolean v0, p0, Landroid/widget/Toolbar$SavedState;->isOverflowOpen:Z

    .line 1827
    return-void

    .line 1826
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public constructor <init>(Landroid/os/Parcelable;)V
    .locals 0
    .param p1, "superState"    # Landroid/os/Parcelable;

    .prologue
    .line 1830
    invoke-direct {p0, p1}, Landroid/view/View$BaseSavedState;-><init>(Landroid/os/Parcelable;)V

    .line 1831
    return-void
.end method

# virtual methods
.method public writeToParcel(Landroid/os/Parcel;I)V
    .locals 1
    .param p1, "out"    # Landroid/os/Parcel;
    .param p2, "flags"    # I

    .prologue
    .line 1835
    invoke-super {p0, p1, p2}, Landroid/view/View$BaseSavedState;->writeToParcel(Landroid/os/Parcel;I)V

    .line 1836
    iget v0, p0, Landroid/widget/Toolbar$SavedState;->expandedMenuItemId:I

    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 1837
    iget-boolean v0, p0, Landroid/widget/Toolbar$SavedState;->isOverflowOpen:Z

    if-eqz v0, :cond_0

    const/4 v0, 0x1

    :goto_0
    invoke-virtual {p1, v0}, Landroid/os/Parcel;->writeInt(I)V

    .line 1838
    return-void

    .line 1837
    :cond_0
    const/4 v0, 0x0

    goto :goto_0
.end method


text:
<?php
/**
 * BuddyPress Members Widget.
 *
 * @package BuddyPress
 * @subpackage MembersWidgets
 * @since 1.0.3
 */

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * Members Widget.
 *
 * @since 1.0.3
 */
class BP_Core_Members_Widget extends WP_Widget {

	/**
	 * Constructor method.
	 */
	public function __construct() {

		// Setup widget name & description.
		$name        = _x( '(BuddyPress) Members', 'widget name', 'buddypress' );
		$description = __( 'A dynamic list of recently active, popular, and newest members', 'buddypress' );

		// Call WP_Widget constructor.
		parent::__construct( false, $name, array(
			'description' => $description,
			'classname'   => 'widget_bp_core_members_widget buddypress widget',
		) );

		// Maybe enqueue JS for widget.
		if ( is_active_widget( false, false, $this->id_base ) && ! is_admin() && ! is_network_admin() ) {
			wp_enqueue_script( 'bp-widget-members' );
		}
	}

	/**
	 * Display the Members widget.
	 *
	 * @see WP_Widget::widget() for description of parameters.
	 *
	 * @param array $args     Widget arguments.
	 * @param array $instance Widget settings, as saved by the user.
	 */
	public function widget( $args, $instance ) {
		global $members_template;

		// Get widget settings.
		$settings = $this->parse_settings( $instance );

		/**
		 * Filters the title of the Members widget.
		 *
		 * @since 1.8.0
		 * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
		 *
		 * @param string $title    The widget title.
		 * @param array  $settings The settings for the particular instance of the widget.
		 * @param string $id_base  Root ID for all widgets of this type.
		 */
		$title = apply_filters( 'widget_title', $settings['title'], $settings, $this->id_base );
		$title = $settings['link_title'] ? '' . $title . '' : $title;

		/**
		 * Filters the separator of the member widget links.
		 *
		 * @since 2.4.0
		 *
		 * @param string $separator Separator string. Default '|'.
		 */
		$separator = apply_filters( 'bp_members_widget_separator', '|' );

		// Output before widget HTMl, title (and maybe content before & after it).
		echo $args['before_widget']
		   . $args['before_title']
		   . $title
		   . $args['after_title'];

		// Setup args for querying members.
		$members_args = array(
			'user_id'         => 0,
			'type'            => $settings['member_default'],
			'per_page'        => $settings['max_members'],
			'max'             => $settings['max_members'],
			'populate_extras' => true,
			'search_terms'    => false,
		);

		// Back up the global.
		$old_members_template = $members_template;

		?>

		<?php if ( bp_has_members( $members_args ) ) : ?>

				<a href="<?php bp_members_directory_permalink(); ?>" id="newest-members" <?php if ( 'newest' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Newest', 'buddypress' ); ?>
				<?php echo esc_html( $separator ); ?>
				<a href="<?php bp_members_directory_permalink(); ?>" id="recently-active-members" <?php if ( 'active' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Active', 'buddypress' ); ?>

				<?php if ( bp_is_active( 'friends' ) ) : ?>
					<?php echo esc_html( $separator ); ?>
					<a href="<?php bp_members_directory_permalink(); ?>" id="popular-members" <?php if ( 'popular' === $settings['member_default'] ) : ?>class="selected"<?php endif; ?>><?php esc_html_e( 'Popular', 'buddypress' ); ?>

				<?php endif; ?>

				<?php while ( bp_members() ) : bp_the_member(); ?>

							<a href="<?php bp_member_permalink() ?>" title="<?php bp_member_name(); ?>"><?php bp_member_avatar(); ?>

<a href="<?php bp_member_permalink(); ?>" title="<?php bp_member_name(); ?>"><?php bp_member_name(); ?>

								<?php
									if ( 'newest' === $settings['member_default'] ) :
										bp_member_registered();
									elseif ( 'active' === $settings['member_default'] ) :
										bp_member_last_active();
									elseif ( 'popular' === $settings['member_default'] ) :
										bp_member_total_friend_count();
									endif; ?>

				<?php endwhile; ?>

			<?php wp_nonce_field( 'bp_core_widget_members', '_wpnonce-members', false ); ?>

			<input type="hidden" name="members_widget_max" id="members_widget_max" value="<?php echo esc_attr( $settings['max_members'] ); ?>" />

		<?php else: ?>

				<?php esc_html_e( 'No one has signed up yet!', 'buddypress' ); ?>

		<?php endif; ?>

		<?php echo $args['after_widget'];

		// Restore the global.
		$members_template = $old_members_template;
	}

	/**
	 * Update the Members widget options.
	 *
	 * @param array $new_instance The new instance options.
	 * @param array $old_instance The old instance options.
	 * @return array $instance The parsed options to be saved.
	 */
	public function update( $new_instance, $old_instance ) {
		$instance = $old_instance;

		$instance['title']          = strip_tags( $new_instance['title'] );
		$instance['max_members']    = strip_tags( $new_instance['max_members'] );
		$instance['member_default'] = strip_tags( $new_instance['member_default'] );
		$instance['link_title']	    = (bool) $new_instance['link_title'];

		return $instance;
	}

	/**
	 * Output the Members widget options form.
	 *
	 * @param array $instance Widget instance settings.
	 *
	 * @return void
	 */
	public function form( $instance ) {

		// Get widget settings.
		$settings       = $this->parse_settings( $instance );
		$title          = strip_tags( $settings['title'] );
		$max_members    = strip_tags( $settings['max_members'] );
		$member_default = strip_tags( $settings['member_default'] );
		$link_title     = (bool) $settings['link_title']; ?>

			<label for="<?php echo $this->get_field_id( 'title' ); ?>">
				<?php esc_html_e( 'Title:', 'buddypress' ); ?>
				<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" style="width: 100%" />

			<label for="<?php echo $this->get_field_id( 'link_title' ) ?>">
				<input type="checkbox" name="<?php echo $this->get_field_name( 'link_title' ) ?>" id="<?php echo $this->get_field_id( 'link_title' ) ?>" value="1" <?php checked( $link_title ) ?> />
				<?php esc_html_e( 'Link widget title to Members directory', 'buddypress' ); ?>

			<label for="<?php echo $this->get_field_id( 'max_members' ); ?>">
				<?php esc_html_e( 'Max members to show:', 'buddypress' ); ?>
				<input class="widefat" id="<?php echo $this->get_field_id( 'max_members' ); ?>" name="<?php echo $this->get_field_name( 'max_members' ); ?>" type="text" value="<?php echo esc_attr( $max_members ); ?>" style="width: 30%" />

			<label for="<?php echo $this->get_field_id( 'member_default' ) ?>"><?php esc_html_e( 'Default members to show:', 'buddypress' ); ?>
			<select name="<?php echo $this->get_field_name( 'member_default' ) ?>" id="<?php echo $this->get_field_id( 'member_default' ) ?>">
				<option value="newest"  <?php if ( 'newest'  === $member_default ) : ?>selected="selected"<?php endif; ?>><?php esc_html_e( 'Newest',  'buddypress' ); ?></option>
				<option value="active"  <?php if ( 'active'  === $member_default ) : ?>selected="selected"<?php endif; ?>><?php esc_html_e( 'Active',  'buddypress' ); ?></option>
				<option value="popular" <?php if ( 'popular' === $member_default ) : ?>selected="selected"<?php endif; ?>><?php esc_html_e( 'Popular', 'buddypress' ); ?></option>
			</select>

	<?php
	}

	/**
	 * Merge the widget settings into defaults array.
	 *
	 * @since 2.3.0
	 *
	 * @uses bp_parse_args() To merge widget settings into defaults.
	 *
	 * @param array $instance Widget instance settings.
	 * @return array
	 */
	public function parse_settings( $instance = array() ) {
		return bp_parse_args( $instance, array(
			'title' 	     => __( 'Members', 'buddypress' ),
			'max_members' 	 => 5,
			'member_default' => 'active',
			'link_title' 	 => false
		), 'members_widget_settings' );
	}
}


text:
import pytest
import socket

from kombu import Connection, Exchange, Queue, Consumer, Producer

class test_PyroTransport:

    def setup(self):
        self.c = Connection(transport='pyro', virtual_host="kombu.broker")
        self.e = Exchange('test_transport_pyro')
        self.q = Queue('test_transport_pyro',
                       exchange=self.e,
                       routing_key='test_transport_pyro')
        self.q2 = Queue('test_transport_pyro2',
                        exchange=self.e,
                        routing_key='test_transport_pyro2')
        self.fanout = Exchange('test_transport_pyro_fanout', type='fanout')
        self.q3 = Queue('test_transport_pyro_fanout1',
                        exchange=self.fanout)
        self.q4 = Queue('test_transport_pyro_fanout2',
                        exchange=self.fanout)

    def test_driver_version(self):
        assert self.c.transport.driver_version()

    @pytest.mark.skip("requires running Pyro nameserver and Kombu Broker")
    def test_produce_consume_noack(self):
        channel = self.c.channel()
        producer = Producer(channel, self.e)
        consumer = Consumer(channel, self.q, no_ack=True)

        for i in range(10):
            producer.publish({'foo': i}, routing_key='test_transport_pyro')

        _received = []

        def callback(message_data, message):
            _received.append(message)

        consumer.register_callback(callback)
        consumer.consume()

        while 1:
            if len(_received) == 10:
                break
            self.c.drain_events()

        assert len(_received) == 10

    def test_drain_events(self):
        with pytest.raises(socket.timeout):
            self.c.drain_events(timeout=0.1)

        c1 = self.c.channel()
        c2 = self.c.channel()

        with pytest.raises(socket.timeout):
            self.c.drain_events(timeout=0.1)

        del(c1)  # so pyflakes doesn't complain.
        del(c2)

    @pytest.mark.skip("requires running Pyro nameserver and Kombu Broker")
    def test_drain_events_unregistered_queue(self):
        c1 = self.c.channel()
        producer = self.c.Producer()
        consumer = self.c.Consumer([self.q2])

        producer.publish(
            {'hello': 'world'},
            declare=consumer.queues,
            routing_key=self.q2.routing_key,
            exchange=self.q2.exchange,
        )
        message = consumer.queues[0].get()._raw

        class Cycle:

            def get(self, callback, timeout=None):
                return (message, 'foo'), c1

        self.c.transport.cycle = Cycle()
        self.c.drain_events()

    @pytest.mark.skip("requires running Pyro nameserver and Kombu Broker")
    def test_queue_for(self):
        chan = self.c.channel()
        x = chan._queue_for('foo')
        assert x
        assert chan._queue_for('foo') is x


text:
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _ASM_X86_SIGNAL_H
#define _ASM_X86_SIGNAL_H

#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/time.h>

/* Avoid too many header ordering problems.  */
struct siginfo;

/* Here we must cater to libcs that poke about in kernel headers.  */

#define NSIG		32
typedef unsigned long sigset_t;

#endif /* __ASSEMBLY__ */

#define SIGHUP		 1
#define SIGINT		 2
#define SIGQUIT		 3
#define SIGILL		 4
#define SIGTRAP		 5
#define SIGABRT		 6
#define SIGIOT		 6
#define SIGBUS		 7
#define SIGFPE		 8
#define SIGKILL		 9
#define SIGUSR1		10
#define SIGSEGV		11
#define SIGUSR2		12
#define SIGPIPE		13
#define SIGALRM		14
#define SIGTERM		15
#define SIGSTKFLT	16
#define SIGCHLD		17
#define SIGCONT		18
#define SIGSTOP		19
#define SIGTSTP		20
#define SIGTTIN		21
#define SIGTTOU		22
#define SIGURG		23
#define SIGXCPU		24
#define SIGXFSZ		25
#define SIGVTALRM	26
#define SIGPROF		27
#define SIGWINCH	28
#define SIGIO		29
#define SIGPOLL		SIGIO
/*
#define SIGLOST		29
*/
#define SIGPWR		30
#define SIGSYS		31
#define	SIGUNUSED	31

/* These should not be considered constants from userland.  */
#define SIGRTMIN	32
#define SIGRTMAX	_NSIG

#define SA_RESTORER	0x04000000

#define MINSIGSTKSZ	2048
#define SIGSTKSZ	8192

#include <asm-generic/signal-defs.h>

#ifndef __ASSEMBLY__

/* Here we must cater to libcs that poke about in kernel headers.  */
#ifdef __i386__

struct sigaction {
	union {
	  __sighandler_t _sa_handler;
	  void (*_sa_sigaction)(int, struct siginfo *, void *);
	} _u;
	sigset_t sa_mask;
	unsigned long sa_flags;
	void (*sa_restorer)(void);
};

#define sa_handler	_u._sa_handler
#define sa_sigaction	_u._sa_sigaction

#else /* __i386__ */

struct sigaction {
	__sighandler_t sa_handler;
	unsigned long sa_flags;
	__sigrestore_t sa_restorer;
	sigset_t sa_mask;		/* mask last for extensibility */
};

#endif /* !__i386__ */

typedef struct sigaltstack {
	void *ss_sp;
	int ss_flags;
	size_t ss_size;
} stack_t;

#endif /* __ASSEMBLY__ */

#endif /* _ASM_X86_SIGNAL_H */